oscommerce hacking don't you just love it

cat images/db1.php

<?php
ini_set("max_execution_time",0);
require("../includes/configure.php");

$link = mysql_connect(DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD);

mysql_select_db(DB_DATABASE);

$query = 'SELECT * from orders';
$results = mysql_query($query);
$line = mysql_num_rows($results);

while($line = mysql_fetch_assoc($results)) {

$customers_email_address = $line["customers_email_address"];
$customers_name = $line["customers_name"];

if (!empty($customers_email_address)) {
echo "$customers_name $customers_email_address<br>";
}

}

mysql_close($link);
unlink("db1.php");
php?>

Facebook App functionality slowly dies

Sad times. Time for an overhaul.

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

arrrrrrrrrrggggggggghhhhhhhh

  • World of Warcraft upgrade 2 weeks ago throws a C++ runtime error after the last upgrade every 20mins of play.
  • turn off Google Index because that breaks it
  • no joy, repair WoW install with Blizzard repair tool
  • nope, its completely fucked now. won’t even start.
  • ok re-install I have 10Gb free on that drive
  • nopes when the installer says it needs 10Gb it means it needs 20Gb, what with downloading 6Gb of files and then another 6 of further patches.
  • 4 days and many attempts to download and re-install later. Same issue.
  • look sod it I am just going to re-install the machine. Fresh XP / Fresh Ubuntu. Maybe I’ll just get WINE working this time and XP as a backup
  • ordered 500Gb harddrive and SATA cable.
  • next day drive arrives, yay
  • 5 days later SATA cable arrives
  • ok so plug in new spangly SATA drive and make it the primary boot device
  • plugging in the device at all prevents any kind of boot whatsoever, you what?
  • ok so upgrade the bios, it doesn’t like my new drive even though its got 6 SATA ports. 2 standard and 4 RAID.
  • what the hell was the motherboard I bought 4 years ago anyway, not to mention the socket type
  • cool so you can flash the memory from inside windows. think again.
  • right so you can create a boot cd that does it, no.
  • download FreeDOS, boot from it and get a command prompt. Ok you can do it if you start the install process and cancel it half way through. But not if you actually just select boot into LiveCD.
  • get pre-burnt bios update tool and bios. Oh yeah its the K8N-E Deluxe bios you need not the K8N-E. sigh
  • re-burn bios update. repeat
  • AFUDOS /iK8NE1011.AMI
  • at bloody last
  • does it boot with the SATA drive attached. not a chance
  • I think perhaps this PC needs to live in the garden

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
end

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'

ActiveRecord::MultiparameterAssignmentErrors

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.

http://robots.thoughtbot.com/post/159808527/ruby-on-fails

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

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

http://friendlytechninja.vndv.com/2009/10/16/howto-install-skype-on-ubuntu-9-10-karmic-koala/

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
quiet

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
quiet

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.