6

S
e
p
t
e
m
b
e
r

2
0
0
6

Traversing the DOM

Justin Palmer writes about a forthcoming update of Prototype, which will include sensible (read: easy) ways of wandering around the Document Object Model. Grab an Element with the usual $ operator, then do any of the following:

  • up
  • down
  • previous
  • next

These support tag names and offset parameters so you can be even more specific. But there’s more:

  • descendants
  • previousSiblings
  • ancestors
  • siblings
2
8

A
u
g
u
s
t

2
0
0
6

Agile Refactoring

Just realised one positive side-effect of Agile Development: you can develop stuff safe in the knowledge that at some point in the future (possibly, near-future), you can, will and want to refactor.

That’s completely different to refactoring in other types of development, which requires much greater expenditure of effort and has considerable inertia associated with it.

Furthermore, refactoring during Agile Development actually exposes opportunities for introducing new features that meet or exceed users’ expectations.

2
7

A
u
g
u
s
t

2
0
0
6

Ajax Properly

Approximately 6 months ago, I developed a feature for one of our websites enabling one-click downloads of Microsoft Word mail merge documents, automatically hooked into the results of a database query. To do this seamlessly, I used Ajax, and built the feature using a PHP Ajax library called cpaint.

It ended up being a bit nerve-wracking to develop, and frankly a little bit difficult to understand. However it does work.

Since then, we’ve discovered three essential Javascript libraries which help build interactive websites:

The last of these includes Ajax support, including in-place editing (should you need it). Over the past couple of days I’ve worked on a dashboard view for the aforementioned website. The dashboard provides users with a one page summary of everything that’s important to know.

These libraries have made the development so much quicker, and easier to understand. During this weekend I added another component to the dashboard which provides up-to-date sales summaries for a week, including in place editing for additional sales figures. However, rather than use the in place editing feature provided by Scriptaculous, I wrote my own because I needed particular control over how it behaved, and how it affected other parts of the page.

That’s not all though. One huge benefit was provided by the essential Firebug Firefox add-on, which includes diagnostic support for XMLHTTPRequests (the cornerstone of Ajax).

All of this makes developing interactive web applications so much easier, and indeed a pleasure.

2
2

A
u
g
u
s
t

2
0
0
6

Deployment

Yesterday, and today (so far), Last.fm appears to be ill in certain areas: the overall charts have disappeared from user’s profiles and the weekly charts aren’t being generated. Given that one of the primary aims of the website is to enable social networking through common musical tastes, this is a significant problem.

I’ll admit that we don’t have 20 remote servers that we work on. But we do install software to machines remotely.

For Ruby on Rails development, we have our own deployment tools. For PHP deployment we have a repeatable procedure that ensures that remote installations are predictable and reliable. We do three other things too:

  • We ensure that changes work prior to deployment;
  • We ensure that downtime is minimal and that it only occurs when absolutely necessary. If this means programmatically ensuring seamless transitions, we’ll do this rather than take a site down;
  • We ensure that changes work after deployment, rolling back if necessary.
2
0

A
u
g
u
s
t

2
0
0
6

I wonder why

When we set up Junctionbox Media as a limited company in 2001, we approached our Local Enterprise Company for funding. At that time we discovered two things:

  • That they were useless, and,
  • Funding technology companies was not a priority.

It’s with some amusement that I read today that only 60% of production and manufacturing companies have websites and that Charlie Stewart, head of e-business at Scottish Enterprise said: “Many firms do not seem to be making the best use of the possibilities that e-business and the internet have to offer.”

2
0

A
u
g
u
s
t

2
0
0
6

The downgrading upgrade

We’ve just finished retiring our old Apple Macintosh equipment. An eMac and elderly Dual 1.42GHz G4 PowerMac are now surplus to requirements. When it was released about four years ago, the PowerMac was the most powerful Macintosh you could buy. I think it cost about £2.3K.

Such is the improvement in technology, that we’ve replaced both of these Macs with lowest specification MacBooks. To these we’ve upped their RAM to 2GBytes (because you can never have too little memory) and their hard disks are now 7200 RPM 100GByte drives. With some other bits and pieces, total cost came to about £1K each (including VAT).

The migration from the PowerMac to my MacBook was an interesting experience, so I thought I’d write about it, and make some subjective judgements on the differences.

Upgrading the MacBook

Every generation of Mac and PC equipment seems to have better accessibility to user-servicable parts. The MacBook is no different. Replacing the memory or the hard disk is fairly trivial, provided you have the right cross-headed and Torx screwdrivers. Indeed, it can only take about 10 minutes to replace both. The most difficult part is persuading the memory shielding to get back into place, where a flat-head screwdriver or fruit knife comes in handy.

Installing Mac OS X

This was going to be a MacBook that didn’t need many of the iLife packages or trial software installations. Apple provides the option for a customized installation, allowing you to select which applications to install.

Once Mac OS X was up and running – in about 25 minutes – I then installed some additional packages that provided me with developer’s tools: Xcode and the X11 SDK.

Migration

Apple also provides a Migration Assistant which enables you to connect your old Mac to your new Mac via a Firewire cable. It then pulls all of the applications, documents and settings from one to the other.

However, it doesn’t work if your home directory on your old Mac isn’t where Apple puts it. So, although it brought across the applications, nothing else made it. It’s not a great problem because all you need to do is:

  • create a root user on the new Mac
  • login as that user
  • delete everything below the home directory that the Migration Assistant created
  • copy the equivalent contents from the old Mac to the new Mac
  • chown these to the user of that home directory:
    chown -R chris /Users/chris

You might think that Apple should make this easier. But, if you know how to move a user’s home directory away from where Apple puts it, you should certainly know how and why to do the above. Bottom line: if everything is where Apple expects it, there’s shouldn’t be a problem.

