January 5, 2009

Dell PCs featuring Ubuntu

I've been a Mac user for 2 years now: ever since I tested Windows Vista and realized that there was no hope for MS to come up with an OS satisfying my needs (they may someday but not anytime soon). By then, I had to make a decision to buy a PC, install Ubuntu, and throw away Vista or buy a Mac. I chose Mac (Macbook) and it has been a pleasure using the machine.


However, the decision would have been really difficult if Dell started releasing their PCs with Ubuntu as they do now. As a PC, Dell XPS series are very compelling, plus you save money for buying Vista.


Ubuntu has caught up with many features that were bounded only to Mac OSX (Expose, Spaces, etc.), which gives me some reasons to go back to linux.

Apple Keyboard on Ubuntu 8.10




I have 'Wired USB slim aluminium Apple keyboard'. Its design is stunning and it types very smoothly; however, since the keyboard uses slightly different keycodes, some works needed to be done to use it on Ubuntu.

First, [alt] doesn't work as it is: it needs to be pressed with [fn] in order to act as [alt] in PC. Here is how to fix it.

$ sudo vi /etc/modprobe.d/options
> options hid pb_fnmode=2
$ sudo update-initramfs -u

Second, some may find it convenient to have [alt] and [cmd] switched. I personally prefer not to switch them (and it can be done by using compiz manager) but in case you need, here is how to.

Third, if you configured the keyboard layout (Menu -> System -> Preferences -> Keyboard -> Layouts) as 'Generic 102-key', you won't be able to use [F13] ~ [F19]. To overcome this, you need to add the following keycodes.

$ vi ~/.xmodmap
> keycode 191 = Insert
> keycode 192 = Print Sys_Req
> keycode 193 = Scroll_Lock
> keycode 194 = F16
> keycode 195 = F17
> keycode 196 = F18
> keycode 197 = F19

The script assigns F13 to 'Insert', F14 to 'PrintScr', F15 to 'ScrollLock', and so on. Now, you can use the keycodes to configure system shortcuts (Menu -> System -> Preferences -> Keyboard Shortcuts), or to create your own shortcuts.

java.io.IOException: Too many open files

This indicates that Java Virtual Machine(JVM) tries to open more files than the max-number of file descriptors. The max-number of file descriptors varies by OS: 1024 for Ubuntu linux, 256 for Mac OSX. You can check the limit by typing

$ ulimit -a

A frustrating thing is that the exception still occurs even when there is no way that the number of currently opened files exceeds the limit. This can happen when the Java program opens a new file before JVM closes the old file: it takes longer for JVM to close a file. Hence, if your program keeps opening and closing files without much break, you will most likely experience this exception.

How do we get around with this problem? If you are a super user, the easiest way is too increase the limit of file descriptors. Here is how.

$ sudo vi /etc/security/limits.conf
> userId soft nofile 4096
> userId hard nofile 4096

This will increase the max-number of file descriptors to 4096. I haven't tried any number greater than this, but this should be enough for most programs.

One interesting thing. Although Mac OSX has a smaller limit of file descriptors, I never experienced this exception in OSX. Is this because OSX's JVM handles file descriptors better than Ubuntu's one?

April 24, 2007

Eclipse - Compiler Compliance Level

To fix 'The type Vector is not generic' problem,

[Menu] -> [Project] -> [Properties] -> [Java Compiler]
- check [Enable project specific settings]
- Compiler compliance settings -> higher than 5.0

April 10, 2007

VMware - Tools (Guest = Debian)

# install gcc, c-header
apt-get install gcc
apt-get install linux-headers-`uname -r` build-essential

# install VMware tools
Windows: [Menu] -> [VM] -> [Install VMware Tools]
Linux: cp /medai/cdrom*/VMwareTools-*.tar.gz

# Shared Folders
Windows: [Menu] -> [VM] -> [Setting] -> [Options] -> [Shared Folders]
Linux: cd /mnt/hgfs

April 2, 2007

VMware - NAT Setting (Host = XP)

1. [Local Area Connection Property] -> [Advanced]
- Check "Allow other network users to connect through this computer's Internet connection"
- Home Networking Connection: VMware Network Adapter VMnet8

2. Virtual Machine Settings
- Ethernet: Custom -> VMnet8(NAT)