First steps with Ruby on Rails

Ruby on Rails project logoAs any self respecting software developer I jumped on the Rails bandwagon too. It will probably not be something I will be using a lot in the near future, but staying informed never hurts.

So of I went to a local bookstore to do some browsing and this resulted in purchasing a book called Agile Web Development with Rails: A Pragmatic Guide (Pragmatic Programmers) by Thomas and Hansson. The upper left corner says “The Pragmatic Programmers”, which resulted in me feeling good about buying this book, since I loved “The Pragmatic Programmer: From Journeyman to Master“.

Agile Web Development with Rails: A Pragmatic Guide (Pragmatic Programmers)The Rails book is very well written. I have not gone through it yet from cover to cover. Right now it’s the book I’m reading at home when I require some privacy. πŸ˜‰ I find a toilet a place of serenity and quiet contemplation. Or an excellent place to focus one’s complete attention to the contents of a book.

I am running a PowerBook G4 here with OSX. And as the book stated, OSX comes with Ruby pre-installed but requires some tinkering. I opted for the latest Ruby version. So I went with a OpenDarwin Ruby/RubyGems/Rails install. No problem in that area.

The Pragmatic Programmer: From Journeyman to MasterNext up was a database. The Rails book says MySQL is good. So I go with that, although I think an in process DB like SQLite would do just as well for me. Let’s just say it’s been a while since I did a MySQL install. Although it isn’t really necessary as far as I am aware, but I couldn’t get network connectivity to work with MySQL 5. Turned out to be really stupid. Of-course I need to give a user the right on the MySQL instance to actually connect through the network.

Once I got MySQL sorted the fun could begin. Right now I just about finished building the web-shop cart. See, the book uses a simple e-shop as an example. Through the course of about 8 chapters you can build a basic shopping experience. I like this tutorial approach when taking my first steps with a new framework.

MySQL logoIn the end I guess I will get a pretty decent overview of Rails. And while I do get the feeling Rails can be a huge timesaver, it does still feel awkward to me that you should do it the Rails way or preferably not with Rails at all. The whole programming by sensible default is still a bit jarring. I guess because I am more used to rocket science style over-engineered Java systems. Not the most effective use of Java in my opinion. But hey, I’m no software architect yet, so why should anyone listen to my opinion. πŸ˜‰ Also I can’t quite get that Ruby syntax in my fingers yet. Perhaps I should look into buying the pickaxe book too.

I am very curious about where Ruby on Rails will be in a few years. Although many people claim that it’s not ready for prime-time yet, that it’s still a technology too new for “enterprise implementations”. (That’s one term for your BS-bingo list.) I think that Ruby on Rails may actually be further along and actually quite capable and ready for prime-time. I guess time will tell. It is an interesting framework and takes some refreshing approaches, so even when you are not going to use it this or next year do take a peak at it. Most likely some of the concepts of Ruby on Rails will actually be useful for your regular dayjob.

Oh and about the book, yes it is an excellent read on Ruby on Rails if you like a tutorial style read.

Who wants Sudoku, come get some.

Eclipse sudoku projectsExcellent support by Wayne Beaton again. It probably already was available, I just didn’t know it was. The Sudoku game Wayne has been working on is available for download.

Just import this project set into your Eclipse install and you are ready to go. You will be asked for CVS credentials. Just enter anonymous as a user-name and leave the password field blank or enter your email address.

Now you’ve got a sweet little application to molest to your hearth’s content. Complex enough to feel real, but small enough to get into in a short time-span.

Callisto is final

Last night I installed the final release of Callisto with Eclipse 3.2 on my mac. And it works like a charm so far. Earlier release candidates were often broken on OSX. But this seems solid. Also the sheer amount of functionality is just overwhelming, where do I start with exploring all the goodies provided by the Callisto release plug-ins?

Callisto is here...Compared to previous Eclipse OSX releases Eclipse seems a lot more polished now. Sure there are some gripes, like scroll-bars appearing in the description field of the new project wizard. But it is getting better and better. Guess I will be doing some Wayne Beaton inspired evangelising on my current project next week. (Basically this would mean raising my hands into the air, exclaim why I think Eclipse is best, then kindly respond to all questions being asked. I won’t go swimming in a frozen lake though.)

I have been goofing around a bit last night, I smacked together some user interfaces with VE. Which is also part of the Callisto release. It seems to work ok, but still it doesn’t have the flexibility of rolling the views yourself. I’m not sure yet if I really like Visual Editor, but the rest of Callisto: Awesome! πŸ˜›

Oh no! They’re at it again…

Now I must admit I have not ran the second beta myself. I hate beta OS-es. They’re always a big pain in the hiny.

But today I came accross this blog entry. I mean, just look at it. To me this is proof that OSX is infact better then Vista. Haha! Not to mention that eventhough Vista is a visual improvement, it’s still ugly.

Funny to see that first a lot of people were saying: “Ohw, all that visual stuff on a mac, who needs it. It only slows us down.”
And now it’s all: “Oooh, aaaah, looky here how nice Vista is going to look.”

Come on ppl, get a life. Not to mention that it will take about half a decade before Vista is in common use.

Call me a Mac fanboy if you want. But just look at these comparisons. Are you still able to say that Vista is the next big step in OS design…

Running SubVersion svnserve on Mac OS X

