Archive for January, 2010

Days of Code: Perl URL Shortener // Day 5

Since I last wrote, I’ve reconfigured a few different things in this.

  1. In shorten.pl – I’ve fixed the API key verification for now, added rudimentary invalid URL detection.
  2. In list.pl – I’ve used threads, as mentioned in a tweet,
    YES! #Perl | With threads I was able to cut total execution time from 0.121s to 0.78s (both averages)! Perl==WIN!
    , and now save about 64% of the time in listing all of the URLs in the database. (that’s using 2 threads; I’ve found that 8 is optimal in general on this server)
  3. In stats.pl – I now order the URLs by id (in other words, the one with the latest created short code first).
  4. In subs.pl – I rewrote some of the randomPassword subroutine. It should be more efficient in the future, however I will need to write one from scratch to make it work; I keep getting long short codes, I specify a 2-character sc and get a 4 (always 4) character password/sc in return. Help?

I’ve posted the updates to this code on the usual Code >> Perl URL Shortener page.

You can also see it in action at Brad-Zone.com … for now.

Google Buzz

Post to Twitter Post to Delicious Post to Digg Post to Ping.fm Post to Reddit Post to StumbleUpon

Get Adobe Flash playerPlugin by wpburn.com wordpress themes