Jquery Tiptip IE6

May 6th, 2010 by pyrat

Tiptip is a nice jquery plugin for displaying tooltips in a simple and elegant manner. All you need to do is set the title attribute with the tooltip content then give it a class name so it it picked up by the tooltip initializer.

However, it currently doesnt work in IE6 that well. Although users are falling I think you still need at least rudimentary support for IE6.

Create a conditional comment which includes a stylesheet load in your document header.

  <!--[if IE 6]>
     <link href="/stylesheets/ie6.css?1273083940" media="screen" rel="stylesheet" type="text/css" />
   <![endif]-->

And add the following rules to the stylesheet.

Installing Java on Ubuntu Intrepid

April 22nd, 2010 by pyrat

Always doing this on different ubuntu versions and always having to look it up.

Here is a guide for Ubuntu Intrepid

Google Product Search Xml Generator

April 16th, 2010 by pyrat

I have been working on a google base product search xml feed generator. It is in the form of a semi-customizable rake task. I have released this as a kind of rails plugin.

rake googlebase:generate generates an xml file of your products.

Configuration

To configure, add Rails.root/config/google_base.yml

Example google_base.yml file in files/google_base.yml

As the structure of the xml is dependant on your product models I have left it to the programmer to modify the google.rake file and set the correct instance methods for returning product information, along with the named_scope for returning live products.

TODO:

Instead of editing this rake file manually it would be good to add a plugin type class method which can take the configuration of your products and generate this automatically.

Its is available on github

Jquery Assertion for Rails

April 10th, 2010 by pyrat

When doing functional testing of ajax actions it is nice to be able to test the format of the javascript returned to the browser.

