February 2010 Update

Launched VancouverGym.ca, like Toronto-Gym.ca, it is a directory of gyms, fitness centres and health-food stores in the Vancouver/Lower Mainland area.

Why no Buzz for Google’s Twitter

Google launched Buzz last week to generally better press than Apple received seems to have received for it’s iPad, though I wonder if there are some similarities. For one thing, both of these are kind of re-imagines of already successful products. The iPad is basically the iPhone on a grander scale; if you watch Apple’s videos it’s clear they are thinking, “This is what we did with the iPhone- but what if we had a bigger screen?” Google’s Buzz of course is kind of reminiscent of Google Wave which was promoted famously as “What if we where inventing email today?” Buzz might well be asking “What if we invented Twitter today?”

There’s plenty of ways that kind of thinking can go right or wrong, but I’m wondering if what made Twitter what it is today was that it was kind of retro to begin with- and that’s what makes it fun. I’ve tried to explain Twitter to people for about 2 years now. The 140-character limit is kind of arbitrary- text messages can be up to 160 characters and computers-type limits would be multiples of 8, resulting in numbers like 128 or 256 characters.  So yes, it’s a bit of a toy, but it’s limitations are what make it a challenge, you can’t be sloppy with Twitter, it takes a bit of thinking to pack much meaning into 140 characters –spaces and punctuation included– and that in turn that appeals to certain people.

Google Buzz does away with that limit of course.  While  Buzz of course has no limits on text, it lets you add photos, links, probably video too. It’s certainly probably more practical, but it might not turn out to be as much fun.

January 2010 update

This January we launched a updated version of the Leaside Business Park website. The new website streamlines the site navigation as well as a general clean-up of the site and the code behind it.

CakePHP database config quick-tip

Most CakePHP programmers have seen this simple way of storing the development and production database settings in one file:

  1. class DATABASE_CONFIG {
  2.     var $prod = array(
  3.        
  4.         'database' => 'live_mysite'
  5.     );
  6.  
  7.     var $test = array(
  8.        
  9.         'database' => 'local_mysite'
  10.     );
  11.  
  12.    // the construct function is called automatically, and chooses prod or dev.
  13.     function __construct() {
  14.         //check to see if server name is set (thanks Frank)
  15.         if(isset($_SERVER['SERVER_NAME'])){
  16.             switch($_SERVER['SERVER_NAME']){
  17.                 case '127.0.0.1':
  18.                     $this->default = $this->test;
  19.                     break;
  20.                 default:
  21.                     $this->default = $this->prod;
  22.                     break;
  23.             }
  24.         } else { // we are likely baking, use our local db
  25.             $this->default = $this->test;
  26.         }
  27.     }

If you haven’t, check out Edward A. Webb’s original post from 1998 2008.

This same technique can be used in the bootstrap.php file for other settings that change based on the server, for instance GoogleMap keys:

  1. if ( strpos( $_SERVER['HTTP_HOST'],'MySite.com') !== false)
  2.     Configure::write('GMAP_KEY', 'ABQIAA…qcPrtZgKHQ');
  3. else
  4.     Configure::write('GMAP_KEY', 'ABQIAB…e6qfWeeY8Q');

However, when baking a model, the database file only defines two types: prog and test so you pick one and end up with a model file with a line like:

  1. var $useDbConfig = 'test';

in your baked model that doesn’t cause any problems right up until upload it to your live server late one night and start getting errors about being unable to make a connection- guess who did that?

The solution is simple: just define a default

  1. var $default;

somewhere in the file, now when you bake cake will give you the option of using the default connection which won’t add any problem-causing $useDbConfig to your model.

Hope this saves someone 20 minutes :)

December ‘09 Wrap-Up

This past December we launched 2 new websites serving the Toronto area and a re-launch of an older website.

Toronto-Gym.ca
Launched on December 27th, Toronto-Gym.ca is a directory of gyms, fitness centres and sports and health stores in Toronto and the GTA. A Vancouver version of this site is expected to be launched in early 2010.

