CakePHP Expandable Behaviour Tip

When YYZtech was being updated to use the VSS (Venue Storage System) from the previous system, it became clear that VSS needed to be updated as well. One of the original goals of VSS was that it could be a directory system for different kinds of things as long as they where physical venues of some kind and so they had certain properties like an actual address, hours they open to the public, etc.

As part of that, a way of storing “meta” information was needed, that is information that was unique to a venue or type of venue that not all would have, much like WordPress lets additional information about a post be stored in a separate table which makes, say, adding an ISBN number field to book reviews easy.

After rolling our own for several projects, Felix Geisendörfer’s Expandable behaviour was chosen because it was simple to set-up and use and it just worked. Hopefully CakePHP at some point includes a similar functionality as an “official” add on much like virtual fields was added in CakePHP 1.3

Which leads to a “gotcha”….
One issue combining virtual fields and the Expandable behaviour is that virtual fields can end up being interpreted as new fields by Expandable and Expandable then saving them. What’s worse, is that when the table entry is loaded, the virtual field and field from Expandable are combined with one overwriting the other.

This particular behaviour happened when we added a way of cloning venues, removing and replacing certain information along the way. The reason for this would be adding a chain store location; the address and phone number would change but the description or products sold probably wouldn’t. Now the table that stored the venues had a virtual field, full_name, that contained the name and sub-name of a venue (e.g. “Joe’s Bar”, “and Delicatessen” as “Joe’s Bar and Delicatessen”) which Expandable saw as a new field and saved the virtual field to its table and led to about 20 minutes trying to figure out if there was some kind of weird caching issue going on.

Anyways, the fix was to turn off the virtual fields like so:
$this->Venue->virtualFields = false;

…and that was the end of that problem.

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

Targeted Ads?

Just checking in on YYZtech.ca this evening and noticed a whole lot of ads for the Sex And The City movie coming out this week. Now I’m guessing they where targeting city-specific sites, otherwise, I can’t figure out how we ended up with these ads? Just one of those strange things.Sex in The City AdSense ads on YYZtech.ca

Google App Hacks: Turn your Spreadheet into a CMS system

Besides that hack there’s a whole lot more on gMail and rest of the Google eco-system (Blogger, YouTube, etc.)

One of the new style O’Rielly Hack books, this one looks at how to use Google’s applications through a series of short examples (aka hacks) covering, not just the office applications, but many other applications under the Google banner. For web designers, there’s a lot of material here too on how to integrate Google’s services into your own website.

read more | digg story

New kind of spam bot

While checking out the forums on YYZtech.ca for spam, I noticed something new and kind of interesting. I wasn’t sure if it was spam untill I looked at the address, but for a second or two it fooled-me, the bot had taken a short quote (or just the fist word – there where several posts from the same bot) and worked it into a question, so at a quick glance it looked like just part of the normal forum thread – sneaky :)