When using rjs I was using the excellent arts testing library, now I have moved to raw jquery instead. The method below provides a short hand way to test simple jquery methods. it can be built upon for sure but this little regex is quite powerful.

  def assert_jquery(effect, id)
    assert_match(/\$\(['"]+##{id}['"]+\).#{effect}\(.*\);/, @response.body)
  end

Consider the jquery

$("#announcement").hide();

  assert_jquery('hide', 'announcement')

This currently only works for id methods and when jquery isnt in compatibility mode. Also integration testing using something like env.js and harmony is a better way of javascript testing. Things like blue ridge actually integrate the env.js framework into a rails plugin and are a great solution if you have to do some real heavy lifting.

However, this method brings maximum results for minimum effort.

Kazakhstan Avalanche Control

April 9th, 2010 by pyrat

Often the ski patrol does avalanche control after a big dump. You normally hear it before you get out of bed.

Here in Kazakhstan the ski patrol might have had one too many vodkas as the avalanche control didnt go so well!

Php Code Beautifier Textmate Bundle

March 24th, 2010 by pyrat


Make your manky pretty.

I think this could me my first php blog post ever! I am normally so excited about ruby and related technologies that my involvement with php has wained over recent years.

I think this is a good thing as I can now see that PHP is not as good as its Python and Ruby colleagues. However, recently I have been unable to choose technology and have been working on a number of php projects at work.

Using textmate as my weapon of choice (instead of eclipse based IDEs which are more common) I have come to use the ruby code beautifier bundle a lot when crafting elite ruby code.

I have put together a code beautifier bundle for textmate which makes dirty php code look prettier.

The actual beautifier php class was modified from the original . This is a relatively crude beautifier and could do with some fine tuning to improve a few annoyances. If you feel like helping please fork the project on github and give me a pull request.

Happy tarting!

Install Mysql Gem on Snow Leopard and Macports

March 8th, 2010 by pyrat

export ARCHFLAGS="-arch i386 -arch x86_64" ; gem install --no-rdoc --no-ri mysql -- --with-mysql-dir=/opt/local/lib/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config

Ski Touring Equipment List

March 8th, 2010 by pyrat

Juratind Summit Ridge, Romsdalen
Juratind Summit Ridge, Romsdalen

In my continuing quest for not being as slow to pack for weekends away I have included a packing list for a weekend ski touring trip.

Equipment

  • skis
  • boots
  • skins
  • transceiver
  • shovel
  • probe
  • map + compass in map case
  • food (enough for tour plus a little extra)
  • strap (for attaching skis together on back)
  • poles (collapsible)
  • ski leashes
  • rucksack 35l

Tour Dependent

  • crampons
  • ice axe
  • walkie talkies + charger

Clothes

  • jacket lightweight
  • jacket beefy
  • waterproof trousers
  • thermal bottoms x2
  • thick gloves
  • inner gloves x2
  • ski socks
  • goggles
  • sunglasses
  • hat x3
  • buff x2
  • sun cream
  • waterbottle
  • thermal tops x3
  • down jacket
  • lightweight fleece
  • watch
  • first aid (incl compeed)
  • survival blanket
  • knife
  • small headtorch w/ spare batteries
  • mobile phone

Civi Stuff

  • toiletries + personal medication (eg. asthma inhaler)
  • trousers x2
  • boxers x3
  • socks x3
  • tshirt x2
  • towel
  • sleeping bag + pillow case
  • trainers

Rails 2.3 Upgrade Notes

February 27th, 2010 by pyrat


In Need of Love and Care

I have written a number of rails applications over the past few years. While new projects are using rails 2.3 I have a number of older applications which I should have upgraded before but havent. Anyway, here is some little notes to take into account when upgrading to rails 2.3. Then from here you are placed well for the upcoming release of rails 3.

  • to_param method issues (fixnum to string)
  • test_helper modifications – class name (ActiveSupport::TestCase and all unit tests need to extend this)
  • add include ActionController::TestProcess to test_helper.rb
  • to silence spec warnings for old unpacked gems – Rails::VendorGemSourceIndex.silence_spec_warnings = true
  • sessions

ActionController::Base.session = {
  :key => '_session_name',
  :secret => 'd00cda5710eab8sdfsdf6c5fe165780074fa5027f50168a0bd0ae2832c05bb4f804a07228b220b67e'
}

In an initializer instead of environment.rb (some plugins access the session in a different manner.)

  • Truncate format is deprecated, update to include :length hash key.
  • If you are defining constants in environment.rb, move them to an initializer to make them play better with tests.
  • To access session_id you first have to call the session. Also, the method of accessing the session id has changed.

The following 2 lines are required to get the session id.

session[:session_id]
id = request.session_options[:id]

List of Equipment for a 1 Week Offpiste Holiday

February 26th, 2010 by pyrat

Drew packing away.
Drew packing away.

I am really slow at packing. In an attempt to reduce the time spent here is a list of stuff I took to Verbier.

  • Snowboard
  • Boots
  • Bindings
  • Thermal tops x4
  • Thermal bottoms x2
  • Jacket
  • Salopettes
  • Large Hip flask (full of Bowmore)
  • Small Hip Flask (full of Bowmore)
  • Snus
  • Wax + Scraper
  • Passport
  • Tickets
  • Phone + Charger
  • Walkie Talkies + Charger
  • Snowboarding Socks x2
  • Normal socks x5
  • Boxers x7
  • Tshirts x3
  • Petzl Tikka + Spare Batt
  • First Aid inc Compeed
  • Knife
  • Spoon
  • Cup
  • MSR Whisperlite Stove + Fuel Cannister
  • Pan
  • Slippers
  • Jeans
  • Lightweight Trousers
  • Food
  • Towel x2
  • Down Jacket
  • Insulated Lumberjack Shirt
  • Shovel
  • Probe
  • Avalung
  • Tranceiver
  • OMM Jirichanca Rucksack
  • Snowshoes
  • Poles
  • Helmet
  • Googles
  • Shades
  • Buff x3
  • Hat x3
  • Gloves x2
  • Inner Gloves x2
  • Sleeping Bag
  • Pillow Case
  • Fleece
  • Ipod Shuffle
  • Camera x2
  • Waterbottle
  • Book
  • Sun Protection