Apples and PEARs

I’ve finally decided that PEAR is a good thing. For those unfamiliar with it it’s a little like CPAN for Perl. For those unfamiliar with that it’s a repository of high quality PHP code, covering everything from benchmarking and debugging to database abstraction.

I’m about to dive back into PHP after a minor break playing with mainly client side toys, and with my work now mainly on the markup/styles and planning side of things PHP is a nice break. PHP isn’t the devil as far as I’m concerned, and I think now I’ve grown up PEAR is part of the non devil like side to PHP – the professional side if you will.

I like PHP for it’s flexibility. The same problems this causes in terms of it being easy to write poor, unmaintainable code are the same boons in brings if you use it nicely. I dont want static typing, on occasion being able to get down and dirty with procedural code is handy and with so much good code out there in places like PEAR it’s often very quick to put together something from existing parts.

I even went as far as getting a book, PHP Tools to have a good going through. I’ve been on something of a mad web design book shopping spree of late, so I’ll try do a quick round up of books soon as well.

Anyone else have much playtime with PEAR, or similar code repositories?

PS. Apologies for the two week hiatus. I’m something of a busy person at the moment. More quality posts as soon as possible. Promise.

keyboards and web applications

Web applications are still evolving. This we know. One thing any power user tends to pick up on pretty quickly in desktop applications is the keyboard shortcuts. We just cant get enought of them. Why dont we see them more in web applications? Well a couple of reasons as it happens:

  • Potential clashes with browser or OS shortcuts
  • Many web applications are still evolving from more promotional websites. The learning curve for a website needs to be instantaneous, otherwise your potential customer just left. But what about a web application? The users may have to use it, as well as having documentation and maybe even training.
  • Because we dont see them in web applications? The circular argument.

Personally I think in some cases keyboard shortcuts would be nice, I have a little plan for something in mind as well so started experimenting. The clash issue I’m going to leave for another post as it will take a bit of brute force experimenting but I did start playing with a simple way of assigning functions to keys.

The following code creates an object to store the lookup/hash/two dimensional array (pick one you like). This is a simple associate between a key, and a function to run when it’s pressed. A function is then assigned to the onkeyup and onkeydown events which monitors them, checks for one of the keys in the lookup to be pressed (in this case along with the ctrl key) and runs the assigned function.

<txp:php> include('/www/htdocs/morethanseven/scripts/sample/keyPress.js'); </txp:php>

A simple library function is used to add the event to the document onload. My library obviously includes other helper functions but we dont need any of those for this example.

<txp:php> include('/www/htdocs/morethanseven/scripts/sample/lib.js'); </txp:php>

Some improvements I can spot from here which I’ll implement as I actually take this out of the lab and into something production like.

  • JSON (or YAML) data storage. Either one makes configuration simpler and scores geek points. It’s a win win.
  • Abstract the use of the ctrl key from the function and allow other modifiers to be set when used.

I’ll try get round to the look at keyboard shortcut clashes, or link to someone who already has, as I get round to it. In the mean time, what do people think about the use of keyboard shortcuts in web applications? Any good or bad examples welcome.

Last Week with Ajax

Last friday I got the chance to stick around in London and attend the Clearleft Ajax workshop with Jeremy Keith. 30 people from different web disciplines and backgrounds trying to get as much out of a single day on the latest buzz word has to sound like fun?

I had heard Jeremy’s speak before at @media last year where he was one of the highlights and friday was much of the same. In a good way. Clear, to the point, explanations. Examples where they help to make a point, some wry humour and the odd culinary simile. The only real let down there was he’s cut his hair short. This tendency for minimalism in hair cuts amongst web designers is disturbing me. Only Norm can save us now.

Back on topic the day covered everything from theory and first principals to some fully working examples, but stuck with playing with Javascript and code from scratch, rather than frameworks and server side stuff. A descision I think really made the day useful.

The morning was, to be fair, less useful from my standpoint. The speed introduction to Javascript, and some of the concepts of Ajax where covering ground I’d already covered personally. That’s not to say they weren’t well placed or interesting though, far from it, and did provide some people with what was probably the best crash course in Javascript imaginable.

