SXSW 2005 is Getting Close | February 27, 2005

So SXSW 2005 is only a couple of weeks away and I’m really looking forward to it. Jeremy Keith popped round this afternoon and we quickly ran through our draft talk. I’m sure most of the speakers will be writing their talks on the flight over, but I’m a little too organised (anal) for that.

In the SXSW mood, I spent the rest of the afternoon going over the SXSW site and organising what sessions and events I want to attend. I’ve posted my iCal Calendar online and you can also subscribe to it if you’d like. This is probably only of interest to a handful of people, but what the heck, it’s my site!

I’ve not been to SXSW before, but luckily Ian Lloyd gave me the low-down on our recent Geekend in London. However If you’ve been to Austin before and especially if you’ve been to SXSW before, I’d love to hear your top tips for making the most of my time there. Also, If you’re going this year which talks are you most looking forward to attending and who are you looking forward to meeting up with?

Comments (6)

The no hassle guide to installing PHP and MySQL on OS X 10.3 | February 23, 2005

In preparation for last weekends PHP workshop I decided to set up a development environment on my iMac. It was pretty easy to do and only took about an hour. Since then I’ve had a couple of people ask about developing on OS X so I thought it would be worth going through my process.

Install PHP

Panther (OS X 10.3) comes bundled with PHP 4.3.2 and enabling it is as simple as uncommenting a couple of lines in the Apache configuration file (httpd.conf). However I chose instead to install the PHP5 package supplied by Marc Liyanage which comes with a number of additional libraries. Being a regular OS X installer package, all you need to do is double click the package and follow the on screen instructions.

Once installed, turn web sharing on in the sharing control panel and drop a file containing the following code in your shared folder.

<?php phpinfo(); ?>

Then you can then test your php installation by accessing that file through your browser at http://127.0.0.1/~username/filename

Install mySQL

To install mySQL, grab the latest OS X package and follow the installation instruction. In older versions of OS X you needed to create a mysql user for the program to run under. Luckily 10.3 comes with a mysql user already set up, making installation a bit easier.

The package contains the mySQL installer and also a startup item installer which makes sure mySQL is running when you reboot your computer. With both items installed you need to do a couple of things in the command line to finish off.

First you’ll want to add the path to mysql as an environmental variable, so you won’t have to type the full path out each time. The install instructions explain how to do this in the tsch shell (Jaguars default shell) but to do the same thing in Panthers bash shell, run the following commands.

shell> echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile

Then you’ll want to run mySQL to remove the anonymous user and to set the root password.

shell> mysql -u root
mysql> DELETE FROM mysql.user WHERE User = '';
mysql> FLUSH PRIVILEGES;
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');

For more info see the post installation documentation.

mySQL frontend

If you’re not a hard core command line user you’ll probably want a nice front end to manage mySQL. Most hosts use phpMyAdmin, an easy to install php front end. Simply download the files, move the folder to your shared directory and then edit the config files (phpmyadmin.conf) with your mySQL username, password and path to phpMyAdmin. You can then simply navigate to that folder in your browser to manage mySQL.

Keeping your password as clear text in the config file isn’t very secure, so you’ll probably want to use HTTP authentication instead.

Alternatively if that’s too much messing around for you, try CocoaMySQL instead. It’s a really nice freeware mysql administration application which allows you to manage all your mySQL databases, both local and remote.

Apparently there is a problem connecting to MySQL 4.1 with CocoaMySQL because of a change in encryption mechanisms. However there is a simple fix for this.

Apache configuration

Lastly it’s really handy to set up Virtual Hosts in Apache. This allows you to access your sites directly via a virtual hostname or port number e.g.

http://mysite
http://127.0.0.1:8080

instead of via your home directory

http://127.0.0.1/~username/sitename.

This makes developing a little easier as you can use absolute rather than relative urls in your html, css etc so you won’t have to change paths when you move your files to the live server. There are a number of ways to do this, so have a look at theses articles and the resulting comments for more info.

Comments (13)

PHP Workshop | February 21, 2005

Saturdays PHP workshop in London was lots of fun. Getting there was a hassle as the trains were out part of the way, necessitating a long and uncomfortable replacement bus service. However I still managed to get there in enough time to grab breakfast at traditional Italian coffee shop just around the corner.

The workshop was held in Oyster Partners large–and somewhat college like–canteen area. Working for a “boutique” web design agency, it’s easy to assume that most companies are small. However despite the fact that 70% of web design companies in the UK have less than 10 staff members, a number of large agencies did survive the dot com era.

While I know the basics of PHP and understand many of the more advanced concepts, I’m no PHP expert. I liken myself to somebody learning a language in the sense that I can understand far more than I can actually say. I can look at a class and pretty much understand how it works. However ask me to build something similar from scratch and I’d be lost.

The main problem I have with PHP is how to actually string things together. I can build simple application, but they always end up being a little haphazard. The code is never as lean as I want it to be and my file structure is always a little random. So I’m constantly dissatisfied with my coding. Going back to the language analogy, I’m capable of ordering food and finding my way to the station, but if I tried to write a book it would be all over the place.

My dissatisfaction is down to a couple of things. Firstly I’m a perfectionist and want to do everything the best way possible. On it’s own this is laudable. However I’m also fairly impatient, so want to be getting everything right first time. I’m capable of figuring out most logical problems. However it’s the conceptual ones–like the most efficient way to architect your application– that can only be learnt over time. So one of the main things I wanted to get from this workshop was a better understanding of the more conceptual elements of PHP programming.

