Posts

  • New Job

    Last week was a good one. Most of the week was spent working in the bike shop building bikes for Christmas, which makes the day go by quickly.

    On wednesday evening I had a lovely dinner courtesy of Gaz, and then went to the Crags with some of the Vets. I found a 14inch kids bike beside the bins on the way there, so rode that there and back, slightly more wobbly on the way back!

    On thursday I was out with the cycling club for our Christmas dinner. After a lovely meal at The Buffalo Grill we headed round to our usual pub, where drinking games ensued and the banter was great. Photos can be found on my Flickr including Iain in his stunning beater and tie combo.

    On friday I went round to my aunts and had yet another lovely dinner, and a good long chat about family, computers and moving houses.

    In between all this going out at the end of the week I bagged myself a job with FutureCorp, a web application consultancy firm. I’ve been enjoying my first few days getting to know things and am sure there are more exciting things to come. I’d better tidy my room now, seeing as I’m working from home!

  • Almost There

    Yet again it seems that Christmas is upon us. Yah! To be honest I think that money has ruined Christmas, it’s too commercial these days. Enough of the scrooge though!

    As an early Christmas present I thought you might like to know a bit more about me. I’ve finally got round to putting up the about page, which gives (a little) more info than what’s at the bottom of the page here.

    My CV can be downloaded from there in Word and PDF formats, so anyone who would like to hire me or offer me a job is more than welcome to look at those.

  • Say Some Stuff

    Todays pictures is just for the ‘banter’ as some circles might say. It’s Tim looking sexy as usual.

    I finally got my Macbook back, a day short of 5 weeks after I handed it in. Apparently the hard drive had failed (I told them that) and they put a new one in. If I’d spent £60 to buy a new drive online, I could have fitted it myself, and probably have saved the money in gained work time. Suffice to say I am very unimpressed with Apples Warranty turnaround.

    Yesterday I agreed to ride the Strathpuffer 24 hour. It’s yet another 24 hour race, but this time in January, and somewhere near Ullapool. It’ll be cold, but I’m sure I’ll enjoy myself.

    I’ve already started collecting bits to put on the bike in March. Yesterday I snapped up a bargain, a pair of Avid Juicy Ultimates for only £220. That’s cheaper than I can get them at staff price. I’m loving the $/£ exchange rate at the moment. They’ll sit in their box for a few months, but I’ll be sure to give you some pictures on the meantime.

    Job hunting isn’t terribly exciting, and thats before I’ve really got started. Any offers?

  • Graduation

    It was my graduation ceremony on tuesday. Was rather good fun getting dressed up, and getting taken out for two meals on the same day.

    The ceremony itself seems to pass quickly when you are part of it, before you realise it you have been tapped on the head with the cap, and are walking back to your seat.

    Definitely something I’d like to be part of again ;o)

    Update:More pictures can now be seen on my Flickr

  • EUCC Film Night

    Thursday saw the (semi) annual EUCC film night. The usual banter was to be had, and the combination of Dave’s (The one with the busted collarbone) home cinema system, and our flat’s projector, meant a hired room became almost as good as a cinema.

    Synopsis

    This was the first film we watched. From what I could gather it was a film following riders from the southern hemisphere as they toured the North American downhill circuit. It was rubbish. All the courses were dull, and the dirt jumping consisted of guys rolling BMX jumps. Oh, no, sorry, there was one guy who could do 5 (We counted) different tricks. He was described by the other riders as ‘really good at jumps’!

    New World Disorder VII – Flying High Again

    This was our second film. It was brilliant. The previous NWD film seemed to be a bit duller than their previous creations, but this one was way back up there. The quality of the riding, the locations, and of course the filming were top notch. Some stuff was just sick, lots of new stuff that I had only previously seen done on a BMX. The highlight is Robbie Bourdon’s section at the end, everyone was looking forward to it, and wasn’t disappointed.

    Banter can be found on the EUCC website.

  • Inside the Hope Pro 2

    Many of you will know of my excitement at getting my Hope Pro 2 rear hub, then building it into a wheel.

    Nine months have passed, and it’s been on a lot of rides and some very muddy races. I’d reckon it’s done about 1500miles in that time, so it was time to take it apart for a little service.

    Taking it apart was easy, I did it by the method I was told last week:

    1. Take off the cassette and disk rotor, just to make life a bit easier.
    2. Tease off the non-drive side dust cap with a screwdriver.
    3. Holding the freehub with one hand, and whack the now exposed axle with a soft-faced mallet.

    That method unfortunately pushes one of the bearings out of the hub body, not ideal. The method used for the older hubs is much better:

    1. Take off the cassette and disk rotor as before.
    2. Grip the drive-side steel serrated axle end in a vice gently. Pull the wheel gently to slide this off.
    3. Now pull off the freehub body with your hand. If it’s a bit tight, put your cassette back on, but only tighten the lock-nut one turn. Use the gap between the cassette and the spokes to pull the freehub body off with your fingers.

    Unlike the old Hope hubs, the springs and pawls don’t eject themselves across the workshop never to be seen again. A clever design means that the springs and pawls slide into the freehub body from the side, rather than in the direction of their motion.

    My freehub body was manky inside, something to do with it being an early Pro 2. I didn’t have one of the new ones to compare it to, so after cleaning it all up, I put it all back together.

    It now sounds smooth again, and the loud clicking is slightly less rough. Well worth doing. I was a little disappointed with the amount of muck that had got past the seals, but I’m going to speak to Hope and see if that can be remedied.

    Hope Pro 2 – Still the best hub going!

  • Minfigs Ahoy!

    I was a little bored this evening, so I had a rake around in my box of Lego. I was primarily trying to see how many Lego people I had in the flat, but with help from some instructions I ended up building a tipper I got about 16 years ago. There is a headlight missing but I’m sure I’ll find that at some point.

    In other news:

    • The Edinburgh Uni Sports Union have started an XXX club, all present at the pub on thursday were clamoring to join.
    • Sandy was knocked off his bike by a blind council worker.
    • Tim left his singlespeed locked in his stairwell, and surpise, surprise; it got nicked.
    • It is rumored that I may have looked at proper jobs. This is a lie. Honest.
  • Curse The Royal Mail

    The new Ross Noble DVD arrived for James this morning. Shame it didn’t come in it’s packaging! If you click on the image to the right, you’ll see the anotated version on Flickr, on which I’ve highlighted the packaging and the DVD.

    I heard the postman forcing something through the letterbox, it must have been this. I have no idea whether he took the packaging off to fit it through, but should it not be left on for privacy purchases?

    I’m pretty unimpressed, and the Royal Mail website is only interested if you want compensation. Meh!

    Update

    I had forgotten about previously cursing the Royal Mail for crimes against common-sense.

  • Cron Jobs in Ruby on Rails

    Attention!

    It has come to my attention that this plugin is no longer available from it’s original source. I have made it available on Github.

    In place of steps 2 and 3 below you can download the tarball and unpack it to your vendor/plugins directory.

    Let me know in the comments how this goes, thanks.

    Back to the action

    Sometimes you need some precess to run at set time intervals, independent of the request-response cycle a standard web server. Things like (as I did) polling Flickr to see if you’ve added any new images to your account, or looking at a to-do list to see if any email reminders are due to be sent out.

    Cron jobs under Unix are a great answer to this , but you have the problem of these being:

    1. Particular to Unix and Linux systems.
    2. How do you access your active-record models that make up your Rails app?

    Enter Kyle Maxwell’s Daemon_generator plugin, a simple way to create and control daemons that run your own code within the Rails Environment.

    It took me a while to figure out how to get it all set up, so I decided to write a guide to help people get to grips with it.

    OK, here we go…

    1. Install the Daemons Gem on your system using the command:
      sudo gem install daemons
    2. Navigate to the root of your rails app, install the daemons_generator plugin in your app using the command:
      ruby script/plugin install http://svn.kylemaxwell.com/rails_plugins/daemon_generator/trunk
      See the the top of this article for the new download location.
    3. Unfortunately this will be installed in your vendor/plugins folder as trunk, so change the name of this to daemon_generator so it’s easy to see at a glance what it is:
      mv vendor/plugins/trunk vendor/plugins/daemon_generator
    4. Now you can create your first daemon. I’m going to call mine test:
      ruby script/generate daemon test
      That should create a bunch of files, including lib/daemons/test.rb, which will hold your actual code. If you have a look at this, it should be fairly self-explanatory where you put your own code and how you set the time interval. Leave this unchanged for the moment, just to see it in action.
    5. Start the daemons with the command:
      ruby script/daemons start
    6. Look at the production log, you should see output similar to the following:
      dougal@tempy:~/test123$ tail -f log/production.log 
      This daemon is still running at Thu Nov 09 00:33:54 GMT 2006.
      This daemon is still running at Thu Nov 09 00:34:04 GMT 2006.
      This daemon is still running at Thu Nov 09 00:34:14 GMT 2006.
      It might seem strange to be looking at the production log, daemons run in production environment by default as they can be run separately from your web server (The we server doesn’t even have to be running to get this to work). You can of course change the environment at the top of lib/daemons/test.rb should you wish so for testing purposes.
    7. Stop your daemon with the command:
      ruby script/daemons stop</pre>

    Having Trouble?

    This plugin is no longer maintained by the original author. However, commenters have been kind enough to suggest fixes to problems. See Rob Lucas’s comment in particular. I will of course accept patches and fixes, and apply these to the repository.

    Wrapup

    That’s it, you created, run and halted your first daemon! More commands for controlling daemons can be found in the readme, and the complete source in Kyle’s SVN repository.

    Hope that helped some people out. If you have any questions or problems leave a comment and I’ll hopefully see you good.

    Screencast

    You can now see Daemon Generator in moving pictures, courtesy of Ryan Bates’ Railscasts.

  • Acts_as_ferret Returning Only 10 Results?

    The acts_as_ferret gem is great! It allows the power of the Ferret (Apache Java Luciene originally) search engine to be leveraged in a Rails application easily.

    There is one thing about it that leaves me slightly miffed. Why does any search only return 10 items by default?

    The fix is to use your search methods as follows…

    If you are wanting model objects returned, then use:

    objects = Model.find_by_contents('string search query', :limit=>1000000)

    If you just want the IDs returned, use this:

    object_ids = Model.find_id_by_contents('string search query', :limit=>1000000)

    It would be rather nice if an :all option switch was available, but instead we make do with the :limit=>1000000 ‘hack’, which isn’t a problem unless you end up with more than a million results returned by a search. Unless you’re Google, this isn’t going to be an issue.

    Hope this helped some folks out who were puzzled by this as I was.

    Update

    After looking at my logs, I’ve realised that :num_docs has been deprecated in favour of :limit. I’ve update this post to reflect that.

    Did you like my Ruby on Rails related article? Then why not recommend me on Working with Rails?