Coding: Ruby GUIs, Python, and how to make VIM better for coding

Lately I’ve been checking out Python, partly out of curiosity and partly because I’ve recently been working on a GUI application in Ruby, and to be honest, the GUI tool kits available for Ruby aren’t exactly impressive. WxRuby, which I ended up using, is lacking in documentation and even though it claims to have native look on all platforms, it doesn’t look even remotely native on Windows. No biggie really, but still a minor annoyance. It’s also plagued by a lot of half-implemented and undocumented features, such as the Wx::GridCellEditor, which should allow me to build custom editors for cells in a Wx::Grid, but in reality it allows me to do nothing because of a bug that no one has cared enough to fix. In retrospect I probably should have gone with QT, but hindsight is 20/20 and I’m not going to switch now that I’m nearly done. I actually don’t even need a cross-platform GUI tool kit — a Windows one will suffice — but the state of GUI tool kits for Ruby is so poor that the half-baked cross-platform tool kits are actually the most complete.

So, back to Python. I know there’s an on-going holy war between Python and Ruby, but here’s the exact number of fucks I give about that: 0.00. I’m at the point where I’m thinking “whatever floats your boat”, and Ruby certainly doesn’t float my boat with regards to GUI tool kits, so why not give Python a go? Python and Ruby aren’t that different. Sure, syntax-wise they are, but the basic philosophies of the languages are pretty much the same. I could have gone with C# or even C++ instead, but both of those are very unfamiliar to me and far more removed from the languages I already know.

Python comes with a built-in IDE called IDLE. It’s a pretty decent piece of work done in Python and Tk, but I’m at a point where I can’t use a “normal” text-editor anymore. I constantly hit ‘esc’ followed by ‘dd’ to delete a line, I hit ‘shift-V’ to select multiple lines and try to indent them with ‘>>’, and, without exception, I type ‘:w<enter>’ whenever I want to save the file. In the end, using a normal text-editor (where you save with ‘ctrl-s’, select with the mouse or with ‘shift+<arrow keys>’) actually causes me more problems than just using VIM. While trying out IDLE, I found that I really liked how I could just hit ‘F5′ to run the script (or module), unfortunately VIM doesn’t offer me that. However, VIM being VIM, there is of course a way to set up such a thing. Here’s what I did to my ~/.vimrc in order to emulate IDLE (and other IDEs’) ‘run’ binding:

autocmd BufRead,BufNewFile *.{rb,rbw} map E :!ruby %<CR>
autocmd BufRead,BufNewFile *.{py,pyw,pyc,pyo} map E :!python %<CR>

With this I simply hit ‘shift-e’ in command mode to execute the current file, and depending on the file’s extension (.rb, .rbw, .py, pyw, .pyc or .pyo) it will select the correct interpreter. In GVIM on Windows it will open a Command Prompt and run the interpreter + script in that, while in VIM in a terminal on e.g. Linux it will suspend VIM, open a new shell in the same terminal and execute the script.

Now, I haven’t gotten very far with Python yet, but so far I like it even though I’m still at the point where I’m basically thinking in Ruby code and trying to translate it to Python.

Posted in Computers, Linux, MacOS X, Programming, Python, Rant, Ruby, Windows | 2 Comments

My Further Adventures in Dubstep

Regarding my earlier post about me wanting to learn to like dubstep, I can proudly say that I’ve succeeded — at least to some extent. As with any genre there will always be shitty music and good music. Here are a few of my latest favorites in no particular order (sort of… The first track, Far From Home, is pretty fucking awesome, especially after 1:36.)

Hell, I even went and made some myself.

Posted in Music | Leave a comment

Some games just need to be played

So the Steam Christmas sale is over and because of the Great Gift Grab I ended up trying out some games I had lying around just waiting for me to actually pick them up and try them on for size. Here’s my completely subjective opinion on some of the games I tried out to get the free swag from Steam.

First of all, Team Fortress 2 (Free; Windows & Mac) is surprisingly fun — if you’re on a good team. It’s free, which is always a good thing, and it seems to not be completely flooded with trolls/griefers/hackers, which is another good thing. There’s really not a whole lot to say about it. If you’re into class based team FPSs you’ll probably enjoy it. If the cartoony look is not your thing and you prefer realism and strategy over fun, then maybe go have a look at Nuclear Dawn (€18; Windows & Mac). I haven’t gotten around to buying it myself, so I really can’t say much about it yet. Or not… Unless you got a sadistic craving for trying to shoot people at 16 frames per second. (Got hold of the game, huge disappointment. Great idea, terrible execution.) Incidentally, the Team Fortress 2 Gift Grab 2011 achievement (the reason I installed and tried the game) earned me an additional copy of Portal 2. This was a triumph!