The workshop was essentially divided into two parts. The first part was lead by Chris Lea, who did an excellent job in walking through the basic concepts of PHP application development. I have to admit that I actually new most of this stuff–which came as a bit of a surprise–but it’s always good to have your beliefs validated by an expert.

The second part of the day was lead by Mike Buzzard, who created a simple PHP framework and tempting engine especially for the workshop. This part of the talk got a little bogged down in the framework specifics for my liking. However what really got me was the usefulness of having a framework in place– be it your own or one of many existing ones.

I realise that I’m never going to be a hard core PHP guru which is why I’ve recently been wondering if I’d be more productive using another language. This was prompted by seeing a demo of Ruby on Rails

However I now think the best approach (for me) would be to make use of various PHP projects such as PEAR and Smarty along with a simple framework. I understand the associated problems and restrictions, but in my defence I’m a front end designer/developer who needs to do the odd bit of coding, rather than somebody wanting to become a hard core programmer. I just don’t have the patience for that!

So on the whole I found the workshop useful from a conceptual level as it helped me solidify how I feel about PHP.

Afterwards everybody headed down the pub for drinks and a chat. Both Chris and Mike looked shattered from the day and the jet lag, and it was unfortunate that I didn’t get much of a chance to chat to them. However I did meet up with some cool people, including 2 people from Brighton and two people who read my blog. Apart from the learning angle, the other important part of these events is the social angle. so it was great to meet, chat and share war stories with other developers.

All in all, a thoroughly enjoyable day.

Comments (13)

Life Just Got a Little More Random | February 17, 2005

ipod shuffle

So while I was up in London over the weekend, I decided to treat myself to an iPod Shuffle. I’ve wanted a proper iPod for some time now, but could never justify the expense. The power of the iPod lies in the ability to carry your whole music collection around, allowing you to listen to what you want, when you want. They’d be a great gadget to take travelling, and my girlfriend used hers everyday when commuting to London. However with a 5 minute walk to work, an iPod would be wasted on me.

I’ve always thought it would be handy to have a little portable music player for those moments when you want to kill a bit of time, say on the odd trip up to London or down at the gym. The iPod shuffle is great for this as it’s random nature fits perfectly with my random usage patterns. If I was using it every day for long periods I’d want more control. But for occasional use, shuffle works perfectly.

However my main reason for getting an iPod Shuffle wasn’t to get an mp3 player, It was to get a new USB drive. I’ve previously owned two USB keyring drives and found them a realy handy way of moving files around. Unfortunately neither lasted very long so it was time to buy a new one. The iPod Shuffle turns about to be one of the most affordable USB drives around, with the extra bonus of doubling up as a great little mp3 player.

Comments (10)

Alt Text, Image Captions and Accessibility | February 9, 2005

Here’s an accessibility question for everybody out there. If an image has a caption that accurately describes the content of the image, do you still need to add alternative text, or would a blank alt attribute be OK? Whereas some screenreaders can read link text out of context, I don’t believe there are any that read images out of context. As such, apart from when images are links, I can’t see a situation where the additional duplication of the image caption in the alt text would be useful. However I can see that for large photo gallery style pages, the duplication could get very irritating to screenreader users.

What do you think?

Comments (31)

Heading Elements, Semantics and the Spec | February 7, 2005

Many people have taken to using the h1 element to describe the site a particular page belongs to. This usually involves wrapping a h1 tag around the site name, hiding the containing text from browsers using CSS and possibly swapping in the site logo using an image replacement method.

I can see the logic to this. Many people see a website much in the same way they see a book. Each page on a site is like a chapter in a book, so each page gets it’s own headline. However that chapter is part of a collection of chapters and it’s important to know what that collection is called. How else would you be able to buy it off Amazon? In the same way, people feel that a webpage is naturally part of a collection of pages called a website, so the main heading of all the pages on a site should be the name of the site.

The spec says “A heading element briefly describes the topic of the section it introduces. Heading information may be used by user agents, for example, to construct a table of contents for a document automatically.”

The purpose of the heading element therefore is to describe the structure and content of the current page, not to describe the structure of the site or how this particular page fits into a larger hierarchy. By using the H1 element to link a document to a group of documents the web author is almost trying to create their own meta data. However that isn’t necessary as HTML already provides us with the means of doing this using the link element.

Most web authors are using the H1 element this way in order to increase the meaning of the document. However in many respects they are actually doing the opposite and adding superfluous information. For instance, much in the same way that a sighted user will scan a pages headings looking for information, an experienced screenreader user may have all the level one headings read aloud. This is because they know that level one headings should accurately describe what a page is about. If the site author has decided to use the level one headings to describe the name of the site instead, screenreader users may naturally assume that the pages don’t contain the info they are looking for and go elsewhere.

A lot of web authors also mistakenly believe that there should only be a single h1 per page. This makes sense if all the information on the page is about a single subject but it makes less sense if the page has groups of unconnected information. For instance, this article is primarily about headings, however the side bar contains unrelated information. Unfortunately because the sidebar doesn’t have it’s own h1, this information is structurally considered part of the headings article, even though it has nothing to do with it.

Comments (29)

Last Call for BlogAid Support | February 1, 2005

So the month is over and very soon I’ll be emailing everybody who pledged their site earning to BlogAid to ask how their fundraising went and to thank them for their support. However there still is time to get involved and pledge your site earnings retrospectively. So if you’d like to help the Tsumani relief efforts by retrospectively pledging your site earnings for the month of January, please visit the BlogAid pledge page and register your support.

Comments (0)