December 9, 2008

Opera 10 alpha download

Heard about Opera 10 scores perfect 100/100 on Acid 3 test?  Download ALPHA version here (Windows).  For other platforms, go here.

I use IE, FF, and Opera.  (No Chrome, no Safari.)  It's because:

  • IE: some sites just requires it.

  • FireFox: many good add-on, especially for development.

  • Opera: Fast, and I need another browser to use with a different proxy.


Donate to OpenOffice and Wikipedia, or to Red Cross

"erl -man io" doesn't work?

While I was playing around with erlang, I found my installation of erlang's man page does not work:
$ erl -man io
No manual entry for io

I have compiled and installed (with configure's prefix option) in /opt/erlang on Solaris 9, put the man page files just in /opt/erlang/man.  Clearly this doesn't work.  So I did some tracking with:

$ truss -o /tmp/output.txt erl -man io 

(truss is like strace for Solaris; "strace" on Solaris is completely different thing.)

And found that the "/man" directory should live in /opt/erlang/lib/erlang/man.

"erl -man io" works now.  It's in MANPATH and Windex is created -- so just "man io" would work just fine, but I just wanted to fix it anyway.

December 8, 2008

Windows remote task list

Just a note for myself.  I had to list processes of an XP box, remotely from Vista.  This can be done by issuing following command:
tasklist.exe /s [computer name] /u [user name] /p [password]

At first try, I got an error message, "ERROR: Logon failure: unknown user name or bad password."  I had to change network securtiy on XP machine:

Administrative Tools -> Local Security Settings -> Local Policies -> Security Options -> Network Access:Sharing and security model for local accounts".  Set this to "Classic - local users and authenticate as themselves".

December 6, 2008

Erlang and Java (and Scala too)

People on the net did many performance testing on Erlang, and it shows that Erlang clearly wins over other environments.  And I see that more people are experimenting with it and there are real systems built on it, and performs incredibly.  The language is not easy to learn for someone (like myself) who worked in C++ and Java for many years and only touched Prolog (and Lisp) very lightly.  It's very fun to play around with it, but it'll take a while for me to be proficient enough to write a big application in it.  I was a bit bored with Java and was looking for something new, so it's alright.

I started wondering why this (Erlang way of concurrency) can't be done in Java, and found something: Kilim. (and Scala's concurrency.)  It is too early for me to say anything about them as I don't know enough, but it's worth reading a few pages.  This page shows Java+Kilim out performs Erlang: http://stephan.reposita.org/archives/2008/06/22/erlang-vs-java-benchmarking-update/

Kilim: http://www.malhar.net/sriram/kilim/index.html

Here is a posting about Erlang and Scala: http://yarivsblog.com/articles/2008/05/18/erlang-vs-scala/ I only read and played around basics with Scala and thought it's just a way to add FP to Java.  After reading above posting, I looked at Scala site and found this article: http://www.scala-lang.org/node/242.  Take a look at the example code.  It's very similar to Erlang how concurrency is done.

To Do:

Trying Erlang

I tested DB and Yaws a bit, and found DB access wasn't working for Solaris version of Erlang.  After some digging, I found that iodbc does not work.  There are two (open source) flavors for ODBC in Unix.  iodbc and unixODBC.  I recompiled Erlang with unixODBC, and DB access works --- sort of.  Still some SQL doesn't work properly, and I haven't figured it out yet.  But it's good enough to test Erlang and Yaws for now.  For Ubuntu, no problem.  Installing Erlang, ODBC, and Yaws were effortless.  But I like Sparc Solaris I use at home. :-)  It's quite old, but still have enough disk space, RAM and works extremely well.

unixODBC: http://www.unixodbc.org/

One thing about Yaws on Solaris -- while I was building Yaws, I got an error from 'id' with option '-u'.  This is due to Solaris 9's 'id' (located in /usr/bin) doesn't support -u option.  I temporarily changed GNU's 'gid' to 'id' and it built correctly.

November 25, 2008

