October 26, 2008
· Filed under internet, ruby, web
I had a very confusing situation today with a multipart form that was for uploading a picture to a new web service I’m working on.
In Safari the form upload worked. Even in Internet Explorer 6 the form upload worked (after I fixed the dodgy MIME-type that IE passes through for JPG images - image/pjpeg for those interested).
The form I was trying to submit had the multipart attribute set correctly, and also had some javascript to disable the file selection, form submission button, and show a spinner to indicate that something is happening, and they don’t try and submit the file twice if they’re sending in a large image.
My submit tag orginally looked like this (Ruby on Rails)
<%= submit_tag 'Upload Photo', :class => "formbutton", :id => "submit-button", :onClick => "$('upload-form').submit();Form.disable('upload-form');Effect.toggle('footnote', 'appear', {duration: 0});Effect.toggle('spinner', 'appear', {duration: 0});" %>
I was very confused as it did work in those other browsers, but not in Firefox.
The key to fixing this was to add return false; to the end of the javascript statement…
<%= submit_tag 'Upload Photo', :class => "formbutton", :id => "submit-button", :onClick => "$('upload-form').submit();Form.disable('upload-form');Effect.toggle('footnote', 'appear', {duration: 0});Effect.toggle('spinner', 'appear', {duration: 0});return false;" %>
What I find particularly confusing about this is that everything I read on the “return false;” statement leads me to believe that this form should not be submitted - however - return true does not work (500 Internal Server Error returned). But what the hey - it works.
September 18, 2008
· Filed under internet, web
I’ve recently transferred some funds internationally. To do this I needed a special account code so that the bank I’m sending money to know which of the accounts they hold should receive it. This number is a conventional looking account number, prefixed with a country code, and a checksum value. There is also a website that checks them - http://www.apacs.org.uk/payments_industry/ibans_5.html
Putting in a country that they can’t check the actual account number for causes their little javascript application to unleash a serious dissing.

Ouch!
BTW - Sorry for the Rodney Dangerfield knock-off quote. He’s awful.
September 1, 2008
· Filed under internet, web
me: Countees isn’t in google yet
someone else: You have to put it in there?
me: Yes, I have to tell them about it.
someone else: Don’t they just find it?
me: How would they find it?
someone else: Google.
BTW - check out countees.co.uk - wear your UK county on your chest. More about this soon.
August 30, 2008
· Filed under music, web
I got an email yesterday from Amazon.com about the Verve’s new album Forth. They were offering me a free, DRM free download of their latest song “Love is Noise”. Having not heard anything out of the Verve for a while I was interested, and free is a pretty good price so I went to download.
The first thing I was unimpressed with was the Amazon.com downloader they tried to install on my machine. I understand that some people may not understand how to add MP3s to iTunes, but the “skip this step” link to me was not in an intuitive place. So, I accidentally downloaded it, went back to the page, then found the skip link.
But the real kicker with this is the below screenshot.

Useless.
Why would they send me an offer I can’t redeem, ESPECIALLY WHEN THEY KNOW THAT I DON’T LIVE IN THE US. They have my address, I have purchased from them before. Unimpressed.
August 20, 2008
· Filed under business, internet, web
Opening hours. I want them on every physical stores, restaurants, and bars website. They do good store locators in the UK, I guess it’s because postcodes are everywhere, everyone knows them and they identify a very small area (a street, or part of a street). How come stores, when thinking about the data on their store locator, don’t include opening hours. Address and phone are always there, but when I’m going home on the train I want to know if my local stores will still be open when I get there.
Oh well, no spending at that particular store tonight.
August 15, 2008
· Filed under ruby, software, web
At the moment I’m working on a fairly complex extension for Radiant CMS. In creating the administrative pages I want to use a javascript library that is not distributed with the core radiant code. This post will describe how to implement your own extension that can use an external javascript library, without playing around with any of the core radiant files to inject the javascript into the administrative layout.
It’s actually really easy to do. If you haven’t created a Radiant extension before I’d recommend following this tutorial on the Radiant wiki.
Inside the Radiant GEM, the standard page layout resides at app/views/layouts/application.html.haml
The lines of code that insert the javascript tags are:
- @javascripts.uniq.each do |javascript|
= javascript_include_tag javascript
The @javascripts variable is populated from inside the app/controllers/application_controller.rb file. The culprit is below.
def include_javascript(script)
@javascripts << script
end
Pretty simple huh? So, all you need to do, is call this method from within your new controller, because all controllers inherit from the application_controller.rb file, so they have access to this method, and you can have different javascript included for each method if you so wish. In (assuming the example LinkRoll extension was built as linked above) vendor/extensions/link_roll/app/controllers/admin/links_controller.rb
def index
include_javascript("admin/mootools-1.2-core-yc.js")
@links = Link.find(:all)
end
That will insert a link to admin/mootools-1.2-core-yc.js inside the admin/links/index page. Righto, so now the only thing left to do is get the mootools-1.2-core-yc.js file into the actual public/javascripts/admin directory within the project. What you want to do is alter the vendor/extensions/link_roll/link_roll_extension.rb file so that within the activate method the file is copied over. I’d recommend making a public/javascripts/admin directory within your extension folder, and putting the file in there. Then, when activate is called on the link_roll_extension.rb file, the activate method will copy the file over to the projects public/javascripts/admin directory. You should also delete the file when the deactivate method is called in the link_roll_extension.rb file.
Questions and comments please!
August 5, 2008
· Filed under internet, web
This might be old news (released end of May, I’m soooo behind the times), but Google are supporting hosting for popular javascript libraries, and they are promoting people using their copies of the libraries rather than hosting their own. I only just found this out, and I think it’s pretty cool
http://code.google.com/apis/ajaxlibs/
The service supports either programmatic inclusion using the google jsapi library, or linking directly to their hosted copies.
Good things about this
- You save bandwidth costs, as your users download the libraries from google
- Your users get faster browsing ON OTHER DOMAINS, because the more people that use a single source, the more caching should happen
Bad things about this
- Google have more opportunity to don’t be evil - the biggest concern for me is their increased ability to understanding which users use your application, and propensity for understanding how they use it. A malicious individual within the company could put some nasty code in the js to screw with your site, or monitor and transmit back to googlebase what the user is up to. It’s very unlikely, but it could happen.
July 24, 2008
· Filed under internet, web
Twitter seems to be having some issues, well, more issues than normal. I was surprised to not get any updates on Twitterrific on my iphone today, so though I’d check out what was going down on their site. It appears that I’ve lost all of the people I was following, and all of my followers. A quick check with some of the followers as well, and they’ve lost all their contacts.
Come on Twitter, what’s going on?
(and if you want, follow me on Twitter!)
June 14, 2008
· Filed under web
I spent the day reworking Glimmer Design. I always intended to - the template I had on there was good, but not quite what I was after. I had a think last week about what I’d like the site to look like, and I made it today.
Homepage

And the page behind the spanner (yes! that’s what it’s supposed to be)

There are 2 things that concern me
- People’s browser windows may not be big enough for all the content
- The icons down the bottom of the page may be a little obtuse.
Let me know what you think.
June 14, 2008
· Filed under web
I’ve updated Wordpress, AND migrated my two blogs together to be one, again.
I’ve also tried to support the existing feeds - so I’ve got a couple of permanent redirects in the .htaccess files to sort them out. So, if your feeds don’t work anymore, your crappy feedreader doesn’t support the HTTP specification correctly.