The afternoon really kicked into gear though. Lots of examples; from simple updating content through to making use of the Yahoo API. Throw in some examples with server side code, the obligatory shopping basket example and, particularly impressive, a detailed look at JSON. This all in one afternoon remember.

The code examples we got to take away with, and much of this was generic enough to have already found it’s way into my working library. I’m very much a fan of Jeremy’s DIY ethic with regards Javascript. I too am sceptical of using huge frameworks to crack nuts without a clue about what they are doing. The actual simplicity of the Ajax methods I think was one thing that Jeremy got over better than anyone I’ve listened to date. It really is about application design more than new, fancy, complex technology.

A few other people who attended have posted their opinions .I’m really not stalking Molly by the way.

As Molly had hinted, Jermey is also very quotable. So here are a few of the things I’m sure he said, any loss of context here is completely my fault though:

The validator is my friend

What’s the problem? Reality! (refering to IE)

DOM is like a scalpel, innerHTML is like a sledgehammer!

It’s hard to argue with one line of code (on innerHTML vs DOM)

Pointing at Google maps as an example of Ajax is like pointing at a ferari on a race course as an example of the combustion engine. You spend most of your time going wow!

We closed up the afternoon with some discussion of the accessibility concerns, some of the development issues (wireframing ajax apps anyone?) and a whistle stop look at frameworks. All in all a very useful day, both personally (ie. I had fun) and professionally (I think my employer got value for money.) It also reinforced what I’ve been thinking more and more recently. It’s nearly all about design when it comes to real work. When and where and why must come first, and how is often more trivial than you think.

Easy for whom? - a minor rant about help from frameworks

Some people think that programming should be hard while others, like me, quite like the idea of anyone being able to build things, especially web sites. To me the fact that either of my housemates (non IT types) could probably build a website this evening if they so choose is great. And to be honest if they did I’d be unlikely to complain about the code or the programme they chose to build it with (Ok, I would, but that’s me and I’d like to pretend I wouldn’t.)

It’s pretty unlikely however that either of them, or any beginnner, would go along the route of choosing say ASP.NET or Ruby on Rails for that first site. Which leads me to some sort of assumption – that both of these are for experts and professionals. There are other facets which could be used to back up this argument but I dont want to go on – rails making use of the command line (in very cool ways) or ASP.NET requiring IIS configuration for a start. Not something I fancy talking non experts through to be fair.

Using that assumption brings me nicely to helpers. Both are frameworks that try (and in may places succeed) in making life easier for developers. This is a good thing. What’s not so good is where this goes too far, in my opinion. ASP.NET linkButtons are simply Evil. No questions. At All. Stop using them. Now. Rails wades in as well with it’s reliance, when it comes to certain controls, on inline Javascript. Did someone not get the memo?

As good web standards people we have divided content from presentation. Behaviour from both (sort of). Now we have great (in both senses of the word) frameworks coming along and riding roughshod over our labour of love to make the web a better place. Making the developers life easier, but impacting negatively on the end users. Such wide ranging and powerful tools for experts need not treat all users as experts in everything. ASP.NET (or Ruby on Rails) does it so it must be OK? cannot be allowed to undo good works.

Lots of similar talk abounds at the moment, with certainly some light in some of these areas showing through. Visit Dan and Jeremy for more.

end Rant – mmm Rails

One Conference Down

Well, yesterday was the long awaited Carson Summit which seemed to go pretty well all in all. Lots of reviews and notes around at the moment but I’ll just throw a couple of my personal observations into the mix.

The presentation where all good, but nothing mindblowing. Most had something going for them; whether enthusiasm, numbers or a special announcement

I liked Tom Coates diatribe about clean URLs, it something I’m fairly keen on too, I’m uming and arring over whether I too am a URL Fetishist