Erlang

I've been looking at Erlang for some time now to see whether it gains popularity. At that time, I was looking for a new way for programming multi-threading/multi-processor (now multi-core). The existing methods were (and still are) little cumbersome and then I found Erlang after some searching. However the language is very different from other widely used languages, and I wasn't sure if it worth the time to learn it...until recently.  I'm beginning to hear more people are talking about it, and I see more people blogging about it.  So I've played around with it a bit recently.

I installed Erlang on Sparc Solaris (v9), XP, Vista and Ubuntu. The installation for Windows was just a breeze. Ubuntu needed a couple of apt-get's and the version doesn't look like it's the latest. On Solaris, it was a bit of hassle -- the code itself compiles fine, but complained that I need ODBC. I never used ODBC on any Unix flavored OS except Windows -- so I was a bit puzzled whether I could get such for my system. With a bit of googling, found that I needed to install libiodbc, and MySQL ODBC.

Erlang is getting a lot of attentions lately and I'm now reading tutorials and studying it -- so far, it's been fun experience.   It's very similar to PROLOG.  So it's not a completely strange language. I'll keep putting some information on Erlang on my blog.  I get bored easily, and lately Erlang makes my days little more exciting.  Scala was at the top of my list (for interesting technology), but it's Erlang (for now).

Some useful links

November 6, 2008

chkconfig in Solaris

Adding services in Solaris 9 (and prior versions of Solaris) is a bit of pain compare to Linux.  There is no chkconfig like Fedora/RH by default or solaris pkg.  But I found this:

http://www.fastcoder.net/software/chkconfig/

It's available in source code form, so compilation is necessary but it went smooth without any difficulties.

- For Ubuntu, it's simpler than chkconfig:
sudo update-rc.d name_of_the_script defaults

- For Solaris 10, here's info:

http://www.unix.com/sun-solaris/32936-solaris-10-add-new-svc.html

September 2, 2008

Editing large text files

Ok, straight to the point: there is NO editor that can handle huge text file, size of giga bytes.  I have this SQL file, 10+ GB, and no editor can handle it.

One commercial software I found is: http://www.textmaster.ca/

It claims it can handle 300GB file.  It's nice, but I don't do this too often, so sorry, I don't want to purchase one.  One easy way to go around the problem is, of course, splitting the file into multiple files and edit each, and later join the files together.

Split:
[sourcecode language='css']
split -b 50m example.sql example_
[/sourcecode]
Join:
[sourcecode language='css']
cat example_[aa-bb] > example.sql
[/sourcecode]
This will do.

Back up using DOS batch

Almost always I make backups of important files, but I still lose up-to-date files.  So automating/scheduling backup is needed.

I do:

  • Files are backed up continously using Mozy.

  • Image of C drive is created daily onto another HDD.

  • Some important files are backed up using SyncBack to another computer.

  • For MySQL, I use MySQL Administrator to schedule back up.


Fo sync back, it is easier if a directory is ZIPed up.  So here is a simple batch file:

[sourcecode language='css']

@echo off
REM =============
REM back up daily
REM Run by WinXP scheduler
REM =============

REM === Get current date
FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B
FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B
FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B
FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B
SET date=%yyyy%%mm%%dd%

REM KK-20080829: backing up Palm
zip -r "C:\BACKUP\palm\kkim_%date%.zip" "C:\Program Files\palmOne\kkim"

[/sourcecode]

I got this "date" batch script from the net.  Sorry, don't remember where I got it.  This works very well, and kudos to who wrote it.

I have cygwin installed and c:\cygwin\bin is in my PATH, thus the 'zip' executable is used in the batch file.  And Windows scheduler is used here.  And, SyncBack will pick up the file and put it onto another computer.  Or, the ZIP file can be created on another HDD.

August 23, 2008

Faster Vista by turning off UAC

