Pooya Karimian


Download an album with Picasa broken?

[Google Picasa]
For some unknown reason, Google's Picasa sometimes looses its external application registration with Firefox. This means that you don't see the "download this album" link when viewing an online album although you already have Picasa installed. I'm not sure if this is a Picasa 2.0 - Firefox 3.0 issue but I think I had the same problem with Firefox 2.0 too.

Searching for this, looks like many people have the same issue with hardly any solution at hand. For this reason I made an easy hack for myself which I thought worth publishing here as well. It is a bookmarklet.

Bookmark the follow link by dragging and dropping it to your bookmark toolbar or right clicking it:
Download with Picasa

Then, browse to the main page of the album you want to download and press this bookmark. You will be prompted to open a file with Picasa which if you accept will download the whole album for you.

If you have the same issue, let me know how this works out for you.

Posted to Programming by pooya at 11:12 AM | Comments (4)

Yahoo! Mail source code
[Yahoo!] Update [July 3rd]: It seems like many people are running into this page and when they search for it they find my site. Just for your information this is a problem with Yahoo servers and your account has not been hacked or anything. This is basically Yahoo source code showing up. You can try contacting Yahoo! support if you want it to be fixed.

I logged out of Yahoo! Mail and guess what showed up instead of the normal flashy ads. Yes, their PHP source code:

Posted to Programming by pooya at 07:53 PM | Comments (8)

pkOrkut 0.5

[Orkut]pkOrkut 0.5 greasemonkey script is released. Its features include searching inside friends list, scrapbook, etc. and adding album photos to list views.

Get it while it's hot on my pkOrkut page.

Update: It's now 0.5.2 with bug fixes.

Posted to Programming by pooya at 01:19 PM | Comments (7)


[Catalyst]Not much new to write about this week. I was playing with Catalyst which is a Perl implementation of Ruby on Rails, or better say, an MVC style web framework written in Perl. Having the power of being backed by CPAN modules that can be used for everything you can think of, it seems to be a good thing to learn. But it has its own problems, like installation and the overhead especially in CGI mode. Check out the following article at Perl.com on how to make a sample application using Catalyst:

- Perl.com: Catalyst
- Catalyst
- Model-View-Controller
- Ruby on Rails
- Comprehensive Perl Archive Network

Posted to Programming by pooya at 11:58 PM | Comments (1)

karimian check

Do you remember /~karimian/check? It is coming back!

Posted to Programming by pooya at 04:40 PM | Comments (3)

Recording MMS Streams

Finally this semester is finished, my second semester here in SFU. So till now I'm done with 4 courses and I still need to take one more course. I may write more about my research here soon. But for now some this is one of the things I have done during the projects and exams.
As you know lots of multimedia contents on the Internet are only streamable through different protocols such as RTSP or MMS. Unlike HTTP, MMS the Microsoft's protocol for streaming content is not easy to download. But one simple and useful utility I found recently is MiMMS. It can be used to download mms streams to a file. It can download both audio and video streams and wherever I tested it is working perfectly. It is good that it can be called from command line without depending on any other library so it is easy to use it when downloading large number of streams.
I was able to download music videos from Yahoo! Launch (recently changed name to Yahoo! Music) but I don't know whether it is legal to do so or not. I believe it is like recording from TV to VCR and as long as you don't distribute/sell that it should be legal. In Yahoo Terms of Service it is only mentioned that Resale of Service is illegal.
So this is my solution for recording some music videos from Yahoo. You need first to download mimms-0.0.9.tar.gz, compile it and put the binary in the same directory as the following script (which can be downloaded from: getlaunch.sh):

And for running that you need to find the video id of each video which you can find by checking the link address of that video or viewing the html source and finding the parameter to playVideo function call. Sample usage for Sting’s After the Rain has Fallen clip:

$ ./getlaunch.sh 2152289

This script is based on the note from Michael Clement and the script posted on Linuxforums.org.

Posted to Programming by pooya at 11:07 AM | Comments (5)

Coding for fun

