Sometimes it’s beyond your imagination

The sheer stupidity of this registration form is unfathomable. Not only they don’t allow white spaces, they also forbid vietnamese characters ! How can I submit my name now ?!

lacviet mtd registration form stupidity

On the other side, i really give kudos to LacViet for having an usable ecommerce site. They make online transactions quite pleasant to go through (except the atrocity above, of course)

Interesting Windows hotkeys you should know about

non trivial windows hotkeys

Vim has shown me the power of muscle memory. That’s why i always try to learn hotkeys of any thing i use daily. Managing your desktop environment of course is one of those tasks.

Below are non-trivial and useful windows hotkeys that you probably don’t know about.

Win + Pause = System Properties

Win + D = Show Desktop

Win + M = Minimize all windows

Win + E = Launch Win Explorer (@ My Computer),

Win + R = Run Command

Win + L = Lock the screen

Win + X = Open Windows Mobility Center

Win + T = Shift through windows list in task bar (Win7)

Win + P = Change display output between Computer and Projector

Win + B = Let you select items in task bar’s tray

Ctrl + Esc = Start Menu (for those who use old keyboard)

Ctrl + Shift + Esc = Show Task Manager

Win + Shift + M = Maximize all windows

Alt + Spacebar + X = Maximize window

Alt + Spacebar + N = Minimize window

Alt + Spacebar + R = Restore

Alt + Tab = Shift between Windows (this one is trivial but do you know that Alt + Shift + Tab = Shift between Windows in reverse order ?)

Ctrl+ Shift + F10 = Shows Context Menu (Mouse Right Click Effect)

Application Specific (generally): Ctrl + S = Save, F3/Ctrl + F = Find

Desktop/Win Explorer: F2 = Rename File, F3/Win + S = Launch Search

Php-fpm error after reinstall PHP

Error:

lamnk@lamnk:~% sudo php-fpm start