TorontoIndustryNetwork.com
Toronto Industry Network is a group of manufacturers and manufacturing associations with operations in the City of Toronto. Collectively the Network employees approximately 35,000 people directly and another 100,000 indirectly through suppliers and customers.

Halifax-Restaurants.com
Halifax-Restaurants.com was re-launched after about a year-long break. This is a sister site to SimcoeDining.com that will be covering more places to eat in Halifax, Nova Scotia in the coming months.

Adding robots meta-tag to a CakePHP view

Here’s a little how-to I discovered a few months ago while I was working on SimcoeDining.com and realized that Google was indexing a whole lot of mostly blank pages.

To solve this, I figured I’d better put a no-index on those pages fast; after mucking around with CakePHP’s html->meta handler (because I wanted the meta tag in the header where it belonged) and not finding anything, I came up with:

  1. $html->meta('robots', null, array('name' => 'robots', 'content' => 'noindex') ,false);

BTW: The pages where empty at the time because there wasn’t a lot of data in the system, so a lot of searches where coming up empty- that’s been “fixed” now too.

Hopefully this saves someone else 20 minutes :)

MySQL’s Order By Field – this time we do it the easy way!

A few years back my company was writing a search engine for a Toronto restaurant directory. The search used tag-words to search for venues. Every time a search was done, venues where assigned a score based on how relevant there where to the tags being searched for. Now after the score was calculated, I ended up with a list of venues ordered by their score.

Now the messy part…
In oder to display these in a list, the venues had to be pulled out and listed in that order; as well, if there was more than 40 venues, they had to be split and displayed on two or more pages. In the end, it turned out the quickest way to write it was to query MySQL for each venue one at a time. Needless-to-say not an optimum solution.

…and the right way- 4 years later
When this came up last summer during the re-write of SimcoeDining.com, I figured there there had to be a proper way of solving that problem, and I found one in Imthiaz’s blog entry:

  1. ORDER BY FIELD(Venues,13,22,42,1,11)

See with MySQL (at least since v5) lets you specify a field and values to sort them by which nicely fits into CakePHP’s Paginator too.

SimcoeDining Re-launch

SimcoeDining.com has been running for 3 months as of October and currently lists about 150 of the best restaurants, bars and clubs in the Simcoe County area which includes Barrie, Orillia and Collingwood.

Originally launched as a directory in 2007, a complete re-write of the site was done over a 2 month period this past summer.

Technical: SimcoeDining is written using the CakePHP framework and uses the jQuery UI library for the client-side.

SitePoint – Better looking with age?

About 4-5 years ago I picked up this book, Deliver First Class Web Sites: 101 Essential Checklists by Melbourne-based SitePoint, billed as a check-list of things a website should have to be successful. Well it was a lot of lists, a lot of the material was useful, unfortunately the book itself looked like it had been typeset in Word and then printed off on a photocopier.

Fortunately I think they realized this too and in the last few years they’ve really improved to the point where the look of their books matches the technical material. In the Canada and the U.S. they have been distributed by O’Reilly publishing since 2004 and I wonder if that had some influence on their more inviting look.?

If you’re interested in web design I’d suggest having a look though some of their recent titles.

Links to Reviews:
http://yyztech.ca/reviews/book/principles-beautiful-web-design
http://yyztech.ca/reviews/book/sexy-web-design
http://yyztech.ca/reviews/book/everything-you-know-about-css-is-wrong

review of Mafiaboy: How I cracked the Internet

It’s the story about a young teenager in the West Island of Montreal who hacked website like Yahoo, CNN, eBay, Dell and others in year 2000. The book follows Michael Calce’s involvement in hacking, from his early adventures on AOL, launching the attacks on Yahoo, CNN and eBay in 1999 to the resulting investigation, trial and sentencing that followed. The second part of the book covers a bit of his life afterwards but is mostly on how hacking has changed since his Mafiaboy days and ways for users to protect themselves online.

http://yyztech.ca/reviews/book/mafiaboy-how-cracked-internet-why-still-broken