What I learnt at Web Directions South 08

First off, thank to WA government for having the foresight for ignoring the actual birthday of the Queen and making today a public holiday - my couch has been-a callin’. So what has been happening over the past couple of days?

Day 0

After getting in early morning on the Wednesday, I toddled along to Stories for one of their famous egg and bacon rolls with Simon, Lachlan and Nick.  Oh how I’ve waited for that. I could have gone home at this point a happy man, but then there was work to do! Spending the day tweaking my presentation, next it was up to the Kirk for memories of last year (Yes, they still only have five pint glasses) and then on to Port80 Sydney: Wednesday edition. We had a fantastic turnout, with over 80 people - most of which were new faces. Big ups to Clever starfish, radharc and Saasu.com for throwing dollars on the bar. I’m seeing a definate pattern here in regards to free beer.

Day 1

Waking up slightly hung over, I was off to the registration desk, and then the games began. Highlights for me was Dmitry Baranovskiy’s web vector graphics  talk. I’m about to go download raphael and build some stuff - not only if the guy a genius, but his talks are hilarious. Unfortunately, I missed the JavaScript workshop, where I hear Cameron Adams wowed the crowds with a JavaScript drum machine - with visualizations. The final keynote from August de los Reyes tied software and psycology together, something that I think is the crux of what we do. It was also a great talk, although the ads were a little too much to take.

What I learnt:

  • Seeing cool stuff is inspiring.
  • When giving a presentation, find out about the audience - it’s better to pitch a bit to high than to low.
  • Don’t try to squeeze in 2 hours of material into 55 minutes

Day 1.2

Next up was WebJam8. The one big disappointment of this trip is that I didn’t get something entered in WebJam, but having a Web Directions talk to do and a stupid amount of work took priority… Some really cool stuff was shown: Dmitry came third with a live code, that added reflections and animation to images on a web page, Diana came second with a crazy funny fast presentation about governments and bike helmets and the winners, Mr Speaker and Henry Tapia did a awesome YouTube remixer. In a moment of unlike-me-ness, I wentback to the hotel at a reasonable hour…

Day 2

…and for the first time EVER made it to the first session of the second day! So no one can joke that I missed the best talk of the conference (as happened the past couple of years) and I wasn’t dissapointed. Jeffrey Veen is a brilliant speaker, and I wanted to pull my laptop out right there and then and cut some code. This is the sort of stuff that makes these conferences. After lunch, I gave my presentation on OpenID, OAuth and webservices (Available on slideshare here), and I think it went pretty well. The backchannel was only positive, so I count that as a win. Next I headed over to Douglas Crockford for a good old fashioned Computer Science lecture, god that takes me back! Whilst a little dry, and technical (Who am I kidding - I wanted that) it generated some great discussion.

What I learnt:

  • Great talks bring in personal experience
  • You need to get the audience to think
  • Dual monitor Powerpoint never works properly when you need it to

Closing night

With all of the festivities over, it was time to let the hair down at the Shellbourne, for a quick shandy.  Had a debate about designers vs UX experts (We were actually arguing the same point, it turns out), and had many an indepth conversation, including one with Charles from Opera, about webservice brokering. So much so, my plans to build one may now be possible (Huzzah!).

What I learnt:

  • Finding random “locals” to go out with doesn’t mean they know where they are going
  • Peanuts 2u is actually a brand of salted almonds
  • There is a “No redheads” policy in NSW pubs
  • Bats are weird and scary

So that was my Web Directions experience in a nutshell! Roll on Edge of the Web - only five weeks until we get to do it all over again!

Have a happy and safe conference season

We are about to head into my favourite times of the year - Australian web conference season! Ausralia’s biggest web conference - Web Directions South - is due to kick off on Thursday, and as usual the Perth Posse (sans Adrian and Rose) and heading over. There is even a few n00bs who have joined the clan, making for this years Port80 Sydney even bigger! As previously mentioned, I’m lucky enough to be speaking on OpenID, OAuth and Webservices on Friday. Not to mention always amazing WebJam 8 on Thursday night (Unfortunately a lack of rips in the time-space continuum has stopped me from presenting in that this year - I petition for a 30 hour day - whos with me?) and the always crazy post-conference drinks on the Friday. Let the games begin.

BUT! We can’t let the east coast have all the fun - don’t forget that Perth first major web conference is  happening in less than 6 weeks! Our little sub-committee has been toiling away for the past few months organising the very first Edge of the Web conference and fourth WA Web Awards. Tickets are on sale now for both events, being held on November 6 and 7. There are some awesome speakers coming from overseas and over-east. There is also a number of other soon-to-be announced activities, so what this space.

Excited?

Abusing JavaScript for fun and profit: Redux

The fine lads at Sitepoint have just just notified me that part I of my article outlining my JavaScript Mario Brothers game is up on the front page. This part goes through the JavaScript and CSS techniques I used - it’s a bit theoretical, but if you are a frontend developer and want to get a better understanding of how to use JavaScript classes, go and check it out.

The next part will get into some game
theory (not that I’m really an authority on that) but it really was a fun experiment.

A room with a view

Whilst not being one to make gross generalisations (heh!) I like to think there are two schools thoughts on databases - those that use “extended” features such as triggers, views and temporary tables, and those that don’t. I, for one fall firmly in the latter - usually.

However over the past few days a major project that I’ve been working on brought forth a requirement for some hardcore reporting. Due to the database structure that was required (there was a lot of dynamic fields and association tables) doing it in ActiveRecord was near impossible - in fact, doing it in native SQL was equally painful.

Quite jokingly, MySQL views were suggested, but then in a cold flash back to my days working in Government environments, reminded me that DBAs used views for this stuff all the time, so time to investigate.

The idea is pretty simple: a view is a virtual table that is based on a SQL query that you can run queries against, which means you can easily flatten associated tables and turn complex search queries into simple ones. Example…

Say you have a structure that looks something like this:

Database example

(Excuse the diagram - My windows laptop is in the other room and the graphics editors in Linux are balls)

So as you could imagine, you may have companies that have many projects which in turn have many shifts. Who would you calculate all the shifts from a particular company? You would probably end up with something like this:


SELECT shifts.id, shifts.start, shifts.end FROM shifts INNER JOIN projects ON shifts.project_id = projects.id INNER JOIN companies ON projects.company_id = company.id WHERE company_id = 4

Which, whilst fairly simple, is a pain to write - and it can only get worse if the data model becomes more complex. This is where views make life so much easier. By creating a view using a simple query:


CREATE OR REPLACE VIEW shift_reports AS SELECT company.id AS company_id, company.name AS company_name, project.id AS project_id, projects.name AS project_name, shifts.id AS shift_id, shifts.start AS shift_start, shifts.end AS shift_end FROM shifts INNER JOIN projects ON shifts.project_id = projects.id INNER JOIN companies ON projects.company_id = company.id

we now have a virtual table called shift_reports with columns: company_id, company_name, project_id, project_name, shift_id, shift_start and shift_end ehic you can query just like any other table. (I am aware that the query is much longer than the one we are trying to replace, but you only do it once per database, and the example is contrived - humour me). An example query would be: SELECT * FROM shifts_reports WHERE company_id = 4 - much cleaner! Where this becomes even cleaner is if you are trying to link this up to a search form - everything matches up with a much bigger bow (especially if you are using a framework like Rails).

Whilst on the topic of frameworks (like Rails) - because it is exposed as a regular table, you can point ActiveRecord at it - just create a corresponding model and find until your heart is content, just don’t try to modify the records, as it will fail miserably (views are read-only).

So next time a client asks you to create an impossible report, your cold sweat may be slightly less shiver-inducing…