A 1000 Blank White Cards Initial Migration for Rails

class FirstWhack < ActiveRecord::Migration
def self.up create_table :cards, :force=>true do |t|
t.column :title, :string, :null=>false # Name of the card. "Jumpin' Jesus on a Pogo-Stick"
t.column :img, :string # A fully-qualified URL or local filename. Null implies "blank"!
t.column :effect, :string # Psuedo-code. Ex: "modify 1 cards where target has tag 2" Optional
t.column :action, :string # Describe the effect. "Play on a blue card--change the image." Optional.
t.column :points, :integer, :null=>false, :default=>0
t.column :player_id, :integer # Current owner, null is discards
t.column :game_id, :integer, :null=>false
t.column :created_at, :datetime, :null=>false
t.column :created_by, :integer, :null=>false # fk to players
create_table :tags, :force=>true do |t|
t.column :name, :string, :null=>false
create_table :cards_tags, :force=>true do |t|
t.column :card_id, :integer, :null=>false
t.column :tag_id, :integer, :null=>false
t.column :player_id, :integer # Who created it? If null, it was auto-added (ex: "blank")
t.column :created_at, :datetime, :null=>false
create_table :players, :force=>true do |t|
t.column :name, :string, :null=>false, :limit=>128
t.column :born_on, :date, :null=>false # So we know their age (and birthday?) - play will be youngest -> oldest
t.column :email, :string # Notification of turns. Optional.
t.column :img, :string # Full URL or local filename. Optional.
# Apparantly we've got a Catch-22, here: I don't yet have a Player object. Hmmmn.
# jr = Player.create :name=>"Jeremy Rice", :born_on=>Date.civil(1974,8,7), :email => "jrice.blue@gmail.com"
create_table :players_tags, :force=>true do |t|
t.column :player_id, :integer, :null=>false
t.column :tag_id, :integer, :null=>false
create_table :games, :force=>true do |t|
t.column :name, :string, :null=>false # Name of the game: "Teh Interwebs is 4 p0rn///"
t.column :current_player, :integer # Null until the game starts. Fk to players.
t.column :turn_order_sort, :string, :limit=>4 # Null for ASC, otherwise "DESC".
t.column :created_at, :datetime
t.column :started_at, :datetime
create_table :games_players, :force=>true do |t|
t.column :player_id, :integer, :null=>false
t.column :game_id, :integer, :null=>false
t.column :ready_to_start_at, :datetime # Null until the player has created their first 5 cards.
t.column :joined_at, :datetime
# This will store each play in a game. Useful for undos, but might also produce a kind of history.
create_table :plays, :force=>true do |t|
t.column :player_id, :integer, :null=>false
t.column :game_id, :integer, :null=>false
t.column :card_id, :integer, :null=>false
t.column :comment, :text # Jibe from the player; optional.
t.column :targets, :text # Not yet sure how I'll store this, but it'll be an array of objects.

def self.down
drop_table :cards
drop_table :tags
drop_table :cards_tags
drop_table :players
drop_table :players_tags
drop_table :games
drop_table :games_players
drop_table :plays


Today's thought-in-the-shower was:

Angry → stupid.

For the most part, the word "angry" and its derivatives can be substituted for "stupid".

  • "I got stupid at my son last week."
  • "Obnoxious drivers make me stupid."
  • "9-11 make a lot of Americans stupid."
...Really, this makes sense. Biochemically, anger must be releasing some rather nasty hormones that interfere with logic.

Same with being horny. : ) ...which is another word that clearly maps to "stupid".

Speaking of which, it dawned on me that people who use "Men can't help themselves sometimes" as an excuse for why women must dress appropriately at all times is akin to arguing that no one should be offensive because they're at fault when people hit them.

Okay, that thought isn't stated elegantly. But I'm tired. ...I woke up with an idea to make Blank White Cards into a Rails app. I couldn't sleep: I had to draw out the ORM and some ideas on a mini-parsing language for the "actions" at the bottom of cards.


