Archive for the ‘Tools’ Category

Getting XML data into Symfony, automatically.

Tuesday, November 3rd, 2009

The problem

We have a complex XML file with many different node types, etc. supplied by a third party via a URL reference.
There’s an initial dump, and then an incremental update every couple of weeks, with additions, deletions and updates.

What I’d like to be able to do is to drive a symfony app with this data.

Some thoughts so far

I’m a symfony noob.

Getting the data

I could manually transform the XML into YAML to create the schema and the initial data load, and then build the app. But I don’t want to have to do this manually for the regular updates. Ideally, I’d like to use the symfony ORM to handle all the transactions, rather than a completely separate (outside symfony) script.

… and some images

The XML also contains URIs for remotely hosted images, and I’d like to be able to automagically pull these down to the local app file system and rewrite the references.

Anything that will help us to get started in the right direction would be greatly appreciated.

Google Chrome

Tuesday, September 2nd, 2008

Google have today released their new web browser, Google Chrome, in beta.

Man is it fast!!!! I’ve been using it this evening and it really flies. While it supposedly uses more memory than other browsers, this use of extra memory is due to the fact that it spawns a new process for each tab, so if, for example, some nasty JavaScript on a particular page decides to strangle your browser, justthat one tab will be affected. And this also alledgedly prevents the memory leaks that plague other browsers.

It’s only available to Windows XP/Vista users at this stage; I’m eagerly awaiting the Mac version.

Any, back to some awesome browsing…

Goodbye .clearfix, old friend.

Thursday, July 17th, 2008

You all know the old ‘floated elements inside a container cause the container to collapse’ problem?

Well, up until recently, I’d always just called on an old friend, .clearfix, and he’d sorted it out for me. I met .clearfix three or four years ago, and hardly a project has gone by since where I haven’t required his services. You know, I didn’t really ask him how he did it; he’d just quietly go about his job as I directed him, much like Michael Clayton, but without the gambling problem.

But yesterday, when I asked him to help out a colleague for me, little did I know I’d given him his last assignment.

Something happened early this morning – completely coincidentally. A little bird (or rather a tweet) came by and told me that, despite the fact Blueprint CSS uses .clearfix, .clearfix was no longer the way to go. And to be honest, it was almost a relief; the reason I’d never really asked .clearfix how he did his work was that deep down I knew that he was really a hack, and that if I just turned a blind (or ignorant) eye, then I could just pretend like everything was okay and we could all just carry on getting work done.

.clearfix is indeed inelegant, and really is a hack. And would you believe that the alternative solution is not so tricky…
Using overflow: auto; (or overflow: hidden;) on the container with a width will sort it all out for you.
Rather than explain it all here, I’ll just link to a few articles that have already put further effort into describing this:

So, farewell, .clearfix, you’ve served us well.
…and thank you, MB, for the enlightenment.

Does developing in .aspx produce bloated code?

Friday, July 4th, 2008

This started out as a comment in response to Robbie’s question on my previous post, but thought I’d turn it into another post:

So is it that they are written in aspx which makes them bloated?.

Well, I guess that’s what I’m kinda implying.

Building in the .NET framework with the Visual Studio IDE tends to mean that lots of components and snippets are provided for you. So by default you get things like having all your page content wrapped in a <form> element and you get the lovely __VIEWSTATE hidden input field and stuff like that.

I think that there can be a tendency amongst back-end developers, i.e. .NET, Java developers, to produce something that works well technically, and then take the PSDs that the designer gave them and put them on the front, so you’ve got something that looks like it’s supposed to, and works kinda like it’s supposed to, but with the interface between the front- and back-ends being very ugly, slow, and inefficient. Of course this has an often considerable negative effect for the end user.

While this may be a generalisation, I’ve experienced it first-hand, with developers who struggle to understand, or at least show some care, about good clean lightweight, semantic front-end code that performs well in the browser.
When you’re developing with .NET in an IDE like Visual Studio, you have to put in a bit more effort to get that good code.

