All posts in Web Development

I’ve just bought something from Amazon and something has happened that has happened to me every time I’ve used Amazon for the past few months. I’m not sure if it’s something they introduced recently or whether I’ve just not noticed it before but it’s bugged me one too many times so I’m going to moan about discuss it here.
Continue reading this entry »

I’ve noticed a few times that my Ubuntu VM, running in Parallels, suddenly goes slow.

First time round I was totally confused and re-booted the VM (I access it via SSH), that didn’t work, and was also really slow. So I shut it down and then I noticed when I returned to Parallels to stop the VM that a dialog box was waiting for me (telling me there was an update or something). It turned out that this was the issue. It seems to happen to me for any dialog box as just now I’ve had the same issue when there is a dialog box asking if I want the VM to connect to a USB device.

Seems silly to me that this should slow down the VM, but just thought I’d mention it.

I've just started using Observers in a Rails application I'm creating and found out that in order to have them picked up by rails you have to manually register the Observers within your environment.rb file, like so:

RUBY:
  1. config.active_record.observers = :my_observer

I like to have as much coverage for any code I write in Rails, such as associations I've created, validation rules etc. I'm not testing the validation itself (Rails' tests have that covered) what I'm testing is that I've actually applied the validation rule.

So I figured that I should do the same for the Observers which should be registered. I couldn't find any references to anyone else doing this so after a little bit of digging I've come up with the following approach for use with RSpec:
Continue reading this entry »

I've previously highlighted the geekery that is using pseudo-code for non code related activities (in my case an IM insult) and just though I'd share this lovely example from Null is Love:

RUBY:
  1. piper = Baby.new(:name => 'Piper',
  2.                  :born => '2008-06-09 18:22:00 EDT',
  3.                  :weight => {:lbs => 6, :oz => 8},
  4.                  :length => {:inches => 21.25})
  5.  
  6. skoglunds.children <<piper
  7.  
  8. piper.daily do |p|
  9.   8.times do
  10.     p.eat
  11.     p.poop
  12.     p.sleep
  13.   end
  14. end

Having spent most of Saturday trying to get files to upload from a Flex application to a Rails backend, fighting against both Flex and Rails all the way, I thought I'd collect together some of the things that have helped me work through this in the hope that others don't have to spend quite as long battling through this. Note however that these are not necessarily best pratices, more a collection of tips that helped me in my situation, there are probably better ways to do some or all of the things that I'll be writing about - and if you know of any improvements/alternatives I'd love to hear about them.
Continue reading this entry »

I've been doing quite a bit of unit testing on the Flex part of our new product lately and this has led me to fix a few issues and add some improvements to my FlexUnit Test Runner, I've been running with these fixes and improvements for a couple of weeks and finally took some time out yesterday evening to package them up so I could release them.

The key changes are:

  • Release has two downloads - one compiled to Flex 2.0.1 and one to Flex 3 - as it appears changes to Flex internals meant you couldn't use the Flex 2.0.1 compiled swc in a Flex 3 project.
  • Fixed: Issue where error thrown when no test results selected.
  • Fixed: Issue where resizing columns could cause the itemRenderer for the status to display horizontal scrollbar.
  • Added: Ability to choose whether to display test results live or wait until all tests complete (as displaying them live results in slower execution of tests, as it's constantly updating the UI) - this is saved as a preference.
  • Added: Ability to toggle display of the class path for the test case - this is saved as a preference.
  • Added: Test result details now extract Expected & Was from message string for failures and display in a manner that is easier to compare.
  • Changed: Test details now displayed on change rather than click event, to allow keyboard navigation of test results.

Head over to the FlexUnit Test Runner code page for all the downloads and to see the updated demo.

I've just about given up adding comments to blogs as about 80% of the ones I've made recently haven't appeared on the post after I've submitted them.

If you've got spam filters and they're catching comments then inform the users that their comment has been identified as possible spam, if you've got moderation on comments then inform the users.

I don't know how many times I've submitted a comment twice as it hasn't appeared the first time (and usually never does the second time either) just to make sure that it's not a cookie issue -- as in my RSS reader I don't have cookies enabled.

So the long and short of it, is that if for any reason a comment will not appear as soon as the user has submitted it then inform the users that you've got their comment and the reason it hasn't appeared. If you're just returning the existing page without their comment you're going to frustrate people (I can't be the only person this annoys).

Sorry for the rather pointless post, I've just finished ensuring our test coverage is up to scratch on our project (as I mentioned in the last post). This means that I can get on with the next stage.

Which also means we're one step closer to releasing it.

Which also means I'm one step closer to being able to tell you all about it, ohhhhh it's so exciting!

Ubuntu Cola, the way to increase RoR productivity on Windows?A couple of weekends ago I was about to begin a large amount of re-factoring of our Ruby on Rails app (more on that to follow) to move it from a functional wireframe of the app to the final polished first version that users can use without cursing us. However I'd knocked together the wireframe version fairly quickly and had not taken time out to put down some decent test coverage, yes I know, and doing the amount of re-factoring I was planning without having any tests to verify that I haven't broken anything isn't a good idea.

So I undertook to get our test coverage up to scratch, I got ZenTest to ensure that the tests get run for every saved modification, which is a great help during development. But this exposed me to something which I had already started to notice but which hadn't become a real issue yet, Ruby on Windows is slower than a 1-legged dog down the dog track. ZenTest was taking 20 seconds or more to even notice a file had changed and then took even longer to begin the test. Combined with Ruby using 100% CPU most of the time this really dented my productivity and I had to do something. Luckily all that spare time I had while I was waiting for the tests to run every time I pressed save meant I could look into resolving the problem.
Continue reading this entry »

I've just read this interesting post on how to speed up your web application with an automated system for working with browsers cache for your assets (CSS, JavaScript, images etc.).

Previously I've used query strings parameters within asset requests so that they act as a 'cache bust' parameter, these have usually been the source control revision number and is built into the release process. But I've never taken the step of force an expiry date on content that can be cached and the solution in the post is a lot more fine grained than my previous solutions. Something to consider for the future.