• Projects
  • Photos
  • Fiction
  • About
  • My desktop
  • Resumé
  • Contact
  • Page 2 of 5«12345»
  • 11 Jan 2008
    Acid 3 Tackles ECMAScript
    This test is 1) insane, 2) genius, and 3) hell on Firefox 3.
  • 9 Jan 2008

    After the moderate success of 24 bingo, and in response to a couple requests for the use of the code after I used it for MetaFilter bingo, I'm releasing my single-page JavaScript-powered HTML Bingo into the world. Enjoy.

    Discuss
    • bingo
    • html
    • javascript
    • programming
    • projects
  • 28 Dec 2007
    Randomness in Linux
    Brian K questioned my use of rand(), which lead to a discussion and an investigation into random algorithms. Perl's srand() uses /dev/urandom to seed the PRNG, and it turns out that urandom is really clever.
  • 28 Dec 2007

    At work, each new user is assigned a totally random alphanumeric 12-character ID. They're random instead of sequential because this is what goes into the user's cookie (and in some cases into URLs) and we didn't want the IDs to be discoverable. Sometimes we need to do what we call a subscriber load and generate thousands (or sometimes many thousands) of IDs at once. The subload process tends to be very slow, and one of my co-workers was tasked with making it faster. While profiling the code, he discovered that a big time sink was the ID generation procedure. After more research, we discovered that it was written in 2004 and had never been modified after the original checkin. It was hundreds of lines long, used all kinds of global variables (Perl hasn't had static variables until 5.10), and involved big math with a magic prime number close to 7012. Worse, it was implemented as a hash function. And it was always passed a salt. And that salt was always random.

    We replaced it with this code:

    my @chars = ('A' .. 'Z', 'a' .. 'z', '0' .. '9');
    sub randid {
        $rv = '';
        for my $i (1 .. 12) {
            $rv .= $chars[rand(@chars)];
        }
        return $rv;
    }

    It used to generate about 100 IDs per second. Now it can do 175,000 per second.

    Discuss (1)
    • code
    • perl
    • programming
    • random
    • work
  • 19 Dec 2007
    Bugzilla:Languages
    Bugzilla is likely going to be rewritten soon, and they're discussing what language to use. I'm going to have a similar task at work in the next 6 months, so this is interesting.
  • 13 Dec 2007
    Movable Type Open Source
    They buried the most important fact (the license), but at least that wasn't because they picked a poor one. It's GPL!
  • 8 Nov 2007

    A web user is looking at page A. He clicks on a link for page B. That page has a META Refresh to page C. What is the value of HTTP_REFERER for that last request? What if the redirect was a Status 307? Or a location.replace() JavaScript call? What if he's using Opera? I've been doing some redirect referer tests this week and I have results for some the most common browser/OS combinations. I hope to expand them further.

    Discuss
    • browser
    • programming
    • projects
    • web
  • 28 Oct 2007

    Sometime during the planning of our two parallel Halloween parties, Chris and I realized we needed some way to allow the two groups to communicate. Videocasting was our first thought, but we didn't have the equipment or the knowledge. But when it came to taking photos and putting them on websites, we had all kinds of both. Using something Chris had written a while ago as a guide, I wrote a quick script to pull the photos off the camera, resize them to a reasonable resolution, and upload them to our web server. I then wrote a CGI that would pick a random photo from each location and place them side-by-side. Chris asked me to make the algorithm weight towards newer photos, which was far easier than it would have been if we had been uploading to a service like Flickr or something.

    After a rough (and late) start in Boston, things went well. Philly took some naughty shots early, which got people riled up here and for a period of time, things were pretty lewd. Eventually it became family-safe fun time party photos and some gentle photo-jabs were traded between the sister parties. Sometime around midnight, Chris texted me "this is the best thing we've ever done." I agree. That said, we learned things. The script had all kinds of bugs (mostly because I wrote it without having the camera we were going to use or the software). The CGI was too weighted towards new photos. And whereas Chris had done this before and had a neat photobooth setup (a side room, tripod, IR trigger), Boston had a camera that had to be hand-shot and plugged back into the laptop every few minutes.

    Will we ever be able to learn from the mistakes we made, and try out a new iteration of the script? I certainly hope so. Maybe we can hook in a third city. California friends, I'm gesturing in your direction.

    Discuss (5)
    • fun
    • halloween
    • live
    • party
    • photo
    • programming
    • projects
  • 15 Aug 2007
    jQuery: The Write Less, Do More, JavaScript Library
    Because XPath is too verbose and DOM manipulation is missing too many features, and they're both too browser-specific.
  • 3 Aug 2007
    Perl is Dead. Long live Perl.
    People say things like, "Perl isn’t used anymore is it?" or, "Ruby on Rails is all I read about anymore." Ridiculous.
  • Page 2 of 5«12345»

Comments and trackbacks are owned by their respective authors. Except where otherwise noted, all other content is licensed under an Attribution Creative Commons license by Logan Ingalls.

Validate: HTML, CSS