Friday, April 13, 2012

Setup remote desktop on Amazon EC2 Ubuntu 11.10

NX server is running over SSH, similar to sftp.
1. General steps (https://help.ubuntu.com/community/NomachineNX)
Note: when download nx deb packages, use the appropriate packages for your environment, the document assumes i386, but you may need 64 bits

2. NX remote desktop setup requires two types of users:
a). OS user, called "nx", for ssh login like normal ubuntu user, but the "nx" user's home is not at normal /home/nx, but at /usr/NX/home/nx
b). NX specific user. After you logged in via SSH, NX requires another authentication. So need to add nx user and enabled password authentication. (NX client downloaded from NoMachine seems only support password authentication for NX user. a little weird)

3. Setup OS "nx" user to have the public key for your ssh session. Test if you can ssh via "nx" user.
4. Enable EnablePasswordDB = "1" in server.cfg
5. Create an OS user first, then nxserver --adduser "username" since "The user must already exist on the host server when the command is executed." (from nxserver usage)
6. In NX client, load the private key for SSH session, and type "username" and password for NX user

Thursday, June 23, 2011

Oralce Enterprise Manager Java Console

After switching to a new computer, I lost my copy of Oracle Enterprise Manager Console which is quite useful when administrating Oracle databases. It took me a while to finally find Java Console version of Enterprise Manager, since Oracle 11g, they are replacing Java Console with online admin page.

So it's in the Oracle 10g release 2 client zip file: http://www.oracle.com/technetwork/database/10201winsoft-095341.html (10201_client_win32.zip)

Friday, October 1, 2010

Grails database transaction

This is my experience so far.

If transactional is set to true, Grails will always do a real commit when the public method exits. Even using save(flush:true), it won't commit to database until method exits.

Using withTransaction to scope block of code for which you want to commit it when block ends. But be sure to change transactional to false. I think transactional=true will override withTransaction, i.e. it will still try to commit when the method exits.

Thursday, September 2, 2010

Patching Grails

If you want to add a fix to Grails without waiting for next release, here is what I have done to patch it's jars. Basically it's two steps. First, compile patched source code to classes. Second, sneak patched classes into Grails distributed jar file.

1. Create a normal Grails project and add patched source based on same package structure of Grails source code. Compile it to get the classes.

2. Recreate the Grails jar file which contains classes you want to patch. Replace same jar file at $GRAILS_HOME/dist/. Note, Grails cache those jars under $USER_HOME/.ivy2/cache/org.grails. So make sure delete the cached jar file.


Just a side note: Thread.dumpStack() is quite useful to see stack trace.

Tuesday, February 23, 2010

Odd font size in quirks mode

If don't specify DOCTYPE, browser will rend the page in quirks mode. It can cause some weird problem. One problem I ran into: font-size seems mystically changed in some cases. Finally it turns out that browser(ff) is rendering in quirks mode, and in quirks mode, for the any table, it applies some styles to table. One of them is font-size: -moz-init;. This overrides your pages font-size style and use any font size from your browser's font setting, which by default is 16px. After changing to standard mode, it won't add extra styles.