After I moved everything across, I logged out of root, and back in as my user account. Everything was there as I had expected (and hoped!). It was just like being back on my old Mac.

Going Universal

The entire Apple Macintosh range is now Intel-based. Their predecessors were all PowerPC-based. The lowest specification MacBook runs on a 1.83GHz Intel Core Duo – that’s two processors.

Applications built for PowerPC processors don’t run on Intel. There are two solutions:

  • To upgrade the applications with versions that are built for Intel. Apple calls these Universal applications, because they contain two versions: one for PowerPC and the other for Intel. Indeed, Apple’s free software development kit provides one-click building for Universal applications.
  • To keep running the PowerPC-based applications. Really! Apple distributes a technology called Rosetta which provides dynamic translation of PowerPC code into Intel code. It really works.

I therefore went through all of my installed applications, downloading versions with Universal builds. It was also a good opportunity to identify those applications that I no longer used and could therefore discard.

I then launched many of the applications to discover which needed re-registering. The now-defunct You Synchronize needed re-registering and the Macromedia Studio MX 2004 software (all PowerPC applications) needed re-activating. Nothing else did.

I did have an issue with Apple Mail, which refused to do full message searches on old messages. I needed to delete and rebuild Spotlight’s metadata stores by using mdutil.

DarwinPorts and other web development tools

DarwinPorts is our main repository for web development tools. Rather than scouting around websites for the tools we use, DarwinPorts provides access to over 3,400 open source software packages. (Note: DarwinPorts has recently been renamed MacPorts).

One of the consequences of moving from PowerPC to Intel processors is that no previously installed DarwinPorts software will work. DarwinPorts installs everything in /opt, so I needed to delete that directory and rebuild all ports that I use.

We have a corporate wiki that is used to record our notes on installation of software. As a result we have two pages of notes that enable us to install everything we need in a predictable, reliable manner. This means Apache 2, PHP 4, MySQL 4, Ruby on Rails, Ruby gems etc. Everything installed smoothly and very quickly.

Performance

Based on my early experience, PowerPC applications run marginally slower on the MacBook than they did on the Dual G4 PowerMac. But the important point is that they all work.

Native, or Universal applications are significantly faster. MarsEdit Live Preview now works, and doesn’t slow down my typing. The Java-based jEdit is blisteringly quick and searching is incredibly fast.

Graphics appear a little below par in some areas – Exposé and Dashboard reveals are marginally more jerky compared to the G4.

Introducing Parallels

As web designers, it is important that we test websites on Internet Explorer on PCs. Prior to our MacBooks we had a desperately inadequate Dell Laptop, which we used as little as possible.

Parallels provide virtualisation software which enables Intel-based operating systems to be run inside a window on Mac OS X. This isn’t the same as emulation. This is the real deal. With Parallels Desktop it’s possible to have Windows XP, and many other operating systems running a MacBook.

I installed Windows XP on Parallels Desktop. The performance improvement over the Dell was staggering, even with just 256MBytes of RAM allocated. After installation, I activated Windows XP, and then downloaded all of the numerous windows updates. Parallels also provide a set of PC-based tools which enables Macintosh peripherals to work seamlessly with Windows XP.

So, I now had an installation of Windows XP with Internet Explorer 6. But how to get Internet Explorer 7? The beta version doesn’t play nicely with Internet Explorer 6. The solution was to clone my first Windows XP installation, and then install Internet Explorer 7 on the copy. (Mark’s tip!) This progressed satisfactorily despite the IE7 installer announcing that it needed 10GBytes of hard disk space.

I now had two installations of Windows XP running on my MacBook at the same time. Fiddling with their host files enabled me to browse websites running on the MacBook, thus making the whole setup an ideal platform for developing websites.

Conclusion

Upgrading from the Dual G4 to the MacBook went fairly smoothly. There is a notable performance improvement for Universal applications. Everything else is marginally different. But, from a web developer viewpoint, the ability to run other operating systems simultaneously whilst still running Mac OS X is the most compelling reason for upgrading.

4

A
u
g
u
s
t

2
0
0
6

Stating the Obvious, Obviously

Noisy Decent Graphics points to the blog of Peschke, a printing company. Their blog demonstrates why every company should have a blog. (And, yes, we still can’t persuade any of our clients to start a blog – instead they resort to news items, printed documents, PDFs etc.)

One of Peschke’s posts includes some thoughts on being ‘creative’ that can easily be applied to all businesses, including some ‘simple facts’. Taking these, and abridging one of them slightly, here’s some facts about us:

  • We know cool stuff you don’t
  • That cool stuff can make your ideas even better
  • We have ideas too
2

A
u
g
u
s
t

2
0
0
6

Eggs and Baskets

Recently we ordered some items from dabs.com for part of our IT upgrade at our business. Later we decided to purchase some equipment, prior to the despatch of our original order. However, dabs doesn’t allow you to add to an existing order. Instead you have to add items to your new basket, then find the original order and click a button labelled ‘add basket to order’. Which is non-intuitive. Furthermore, if you are buying a reconditioned item, it cannot under any circumstances be added to an existing order.

Amazon is similarly afflicted. You cannot add to an existing order, instead you have to complete an order then go through a convoluted merge process.

Now time for shameless promotion: One of the sites we’ve recently developed allows customers to create as many simultaneous orders as they like, sending each off for processing when they are ready. Prior to any order being packed, they can pick it up (with one click, and ‘boom!’ it’s the one they’re working with) and add to it, change quantities, delete items, update customisation etc. All with real-time stock control adjustments. Surely that’s a better way of working?

copyright ©2006 and so on, ninthspace.org, except quotations, lyrics and some images which are the rights of their respective holders