[insert some joke about geekery mapping to stupidity here]

Ubuntu, Here I Am

Done! Voila! I write this from Firefox within Ubuntu.

...Not quite a cakewalk. ...Much to my chagrin, the installation page has this "Please Wait" screen after handling your video card. This is highly unusual, in my experience, for a Linux app to do: usually such screens (and indeed, the REST of the installation) kindly tells you exactly what it is up to. So my assumption was that the process had crashed, after the "Please Wait, 6%" screen stayed up for 20 minutes. I tried twice more (changing some suspected settings), and got the same results.

But I grabbed my wife's laptop and dug into the Ubuntu install docs, and, lo, they explain that packages are installed on TTY4 during this process, so you can switch over to view them, if you care to.

The dialog should say as much. Harrumph.

Anyway, I'm off to run the additional installation pacakges... getting ruby, mysql, The GIMP, and whatever else strikes me as missing. There's also a bunch of Linux music apps to check out. ...Oh, and I'd like to grab WINE (though Ubuntu kindly set up a dual-boot system, so I don't need it).

Awesome. I'm glad I did this. Linux in under 24 hours, and without a CD drive. : )

Not bad.

Ubuntu, Round 2

The thumb drive image was corrupt.

I don't know why, but after I copy the boot sector image to /def/sdf, it ends up changing the size of the volume to 16 Meg. Weird.

