Archive for the ‘Software’ Category

Installing (and only installing) Cygwin X Server for “ssh -X”

Monday, March 1st, 2010

The following packages are needed: ssh, Xorg sever, twm. I am using  cygwin 1.7.1. Maybe something more … I installed everything under X11 to get it work by clicking the X/Win Server menu, which brings up an xterm window where I do “ssh -X” without problem….

Quick LAMP on debian

Monday, December 14th, 2009

$ sudo apt-get install mysql-server phpmyadmin apache2

Then visit: http://server-ip/phpmyadmin

Tip: Do not leave root password empty, as phpmyadmin by default won’t let you log on with empty password.

apt-get update with public key not available warning

Monday, December 14th, 2009

Question:

W: GPG error: http://ftp.us.debian.org sid Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 9AA38DCD55BE302B
W: You may want to run apt-get update to correct these problems

Answer:

xguan@p4:~$ gpg –keyserver subkeys.pgp.net –recv-keys 9AA38DCD55BE302B
gpg: requesting key 55BE302B from hkp server subkeys.pgp.net
gpg: /home/xguan/.gnupg/trustdb.gpg: trustdb created
gpg: key 55BE302B: public key “Debian Archive Automatic Signing Key (5.0/lenny) <ftpmaster@debian.org>” imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
xguan@p4:~$ gpg -a –export 55BE302B | sudo apt-key add -
OK
xguan@p4:~$

resort the files for my stupid mp3 player

Thursday, November 5th, 2009

for /f  “delims=@” %i in (’dir /b /o:n’) do copy “%i” new_dir\

Encoding DVD to a file with mplayer/mencoder in Windows

Thursday, June 4th, 2009

Very rough cmd line and I do not know the right output file extension, but the output can be played by mplayer, which is all I need :-)

mencoder dvd://3 -alang en -dvd-device e: -o c:\dvd\3.avi -oac faac -ovc xvid -xvidencopts bitrate=1200

No picture in Windows Media Player

Tuesday, July 8th, 2008

When I played any video in Windows Medis Player,  I had sound but no picture. I searched the Internet and knew many people met the same problem. The common solutions include installing a codec software, re-installing Windows Media Player, using other powerful media player softwares,  uninstalling all other media player, and so on.  I tried most of them except installing a more powerful media player (because I found the real solution when I downloaded the software).

The solution for this problem is to change the video acceleration setting.

1. Open Windows Media Player -> Tools -> Options  -> Performance;

2. Change the video acceleration setting to None;

3.  Click Ok and restart Windows Media Player.

Pretty-printing tools for all kinds of programming languages

Wednesday, June 11th, 2008

I have the need to read some obfusticated javascripts from Zillow. GNU indent doesn’t seems to support javascript. Tried a web based tool from http://en.wikipedia.org/wiki/Pretty-printing and it worked. Save this experience here, I am sure I will meet similar problems in the future.

Some programming quotes

Tuesday, May 13th, 2008

“The likelihood of keeping all or part of a software artifact consistent with any corresponding text that describes it, is inversely proportional to the square of the cognitive distance between them.” — http://c2.com/cgi/wiki?LocalityOfReferenceDocumentation

“We will encourage you to develop the three great virtues of a programmer: laziness, impatience, and hubris.” — Larry Wall

Firefox keyboard shortcut

Friday, May 9th, 2008

I am suffering from wrist pain. I’d like to use keyboard shortcuts to control my browser in order to reduce the mouse-using time. I collect some essential keyboard shortcuts for Firefox.

