IRC channel for good stuff
NTU has an IRC channel for students sharing stuffs with each other. Most of them are TV shows, anime such as American Idol, Lost, Bleach, Smallville, Naruto etc. Indeed, I accidentally knew about it while looking for " The Apprentice " (thank HG :D).Here are the details.
IRC server : irc.irchighway.net
IRC Channel : #ntu-pinoyTo connect to this channel, make sure you're in NTU and have an IRC client (xchat or mIRC)Command to connect:/server irc.irchighway.net 6669/join #ntu-pinoy
Power of 2
How to determine if an integer k is a power of 2. This is one of the questions you may face in an interview. The most obvious way is using a loop, which results in O(logn) complexity.
However, there are some beautiful tricks to do it in O(1).
Trick #1: using bitwise XOR operation ( from a website which I forgot the URL)
return k & (k ^ (k-1)) == k;
Trick #2: using bitwise AND operation ( thank VTL for this one :x )
return k & (k-1) == 0 ;
Using smbmount in FC5
From FC5, the smbmount is replaced by mount.cifs to make it consistent with the UNIX's mount command. Therefore, the command line to mount a SMB service is as followed:
# sudo /sbin/mount.cifs "$SERVICE" "$HOME/mnt/$COMP/$SHARE" -o username=$SMBUSER,password=$PASS,uid=$USER,gid=$,umask=0002The command can be put in a bash script to save typing effort, and all the variables are command line's parameters.
Install NVIDIA Accelerated Graphical Driver in FC5
When I switched from FC4 to FC5, I had a problem with the NVIDIA Graphical Driver. The module was built for the older kernel version and it had to be rebuilt for the newer FC5's kernel version. I downloaded the latest driver from NVIDIA website and followed all the usual steps. However, the startx command, instead of starting the X Server, generated a long screen page of error messages. Basically, it complained that the nvidia and glx modules were not loaded, even though I could find them using " lsmod grep nvidia ".The solution to this problem: (as root)# cd /usr/lib/xorg/modules/drivers# ln -s /usr/X11R6/lib/modules/extensions/libglx.so .# ln -s /usr/X11R6/lib/modules/drivers/nvidia_drv.so .# reboot
I did not know why this problem occured with FC5 kernel but not FC4. It was quite uncomfortable to add the symlinks manually while it was better to be done using a script. Anyway, the problem could be solved this way.