Wednesday, August 27, 2008

Swap CAPSLOCK and ESC key in Windows

I decide to do the swap because I use VIM a lot. Save the following text into a file such as swap.reg. Double click the file import the registry values.

REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,3a,00,01,00,01,00,3a,00,00,00,00,00

Saturday, August 16, 2008

Build Ruby on Windows

Get the Ruby 1.8.7 source code from ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p71.tar.gz. Extract the source code to a directory such as D:/Ruby 1.8.7-p71 . Open a Visual Studio .NET 2003 Command Prompt. Run the following commands to compile ruby.
  • cd /d D:/Ruby 1.8.7-p71
  • win32\configure.bat
  • nmake
If the following error occurs, its means that Cygwin find is invoked from the make file. Make sure that windows find precedes Cygwin find in PATH environment variable.


Creating Makefile
find: `=': No such file or directory
NMAKE : fatal error U1077: 'cl' : return code '0x1'
Stop.

Saturday, August 2, 2008

HTTP Status 404 when running tomcat inside Eclipse

HTTP Status 404 will show up when I running tomcat inside Eclipse. And my resource exists. The error will disappear when I restart tomcat for some times. How many times I need to restart tomcat to remove the error is random. And the dialogs of Run on server wizard is random.

Sometimes, I get this error when using welcome-file-list. For some reasons, the welcome-file can be found.

I have used tomcat in Eclipse for some. My overall experience is bad. Maybe some improvements should be made on WTP. For now, I use ANT to deal with Tomcat. And it works well.

Classpath subtlety when using tomcat inside Eclipse

First, an eclipse dynamic web project only recognized classes produced by source folders configured in Java Build Path->Source and classes in the libraries under WebContent/WEB-INF/lib folder. The locations of source folders and class output folders do not matter if they are inside this project. The count of source folders and output folders also does not matter. By default, the output class folder is build/classes. It does not recognize the jar libraries which are not under WebContent/WEB-INF/lib and class folder configured in Java Build Path->Libraries. For class compilation, it is Ok. ClassNotFound exception will be thrown if you begin to use Run on server.