In my previous entry I posted how to get SubVersion on a Mac.

One of the things people start asking after knowing how to run the client, is how to run a server. Most people know that svnserve is a good option and get a repository going with that. Check the free online book I mentioned in my previous post to get a feel for how to set up a repository using svnadmin.

But now you want that pesky svnserve to launch on startup. Best candidate to handle that for you on a mac is launchd.

But it is a bit of an involving procedure to go though. Anyway, this is the link that got me going.

Do read the entry at the link completely. Doing so will save you lots of headaches.

Smearing AWT code into SWT/Eclipse RCP code…

Nothing new to those using Linux or Windows. But for the Mac OSX developers there is some great news. Finally there seems to be a solution on its way. Thanks to some changes in OSX it is impossible right now to run AWT code within a SWT based application from within the Eclipse JDT. Something going awfuly wrong with deadlocks and all between the AWT and SWT event handling threads. It has been one of the strongest arguments against using an Apple system for Java development.

Credits to Wayne Beaton’s blog entry for mentioning this excellent news. I wouldn’t have known otherwise. It seems that it is useful to put in radar reports when you come across something ugly in OSX. The Apple devs won’t prioritize an issue when few reports come in on it. So if sh#t hits the fan when devving an Apple app. Report!!

Now if someone could convince Mr. Beaton to actually get a Mac, that would be great. Perhaps some of his Eclipse enthousiasm will rubb onto his Apple system usage. Eclipse is great, but Eclipse on a Mac, is even better. πŸ˜› (Because even an Eclipse/SWT UI remains butt ugly on Windows.)

Try this in Java …

Objective-C is such a funky (dynamic) language.

Like Scott Stevenson showed on his blog in the last few days:

Dynamic Objective-C with NSInvocation
Forwarding NSInvocations in Objective-C
Replacing Objective-C Methods at Runtime

Stuff like that makes me think that Java as a language/runtime just sucks sometimes. Sure java’s got reflection and funky runtimestuff if you really want too. (As in cooking your own classloader and doing runtime code injection, now that’s a cool one.)

But it doesn’t come even close to what Objective-C can do. Not to mention what Ruby can do. While I’m not into the whole Ruby thing yet (chronic time shortage). It does seem like a hell of a dynamic language. On the other hand, all this dynamic stuff makes me feel wary, feels like a big gun capable of shooting big holes in things. Which can be a good and/or bad. Imagine pointing at your own feet, or better yet, a pointy haired boss.

Also, for those who know Lisp, it must feel a bit like “Been there, seen it, done that. Anything new today?” Just for the record, I also think Lisp ownes each and every language out there. Every new feature a language hauls along on “yet another band wagon” is either allready available in Lisp, or is just around the corner with one or two macro‘s.

OS X’s Objective-C garbage collection

Lately it’s been buzzing around on various blogs that in the next OS X release, Leopard, Objective-C can use garbage collection. For those who’ve been following the introduction of environments like Java, .NET and all other environments with the sligthest whiff of managed memory have seen the same crap all before.

Basicly there are two camps. Those that think automating memory mangement is a piece of crap and that anyone willing to use such “vulgar” mechanisms should be locked away carrying a straight jacket. And those that understand that it’s a good thing since it save complexity on the developers part.

Now this is stated a bit black and white. There’s a lot of gray between the two opposites. But isn’t it true that most applications are constrained by basic I/O speeds and user input rather then by the bit of extra work happening because of some memory reclaiming thread?

Now I haven’t gone into the details of Objective-C’s memory management model yet. But based on my limited observations sofar, the memory management is optional. So if and when absolutely every last instruction counts, yes you can stick to manual management. And then it is absolutly justified to do so. But in all other cases where that extra bit of CPU is not really noticable, why bother with manually managing your memory when in most cases it is just a tedious error prone exercize anyway. Better to save the hours to add functionality then to comb through bits of code to find that nasty memory leak.

I’d say hooray for garbage collection in Leopard and Objective-C.

Some more blog entries on the subject:

Now this is annoying…

Here I am doing my merry thing with the Apple developer tools. Apple provides a great set of tools for developers. Believe me, it kicks hiny.

But why to the mother of all things good on this earth do they forget about updating the developer kernel extensions? Either by the regular kernel OS X updates or the developer tools updates.

See, what I was doing was this. The developer tools contains a tool called USB Prober, with only one mention on the entire apple developer site. So enthousiastic as I am, I give the little app a spin. I see some screens… I push a button labbeled start…

And now the fun begins. The app asks me to if it’s ok to install a file called “KLog.kext”. Sure, I pushed a button and then this message popped. I enter my PW. Wham, so that’s what a kernel panic on Mac OS X looks like. Sweet… NOT!! As mentioned I had to hard boot my system. Thanks guys, just lost 30 minutes of work while I was at it. πŸ™

Rebooted and I do some searching, as any good
developer does…

Hmmm Hum… Something about getting the right version of the USB Debug kit…

Turns out I had to install the latest USB debug kit matching my OS revision and processor.

Why couldn’t they just push this KLog.kext along with the regular updates.. or atleast act more gracefully than crashing my system? Like a dialog stating that I should download the latest debug kit to proceed.

It is great fun though now I got this working. I actually never plugged in and out my mouse this often in a single session. πŸ˜€