Archive for January, 2009

OK, I’ll fess up – lately I’ve become a bit bored with the icons that appear in my OS X dock. I mean, they’re cute and all but they barely even drink. Look at the them. They’re a bit tired, eh? And I’ve always hated that Safari icon. I mean look at them
Leopard dock icons

Leopard dock icons

So I thought I’d have a play around and see how easy it was to change them. Turns out it’s really simple…

Getting the image
I decided to replace my icons with pictures of letters – just so I had a clue as to what applications they represented, so I trawled through Flickr, searching for ‘letter a’, ‘letter t’ and the like. When I found a suitable image, I used Command-Shift-4 to do a cheeky screen grab. Replacement icons can come from anywhere.
Changing the application icon
This is really easy. Open Applications in Finder and click on the application you want to change the icon for. Hit the Command-I or right-click and choose Get Info on the file to view its details.
Get Info

Get Info

double-click on your saved screen grab to open it in Preview then Command-A to select all and then Command-C to copy the image. Back in the Get Info pane, clicking on the icon itself will highlight it with a blue glow. Clicking Command-V will paste your new icon in its place. Careful though, it can be pretty addictive!
Finder

Finder

And here’s the end result. My graphitti dock! OK, it’s a bit more rough and ready than Apple’s work of art, but it’s all mine and I like it!
my dock!

my dock!

Well I thought I'd kick off the New Year by documenting an annoying and frustrating "undocumented feature" of IE and Opera.
This one is pretty simple and I guess it's fairly obvious when you think about it but it's not consistent with other platforms or this web developer's expectations of browser behaviour.

Internet Explorer 7 and Opera 9, as far as I can tell do not send the form element details correctly when the form is submitted. Instead of posting the input element name and value, they post the input name with the x and y co-ordinates of the mouse pointer at the time of clicking. This information is also sent by Firefox and other browsers but they do send it together with the actual element name and value as well.

Important information e.g. the Value of the button could be missed by these browsers

The real gotcha is if you are processing a form and performing alternate actions when a button is clicked on (eg you may have an 'Upload Image' button and a 'Finish' button). Testing that the button has been clicked by looking for a POST or GET value of the button name will not give you the correct result when the button was clicked in IE.

To replicate this behaviour:

Create a form and add a graphical submit button to it, with a name of "submit"

Form with graphical input button

Form with graphical input button

HTML:
  1. <form action="/Search/" method="get"> <input name="search" type="text" /> <input id="submit" alt="search" name="submit" />
  2. src="images/btn_search.gif" type="image" value="submit" /&gt;
  3. </form>

you would expect that as it's an input source that the submit value will be transmitted as part of the form.

Here is the output displayed when the form is submitted to this simple script

PHP:
  1. print_r($_GET);
  2. ?&gt;

this is what you see when you View Source in Firefox and Safari

Output from Firefox

Output from Firefox

output from Safari

output from Safari

see the final value - submit (the button) has a value of "submit"

now lets View Source in Internet Explorer 7 and Opera 9

output from Internet Explorer 7

output from Internet Explorer 7

output from Opera

output from Opera

nada - zip, zilch, nothing

As far as I know, when you create an input element in a form that element has to pass its value by name, eg. last_name=layfield otherwise it is not behaving correctly.