Facebook App functionality slowly dies

Sad times. Time for an overhaul.

On a good note Bob Slayer is quite possibly the funniest man alive.


OK so more googling

disable enter key in jQuery

Fed up of accidentally submitting forms with the enter key, of course you probably need to be able to do newlines in text areas.

$("body").keypress(function(e) {
  if (e.which == 13 && !$(e.target).is("textarea")) {
    return false;

Or if you want to be more specific.

$('form input[type="submit"]').keypress(function(e) {
  if (e.which == 13) {
    return false;

back in the day...

…when beans and sausages where smaller. And my computer was a little less powerful and complimercatered.

Amstrad CPC 464

8 games on a D90 with crude start/stop sticker marking on the side. Under 10 and already a software pirate

Amstrad CPC 6128

faster 3.5" floppy games, but its cheaper to buy a tape deck and games for £2.99 from the camera shop. You have all the time in the world when you’re 8

Good times…

customising spec_helper.rb

I’ve never really looked at spec_helper.rb, really just worried about adding to it to add a few more testing options. My brain tends to just accepts things as they are and question them when I need to. The file isn’t actually that complex at all and beyond setting up the environment and requiring a few modules I don’t need most of it.

# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
require 'spec/autorun'
require 'spec/rails'

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

Spec::Runner.configure do |config|
  # If you're not using ActiveRecord you should remove these
  # lines, delete config/database.yml and disable :active_record
  # in your config/boot.rb
  config.use_transactional_fixtures = true
  config.use_instantiated_fixtures  = false
  config.fixture_path = RAILS_ROOT + '/spec/fixtures/'

  # == Fixtures
  # You can declare fixtures for each example_group like this:
  #   describe "...." do
  #     fixtures :table_a, :table_b
  # Alternatively, if you prefer to declare them only once, you can
  # do so right here. Just uncomment the next line and replace the fixture
  # names with your fixtures.
  # config.global_fixtures = :table_a, :table_b
  # If you declare global fixtures, be aware that they will be declared
  # for all of your examples, even those that don't use them.
  # You can also declare which fixtures to use (for example fixtures for test/fixtures):
  # config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
  # == Mock Framework
  # RSpec uses it's own mocking framework by default. If you prefer to
  # use mocha, flexmock or RR, uncomment the appropriate line:
  # config.mock_with :mocha
  # config.mock_with :flexmock
  # config.mock_with :rr
  # == Notes
  # For more information take a look at Spec::Runner::Configuration and Spec::Runner

So now here’s my one now, I don’t need custom matcher includes as remarkable has plenty for me to get on with, and I’ve replaced the default fixtures which I don’t use anymore set up with machinist .

# default
ENV["RAILS_ENV"] ||= 'test'
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
require 'spec/autorun'
require 'spec/rails'

# machinist
require 'machinist/active_record'
require 'faker'
require File.dirname(__FILE__) + '/blueprints'

# remarkable
require 'remarkable_rails'


interesting bug, ever heard of this one ActiveRecord::MultiparameterAssignmentErrors?

So, on your social networking site the person signing up want’s to expose their birthday so they can get loads of best wishes but is a bit conscious of their age.

>> Person.new("born_on(1i)" => "", "born_on(2i)" => "4", "born_on(3i)" => "25")
ActiveRecord::MultiparameterAssignmentErrors: 1 error(s) on assignment of multiparameter attributes

This has only occured ocassionally, not everytime someone doesn’t want to set their year of birth.

born_on(1i) : year
born_on(2i) : month
born_on(3i) : day

>> Person.new('born_on(1i)' => '2012', 'born_on(2i)' => '12', 'born_on(3i)' => '12').born_on
=> Wed, 12 Dec 2012
>> Person.new('born_on(1i)' => '', 'born_on(2i)' => '12', 'born_on(3i)' => '12').born_on
=> Thu, 01 Dec 0012

It turns out the assignment gets really confused when it is nil, or at least when the first interger is nil it removes it and sets the first integer it finds to the year, the second to the month and the third…well it sets it to 1, or the first of the month. How annoying. I would have hoped you could validate against assigning incomplete dates, but apparently not.

This breakdown from Thoughtbot demonstrates the process they took to not really solve this problem. Ultimately they used a work around; a before_filter in the controller.


def validate_expires_on
    Date.new params[:job]['expires_on(1i)'].to_i,
  rescue ArgumentError
    params[:job].delete 'expires_on(1i)'
    params[:job].delete 'expires_on(2i)'
    params[:job].delete 'expires_on(3i)'

I guess a before_filter that matches all (i) params could be put in an application wide before_filter to cover every case like this, if arises.

Skype doesn't work in Karmic Koala

I had to uninstall the Jaunty package from Multiverse…

apt-get remove skype skype-common

…and then re-install the 8.10+ version from Skype. You may need to restart pulseaudio and mute and un-mute the microphone it working again.

dpkg -i http://www.skype.com/go/getskype-linux-beta-ubuntu-64


Karmic Koala doesn't actually add the kernel to menu.lst

I had sever issues this morning after last night’s upgrade from Ubuntu Jaunty to Koala. Xorg was constantly at 98%, sound was broken, and the whole system was completely unresponsive.

Looking in /boot/grub/menu.lst I noticed the upgrade hadn’t actually added the new kernel at all. So I copied to config for the previous kernel and updated it to the new 2.6.31-14 kernel and on reboot we have sound and Xorg is now playing nicely at about 2% CPU. Panic over.

title   Ubuntu 9.10, kernel 2.6.31-14-generic
root    (hd0,0)
kernel    /boot/vmlinuz-2.6.31-14-generic root=UUID=a3c5e83c-f5f2-4704-8bd9-530ecf71f9e5 ro quiet splash acpi_osi="Linux"
initrd    /boot/initrd.img-2.6.31-14-generic

title   Ubuntu 9.04, kernel 2.6.28-11-generic
root    (hd0,0)
kernel    /boot/vmlinuz-2.6.28-11-generic root=UUID=a3c5e83c-f5f2-4704-8bd9-530ecf71f9e5 ro quiet splash acpi_osi="Linux"
initrd    /boot/initrd.img-2.6.28-11-generic

HR Giger Ibanez

I saw this about a year ago, it doesn’t have 7 strings….but its the most gorgeous piece of electromological greatness I’ve seen in a while. I guess the only issue is that I wouldn’t want to ruin a work of art by actually playing it.

Shirts and Destroy

My favourite independant T-Shirt manufacturer and store, Shirts and Destroy have two new Agoraphobic Nosebleed shirts in stock.

Just a quick quote from their site…

The profits for the items you buy here go to the Bands and Artists we work with. So you really are SUPPORTING these bands and artists when you shop with us. We strictly work with people who’s art we respect and admire. Nothing is sold here that we don’t stand behind artistically 100%. If something offends you were not sorry… this isn’t the mall. Thanks for helping us do our part in supporting independent art and music.

Basically, they rock! Help support the bands you love.