Unzipping palm apps on a nintendo ds

Yesterday we wanted to play 3D tictactoe on my palm, but we didn’t have any such game. Now I could have used OnBoardC or plua to ‘quickly’ write a game but I didn’t have 2 weeks or a collection of icons at hand. Instead I found myself using Opera on my Nintendo DS to browse the internet but I couldn’t download the zip file.

So, rebooting into DSLinux (using a supercard and sd card) I could use wget to download file to the memory card and then unzip it.

All I needed to do then was put the memory card in the palm and copy it … after playing the game I wished that I could write the game for the Nintendo DS.

Childrens TV in the UK

This is more of a note to myself, but when I was a lad at lot of the children’s drama that was shown on childrens tv was Australian or from New Zealand. Thinking back it was quite impressive as there was (as far as I can remember):

(all links point to wikipedia)

Does anyone remember anything else?

Site upgraded

Well, I upgraded to wordpress 2.1 and I thought everything was fine, but as I forgot to copy over some files many of the pages stopped working :( I suppose I should really try and check for such things in the future! Well, I have a couple of changes coming up, so I’ll cross my fingers and hope that I get them working…

an assert_difference that works with arrays

I have started using the better assert_difference that was posted at blog.caboo.se to improve my rails tests. This allowed me to write tests such as:

assert_difference Item, :count do
  Item.create(:name => "Monkey magic")
end

# This replaces:
#   item_count = Item.count
#   Item.create(:name => "Monkey magic")
#   assert_difference, item_count + 1, Item.count

but I also wanted to be able to test if emails were sent by writing:

assert_difference ActionMailer::Base.deliveries, :size do
   SystemNotifier.deliver_important_message
end

That didn’t work and it was noted on that website that the code didn’t work properly with arrays so I have modified the assert_difference method to check if the objects respond to the method (e.g. size) and act accordingly:

def assert_difference(objects, method = nil, difference = 1)
  initial_values = []

  if objects.respond_to? method
    initial_values = objects.send(method)
  else
    objects = [objects].flatten
    initial_values = objects.inject([]) { |sum,obj| sum << obj.send(method) }
  end

  yield
  if difference.nil?
    objects.each_with_index { |obj,i|
      assert_not_equal initial_values[i], obj.send(method) #, "#{obj}##{method}"
    }
  else
    if objects.respond_to? method
      assert_equal initial_values + difference, objects.send(method) #, "#{objects}##{method}"
    else
      objects.each_with_index { |obj,i|
        assert_equal initial_values[i] + difference, obj.send(method) #, "#{obj}##{method}"
      }
    end
  end
end

I have tested it for an array such as ActionMailer::Base.deliveries but I haven’t tested it in other situations so hopefully it won’t create any problems.

The rspec version of this is:

def assert_difference(objects, method = nil, difference = 1)
  initial_values = []

  if objects.respond_to? method
    initial_values = objects.send(method)
  else
    objects = [objects].flatten
    initial_values = objects.inject([]) { |sum,obj| sum << obj.send(method) }
  end

  yield
  if difference.nil?
    objects.each_with_index { |obj,i|
      initial_values[i].should_not_equal obj.send(method) #, "#{obj}##{method}"
    }
  else
    if objects.respond_to? method
      (initial_values + difference).should_eql objects.send(method) #, "#{objects}##{method}"
    else
      objects.each_with_index { |obj,i|
        (initial_values[i] + difference).should_eql obj.send(method) #, "#{obj}##{method}"
      }
    end
  end
end

Hiragana/Katakana quiz update

I have updated the hiragana and katakana quizes and I hope they are now easier to use.

I have split the text box on the question page into multiple text boxes so that there is one for each hiragana or katakana. I hope that this is clearer than the previous version where one had to insert a space between each romanji.

The results page might actually be useful now as it shows you not only how many times you got a katakana or hiragana correct, but also how many times you got the row of characters (e.g. the ‘k’ row with ka, ki, ku, ke, ko) right so you can decide to reconfigure the quiz and choose some different rows.

As always, the quizes can be found at quiz.kumo.it so enjoy! If there are any problems, or you don’t like how I have changed something, or you have new ideas please write to me on my guestbook or at kumo@kumo.it.