Bit.Trip Runner (€8; Windows & Mac) wasn’t actually part of the Steam Christmas event, but Bit.Trip Beat (€8; Windows & Mac) was, and that prompted me to try out Bit.Trip Runner. Bit.Trip Beat is basically Pong evolved. It’s pretty fun for 10–15 minutes, but that’s about it for me. Bit.Trip Runner however… That game is so hard, fast and annoying in every way possible that you just want to keep playing until you’ve beat it. For every level the rule is: Make one mistake and you start the level over. And you’re going to be making mistakes — lots of them. While running and dodging stuff at 200 billion mph you’re bound to fuck up even the simplest things at times, so after maybe 9 or 10 tries at a level, you’ll begin to get into the groove, have the level memorized and then you’ll have a shot at completing it. If it wasn’t because completing a level feels so good, I would’ve probably ragequit and hurled my controller at the screen.

PAYDAY: The Heist (€19; Windows only) is a co-op FPS where you finally get to play the bad guy(s) without some lame plot twist revealing that you’re actually good guys. You play one of a bunch of hardened criminals out to pull off some epic heists. During each heist you have to complete various sub-missions in order to get away with the big score in the end. Meanwhile the cops and the FBI are sending wave after wave of forces after you, each wave tougher than the last. One of the under-appreciated aspects of the game is that it’s not all too reliant on team work. Missions are definitely easier when playing as a team, but they’re also manageable alone, which is nice if you end up on a bad team online. Definitely a fun game if you’re not looking for something that “redefines the genre” or “completely changes your look on life”. If you want that, read the last description in this post.

Revenge of the Titans (€10; Windows & Mac) is sort of a retro-styled tower defense game, and the retro-style (both in looks and in music) is what really does it for me. I actually played this game a while ago when I bought it as part of a Humble Indie Bundle. Generally I find tower defense long-winded and downright boring, but this one is different. Not in gameplay really, but apparently style and delivery are hugely important factors for me, and Revenge of the Titans delivers on both accounts. If nothing else, you can always enjoy Dave S-B’s dramatic synth interpretation of Bach’s Fugue in D minor. It just works so well with the rest of the game. (Other classics like Bach’s Toccata to go with the Fugue, and Strauss’ Also Sprach Zarathustra are also featured on the sound track.) Oh, and this game is hard. I mean, really, really, really hard. (Maybe because I don’t generally play tower defense games.)

Bastion (€14; Windows/Mac through Steam, other OSs can run it in Chrome — read on). Literally the best game I’ve played in years — maybe ever. This game definitely deserves every word of praise it’s gotten. The gameplay is not unlike Diablo, in that you have a fixed isometric view of the world, but that’s about the only similarity you’ll find between the two. Bastion has a narrator who sounds just a little bit like The Stranger from The Big Lebowski. Incidentally the narrator of Bastion is referred to as The Stranger during the first part of the game. Now, I’m not usually a huge fan of narration in games, but in this case it works incredibly well, partly because the narrator has a great voice, and partly because the narration is dynamic. The narrator will react to your actions throughout the game, which gives the game great feeling of story telling. And then there are the graphics. Beautiful hand-drawn environments in lush, vivid colors, that give the game a completely unique look. Even the sound track is phenomenal. Like nothing I’ve heard for a game before — well maybe with the exception of a certain song about still being alive as sung by a certain passive-aggressive AI. Darren Korb has really made a great sound track that also deserves listening to outside of the game. It all comes together in a great story with plot twists, tough decisions, etc. I’ve said it a million times already, but do not miss this game! (Did I mention that it’s available in the Google Chrome Web Store? Well, it is — both as a free demo and as a full game for $15.)

Posted in Games | Leave a comment

50 Albums #50

Powersolo – It’s Raceday and Your Pussy is Gut!!! (http://goo.gl/XKpRk)

Powersolo - It's Raceday and Your Pussy is Gut!!! (album cover)Forgot to post the 50th and final album. Sorry about that.

Posted in 50 Albums, Music | Leave a comment

Retro styling photos in The Gimp

So I’ve been playing around with The Gimp trying to process photos to look like they’re taken with old “shitty” cameras.


See more on Picasa.

I’d love to post a how-to, but right now I don’t have the time, so just enjoy the pictures.

Posted in Art, Software | Leave a comment