After re-trying that in vain a couple of times, I decided to follow the long way around, which involved installing syslinux, running that (there's a win32/ subdir with an EXE in it, takes a drive letter as an arg), and then copy "files from the Ubuntu archives" to the disk. Archives? WHAT archives?!? No clue.

[dig dig]

Oh, you mean THESE archives. Okay. ...But where the heck ARE They?!? No clue.

[poke poke]

It looks like two of the files are available, but the other one (which I guess is optional, really) isn't there. Hmmn. It occurs to me that the image that I unpacked (and which mucked up the format of my stick) has these files on them. Perhaps I'll grab another (small) stick and unload the image onto it, copy the files to my HD, and yada yada. Sure... let's do that and be safe. -Ish.

The smaller stick came up with a different drive letter (why?), but was still mounted on /dsv/sdf, so I copied the image over to it, ejected it, put it back in, noted that it, too, was reduced to 16 Meg, and copied all the files over to the disk. So far, so good.

Format the small stick (to bring it back to 64 Meg, grr), and eject it. Pop the big 'un back in. Copy all the files over to it. Whee. I peek at the file that was missing from the archives and see that, yeah, I probably wanted that... it seems to have prompts and what-not, probably making the install easier. I hope. There's a note on the Ubuntu site about how this file should contain a line saying "default vmlinuz", but I guess this is bullshit: the default directive (install) seems to point to a viable set of commands. I trust in the file as-is. Last step: copy the ISO image over to the (now big) thumb-drive. This takes 4 minutes: it's a big one.

And now it's time to reboot.

If you don't hear from me in 4 hours, call the President.


So, I did research on Linux tonight, and I'm edgy about the whole thing. I wondered what I would really be gaining, besides "sticking it to Windows".

I suppose I'd be learning lots of new geekery. That's worth something.

Regardless, I decided to go ahead and try out Ubuntu in the short-term, perhaps switching to SuSE if I decide I really can live with Linux and no Windows. It couldn't hurt too much, right?

My CD-drive is fried, so I can't write the ISO image to a disk and boot with that. I do have a handy 1Gig thumb drive, however... but the instructions say that you need to build the thumbdrive with a Linux system. Hmmmn.

I thought perhaps I could cheat with Cygwin, which I have installed (another reason I'm feeling odd about the move)... but it turns out you can't redirect STDOUT to a directory. No worries, I'll just go... to... /dev... wha?!? There's no /dev in cygwin.

[dig dig] Okay, there is /dev, but for some unexplainable reason, they hide it from you. You can still type /dev/sda and get to the harddrive, for example. Weird. But there's no /dev dir, and you can't see everything that's there. They do, however, point to a utility that makes this possible. I install. I run. /dev appears.

And it's huge. Nothing is clearly the USB drive... and I'm not sure how to find the bloody thing.

I decide to start heading each of the mount points, and I find that, indeed, /dev/sdf seems to be accessing by thumbdrive (by virtue of the fact that the thing blinks as I head it). Neat.

I zcat the boot image to the drive, I copy the ISO image... and... OH MY GOD, it's Saturday!

Time for sleep. Plenty of time for this over the weekend: the wife is away, so I'll be bored, anyway.

Fear and trepidation... mixed with perverse glee. We shall see.

Open Source

A very interesting post over at O'Reilly has me thinking about Open Source. The bloke asks what the "most important" Open projects currently are.

My answer (search for "JRice") complains that the question wasn't very clear. ...Still, it's a heart-warming subject, and I loved the thought of it so much I thought I would make a list of projects that I have enjoyed and appreciated over the years (in order that they occur to me):

  • FreeBSD
  • Fedora
  • RedHat Linux
  • GNome, KDE, Enlightenment
  • Perl, Ruby, Python
  • vim (and vi)
  • MySQL
  • pine
  • The GIMP
  • WAMP (Apache, specifically)
  • MediaWiki
  • TWiki (well, I do think MediaWiki is far superior, but... I did use this...)
  • imageMagick
  • GCC (of course!)
  • Wikipedia (not all things "Open" are programs!)
  • OGG Voribis
  • tcsh and bash
  • Mozilla (Firefox)
  • Firefox plugins... particularly FireBug (!), AdBlock, and SessionManager
  • Eclipse / RadRails
  • Java
  • OpenOffice
  • PGP (!)
  • GhostReader
  • YAML
  • Wine :)
  • Jabber
  • SSH (and PuTTY)
...In making this list, I'm reminded of how incredibly rich the Open Source world is, and I'm more than a bit ashamed to think that I hardly run half of these apps today, in lieu of their commercial counterparts. It's making me seriously re-consider scrapping the whole Windows thing on my home machine. Screw.

...There are really two big reasons that I haven't already done this: music and games. But I think it has come time to reconsider this decision. Music is a money pit, and games could easily be switched over to a nice new PS3, which I'd like to get sometime this year, anyway.

And, hey: I have a Windows license... I can just run Wine, when desperate!

I going to do it.

...And, yes, I know I have been profoundly silent, of late. It's mostly because I'm busy on 43 things.


So, Chrsms. The greedy version.

My main gift was a very expensive watch, from my wife. Geek's watch!

The only gift I got from my wishlist was a photography book, which has (20 pages in) reminded me how much I suck as a photographer. ; )

I got a couple of neat display-type items: a chinese (I think) teapot with two cups, and a very cool blue bottle of sake. Nice.

I got an expansion (The Tower ) for Carcassonne. Cool.

I got some money, which we're going to use for a trip... either Vegas (which I would like for Blue Man, Cirque, food, and art), or northern NM (which I would like for the rest... and art).

I got some other trinkets, but they're all relatively minor.

I bought myself HL2: Episode One. Already beat it. Loved it.

The vacation itself was nice and relaxing: we played games, including one that I need: NAQ. We saw Happy Feet. Meh. (Entertaining, sure, but not nearly as good as Pixar films.) We went to the beach, once, where I visited a few nice galleries and a very cool rocks/minerals store. I read The Chronicles of Amber (well, the first half). I worked on my character for our Amber game. We watched a movie and a few episodes of Myth Busters around the house. It was quiet.


Visual Studio

As I've mentioned, we use Visual Studio to write C#, here at work.

Recently, MS released a " service pack" for VStudio. According to their site, "fixes in this Service Pack include stability, perfomance and security enhancements made in many areas of the product."

431.7 MB.

That just doesn't sound like bug fixes to me.

...I'm just sayin'...