The Google vs Yahoo show was entertaining and interesting. Reading that Google tend to be more academic with Yahoo being a little bit more unhinged/entreprenurial is one thing – going to a conference where the guy from Google came across as something of a mad german professor with something of an axe to grind, compared to the Yahoo mob who ranged from a self confessed hippy to Cal and his three quarter length trousers. It’s appears all the rumours are true.

I did a couple of stints of SubEthaEdit collaborative note taking with Simon which was fun and interesting at the same time. The who’s going to write the next part bit was quite amusing – at times writing the same things down, then everyone deleting them, then a pause.

The after show was, as always, good fun and fairly drunken. The pub was nice, but whomever suggested it on the wiki was playing a cruel joke. A conference with 800 geeks and a pub about 3 people wide at it’s widest point is not sensible. Neither was Patrick’s suggestion about not eating, but it all worked out in the end.

Was good to meet up with lots of people, both those I had met before and those that I hadn’t. Hope to see everyone again soon, if not it will have to be @media.

Molly in Newcastle

Not so subtle hint in the subject line, but without further ado, Molly (yes, that Molly) is coming to Newcastle for a talk.

All the details are still being confirmed but we are talking:

15th February Room 149 Northumberland Building, Northumbria University, City Campus, Newcastle, NE1 8ST 5-7pm

After talk drinks and food to be confirmed. Probably going to be along the lines of “Webstandards and Usability” with some time for a Q&A session as well.

Big up to Tom Simcox here. He’s been threatening for a while and with Molly in the country she’s agreed to come and visit little old us. Mark (of sunderland uni and NEUA fame) also sorted out the venue, amongst other things. Good job everyone.

We need people along for this so tell you employers, whoop to your colleagues, threaten you employees and be there.

I’ll post more details as they are confirmed. If your from outside the region and want to come along let me know. It’s short notice but sometimes these things are – and you know you dont want to miss out.

To help us gauge interest a little it would be grate if you interested to leave a comment below. If you cant come along because say, it’s your birthday, then what questions would you like asking?

Small Software

Of late I’ve found myself making quite a few smaller purchases of software. I’ve always been a fan of Open Source (and before that shareware – mainly on the ZX Spectrum) and still use lots of open source apps (anyone say Firefox) but for some really specific jobs it’s nice to have something you know is maybe a little more polished.

I dont know if it’s just me getting older and having more disposable income, or a greater appreciation of what it takes to make really good software (probably a bit of both) but it’s sort of snuck up on me? Anyone else finding the same? I know Jon has been mentioning some cool new apps he’s using. What about everyone else?

Recent purchase have included the following, nearly all bought with PayPal as it happens:

  • Airfoil allows any sounds (mainly music) to be send round the house to speakers connected to my AirPort. Lovely.
  • PSPWare Like iSync but for my PSP. Also converts movies.
  • radioShark Ok, software and hardware but useful at times.
  • Mint I’ve mentioned before. Lovely stats.

I’m also evaluating (and at the moment being impressed by) a few other apps. Upcoming purchases probably.

  • QuickNews RSS reader (and podcasting app) for Palm OS.
  • PocketTunes Good quality audio player for Palm OS, much better than the bundled Real Audio.
  • TextMate The missing editor for OS X? Maybe. It’s toying with me at the moment to sit aside SubEthaEdit

On a blog related point, I’m aware I’ve been blogging more technology related stuff of late. I’ll be back with alot more web design and development banter soon, and some things happening up this neck of the woods (including a revamped newcastlenewmedia site hopefully) – it’s a matter of having the ideas but not having the time! Hope it’s still all interesting to everyone.

The Meaning of Scale

I’m quite a numbers person and have something of a penchant for statistics As if you couldn’t guess from the site name. So it is with Google (who also have a mathematical inspired site name). But unlike me they have more people (it’s just me) and lets face it, more computing power (only so many computers I can get in my house without getting told off).

So they bring us something of a large, automated, study (including some decent analysis) of what markup is actually being used, interestingly also including common class names. I’d love to do something like that – over 1,000,000,000 sites analysed!

On a standards front seems to be good news and bad news, some of the common classes are things like:

  • footer
  • menu
  • title, header, top
  • small, smalltext
  • text, content, main, body
  • nav
  • copyright
  • search
  • date