Ctrl + T (new tab)
Ctrl + L or F6(cursor to address bar)
Ctrl + K(cursor to search bar)
Backspace or Alt + left (browse back)
Shift + Backspace or Alt + right (browse forward)
Ctrl + [1-9] (select tab (1-9))
Ctrl + Tab (switch tabs)
Ctrl + -/+ (reduce / enlarge font size)
Ctrl + R or F5 (reload current page)
Ctrl + Enter (add http://www and .com to word in address bar)
Ctrl + F (find text in current page)
Ctrl + G (find next)
Ctrl + Shift + T (Undo last closed tab)
Shift + Enter (open link in new window)
Ctrl + Enter (open link in new tab)
Alt + Enter (open address/search in new tab)
Ctrl + W (close a tab)

Firefox built-in keyword/quicksearch

Search google by typing: g TEXT

You can add your quick search keywords.

1. visit the url, e.g. www.google.com/maps.
2. right click the search input.
3. select “add a keyword for this search”.
4. input the keyword, e.g. gm.
5. now you can search google maps by typing : gm TEXT.

You can refer more keyboard shortcuts at http://support.mozilla.com/en-US/kb/Keyboard+shortcuts.

If you are interested in IE keyboard shortcuts, please visit http://support.microsoft.com/kb/306832.

Install Apache 2, PHP 5.2, MySQL server 5.0, and phpMyAdmin on Windows Vista

Friday, May 2nd, 2008

I was busy installing softwares at my new computer. The LCD monitor of my Dell laptop stopped working normally. It’s time to change to a new computer. I was using Windows XP because I am not interested in try new but unstable softwares. This time I have to change to Vista since Xudong warned me it’s hard to find some device drivers if I continue to use Windows XP.

I never know it’s so hard to let  open source softwares running on Vista. I am not the only person who meet so many problems. Whenever I met the problem, I always found many people had already met the same problems. Fortunately I could find the solutions for the problems although some of them didn’t work for my computer. Here I’d like to share my installations.

1. Installation sequence

My installation sequence is Apache -> PHP -> MySQL -> phpMyAdmin. My friend recommended me to install PHP before Apache.  From my experience (I tried both), the sequence between them doesn’t matter.

2. Install Apache

Download Apache from http://httpd.apache.org/download.cgi. At first I installed Apache 2.2.8. But I downgraded to Apache 2.0.63 when I found PHP 5.2 couldn’t work on Apache 2.2.8.

2.1. Problems

1. Cannot stop or restart apache.
2. Cannot edit httpd.conf.
3. Cannot load php5apache2.dll.

2.2. Solution

1. Download apache_2.0.63-win32-x86-no_ssl.msi.
2. Turn off UAC (optional if you don’t want to restart computer and don’t think it’s annoying that you get continuous comfirm windows during the installation.).

1. start ->control panel
2. ->user accounts and family safety
3. ->user accounts
4. ->turn user account control on or off
5. uncheck “user account control”
6. click OK
7. restart computer

3.  Install Apache as administrator.

1. start ->accessories
2. right click command prompt -> run as administrator
3. go to the diretory where you save apache_2.0.63-win32-x86-no_ssl.msi
4. type “msiexec /i apache_2.0.63-win32-x86-no_ssl.msi”
5. follow the instruction to install Apache

4. Visit http://localhost/ in the browser to test Apache. If Apache is installed successfully, you will get:

It works!

5. Edit httpd.conf if you want to change config parameters.

1. start ->accessories
2. right click notepad -> run as administrator
3. edit and save httpd.conf in notepad
4. restart Apache to let config go into effect

3. Install PHP 5.2

1. Download PHP zip package from http://www.php.net/downloads.php.
2. Unzip the zip file into a dirctory of your choice.
3. Save php.ini-recommended as php.ini.
3. Add following script in httpd.conf.

LoadModule php5_module “c:/php/php5apache2.dll”
AddType application/x-httpd-php .php
PHPIniDir “C:/php”
(suppose you extract php package at C:\)

4. Install MySQL 5.0

1. Download MySQL 5.0 setup.exe from http://dev.mysql.com/downloads/mysql/5.0.html#win32.
2. Unzip the zip file and run setup.exe.
3. Follow the instructions to install MySQL.\

4.1. Problem

1. Fail to open “MySQL server instant config wizard”.

1. Download ResourceHacker from http://www.angusj.com/resourcehacker/.
2. Run ResourceHacker and open “C:\Program Files\MySQL\MySQL Server 5.0\bin\MySQLInstanceConfig.exe”
3. Edit last resource entry (24 -> 1 -> 1033), change level=”asAdministrator” to level=”requireAdministrator” .
4. Click “Compile script”.

2. Fail to connect MySQL in PHP.

1. Uncomment “extension=php_mysql.dll”.

2. Print phpinfo() to check Apache PATH. If php installation directory is not included in the path. You need copy libmysql.dll at php installation directory to any directory included in Apache PATH.

5. Install phpMyAdmin

1. Download phpMyAdmin from http://www.phpmyadmin.net/home_page/downloads.php.
2. Unzip the zip file in your web server’s document root.
3. Create config.inc.php file and edit as following:

<?php
$i=0;
$i++;
$cfg[’Servers’][$i][’user’]          = ‘root’;
$cfg[’Servers’][$i][’password’]      = ‘cbb74bc’; // use here your password
?>

Read document.html at phpMyAdmin directory for more information.

5.1. Problem

Get error message “cannot load mysql extension, please check your PHP configuration”. Refer to problem 2 in section 4.1 for solution.

Finally I got them all runing on Vista. Good luck!