SET A CUSTOM HOME SCREEN TITLE FOR YOUR WEBSITE ON IOS DEVICES

Here’s a neat little trick I’ve just learned. I’ve been setting up all the different icon sizes on mtvan.com for iPhone and iPad (including retina displays) for when you ‘Add to Home Screen’ and got the icons all working nicely.

The only thing that bugged me was my title tag. ‘mtvan – Courier Work and Networking for the Sameday Courier Industry’ is descriptive, accurate, great for Google and users alike however gets truncated the you add to home screen – far from ideal. Continue reading

IOS APP ICON NAMES & SIZES

Just a quick reference to the names and sizes required for iOS app icons. The format is always .png.

Here’s a list with the file name and the icon size in pixels.

iPhone and iPod

  • Application Icon for iPhone (retina display) – Icon@2x.png 114×114
  • Application Icon icon for iPhone – Icon.png 57×57
  • Settings/Spotlight icon for iPhone (retina display) – Icon-Small@2x.png 58×58
  • Settings/Spotlight icon for iPhone – Icon-Small.png 29×29
  • Launch image Portrait (retina display) – Default@2x.png 640×960
  • Launch image Portrait – Default.png 320×480

iPad

  • Application Icon for the new iPad (retina display) – Icon-72@2x.png 144×144
  • Application Icon for the iPad – Icon-72.png 72×72
  • Settings/Spotlight icon for iPad – Icon-Small-50@2x.png 100×100
  • Settings/Spotlight icon for iPad – Icon-Small-50.png 50×50
  • Launch image Portrait (retina display) – Default-Portrait@2x.png 1536×2008
  • Launch image Portrait – Default-Portrait.png 768×1004
  • Launch image Landscape (retina display) – Default-Landscape@2x.png 2048×1496
  • Launch image Landscape – Default-Landscape.png 1024×748

iTunes App Store

  • App icon for the App Store (retina display) - iTunesArtwork@2x.png 1024×1024
  • App icon for the App Store - iTunesArtwork.png 512×512

ALLOW PHP TO SEND MAIL IN FEDORA

Just run into this one as I’ve been configuring a new server.

On a fairly standard Fedora set-up it’s likely that the reason you can’t send emails from a PHP script is in fact because SELinux is stopping  Apache (httpd). This applies to both sending with Sendmail, and sending via SMTP.

You’ll need to run the following commands as root to fix the problem:

$ setsebool -P httpd_can_sendmail 1
$ /etc/init.d/httpd restart

MTVAN COURIER DIRECTORY REDESIGN

Following on from the mtvan booking page, the next update I’ve been working on is the long overdue revamp of the courier directory. This part of the site provides a listing of owner drivers and courier companies for other site members.

It ought to allow members to quickly find others with required skills and availability in the desired location. Unfortunately the old version struggled a little to achieve that.

What we had to beat

The old directory provided a paged listing of all the members on the site. It allowed re-sorting by whatever location you chose to enter. However it was built before we’d implemented a really solid ‘service types’ matrix, so selecting skills was not possible. You could also search against company names and first/last names – it was a little hit and miss though. As it was one of my first ventures into using AJAX, it was a bit heavy and annoyingly didn’t save state – it was not possible to select a courier and then hit ‘back’ and be where you left off. Oh, and the SQL queries were not fantastic so that slowed things down too!

The new mtvan courier directory

So… what have we done for the new page (above) then?

Combined SQL Queries

The new page also displays our empty couriers, as well as the directory. Despite doing more, we now perform just 2 queries to the database and bring back only what we need. Previously a lot of logic was performed in PHP before a result was calculated.  Now all that is sorted before any data comes back. It’s really very fast now.

Sort by any column (almost)

The new directory is sortable by any column (apart from the ones that don’t make sense to sort by). It’s intuitive and helps you find what you want ASAP.

Display Service Types Offered

We now provide a full listing of all service types members can handle. You can drill down results by service type too.

Trusted Status

This was one of our very old ideas that got binned. Now we realise better the value of being able to create your own ‘favorite’ list of couriers. This is now included: you can add and remove your trusted members with just one click. It’s all AJAX so things get done on the fly. Again, you can drill down to display just your trusted members only too. We plan to build on this feature heavily in the future.

Saves State

If you navigate away from the page and go ‘back’, the state is as you left it. You can try the next search result rather than having to refill the form.

Give it a try

The courier directory is free to use for anyone in the transport and logistics industry. Get started on mtvan and start building your business relationships today.

Update 18/05/2011: You can check out more about the courier directory here.

TIME ZONE CONVERSION USING PHP DATETIME CLASS

Following on from my post last month about problems with PEAR daylight saving, here’s a quick example of using the PHP DateTime Class which was introduced recently (PHP 5.2).

Convert from UTC to Europe/London local time:

