LendKey

Monday, December 3, 2007

Start multiple versions of Firefox at the same time in Windows

I have been long time Firefox user. I started using Firefox since it was 0.7 or so.

Now Firefox 2.0 has been used for my most day-to-day work, its profile contains lots of my cookies, passwords, plugins, etc. which I rely on everyday.

But 2.0 is famous as a memory eater. It can easily use up to 500M of RAM, and make my Vista 64bit with 4G of RAM running slow. So I started trying Best 3. It works great, and eats up way less RAM than 2.0 does. However, since all plugins in my 2.0 are not supported in 3.0 beta yet, I do need to switch back and force between the two versions. By Googling for a while, I found a site and learned the trick there. Basically I need to create a short cut for my 2.0 Firefox as:

C:\Windows\System32\cmd.exe /C set MOZ_NO_REMOTE=1 & start "Firefox" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -p default

and another shortcut for my 3.0 Beta as:

C:\Windows\System32\cmd.exe /C set MOZ_NO_REMOTE=1 & start "Firefox" "C:\Program Files (x86)\Mozilla Firefox 3 Beta 1\firefox.exe" -p "Li Ma Test"


Now the two works greatly together.

The trick is to create a new profile named as Li Ma Test. You need to run Firefox with the following command line option:

-ProfileManager

Then you can create a new profile to be used by the shortcut.

The two useful sites I found were:

http://www.hiveminds.co.uk/node/3114

and

http://www.google.com/search?source=ig&hl=en&rlz=1G1_____ENUS242&q=firefox+command+line&btnG=Google+Search

Enjoy!

And hope 3.0 Beta can go to final soon.

Saturday, December 1, 2007

Implement resumable file download by PHP

I had a requirement to implement a file downloading service with Apache + PHP.
The files are all uploaded by another tool. All uploaded files are renamed to UUID, and a UUID.info file is attached to store corresponding information of the original file.

Now at downloaded side, I need to:
1. verify UUID info before download
2. still able to download the file into the original file name instead of a user-in-friendly UUID.
3. Support browser and download manager, such as FlashGet

Without PHP code the 1 and 2 could not be accomplished.
But to support 3, PHP does not have any built-in support. Especially when considering downloading large files from server, PHP normally does not work well.

Luckily, I found a PHP class from:
http://www.phpclasses.org/browse/package/2221.html

Big thanks to the author, I was able to implement all I needed in less than 30 lines of my code :)

Hopefully, my finding can be helpful to you.

Li