TheRubyMine - Italian Ruby/Ruby on Rails assets

I am happy to see that TheRubyMine is online and so if you are interested in the Italian Ruby and Ruby on Rails community then you should take a look and perhaps even take part.

It is still early days for them but give them some time and I am sure they will start causing trouble… hmm I hope it won’t be long before I join in with the fun!

Experiences in emulating BeOS in OSX

Update: it is probably a much better to look at the official Haiku wiki for more up-to-date information.

A couple of nights ago I decided that it was time to see if I could get BeOS to work on my iBook (it worked but it was very slow). The only way I could get it to work was with emulation. I found the information on various places on the Internet but I forgot to note down where I found it from so I am recreating it here (so that at least I don’t forget how it was done).

For now I am trying to use just the simple BeOS 5 Personal Edition.

  • Download the BeOS R5 Personal Edition for Linux from BeBits
  • Extract the file that you just downloaded and if you want to, place image.be and floppy.img somewhere
  • Install qemu which is a PC emulator. I installed it from http://stegefin.free.fr/qemu/qemu.dmg as suggested on the Haiku Wiki

At this point, you should open up a Terminal window and cd to the location where image.be and floppy.img are. Both files are needed to get BeOS PE to run and so the following should be typed:

qemu -fda floppy.img -hda image.be -boot a -m 128 -user-net

# -fda floppy.img
# The floppy disk is floppy.img

# -hda image.be
# The hard disk is image.be

# -boot a
# Boot from drive a

# -m 128
# Provide 128 meg of memory

# -user-net
# Creates a private network (?)

After a while BeOS will be running in greyscale. Either I would have to enable the safe video mode everytime I booted BeOS or I would have to use one of the pieces of software on BeBits to force the video mode. I couldn’t get the network to work so I was stuck with the problem of how to transfer files to BeOS. I tried to make a dmg but it didn’t work so in the end I made a CD image using the following command:

hdiutil makehybrid -o stuff_for_beos.iso -iso DIRECTORY

At that point the CD image can be passed to qemu by adding -cdrom ISONAME to the qemu command:

qemu -fda floppy.img -hda image.be -cdrom stuff_for_beos.iso -boot a -m 128 -user-net

Messy site

Well something seems to have happened in the past couple of days or perhaps it has been weeks and I never noticed. For now I am reverting to a wordpress version, but surely something doesn’t work.

It is quite troublesome and makes me wonder if I should just hand-cruft some html again but those would be dangerous waters indeed…

BeOS apps

I am wondering if I should bother making the source code to my old BeOS applications available… does anyone care at all?

rubyonrails - beware of similarly named relationships

I recently developed a rubyonrails application in which a user had a province (as part of their address) and also a collection of selected provinces.

class Users
  belongs_to :province
  has_and_belongs_to_many :selected_provinces, :class_name => "Province
end

I could very easily find out which provinces a user had selected and also which users had selected a specific province. However I didn’t realise that if I accessed a user via the province then the province_id which previously pointed the user’s address province was replaced by the id of the selected province.

province = Province.find_first
province.users.each do |user|
  # do something
  # however user.province_id now points to province
end

I assume the province_id is added by the habtm join so that we can understand which selected_province object this user object comes from however in my case it meant that I lost the original province_id and so if I saved that user then I would end up changing the address province.

This is probably not a bug as such but something that should be watched out for as it took me a while to discover this problem with my application.