Most of those I can see use for. They Mean something for a start. Although some of the other top entries included things such as:

  • white
  • link
  • button
  • style1 (my personal fave)

Which maybe aren’t as well chosen.

On the other hand there are still lots of weirdness, proprietary tags and bizarre attributes. iWeb might be using crazy nested divs but it’s still valid.

Being Google it’s all written fairly amusingly, including a few digs at competitors with applications which generate nightmare markup. Overall, a good read. There are probably a good number of other useful nuggets of information burried in the document as well. Anyone coming across anything of particular relevance leave a comment.

Meme Warning! Enter at Own Risk

Help! I’m not sure what to do? I appear to have been set upon by nearly published author simon in an attempt to spread a deadly meme. Oh well.

Four jobs I’ve had in my life
  1. Paper Boy
  2. Kitchen Porter
  3. Packager of Shower Fittings
  4. Front End Architect

Four movies I can watch over and over
  1. Black Hawk Down
  2. Serenity
  3. 28 Days Later
  4. Impostor

Four places I have lived
  1. Bradford
  2. Durham
  3. Belmont (not to be confused with Belmarch)
  4. Newcastle

Four TV shows I love to watch
  1. Alias
  2. The Wire
  3. The Shield
  4. The West Wing

Four places I have been on vacation
  1. Cornwall
  2. Rome
  3. France
  4. Denmark (Lego Land)

Four of my favourite dishes
  1. Sausage Casserole with Guinness Gravy
  2. Seabass
  3. Falafel, Spicy Chutney and Chilli Rice
  4. Wild Mushroom and Real Ale Pie

Four websites I visit daily
  1. Google
  2. Newsgator

Four bloggers I am tagging
  1. Steve Woods
  2. Phil Lindsay
  3. Pixeldiva
  4. Lee

Here endeth the lists. I’d be intrigued to see a rather cumbersome tree diagram of this meme thang in action. You know, track it back to it’s source, looking at relationships and all that jazz. But it’s late and I’m tired.

A Foundation to Build Javascript On

Like probably quite a few others I’m doing more Javascript of late, both professionally and at play. It’s not just the whole buzz around it, all the way back to Jeremy using Javascript for Good not Evil but I moved away from doing backend development when I moved jobs, Javascript is most definately in my client side job remit.

As an avid reader I’ve got hold of a few good quality Javascript books that have come along and was on the lookout for more when I came upon Foundations of AJAX from Apress’s black and yellow experts voice series. I haven’t read enough to give a full conclusion but I’ve been impressed with other books in the series and it looks promising so far. A few chapters did stand out (I jumped in and read them first) that had little to do with AJAX, concentrating instead on setting up a proper Javascript development environment.

I’m not a fan of bloated IDEs so the lack of one for Javascript doesn’t bother me as much as it does some. However debugging by browser is a pain for simple scripts, never mind larger applications. Firefox’s Javascript Console is mighty handy here, as is the DOM inspector and the view rendered source extension. There is also the Windows Script Debugger but I personally haven’t had much luck with that as yet.

Projects should have documentation and code should have comments. But it’s time consuming (honestly). Automatic generation of docs from source comments both makes you comment more efficiently and comprehensively and saves time. Everyone’s happy, at least as long as they are using the JSDoc perl application to do just that. Anyone familiar with Java will have come across JDoc and the name isn’t the only similarity. It’s now installed and ready to be used next time I write any Javascript.

Another area of interest recently has been application design, analysis and methodology, so I’d come across the idea of test driven development before and experimented briefly – but not with Javascript. The idea is that you write tests that can be run automatically on your finished code before you write the code, it makes you design more which cant be a bad think. Anyway, Javascript has JSUnit, a nice unit testing framework. Again, installed and ready to give it a whirl.

Hopefully this brief list will prove useful to anyone else making more use of Javascript recently and looking to be more productive. Anyone else with any other useful tools do post a comment, or is their a mythical application that you just wish existed to help you with your Javascript woes?