$time_object = new DateTime('2011-04-19 17:45', new DateTimeZone('UTC'));
$time_object->setTimezone(new DateTimeZone('Europe/London'));
$LondonDateTime = $time_object->format('Y-m-d H:i:s');

This will work with daylight saving too.

Here’s that example wrapped up in a handy time zone conversion function:

function convert_time_zone($date_time, $from_tz, $to_tz)
	{
	$time_object = new DateTime($date_time, new DateTimeZone($from_tz));
	$time_object->setTimezone(new DateTimeZone($to_tz));
	return $time_object->format('Y-m-d H:i:s');
	}

NEW MTVAN BOOKING PAGE

I’ve just finished putting the final touches on a new mtvan booking page.

It replaces a rather old and clunky version that I did when I was first starting out building dynamic websites in PHP. So what have I improved…

Minimised Required Fields

The old page required the user to provide all sorts of information: Customer details, booking reference number, short description, collection address, collection postcode, delivery address and delivery postcode! This obviously presents the user with a bit of a hurdle to overcome. The new page just asks for a collection postcode and a delivery postcode as that’s all we need to create a booking. The main aim of this was to reduce the arduous form filling that some of our busy vendors don’t have the time for.

Minimised Visual Weight

There’s a lot of different data that can be useful to collect about a courier work booking. Unfortunately even if completion is optional, a big long form can be rather daunting to the user. The new form has a default ‘quick’ layout, which can be expanded to a detailed view if required. The state the page is left in is recorded in our user table for next time they visit the page.

Improved Page Submission Speed

Previously when the booking form was submitted, we went away and did all sorts of clever things geocoding and looking up time zones etc. Except as the server had to make various calls to multiple services, this was not so clever. Although it was bearable, it did add a good few seconds to the submission time. The new page minimises the required calls, and the ones it does make it performs in a separate PHP fork, so as not to affect the user experience. The form submission is now instant.

Reassuring Animations and Feedback

The new page takes advantage of jQuery to slide open various options when the user requests something or selects an option that is going to require a little more data. Previously we would just show/hide via addresses, but these are now animated. Not only is it more cute to use, I think it makes it far more obvious what just happened when an option was selected.

There are loads more little improvements here and there (too many to list here), but if you’re in the transport and logistics industry and have excess work that needs covering, you can give it a try over at mtvan now – it’s free.

PEAR DATE DAYLIGHT SAVING BUGS

The clocks went forward in the UK last night and fortunately I was working on a site today which involved manipulating dates and times between timezones so I immediately noticed a problem in PEAR Date that I have been using without problems until now.

When converting between time zones UTC and  Europe/London there was no change in the date/time value. As we’re now into British Summer Time (BST), Europe/London should show as 1 hour greater than UTC (which incidentally is the same as GMT), so it seems like PEAR Date has a bug relating to daylight saving in the UK in 2011.

Looks like there’s a better way to handle time zones than using PEAR Date now anyway. I’ll write a quick post about using the DateTime class introduced in PHP 5.2 soon.

Update: Time Zone Conversion using PHP DateTime Class

UK DATES AND STRTOTIME

In PHP, strtotime cannot parse the UK date format (i.e. 30/02/2011) as there’s no 30th month.

Here’s a quick fix I came across that seems to work for me (so far)… Just replace the “/” with a “-” before parsing with strtotime.

$timestamp = strtotime(str_replace('/', '-', '30/02/2011'));

Credit goes to Stefan Kunstmann.

Update:

Here’s the note relating to this on php.net…

Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed.

So looks like replacing the slash with a dash is the reliable and correct thing to do.

JQUERY SLIDEDOWN PROBLEM ON IE7

Just run into a problem with IE7 when coding up a fairly complex web form that needs to shrink and grow depending on the amount of detail the user wants to enter.

After an hour of fiddling around and a bit of googling (looks to be plenty of others with a similar problem), it seems to happen when you .slideDown() an element that is relatively positioned.

The quick and painless fix that worked for me was to add zoom:1; to the style of those relatively positioned elements.

div.your_class{
    position:relative;
    zoom:1;
}

For info, I have not tested this on IE6.  IE8 worked fine anyway.

WHERE’S FEDORA 14 SYSTEM RESCUE?

I’ve just finished troubleshooting some things on my server and one thing that held me up was finding System Rescue on the Fedora 14 CD!

Well this turned out to be because it isn’t on every Fedora 14 CD, you actually need the full fat 3.4GB install DVD! The Fedora Live CD does not contain System Rescue.

Here’s some links to the ISO’s on fedoraproject.org (with the System Rescue), to save you having to dig for them…

Fedora 14 DVD 32-bit

Fedora 14 DVD 64-bit

P.S. This may not have been the case on old versions of Fedora, but I think this is the same on Fedora 13 too.