[wxWidgets]A presentation, an assignment, RA works, lab works, course project, and a final exam soon, that's why I'm working with DEV-C++, an open source C/C++ IDE for Windows which is by default comes with MinGW. It is fun writing cross platform GUI applications with wxWidgets in that environment, striping it and compressing it with UPX to make a less than 500k binary.

wxBasic seems cool too.

I have done many of my good codes on exam nights!

Posted to Programming by pooya at 12:50 AM | Comments (0)

Keyevents in Firefox

FarsiI posted about the new PersianJS code in the Persian Computing mailing list. What I've done is to change the code to work in Firefox/Mozilla browsers besides IE, this means allowing Linux/Mac users to use it too.

For catching keypress events and changing them to another key with javascript in Internet Explorer, there's a variable named window.event.keyCode that can both be used both for reading the pressed key and also for changing it to another key.

In Mozilla/Firefox the key code is in a variable named event.which which is defined only in the context of event handler.

The following examples only work in Firefox/Mozilla. The first one shows how to read the key value:

<input type="text" size=20 onkeypress="alert(event.which);">
And the next one is an example of changing the keypress to another key:
<script type="text/javascript">
 function newKey(event) {
     if (event.which==0x23) return;
     var new_event=document.createEvent("KeyEvents");
     new_event.initKeyEvent("keypress", false, true, document.defaultView, false, false, false, false, 0, 0x23);
<form action=""><input type="text" size="20" onkeypress="newKey(event)"></form>

Using a simple method for detecting browser type, such as testing for the existance of window.event object, it is possible to write multibrowser codes. PersianJS is a complete example.

Update Aug 5, 2005: Seems like because of a vulnerability initKeyEvent is disabled from Firefox 1.0.6 as you can see in bug #289940. I'm too busy but I will try to write a complete description and comment on that bug hoping that this feature return back to Firefox.

Update March 1, 2007: It's been a while that the bug is fixed. But the syntax for initKeyEvent is changed. You can no longer change the current event but instead you can create a new event and cancel the old one. I fixed the above code to reflect that.

Posted to Programming by pooya at 09:49 AM | Comments (7)

Expressions in CSS

Sometime ago I used a template from oswd.org as the template for a site and I choose a table-less CSS design. A CSS design will make the page load faster and more easy to change (just by changing the definitions of the style).

One interesting thing about CSS in Internet Explorer is that you can use javascript expressions inline. This can be used to easily do some nice designs (e.g dynamic resizing of elements). Take a look at this example:

--Click here and write something!--

Test Box

and this the HTML :

<span id="pooyak_el1" 
      style="background: lightblue;">
 --Click here and write something!--
<span id="pooyak_el2" 
      style="background: yellow; 
             width: expression(pooyak_el1.offsetWidth+'px');
             height: expression(pooyak_el1.offsetHeight+'px')">
 Test Box

- w3.org's Tableless layout HOWTO
- From Table Hacks to CSS Layout: A Web Designer's Journey
- Advanced CSS Layouts: Step by Step

- MSDN: About Dynamic Properties
- CSS Expressions

Update: I changed my site to XHTML seems like the example above is not working (which is an IE only example) is not working anymore...

Posted to Programming by pooya at 06:35 PM | Comments (3)


I found HTML::TreeBuilder a useful and easy to use Perl module for filtering out unwanted tags. Just take a look at an example:
I was browsing http://www.hottest-lyrics.com and I found it a good place for downloading lyrics of my favorite singers. The good points are that it has the lyrics categorized for each album and also they can be downloaded by recursive wgets:

$ wget -r http://www.hottest-lyrics.com/s.css
$ wget -k -E -r -np -b -t 0 -l 50 -U \ "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)" \ http://www.hottest-lyrics.com/l/loreena-mckennitt-lyrics-2376.html

After downloading the lyrics, I noticed lots of javascripts and images in HTML sources. So I used the following perl code to clean it out :

Posted to Programming by pooya at 07:18 AM | Comments (3)
[Tuesday 2017-02-21] [Updated Friday 2014-07-18]