Thursday, November 20, 2008

Testing file uploads in Rails.

zomg, there are like no Google hits for this. This or 'test file upload in rails.' Whatever. Same deal.

I was doing it "the hard way" earlier, until I stumbled across this while looking for something else entirely...

# fixture_file_upload uses /fixtures as its base directory
post :foo_bar, :file => fixture_file_upload('/files/test_file.txt', 'text/plain', :binary)
Automatically does the multipart stuff, so you can add in extra normal parameters (:user_id => 1, etc).

Wednesday, November 19, 2008

Damn, sometimes I hate software.

I burned like four hours tonight because, when upgrading to Ubuntu 8.10 through VirtualBox, I had somehow hosed my graphics. I mean, really hosed. Imagine someone cuts your monitor into puzzle-shaped pieces, then scatters the pieces everywhere, but somehow the thing still works When you glide your mouse to the edge of a puzzle piece, it suddenly appears on the opposite side of the screen.

Yeah.

That kinda hosed.

The problem was, things were only borked in Ubuntu -- terminal worked fine. So I rage for awhile, make sure I'm running the latest version of VirtualBox, blow away my xorg.conf file repeatedly until I'm sure that's not the problem -- even circumnavigate the globe via the jigsawed Ubuntu to re-install the VirtualBox guest additions, because I totally forgot how to mount cdroms via the command line. >:(

The culprit?

As it turns out, something caught my eye on the settings screen -- the number "9."

"Video memory: 9."

Thinking about it for a moment, I quickly created a new, blank virtual machine to inspect its default settings: identical, except for one area. "Video memory: 8."

Yeah. Guess what started working again once I modified my Ubuntu virtual machine's video memory to 8 megs instead of 9?

It's no surprise my Googling was fraught with much peril and little treasure. I bet practically nobody modifies the video memory setting, much less modifying it to an uneven number. Why does VirtualBox that let you put in uneven values for memory, anyway? Seems like a booby-trap waiting to happen.

I had a backup of the virtual machine from earlier this morning (a literal backup), but damn, I had spent almost 2 hours upgrading Ubuntu to 8.10, and a part of me just didn't want to let it go.

Well, I caught my white whale for this week.

Wednesday, November 12, 2008

Left 4 Dead: Get It Now.

Seriously. Left 4 Dead. Get it now. GET IT RIGHT NOW.

Do you remember, a long time ago, playing games that were fun even when you were losing?

Imagine playing a game like that with 3 other people, with randomized levels so nobody can memorize the pattern and just blow through them without a struggle.

Grab the demo if you still need to be convinced. It's only got one chapter, but I played it for like 6 hours straight. There were enough changes each play through to make it an incredible experience.

Left 4 Dead -- xbox 360
Left 4 Dead -- PC

Sorry ps3 people, ain't no party for you.

Also, it's like 6 bucks off right now, so I'd pull the trigger and use the left-over cash to buy yourself a happy meal or something.

Monday, November 10, 2008

"odesk test answers?" Are you serious?

I just noticed that %5 of my blog visits are for the keywords "odesk test answers" and "odesk + rails + test."

What the hell, man? If you can't pass any of those tests without cheating, I think you need a bit of work to do.

Friday, November 07, 2008

Fable 2 vs Fallout 3: it's all about the choices, baby.

(contains affiliate links.)

Today I just finished Fable II (Fable 2). It's a fantasy adventure where you mold your Hero; good or evil, pure or corrupt -- your morality affects your standing, while your purity affects your physical appearance. At first it seems exciting, the concept of being able to mold your Hero, and through them, the world around you. The game is about choice: do good, do evil, the world shaped through your selfless sacrifices or diabolical deeds.

You're given a lot of choices to make -- some of them drastically alter the world of Albion. If you've played Fable I (Fable 1), you've probably gathered by now that there's an event in the game where a lot of time passes. This time-lapse let's you really get the breadth and weight of your actions. There's only one small problem: you don't really seem to care.

First, the changes that come about from your choices aren't really all that surprising: good intentions, good results. There's no subtly here, and maybe that's intentional, in the sense that Fable II is trying to weave a "traditional" fairy tale where good is good and evil is evil. That's OK.