Starting php_fpm Error in argument 1, char 1: no argument for option -
Usage: php-cgi [-q] [-h] [-s] [-v] [-i] [-f ] php-cgi [args...]
-a Run interactively
-C Do not chdir to the script's directory
-c | Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f Parse . Implies `-q'
-h This help -i PHP information
-l Syntax check only (lint)
-m Show compiled in modules -q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-v Version number
-w Display source with stripped comments and whitespace.
-z Load Zend extension
................................... failed

Reason:

The old config file php-fpm.conf is located at /etc. However the new config file is moved to /usr/etc.

I don’t know why is that. I’ve used the exact same old configuration directives …

Fix:

Move or copy php-fpm.conf from /etc to /usr/etc. Problem solved.

Reset TCP/IP networking stack in Windows 7 and Vista

Sometimes your DHCP service is not able to pull an IP addresse, that means the network stack on Windows goes banana. To fix that, open command prompt with administrator privilege (click on Start -> type in “cmd” -> right click on the command prompt and choose “Run as Administrator”) and type these command:

netsh int ip reset C:\netsh.log.txt
netsh winsock reset

… then all your network configuration is reset.

Almost there …

Yesterday I wanted to clean around my home directory:

rm dmesg.txt feh_02 * boot.txt test.txt test.txt~ xxxtest.txt

And this is the result:

zsh: sure you want to delete all the files in /home/lamnk [yn]? n
zsh: sure you want to delete all the files in /home/lamnk [yn]? y
rm: cannot remove `feh_02': No such file or directory
rm: cannot remove `Customization': Is a directory
rm: cannot remove `Desktop': Is a directory
rm: cannot remove `Documents': Is a directory
rm: cannot remove `Download': Is a directory
rm: cannot remove `Dropbox': Is a directory
rm: cannot remove `Ebooks': Is a directory
rm: cannot remove `Movies': Is a directory
rm: cannot remove `Music': Is a directory
rm: cannot remove `Photos': Is a directory
rm: cannot remove `Pictures': Is a directory
rm: cannot remove `Truyentranh': Is a directory
rm: cannot remove `backup': Is a directory
rm: cannot remove `builds': Is a directory
rm: cannot remove `boot.txt': No such file or directory
rm: cannot remove `test.txt': No such file or directory
rm: cannot remove `test.txt~': No such file or directory
rm: cannot remove `xxxtest.txt': No such file or directory

Luckily i didn’t issue rm -rf as usual …

I will look at shell’s warning before press Y

I will look at shell’s warning before press Y

I will look at shell’s warning before press Y

[repeat 1000 times]

… and still press y on reflex …

How to install Cisco VPN client on Ubuntu Jaunty Jackalope and Karmic Koala 64 bit

Update 2010-08-26: You can now install with this patch applied. It’s all the old patches combined.

cd vpnclient/setup/directory/
wget http://www.lamnk.com/download/fixes.patch
patch < ./fixes.patch
sudo ./vpn_install

This patch is tested on Ubuntu Lucid Lynx 10.04 LTS on 32bit and 64bit.

Old post:
Cisco module again doesn't let us compile against the new kernel in Ubuntu 9.04 and 9.10 beta:

/home/lamnk/vpnclient/interceptor.c: In function ‘interceptor_init’:
/home/lamnk/vpnclient/interceptor.c:132: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
/home/lamnk/vpnclient/interceptor.c:133: error: ‘struct net_device’ has no member named ‘get_stats’
/home/lamnk/vpnclient/interceptor.c:134: error: ‘struct net_device’ has no member named ‘do_ioctl’
/home/lamnk/vpnclient/interceptor.c: In function ‘add_netdev’:
/home/lamnk/vpnclient/interceptor.c:271: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
/home/lamnk/vpnclient/interceptor.c:272: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
/home/lamnk/vpnclient/interceptor.c: In function ‘remove_netdev’:
/home/lamnk/vpnclient/interceptor.c:294: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
make[2]: *** [/home/lamnk/vpnclient/interceptor.o] Error 1
make[1]: *** [_module_/home/lamnk/vpnclient] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.31-1-generic'
make: *** [default] Error 2
Failed to make module "cisco_ipsec.ko".

Before installtion I assume that you have the latest version 4.8.02.0030 and the required packages for compiling ie gcc, libstdc++6 ... The kernel version should be from 2.6.30 to 2.6.32

  • Download the client and extract it
  • Go to vpnclient folder:
    cd vpnclient

  • Download patch file for 64 bit and apply it (users on 32bit systems can skip this step):

    wget http://lamnk.com/download/vpnclient-linux-4.8.02-64bit.patch

    patch < ./vpnclient-linux-4.8.02-64bit.patch

    sed -i 's/^CFLAGS/EXTRA_CFLAGS/' Makefile

  • Download patch file for newer kernel (2.6.30+) and apply it:

    wget http://lamnk.com/download/vpnclient-linux-2.6.31-final.diff

    patch < ./vpnclient-linux-2.6.31-final.diff

  • Next we must edit a kernel source file

    sudo sed -i 's/const\ struct\ net_device_ops\ \*netdev_ops;/struct\ net_device_ops\ \*netdev_ops;/' `find /usr/src -name netdevice.h`

    Yes, it is a one liner, you should copy & paste that command instead of typing ;) The command's translation into English: find the string const struct net_device_ops *netdev_ops; and change it to struct net_device_ops *netdev_ops; in the file locates at

    find /usr/src -name netdevice.h

  • And finally, install Cisco VPN Client:

    sudo ./vpn_install

The patch files are not from me. All credit goes to the people at tuxx-home.at forum

If you can't install or have a problem please leave a comment

Compile rtorrent on CentOS 64bit

I always fall for this error when compile rtorrent, so … :

Error:


checking for STUFF... configure: error: Package requirements (sigc++-2.0) were not met:

No package 'sigc++-2.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables STUFF_CFLAGS
and STUFF_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

Fix:

$ updatedb
$ locate pkgconfig | grep sigc++-2.0.pc

You will see something like /usr/lib/pkgconfig/sigc++-2.0.pc. If it is not there, then go install libsigc++ (it’s not in official CentOS repo).
Then define the PKG_CONFIG_PATH variable as the configure script suggests:

$ export PKG_CONFIG_PATH=/usr/lib/pkgconfig/

Run configure script for libtorrent again. --prefix= should be the same for libsigc++, libtorrent and rtorrent, otherwise they will complain ;)

./configure --prefix=/usr && make

Import Excel .xls files into R

What is R ? R is a programming language and software environment for statistical computing and graphics. It is developed by
statisticians around the world and is free software, released under the GNU General Public License.

In order to import .xls file into R, we must convert the file to csv first. One way to this is to open xls files in a speadsheet application and then export to csv format. Another way is to use a small convert program, handily available on … Google. An example: xls2csv:

xls2csv -x dataset.xls -c dataset.csv

After converting to csv, import data with

> dataset1 <- read.csv(file = "~/dataset.csv")

Alternative PHP Cache – APC – impact

Picture worths thousand words …

apc cpu improvement

apc cpu improvement

I have never used a PHP accelerator before. Now it is a must to install APC for every new server (if you have enough memory to throw around).

Kamehameha in real life

Can’t stop LOL :D

Kamezoko kamehameha

If you don’t know that Kamehameha is, read Dragon Ball serie.