Over at Railscasts, The Honourable Ryan Bates,
Esquire1 has been churning out quality screencasts FOREVER. And
while some of them become somewhat obsolete as Rails itself changes, they're
still a better starting point than most of what's available on the web.
One that I happened to view recently concerned
application configuration
for your Rails app being stored in a .yml
file. This brings site
configuration in line with database, fixtures, etc. As usual, Ryan gives you
exactly what you need to adapt things to your situation. So I did. This is
my ApplicationConfiguration class.2 It basically gives you a global
::AppConfig
object, which allows you to reverence any of your configuration
settings from a single place. It supports nested configuration,
and automatically selects the right environment (test, production, etc).
If you're following along at home, I got my Gentoo install
extracted and running on physical
disk. Now I have a problem to solve: Dual booting with Windows. This is
only a problem because my Windows install is on a RAID0 array using an Intel
fakeraid controller. I found all kinds of info on dual-booting Windows/Linux
while both are installed in the raid array, but nothing to help with my
situation. So here we go.
Attempt #1 :: GRUB on the Linux drive
My first attempt was to setup GRUB on the Linux drive, and tell the BIOS to
boot off that. I knew I should add an entry to grub.conf
to reference the
Windows drive and call chainloader+
, but as I was typing it out I realized
that I didn't have a way to reference it. My Spidey Sense� was telling
me I'd need an initrd with all the raid info in it, so GRUB would know how to
talk to the entire RAID drive. That sounds like work. Moving on.
I decided to convert one of my Gentoo VirtualBox installs to physical disk
(ie. convert Virtual -> Physical ). This sounded pretty straightforward,
but after a bit of Googling, all I had found were a bunch of articlesi
explaining how to take a physical partition and convert it to a .vdi. This
was exactly the opposite of what I wanted to do.
Finally, I found this
wiki article, and it all came together.
Preparing the disks
I had a spare SATA drive laying around, so I powered off the machine and popped
it in. Using my trusty Gentoo install CD, I partitioned the Linux disk. My
Virtualbox install had a disk layout like this:
I was having some updates fail on my machine here at work (KB983583, KB2279264,
KB2277947, and KB2251419 specifically), and couldn't seem to find any
resolution. All the "FixIt"s from Microsoft crashed, and nothing in
this
article seemed to help either.
Probably the strangest first blog post ever, but here goes. I'm migrating a
product from Classic ASP to Rails. The bulk of its data is accessed via a
TCP service, which accepts/responds with XML. Unfortunately, it's a custom
protocol, so I'm forced to do all the packet building/transport myself. No big
deal.
The top level resource is a list of accounts. These accounts don't change over
the course of a session, so I'm caching them to avoid the round trip. This
list of accounts is referenced in some way on every page, so fast access to a
particular account is important. I started out by writing a custom find
method, which took a hash of arguments. This works, but looks weird next to
all the other ActiveRecord goodness in the app. Enter:
Findable.