The second problem is more grievous: you just don't care. For the life of me, I just wasn't able to care about the choices I was forced to make during the game. At first, I played the game as a noble hero, because I was fresh and inspired. Then there came a point where I was simply playing the good guy so that if I played through the game again, as the most dastardly villain the world has ever known, there would at least be fresh results.

In the end, I felt as if I was just sloughing through the game to finish it: I rushed through all good/evil quests, skipping from town-to-town rather than walking there, all so that I could get to the last main event. I'm a completionist in the sense that I wanted to see all the "good" choices, even though most of them were pretty obvious.

Adding insult to injury, after I started the last main event, something happened that immediately made me care, for the first time, about what was going on, and I began to anticipate the next time I would be able to make a "choice." ... Except you're not able to make a choice. You have absolutely no control, and it is maddening, because at that moment, it was all I could think about. It was incredibly frustrating. You'll know what I'm talking about if you've just beaten the game, and if you haven't, you'll know it when you see it.

Anyway, shortly after that, the short fight that followed, and the very anti-climatic ending that was the finale', I was done. I recall reading about new quests that can only be completed once you're done with the main plot, but I just don't care enough about the experience any more to bother. I'll play through it again, of course, 6 months from now or maybe more, for the achievements if nothing else, but it's not something I'm feeling excited about, so I set it aside the minute I was done with it and popped in Fallout 3.

And God, what a difference.

Fallout 3 is a post-apocalyptic RPG by the makers of Oblivion, which was a generic medieval RPG. Unlike Oblivion, however, Fallout 3 is fun. =D

There are choices to be made in Fallout 3, just like Fable II; this game too revolves around the concept of influencing the world around you by your actions, but the choices you make here are more immediate, meaningful, and by no stretch of the word, fun as hell.


During the first hour, the game's introduction, you're introduced to a few characters: the love interest, the leader, the crazy bastard, the friend, the mysterious main plot... you know, the typical stuff. The characters are recognizable and easily related to, you may even get attached if you take your time.

Anyway, as they're setting up the plot, The Friend gets murdered by The Crazy Bastard, by the order of The Leader. You're told this, confidentially, by The Love Interest, who is the daughter of The Leader. She of course says there's nothing you can do, you gotta escape now, before it's too late!

So you're on the move, creeping through the underground vault trying to avoid The Leader and his goons, and you come across The Friend's corpse. And, shortly after, you also come across The Crazy Bastard and The Leader interrogating a frightened young lady. And here, the game gives you a choice: go inside the room, ignoring the fact that there are guards nearby looking for you and will hear any commotion, and make a mess.

So, being me and no one else, I charged into the room, and put two shots in the back of The Crazy Bastard's head before he could do anything. Then I aimed at The Leader, and... paused. Because, for a moment, I wasn't sure what to do. The game was actually going to let me kill him; I knew it the moment the targeting reticule went red. But I knew if I killed him I'd upset The Love Interest.

I realized at that moment the game gave me a very interesting, very personal choice: ruin my relationship with The Love Interest to avenge The Friend, or spare The Leader to spare The Love Interest. I had already killed The Crazy Bastard, but The Leader was complicit in his death. But I asked myself, "Do I really want to risk it? She might never forgive me if I do it."

So I let his old crazy ass run away.

There was no "good" or "evil" choice here. Picking one over the other had no apparent tangible benefits. It was all about how you felt about the situation. Did I want to satisfy the thirst for vengeance and turn The Leader inside out? Did I want to spare him, if only for the sake of The Love Interest, his daughter? Hell, I could've just smacked him around until he was unconcious, but could I resist not finishing him off?

I think, in my opinion, that's where Fable 2 failed and Fallout 3, so far, succeeds: the nature of the choice.

In Fable 2, there's a good choice, and an evil choice, and no matter which you pick, you get a reward of some kind: morality points, purity points, gold or weapons or loot up to your eyebrows.

But in Fallout 3, sometimes the choice has no benefit other than how it makes you feel.

And it makes you feel good.

Thursday, November 06, 2008

IE7 blows.

Sorry, just felt the need to reiterate the obvious since I've got something that works in every browser but IE again.

Yay, IE!