Archive for April, 2007

My Perfect Mac-Eclipse-PHP-Subversion development setup

Eclipse is a truly great piece of software. Anyone developing with PHP (or many other languages for that matter) should consider it as a serious option for an IDE. And like a lot of great software, it’s free.

I use it most:

  • For PHP/HTML/CSS
  • On my Mac
  • With Subversion

If that’s you too, then I have one or two tips for getting things running smoothly. Most of this will be helpful if you use Linux or Windows too.

Step 1 - Download and install EasyEclipse for LAMP

EasyEclipse is a set of great distributions pre-configured with plugins for specific types of development. Eclipse actually has a very easy to use plugins system, but EasyEclipse makes getting up and running even quicker.

» Download EasyEclipse for LAMP

Step 2 - Set up your development environment

When developing in a team using Subversion (or other version control software), you normally need a local development environment to test your work before committing it to the repository. I have had great success using MAMP. It’s a simple Mac package that installs Apache, MySQL and PHP in one go. You get a neat little utility to start and stop the services, easily change the document root and so on. Another similar package that’s available for PC too is XAMPP, which is also very good.

» Download MAMP
» Download XAMPP

XAMPP is more feature rich, but MAMP has been around on Macs a bit longer - It’s bit more stable and easier to use if you are using a Mac.

Step 3 - Eclipse setup - Welcome Screen

Fire up Eclipse. For some rather odd reason, Eclipse has a random, sort of surreal startup screen the first time you run it. This caused me to ditch using it the first time I experimented with it, as I didn’t have much time or patience at that specific moment to work out what it was. And once you have closed it that single first time, there doesn’t appear to be any obvious way of getting it back ever - so it seems kind of pointless.

Eclipse random startup screen

Click the small cross next to ‘Welcome’ at the top, and you will see a familiar looking IDE layout.

Eclipse has a very well thought out (although a little bulky) windowing system. It uses the initially confusing terminolgy ‘views’ and ‘perspectives’. The ‘views’ are the panels, or little dockable windows. The perspectives are pre-defined layouts of views for pre-configured for specific types of tasks - such as PHP Web Development.

If you mess your windows up or get lost, simply do the following:

Window Menu > Open Perspective > Other

Select ‘PHP‘ from the list and click ‘OK‘. Everything should be back to near normality.

Step 4 - Eclipse setup - Turn off some annoying features, turn on some great ones

A lot of this is down to personal taste, but I think I’m fairly typical of an ex-Dreamweaver-code-view-will-do developer who’s learnt the error of his ways. So my preferences might be good for you if you fall in to that category. At the very least it will show you how to find the right options (and Eclipse has loads of ‘em)

To get to the Eclipse preferences, choose ‘Preferences‘ from the ‘Window‘ menu.

Because Eclipse has so many options, they have a really neat search feature that allows you to keyword search for the specific options you want. So type ‘PHP‘ in the ‘type filter text‘ box to get the options specific to PHP.

Eclipse Preferences

Each node in the list has a different page of options. Here’s what I normally change on a new install. With the PHP node selected:

  • On the ‘Appearance‘ tab, I select ‘show line numbers
  • On the ‘Typing‘ tab, I switch offWrap double quoted PHP strings‘, ‘Wrap singe quoted PHP strings‘, ‘Close double quoted strings‘, ‘Close single quoted strings‘, ‘Close brackets and parenthesis‘ (they might be good features when you get used to them, but I gave it a good go and in the end decided they are just annoying)

Step 5 - Create projects - Import your sites

  • In the ‘File‘ menu, choose New > Project.
  • Select SVN > Checkout Projects from SVN, click next.
  • Choose ‘Create a new repository location‘, click next.
  • Type the URL of your Subversion repository, click next.
  • Enter your login details and choose the folder you want to check out. Click next.
  • Important: Choose the option ‘Check out as a project configured using the New Project Wizard‘ (the default). This way Eclipse will send you to the new PHP project wizard next, which is really handy. Click finish.
  • Choose PHP > PHP Project from the list and click next.
  • Choose a location for the files to be stored. I usually work with the default ~/workspace (so set your document roots in MAMP/XAMPP to the directories in this location). Click Finish.

You should see your files in a window called ‘Navigation‘ on the left. If you right click on a file, the Subversion options are all in a sub menu called ‘Team

That’s all folks, I’ll leave the rest up to you. Post comments if you have any questions or corrections and I’ll try to answer them.

Don’t Make Me Think!

Sleeve image of the book Don’t Make Me Think! by Steve KrugThis weekend I read the book Don’t Make Me Think!: A Common Sense Approach to Web Usability by Steve Krug. If you are in any way involved in web site development - as a designer, developer, project manager, CEO, copywriter or anything else - you need to read this book. Bag yourself a copy now - seriously.

It covers all the basics of web usability in a fun and pragmatic way. This second edition now includes a chapter on accessibility. It’s a quick and easy read - I can’t recommend it enough.

Unlimited should mean just that

How many times have you heard the term ‘unlimited broadband’ used by Internet service providers?

The use of the word unlimited can be very misleading. More often than not they are not unlimited at all. Use of the service is often subject to a ‘Fair use policy’ that imposes a data transfer limit of some sort.

For example, Tiscali offer an ‘Unlimited Broadband‘ package:

Screenshot from Tiscali web site

As you can see, it clearly states unlimited monthly usage. But if you check their fair use policy:

A very small number of customers use Peer to Peer or file sharing software, which constantly sends and receives video and other very large files, throughout the day. This type of activity uses a lot of bandwidth and can significantly reduce the speed at which other customers can access the internet during peak hours. Approximately 1% of customers use more than 30% of the available bandwidth during peak hours. We don’t believe this is fair to the vast majority of our customers. This fair usage policy automatically identifies the very small number of extremely heavy users and manages their bandwidth only during peak hours (6pm to 11pm Monday to Sunday), to protect the service for all our other customers. Outside peak hours, the use of the internet by these heavy users is unaffected.

