Browse by Month RSS Feed
  • September 2010
  • August 2010
  • July 2010
  • May 2010
  • April 2010
  • March 2010

  • The End is NighMarch 28, 2007
    Filed under: Life @ 5:44 pm

    My boss was kind enough to let me end my time at my work (CityXpress) a month early. So come July 1st, I will officially be a hapless, good-for-nothing, unemployed bum. Whoo-hoo!

    I decided to ask for the extra month because over the volume of work has just become too great – now I’m finding I haven’t even the time to respond to people, and that sucks. Plus I’ve managed to make myself sick again from lack of sleep. This is just daft.

    So, to borrow George’s phrase from Seinfeld, 2007 is going to the “Summer of Ben”. I’m gonna drap myself in velvet and get a really large block of cheese… that and have some real free time to work on my various projects – Open Translate, Data Generator, Form Tools, Flash Image Scroller and a few other projects I’ve been wanting to do.

    Come August I’ll be moving to Saskatoon to live with my girlfriend for her final year of school. Then, next Spring it’ll be back to Vancouver and – if I can’t make a decent living through contract work – re-enter the job market.

    Comments (3)


    Not… dead… yet…March 21, 2007
    Filed under: Life @ 8:08 am

    My apologies to anyone who’s emailed me lately, I’ve been up to my eyeballs in work and haven’t yet found the time to respond to everybody. I replied to a dozen or so last night, and will do so again tonight. Here’s what I’ve been up to, just to prove I haven’t been spending all my time playing Warcraft…

    • The Legal Services Society: developing them a “proof of concept” Google Maps-driven site, in a similar vein to another site I helped develop: probonomap.bc.ca
    • The BP Way (Beyond Petroleum) – another registration site. This just appeared on my horizon and is due in under two weeks. Erk.
    • Day job! All of a sudden, my day job got rather busy. I may have to put in some overtime to get my current project finished by the deadline next week.
    • Form Tools 1.4.6. Let’s not forget the old workhorse, Form Tools. I took a short vacation last week to visit my girlfriend in Saskatoon. While I was there I managed to finish a first draft of the code (while she was at school). I’m shooting for getting a Beta out the door by the end of the month.
    Comments (0)


    Function: insertAfter()March 9, 2007
    Filed under: Code, JavaScript @ 9:30 am

    Handy function absent from javascript's built in DOM functions. It allows you to insert a new node after another. Originally posted by 1man on snipplr.com.

    function insertAfter(newElement, targetElement)
    {
      // target is what you want it to go after. Look for this elements parent.
      var parent = targetElement.parentNode;

      // if the parents lastchild is the targetElement...
      if (parent.lastchild == targetElement)
      {
        // add the newElement after the target element.
        parent.appendChild(newElement);
      }
      else
      {
        // else the target has siblings, insert the new element between the target and it's next sibling.
        parent.insertBefore(newElement, targetElement.nextSibling);
      }
    }

    Comments (0)


    Filed under: Software @ 11:08 pm

    Small change. I've made a couple of small improvements to the PHP and JS validation scripts. Specifically, you can now use a != operator in conditional tests (if field A is not equal to "yes" then validate such and such). Plus a new letters_only rule for testing that a field has ... you guessed it: letters only. Complicated stuff.

    PHP Validation

    JS Validation

    Comments (0)


    Filed under: Other, Software @ 5:42 pm

    Oh wow. I just added installed Google Analytics on my site today. It took literally minutes to set up and install. Actually, minutes is an exaggeration: try seconds. Since my site is entirely templated, I had to add the JS code to only 2 files.

    This thing is bloody superb. Up until now I've relied on whatever paltry offerings my hosting company provides: webalizer, awstats - apps of that ilk. Google Analytics is leaps and bounds ahead of anything I've seen to date. It provides a characteristically beautiful UI for viewing your website statistics in every conceivable way. Another nice feature with off-site statistics like this is that my site stats won't be interrupted or lost by switching hosting companies.

    Ra-Ra Google. I really have to send them my résumé. And a bouquet of roses.

    Comments (2)


    Filed under: Code, PHP @ 5:37 pm

    This function should REALLY come in handy for a lot of folks (heavy sarcasm). It calculates all size 2 subsets of an array whose values are unique, and in no particular order. So, passing it an array of [1,2,3] will return [[1,2],[1,3],[2,3]]. Passing it an array of [1,2,3,2,1,2,3] will return exactly the same thing. Go wild!

    function get_distinct_size_2_subsets($array)
    {
      $subsets = array();

      // if the array only contains two or less element, just return it
      if (count($array) <= 2)
        return $array;

      for ($i=0; $i<count($array); $i++)
      {
        $curr_el1 = $array[$i];

        for ($j=0; $j<count($array); $j++)
        {
          $curr_el2 = $array[$j];

          if ($curr_el1 == $curr_el2)
            continue;

          // if an element of [$curr_el1, $curr_el2] and [$curr_el2, $curr_el1] doesn't exist,
          // add if to $subsets
          if (!in_array(array($curr_el1, $curr_el2), $subsets) && !in_array(array($curr_el2, $curr_el1), $subsets))
            $subsets[] = array($curr_el1, $curr_el2);
        }
      }

      return $subsets;
    }

    Comments (0)

    Next Page »