Clear a 301 redirect from Google Chrome

Google Chrome caches 301 redirects for a long time. When typing in a URL that you’ve previously visited that had a 301 redirect on it, it takes you to the redirected location without checking the server again. This could be argued as expected behavior, because it is a permanent redirection after all, but this post shows how you can remove a specific URL from the 301 cache in Chrome.

Edit or disable the customer registration email in Lemonstand

When a customer registers their details on a Lemonstand ecommerce website, an email is sent to confirm the registration using the shop:registration_confirmation template. This post shows where to go to edit the email message or prevent it from being sent. Editing the shop:registration_confirmation template In the Lemonstand admin area, click "Email Templates" under "System > Settings". …

Read more

Master Mobile Web Apps with jQuery Mobile 3rd Edition

My friends over at elated.com have recently released the 3rd edition of their "Master Mobile Web Apps with jQuery Mobile" e-book. I had a brief read of one of the earlier editions and it’s a great book and I’ll be using it as a reference at some point in the future. In the meantime, here’s some info about the book and where to buy it from.

Remap quit and close tab shortcut keys etc in Mac OS X

I’m the king of hitting random shortcut key combinations and doing unexpected things and often accidentally close a tab or the entire window in Google Chrome while editing some content on one of my websites. Which means having to go back and re-write that content… I’d have enough of that so decided to work out how to remap the Cmd+Q and Cmd+W keys so I could no longer accidentally shut down a tab or window when really meaning to copy n paste or select all (or some other well meaning shortcut).

Categories OSX

Failed to add the host to the list of known hosts

I recently reinstalled the operating system on my MacBookPro and discovered when trying to SSH into a new server for the first time I was getting the error "Failed to add the host to the list of known hosts (/Users/chris/.ssh/known_hosts)." This post shows what I needed to do to fix them problem.

Fixed number of digits after the decimal place with Javascript

As well as supporting various rounding functions, Javascript has the toFixed() method to have a specific number of digits after the decimal place. This function works in all modern browsers including Internet Explorer from 5.5+.

Number.toFixed(digits)

Simply pass the number of digits that should be after the decimal place and the string returned will be rounded to that number if there are more or zeros added if there are less.

Some examples:

document.write( 1.1.toFixed(2) + '<br>' );
 document.write( 1.12.toFixed(2) + '<br>' );
 document.write( 1.123.toFixed(2) + '<br>' );
 document.write( 1.125.toFixed(2) + '<br>' );
 document.write( 1.125.toFixed(4) + '<br>' );

These will write out to the document:

1.10
 1.12
 1.12
 1.13
 1.1250

See also my rounding numbers with Javascript post for some other rounding methods which do not set a fixed number of digits after the decimal place.