I have been using Vista for a while -- it came with my new PC, Vista Home Premium. It took some time to get used to it and it's quite good. But I do sometimes want to go back to XP, when it is slower than XP, which I use at work, and my notebooks. Well, I was too lazy to install XP over Vista, so I kept on using it. There are just too much stuff on there, and I don't have time to back up and install new OS, reinstall everything, and restore, so on.

So today, some software I need to use doesn't work with UAC, or I have to buy the latest version just to run on the new OS. Heck, I always thought UAC is a good feature, but to run that piece of software which I don't think it worth the money just to run on Vista. So I turned off UAC completely. (With Vista Home Premium, it only allows either turn it off completely, or turn it on.)

I don't know if this is just my imagination, but it feels like the computer is running a lot faster, even all the visual effects are turned on. Well, for now, I'm keeping it off.

August 17, 2008

Finding files in directories

This posting is about 'find' unix command.

Linux has services command to handle processes that need to come up at start up time, and shutdown when system comes down. I use Sparc Solaris, v9, and (may be I don't know if there is) I have to (or I still) manage it manually. Sometimes I have to find what sym links are in /etc/rc*.d/ for certain app -- I usually get this part wrong too often -- if I want to look for :
[sourcecode language='css']
$ find /etc/rc*.d -name "*tomcat*" -print
[/sourcecode]
No quotes surrounding the directory pattern, no single/double quotes.

Here's an example:
[sourcecode language='css']
$ ls -ld rc*.d
drwxr-xr-x 2 root sys 1536 Aug 5 13:22 rc0.d
drwxr-xr-x 2 root sys 1024 Aug 5 13:22 rc1.d
drwxr-xr-x 2 root sys 2048 Aug 5 13:22 rc2.d
drwxr-xr-x 2 root sys 512 Aug 5 13:22 rc3.d
drwxr-xr-x 2 root sys 1536 Aug 5 13:22 rcS.d

$ find /etc/rc*.d -name "*tomcat*" -print
/etc/rc0.d/K15tomcat
/etc/rc1.d/K15tomcat
/etc/rc2.d/K15tomcat
/etc/rc3.d/S51tomcat
/etc/rcS.d/K15tomcat
[/sourcecode]

Vista and UAC

Sometimes you have to run certain commands or application as an adminitrator.  And, right-mouse clicking, and then selecting "Runas administrator" isn't too convenient.  There are a few ways to simplify it.  I'll use Vista-Hosts file editing as an example:


1. Use "runas"

From cmd or Windows-Run, type in this:
[sourcecode language='css']
runas /user:administrator "notepad C:\Windows\System32\Drivers\etc\hosts"
[/sourcecode]
This will ask administrator password, however.


2. Use CTRL+SHIFT+Eneter

From Windows-Run, type below:
[sourcecode language='css']
notepad C:\Windows\System32\Drivers\etc\hosts
[/sourcecode]
Then, CTRL+SHIFT+Enter


3. There's a utility, called "Start++".  You can do "sudo" with it:
http://brandonlive.com/2007/02/22/new-tool-i-made-for-vista-start/
[sourcecode language='css']
sudo notepad C:\Windows\System32\Drivers\etc\hosts
[/sourcecode]
That's it!

Vista and hosts file

With Vista, you can't modify hosts file directly with a normal user. You have to become an administrator to edit the file.  Here's how:
  • Run text editor such as notepad as Administrator, by right-mouse clicking on the application, and select "Run as administrator".

  • You'll get system notification, click "Continue"

  • Open file, C:\Windows\System32\Drivers\etc

  • hosts file doesn't have any file extension. Select "All Files"

  • Open "hosts" file.
  • Glassfish init script

    Here's the init script for Glassfish. Change JAVA_HOME, GLASSFISH_HOME, USER variables for your environment.

    
    #!/bin/sh
    # This is for: Sun's J2EE sdk v5.05 (Glassfish)
    
    JAVA_HOME=/usr/java6
    GLASSFISH_HOME=/opt/glassfish
    export JAVA_HOME
    
    USER=glassfish
    glassfish_stop() {
    su $USER -c "$GLASSFISH_HOME/bin/asadmin stop-domain domain1"
    }
    glassfish_start() {
    su $USER -c "$GLASSFISH_HOME/bin/asadmin start-domain domain1"
    }
    
    case $1 in
    start)
    echo "Starting Glassfish server:"
    glassfish_start
    echo "."
    ;;
    stop)
    echo "Stopping Glassfish server:"
    glassfish_stop
    echo "."
    ;;
    restart)
    echo "Restarting Glassfish server:"
    glassfish_stop
    glassfish_start
    echo "."
    ;;
    *)
    echo "Usage: /etc/init.d/glassfish start|stop|restart"
    ;;
    esac
    

    July 2, 2008

    PODS (Palm OS Development Suite) does not work on Vista

    Tried everything.  I've gotten to the point where I can compile and get .prc file, but it just doesn't work with IDE's debugger, nor it launches the compiled PRC file to the simulator or emulator.

    IT ONLY WORKS ON XP.

    Of course, you can just drop the compiled .prc file onto the emulator/simulator and use the stand alone debugger it comes with.  But it is two extra steps -- if you have a copy of XP, then it's better to use VMWare or VirtualPC + WinXP.

    I'll post more info later.

    ...but it's better to write apps for Android anyway...IMHO.

    May 31, 2008

    Application Menu for Vista

    With Vista, it is very convenient to use the 'Start Search' menu in Start button (it's not 'start' button any more). Just press the window key and start typing -- it'll find applications, email, docs, etc. (There are many freeware programs do this in XP, by the way).

    But I have too many applications, and with XP, I usually organize the "Programs" menu; put all the CD/DVD utilities in a folder, and so on. That way, I can quickly find the application I need. With the Vista's 'Start Search' feature, it's only useful if I remember at least partial name of an application to find it.

    I can still go back to 'classic' menu and organize 'Programs' folder in Start menu, but then I lose this 'Start Search' feature of Vista. How can I keep both? I've found this little utility from snapfiles.com, called "TrayBar."



    This is exactly what I wanted! (The screenshot shows XP, but it supports Vista, and I run it on my Vista home premium fine.)

    Just uncompress it, and run. No need to install. I usually put applications that don't need to be installed in c:\bin\ directory, by the way.

    I have added several applications in "Start Menu", and also in sidebar's launcher gadget.  But they can only have several apps.  With this app, I can list all of my applications, grouped by folders.

    May 19, 2008

    Eclipse Plug-ins

    Here is list of Ecplise Plug-ins I use:

    • CDT (C++)
      http://www.eclipse.org/cdt/

    • Azzurri (DB)
      http://www.azzurri.jp/eclipse/plugins/

    • Perl
      http://e-p-i-c.sf.net/updates

    • Maven
      http://m2eclipse.sonatype.org/update/

    • PHP
      http://download.eclipse.org/tools/pdt/updates/

    • PHP Debugger, Zend Debugger
      http://downloads.zend.com/pdt

    • JavaScript Debugger, JSecplise
      http://download.macromedia.com/pub/labs/jseclipse/autoinstall

    • Python
      http://pydev.sourceforge.net/updates/

    • Scala
      http://www.scala-lang.org/downloads/scala-plugin/

    • Subversion (Subclipse)
      http://subclipse.tigris.org/update_1.4.x

    • Android (ADT)
      https://dl-ssl.google.com/android/eclipse/


    References:

    • PHP and eclipse
      http://2tbsp.com/content/getting_started_eclipse_php_development_tools_(pdt)
      http://mprobst.de/SherlockWeb/?postid=2

    • Scala plug-in, demo video
      http://www.scala-lang.org/docu/movies/plugin_win.html

    • Getting Started with Scala
      http://www.scala-lang.org/docu/started.html

    • First Steps to Scala
      http://www.artima.com/scalazine/articles/steps.html

    • php.ini in WAMP
      http://www.en.wampserver.com/faq.php#q3