Developing in .NET doesn’t necessarily produce bloated code, but I think if you took a look at the average .NET (.aspx) site, I think you’ll find greater code-bloat than in your average hand-crafted-in-TextMate code.

Web site performance

Thursday, July 3rd, 2008

Last week I read Steve Souders’ High Performance Web Sites. While I already have a fairly good understanding of site performance, having completed a fairly extensive performance analysis of tvnz.co.nz a few years ago and being familiar with Yahoo!’s YSlow plug-in for Joe Hewitt’s Firebug plug-in for Firefox, it was good to get into a bit more detail.

But lately, I’ve come across a few sites that have made me cringe; a colleague pointed out a couple of Swiss ones: migros.ch, and gate24.ch, and I came across the new upandgo.co.nz site on newsites.co.nz.

Let’s look at some stats, with vodafone.co.nz (my old gig) thrown into the mix:

Site YSlow score HTTP requests
(unprimed cache)
Size
(kB, unprimed cache)
Size
(kB, primed cache)
gate24.ch F (40) 55 501 49
migros.ch F (39) 85 996 134
upandgo.co.nz F (35) 77 748 284
vodafone.co.nz B (88) 41 195 23

The first three sites are ASPX sites, with bloated, invalid, (W3C) table-based markup, and what appears to be no performance tuning whatsoever. Sure, they are visually heavier than vodafone.co.nz, but being visually heavier doesn’t necessarily equate to looking better, and more often the end-user benefits of the visual components are offset by the performance overhead they introduce.

So, if you’re a web developer and you don’t use, or know of, Firebug and YSlow, stop what you’re doing right now and get familiar with them. Chris Pederick’s Web Developer toolbar for Firefox is also invaluable.

Learn about ETags, far future Expires headers, gzip, script placement, semantic markup, reducing the number of HTTP requests.

These are all vital factors in presenting a great website.
Figure out what you can do to make your site lighter, faster, and more search engine-friendly.

Download Day: Firefox 3

Wednesday, June 18th, 2008

Need I say more? Go and get it!

The Mac arrived yesterday…

Thursday, June 5th, 2008

…and so, as is obligatory, here are the unboxing pictures:

I thought Wordpress made thumbnails, but I can’t seem to get it to work, so you’ll have to make do with the list of links.

A MacBook Pro

Thursday, May 29th, 2008

I’m still doing it all holiday-like here in Switzerland.
I try to make time to leaf through the usual blogs, but I’m really starting to hanker for a bit of work, which is good, because I start my new job on Monday.

And yesterday, my employer very kindly ordered my work machine of choice: a 15″ Apple MacBook Pro (with 4GB RAM and a 7200rpm HDD)

Frameworks. CSS and otherwise.

Monday, November 19th, 2007

Jeff Croft hosts a hornets’ nest of a debate over the use (or not) of frameworks in web development.

It may pay to first read his previous post on this topic. And probably Jeff’s article on frameworks that he wrote for A List Apart.

Analysing your site’s traffic with Crazy Egg

Wednesday, November 7th, 2007

At work, we’re trying to get the most value from our site’s visitor statistics. We’ve been using both Nielsen//NetRatings and Google Analytics for a while now and these tools are great. Just a month or so ago, we added Crazy Egg to our toolbox.

What makes Crazy Egg stand out from our other tools is not that it collects data that the other tools don’t, but rather how the collected data is presented and visualised.

With the volume of traffic we get to our site, we just run Crazy Egg for a couple of hours on a particular page, and can immediately see areas of the page that can be improved; e.g. we can see that many users are clicking a particular image that has no link. So we put an appropriate link on that image, and save our visitors some frustration/confusion and we save them a click.

It’s also quite interesting to note that across the board, people don’t mind scrolling. You can see where people of particular window-sizes clicked. Plenty of small-window users were using the links in our footer; they had to scroll down to see it.

Crazy Egg is free to use on up to 4 pages and for 5000 visits per month. We used the free plan while we trialed it, but have been convinced of its value, and so have since upgraded.