2011/07/18

How to center dynamic ul

A UL is a block element, it'll take up the whole width of its container. If you remove float:left and set a width to it, then margin:0 auto will work, but only the ul will center and not the li, unless you know exactly what the width of the UL should be. If you do not know what the ul width should be(e.g. dynamic list menu), then you need to float:left the UL and li, put it in a div, and use this trick to center http://pmob.co.uk/pob/centred-float.htm

2011/07/02

Connect to VPN via Sonicwall NetExtender

I was trying to connect to company's VPN via Sonicwall NetExtender. The version of NetExtender that I can get from my company is 3.5.629, which works fine in my Windows7 desktop, but it does not work in my Ubuntu 11.04. After doing Access Authentication, I was able to connect to server, but eventually I was logout, and the following are some error message I got.
Using SSL Encryption Cipher 'DHE-RSA-AES256-SHA'
Using new PPP frame encoding mechanism
pppd: no device specified and stdin is not a tty
SSL_read ZERO RETURN
SSL-VPN logging out...
SSL-VPN connection is terminated.
Exiting NetExtender client
Connection interrupted.  Reconnecting... 
I spent sometime Googling, and finally I found out the solution. In short, I need a newer version of NetExtender, which you can download it at  Sonicwall demo page,
https://sslvpn.demo.sonicwall.com/cgi-bin/welcome
(note that you need to use "demo" as username and "password" as password to login, and then click NetExtender to download it. I did that in Firefox, and it should popup the download link, and then you can use Active Manager to extract it.

Here are some note:
1. Before you install the newer version, you must uninstall the old version, if you already installed it. (Go to netExtenderClient folder, and run "sudo ./uninstall")
2. You need root to run netExtender (or, sudo ./netExtender)
3. You can also run sudo ./netExtenderGui (the one has user interface), but it may require java.

Hope this helps for someone who has the same problem.

2011/06/24

phpmyadmin cannot import - ubuntu 11.04

"No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See FAQ 1.16."

Most of time when you see this error, you can just follow the instruction in FAQ1.16 to make some changes in php.ini, such as file_uploads, upload_max_filesize, memory_limit, upload_tmp_dir, max_input_time and post_max_size.
If all of these does not work for you, then it could be the file/directory permission problem. Check the files under /var/lib/phpmyadmin, there are two files, config.inc.php, blowfish_secret.inc.php, and one folder, tmp. Make sure tmp is writeable by APACHE RUN USER, which can be set at /var/apache2/envvars.

Good luck!

2011/06/23

how to install two firefoxs in ubuntu 11.04

Firefox 5 is out now. My ubuntu has updated Firefox Browser to 5, and it works fine, and I do feel it's faster, but the problem is that some add-ons does not work in the new Firefox. If this is a case for you too, or you just like to have old Firefox in your machine, here is how I did it. 1. Go to Mozilla Old download page at http://www.mozilla.com/en-US/firefox/all-older.html, and pick one and download it. 2. Unzip the file and save it to somewhere, says, /home/adam/firefox. 3. Close the existing firefox, and at your command line, change directory to firefox folder, and then enter the following command
./firefox &

Note that you have close exiting Firefox, otherwise, it will trigger the Firefox 5 not Firefox 3. And you can click the file named firefox to open it, but you have to select RUN, not open it in the text editor.

2011/06/17

Order of ClassPath

You can define multiple ClassPath, like

CLASSPATH=$CLASSPATH:/usr/local/apache/lucene/lucene-core-2.0.0.jar:/usr/local/apache/lucene/src/:/usr/local/apache/lucene/src/lucene-classes.jar:.
export CLASSPATH


But the order of ClassPath is important. Basically it is first come first server, if Java Interpreter find the class in the first class path, then it will ignore the the one in the later class path. See the detail from Oracle java doc

The order in which you specify multiple class path entries is important. The Java interpreter will look for classes in the directories in the order they appear in the class path variable. In the example above, the Java interpreter will first look for a needed class in the directory C:\java\MyClasses. Only if it doesn't find a class with the proper name in that directory will the interpreter look in the C:\java\OtherClasses directory.

2011/06/10

remotely connect from Windows - ubuntu 11.04

Here I would like to introduce two ways to connect to Ubuntu from Windows PC.

1. Remote desktop connection.
You need to enable Remote Desktop in Ubuntu, just open application named "Remote Desktop" and change some preference, which is straight forward. And then you need install a VNC viewer software in your windows pc. I use TightVNC and it works just fine.

2. SSH
You need to install ssh server in Ubuntu by running the following command,

sudo apt-get install ssh

And then you can use putty in Windows PC.

2011/06/03

Change archive date format - wordpress 3.1.2

Cannot believe it, but I could not find it in the dashboard to change archive date format. The wordpress I have installed is English version 3.1.2, and date format of archive is "mY", like "June 2011". If you like to show it as 2011 June, beside writing your own get archive function, only thing you can do I think is change source code. I know it is very bad idea, but anyway, if you have to change the formate, here is the solution, Go to "/wp-include/general-template.php", find this line,
$text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
And change it to
$text = sprintf(__('%2$d %1$s'), $wp_locale->get_month($arcresult->month), $arcresult->year);
 
If you also want to change the date formate on archive page title, then find this line,
$result = $prefix . $my_month . $prefix . $my_year;
And change it to
$result = $prefix . $my_year . $prefix . $my_month;