Now what they are saying does seem fair enough, but why should they be able to sell it as an unlimited service whilst imposing these restrictions? This argument has been going on for a long time, and there is something you can do about it - sign this on-line petition:

We the undersigned petition the Prime Minister to Insist that OFCOM and the ASA stop Broadband Providers advertising ‘unlimited’ services that are in fact limited in the small print or by un-defined fair use policies

Great!

Import your Email archive in to Gmail and keep in sync

Gmail LogoI really like the Gmail interface - it’s a better, more usable interface than most desktop mail apps I have used. In order to make proper use of it, I’ve needed to find a way to get all of my past mail archive of 5000+ messages in. And from then on I need to keep it in sync with my desktop mail application (Apple Mail)

If Gmail had IMAP access, this would be easy. But as yet they don’t. So here’s the best solution I could come up with, which is close to being perfect.

What you will need:

  • A Gmail account
  • A temporary IMAP account big enough to store all of your messages. You must be able to access this IMAP account by POP3 (they almost always have POP3 access)
  • An good IMAP client to perform the transfer (Mozilla Thunderbird works very well)

Step 1

  • Import all of your emails in to the mail client you are going to use the transfer (Mozilla Thunderbird). If you already use IMAP, you don’t need to import, just set it up as an account.

Step 2

  • Set up your temporary IMAP account in the same mail client.

Step 3

  • Copy all of your local messages in to your temporary IMAP account. Copy all folders in to the main inbox of the IMAP account, including your sent emails folder (In Thunderbird, select all > right click > copy to). This could take a long while if you have a lot of messages.

Step 4

  • In your Gmail account, set the POP3 mail fetcher to download messages from the POP account associated with your temporary IMAP account. (This is in Settings > Accounts). Untick the ‘leave a copy of the messages on the server box’.

Gmail will download 200 messages every 60 to 90 minutes - so this could take a while to complete. You can watch the progress by looking at the IMAP mailbox they are downloading from - they will disappear once they are downloaded.

Step 5

  • Set up your main email account to forward all messages to your Gmail account from now on, and set the sender address in Gmail to be your main email address.

Step 6

  • Set up POP3 access for your Gmail account (Settings > Forwarding and POP). Choose ‘For all messages from now on’ rather than ‘All messages’.

Step 7

  • Change your local POP and SMTP account settings to the Gmail account.

If you set the Gmail SMTP server as your outgoing server for all messages, Gmail is intelligent enough to store messages sent via SMTP within your Gmail account.

By using this method, you have achieved the following:

  • You have a local copy of your emails that matches the ones in your Gmail account.
  • You can send messages using your desktop mail client and your Gmail client, and all messages are stored in your Gmail sent folder.
  • New emails will arrive both in your Gmail account and your desktop mail client
  • You have a local backup of everything

But there are still some problems:

  • Problem 1: Messages sent via Gmail are not stored in your local sent items box.

The closest solution I have found to this solving this problem is:

  • Set up another POP3 mailbox and call it something like gmail-sent-messages@example.com
  • Set this mailbox up in your local mail client and create a rule to move all received messages in to your local sent items folder and mark them as read.
  • Every time you send a message from Gmail, BCC your gmail-sent-messages@example.com address.

Because it’s BCC, it doesn’t add anything to the message headers so you get a clean local copy of the message. This would be a good solution if Gmail had automatic BCC, but as it is it’s a pain to add the address every time you send a message.

  • Problem 2: The message ‘read’ status is not synchronised between your Gmail account and your local account. This is a shame but I don’t think there is any way around it without IMAP access.

But I think this is as close as we can get until Google add IMAP to Gmail.

Nokia 95 on T-Mobile

Nokia n95I think I was one of the first consumers in the world to get my hands on the newest Nokia handset. Aware of it’s impending release, I was watching the t-mobile site like a hawk and finally on Friday afternoon it quietly appeared in the list of Nokia phones.

I ordered it at around 5pm on Friday, and it arrived before 9am on Saturday morning!

This has got to be one of the most notable mobile phones of 2007, perhaps only second to Apple’s iPhone. Finally Nokia has created a usable, sensible phone with almost everything a web worker needs.

  • HSDPA (Super fast mobile broadband, with speed potential of up to 14.4Mb/s - currently operators support around 1.8Mbps in enabled areas)
  • Onboard Wi-Fi and Bluetooth
  • SIP capability that works quite nicely over WiFi (so cheap calls at home or in a WiFi hotspot) My home phone is SIP from Gradwell so my mobile is now an additional handset to my ‘land line’.
  • GPS with mapping and navigation software (navigation is an extra subscrption, but the mapping with location awareness is free)

Plus slightly less useful gadgety things like a 5Mp camera with Carl Zeiss lens, decent video recording, 3.5mm headphone jack, video output for plugging in to your TV (which works amazingly well - not quite DVD but very impressive)

And all this on a £22.50 per month T-mobile web ‘n’ walk contract which means unlimited* internet access on the move.

And so far I’m very pleased with it. The only problem is the GPS isn’t very sensitive. It takes a couple of minutes to lock on to the satellites, and you need a clear view of the sky with the keypad open. Didn’t work at all in London until I got in to an open area. Even so, it’s pretty amazing that they managed to fit GPS in there with everything else anyway.

The mapping software is pretty good too - resembles Google Earth. You get an image of the globe and then once it finds your location, it zooms in from space on to your position (nice). The maps are loaded from the internet as and when you need them (so a good data package is a necessity.)