Skip to main content


Showing posts from September, 2011

Setting JRuby to run in 1.9.2 mode by default

JRuby comes with both 1.8.7 and 1.9.2 (currently) and the default is 1.8.7. If you want to change it you have to feed an option at the command line:

$jruby --1.9

This weekend I had to migrate a rails program that I hadn't written and the author used 1.9.2 notation so it would not run on JRuby with the default settings. So I had to add the version option with every command which gets old quick. I looked online for a way to make this automatic (and on my JRuby books) but could only found the way to do it on a Mac or Linux but all Windows references just mentioned nebulous concepts such as environmental variables and seemed to be different from which version of Windows you are using. Here is how to do it.

Windows 7:

Got to Control Panel, System.

Wine (Crossover 10):

Java 6 version 21 will run on Wine (at least on Crossover 10) and you can install JRuby on top of that. To set environmental variables you have to go to regeditand set it there manually. Follow the screen-shots below.

Find t…

Cartography in life is not Navigation

A Cartographer doesn't need a map. They make their own maps. They learn about the terrain and learn about it. A navigator has a map, knows where he is going and finds the route to get there.

It seems that all I was taught was Navigation in life. How to make a way to a place. It was useful only as far as I was in school where the goal-to-reach was clear; simply the path to take was all that needed figuring out. Yet life outside of school, even in college is more like doing cartography: you have no map, no clear direction and yet you have to make you way. This is totally different from Navigation. You can ignore most of the terrain with a good map. If you are good at navigating and have a map you are not likely to get lost. However, what do you do when you have to go the areas outside the map?

My schooling seems to reflect more of an medieval world or industrial world than the post-industrial world we live on now. And many times I've felt ill-prepared for the world I live in now…

Configuring Netbeans for JRuby

Netbeans is an IDE (Integrated development environment) originally for Java. However version 6.9 (but not 7) can also be used with Ruby and JRuby. Because it's an IDE for Java, Netbeans is ideal for setting up JRuby on Rails projects. And here is how.

First make sure you Download the Java version of Netbeans 6.9.1 or the complete version. It's easier to add Ruby plugins to the Java Netbeans than viceversa.Install the Ruby plugins to Netbeans.Create a new project and follow the screen shots below. 

Netbeans comes with it's own bundled version of JRuby (1.5) so go to Manage Ruby versions to set a different version or even a C-Ruby version if you want.
The server needs to be set to Webrick to get the normal Ruby on Rails server.

If you are setting up a JRuby on Rails project make sure you mark the: "Access Database using JDBC"

And like that you have a properly configured Rails file for JRuby, without having to use the "--template" option. Go check the Gemfi…

Installing JRuby for Rails

JRuby is Ruby that runs on the Java Virtual Machine (JVM). It has the advantage of being cross platform (Linux, Mac and Windows) and being able to run on a 64-bit machine (important if you have a Windows 64-bit machine since the normal Ruby is 32-bit only for now on Windows). It at present installs both Ruby 1.8.7 and 1.9.2 but defaults to 1.8.7, but in the future the default will change to 1.9. The Windows installer meshes really well with the operating system and aside for the first time start-up time (it loads Java first) it's equally fast. However to run Rails on JRuby some things need to be taken care of. This set up should have you in good shape for Michael Hartl's book: Ruby on Rails 3 Tutorial.
1. Preliminary things you need.
JRuby on Rails is a mostly platform agnostic installation. It can be installed on any OS that runs the JVM or Java as it is commonly known. You probably already have it on your machine. But in case you don’t, you need it to install JRuby. Verify th…

Ants and Agriculture.

Agriculture in humans arose around 11,000 years ago give or take a few thousand years with the domestication of grasses across the world. Wheat, Rice, Maize, and others were the domestic crops upon which agriculture was based. Before that Hunter gather groups did grow plants but not in an organized social way like they do in agriculture.
Ants evolve something like generalized agriculture 50 million years ago. Around 15 million years after the Dinosaurs kicked the bucket. This is co-evolution of species (the ants harvest fungi) not merely breaking up of the ground that ants normally do that's beneficial to plants.
I'd never given that much thought to ants, they're not as easy to study as bees which have a fascinating dance language and an industry appeal right of the bat. But Ants have been recently on my mind due to the connection to flowering plants that I hadn't considered. Ants don't pollinate plants, so their contribution went unnoticed by me, but they are essen…

Cookie Cutter Job postings

I've been between jobs for a while, so I spend a fair amount of time looking at job postings. Admittedly this is a sad and very depressing activity so some weeks I just don't even look, let alone apply. Seems that my time is better used reading, learning programming, mastering a new swimming technique or writing.

After a while though you start seeing some really weird patterns in the postings, that make me wonder when people write this, do they know what they want? Some of them almost sound like dating site profiles' "What do you look for in a partner." I'm waiting for the one that says Requirements "Be Tall, Dark and Handsome." But more often you see the exact same type of language over and over again. Almost like a code that I can't quite decipher. I'm tempted (well more than tempted) to call my friends that work in HR (Human Resources) and have them translate it for me.

Going by Job Postings, there are no jobs for calm people outside of &…

Superman Story: The Collector

Inspired by this story by Xeni, of mentally disabled man who had his collection of Superman memorabilia stolen, I decided to write a Superman story for him. So this short story is dedicated to all people who transcend their limitation be them physical or mental to build beauty in their lives. 
Note: This is a rough un-corrected draft. Please pardon the typos, sometimes it's fun to read those too. :)

The Collector
part one

The sky above was azure blue, one of those days when the clouds disappear and just a blue ball of sky with a puncture for the Sun exist. Clark Kent floated above Metropolis in his Superman alter-ego. His eagle-eye vision allowed him to focus with precision on any section of the vast city below him and he quickly circled around. Surprisingly quiet day. It was hot and muggy and most people had chosen to be in the indoors air-conditioner cooled sanctuaries.

But Clark was not at all bothered by the heat. He didn't sweat from heat, never had. He stood still like a bl…