Ruby on Greased Rails: Adventures in Rapid Application Development

Even though I work in a chip company, I believe in tools that work on the web so creating, updating and maintaining data is a collaborative process (and less personal overhead :) ). Having a spouse who works in web tech is of extra help. I was one of the early adopters of the Twiki at my company (Andy was the initiator). One of the earliest tools that was born out of my pain of having to create work plans, track them and collect status info was the Project Planner Plugin for Twiki (which I also released to the public domain).

I have done a few other CGI scripts to interface databases to the web along the way. But, cgi scripting in perl is not my idea of writing software. It keeps getting in the way more often than letting me do what I want to. Of course, I am not a master of the language. People actually commented on the Project Planner plugin that the code was easy to understand since it was perl written in C style!

So I stumbled upon Ruby on Rails accidentally and that led to making the softwareinterview.com website. I really did it like the 15 minute video on the RoR website and it works! We spent more time on the template and CSS for the view. Yeah, and it is true that getting the first few things up is as quick as 15 minutes but you really do need to understand framework, Ruby, ERb and a few other things to be really up and running. Pickaxe and DHH to the rescue. It helps to read and do some development as opposed to getting dazed with just hacking away and getting stuck on how to take it to the next level.

It also led to me adopting Rails for a cgi script I was maintaining at work. It was a small perl cgi script and was moderately well architected (YAML for config files, serializing and deserializing objects, etc.). However, it was getting a pain to maintain and add any features. I did keep finding myself repeating the same code, trying to abstract it away, refactor it, etc.

I re-implemented the whole thing in RoR and it did make development faster. Since I was not a perl-cgi wiz, getting stuck at RoR and perl-cgi was pretty much similar overhead in trying to search for an answer. It was easier in RoR once I found the answer since it was so much more succint in RoR as opposed to perl-cgi. The application though small does use many features:

  • multiple tables
  • foreign keys
  • ActionMailer
  • acts_as_versioned
  • observe_form AJAX for searches

And as you can guess I did run into several itty-bitty problems throughout (especially since I was a Ruby Nooby too). Surprisingly, web search seems to provide many answers since there are many new rails pages and not too much noise. I find that searching for many topics on the web finds more noise than answers.

About that list of small issues:

  • collections in forms
  • AJAX for form vs fields
  • choicebox selection list and selected value

Oh! As a side effect to the whole thing, I love Ruby! A fortune sample reads, “Computers do what you tell them to do, not what you want them to do.” The way I see it, I have always had a language that let me tell the computer what to do – C. It is pretty close to really thinking in terms of a processor chip.

add 1 to i, mov i to memory at location m

I have never really found a language that really lets me write software that I want to do. Ruby seems to come pretty close to writing code the way we write pseudo-code when writing algorithms.

for each of the elements in the array, slice ‘em, dice ‘em and cook ‘em.

Really! That is how I feel writing in Ruby. I am neither a master of languages nor a novice. I have written and graded a few programs in LISP, COBOL, Perl, Prolog, etc. to understand concepts behind computer languages (PCP did teach us the wonderful lambda calculus in undergrad). Perl seems like sed+awk and I haven’t written anything in python but I do not like white spaces dancing around me in my nightmares. I had enough of those with COBOL (spaces and nightmares while sleeping in the undergrad computer lab).

I design processors (albeit writing a lot of software) and not web sites. Even if I do not use RoR a lot, at the least RoR gets credit for my stumbling onto Ruby! When I have a choice, I will be scripting mostly in Ruby.

Posted in rails, Technology | Leave a comment

Comparison Shopping: Research on the Internet

so much information, so many reviews, so many forums, so little time…

Have any of you recently checked how much time you spend on the web doing research about things you are going to do or spend on? Here is how I am trying to simplify my shopping.

Let me think of the the last few things I did research on:

  • Vacation Trip – Where to go, stay and eat
  • Cellular service and phone
  • PC
  • Digital Camera
  • Web hosting service
  • Baby Stuff
  • Books
  • Car
  • Home

Of course, after making the choice, the research moves into finding the best place to snag the best deal. However, it seems like I wasted more time than the knowledge I gained to make a better decision or the money I saved. Recently, I have started going back to a more basic set of principles to simplify shopping and save time:

  • Repeat Your History: If you liked a place, brand, store, or a website just go with it the next time for the next thing.
  • Forget The Features: Look for the basic features you need. Quit worrying about future proofing your purchase. Either you do not need the features anyway or you will buy a new one in the future.
  • Buy When You Need: Skip the “mega sale now” and the Black Friday sales. I have not so suprisingly found I still get good deals just by spending a few minutes on research and picking a place rather than waiting for the right moment.
  • Go With Your Gut: All else being equal, just pick what “feels” right

I remember the time when I did do as much research but found more quality information at a higher Signal To Noise ratio. When I bought my Canon Elan IIe 8 years ago, I searched photo.net, rec.photo newsgroups and archives and a few other websites. When I bought a Onkyo component system, I got quality information from rec.audio archives. Now it seems as if google can serve information on anything you are looking for but with a million voices on the net spewing their opinion it is pretty difficult to figure out where the best information source is.

I am not advocating that web is bad. My last car buying experience was a pleasantly painless one. Pick the car you want. Submit request for internet quotes. Keep forwarding the offer emails back and forth to the different dealers internet managers till an equilibrium in price is achieved and just go buy it. It took all of few hours each day in one weekend to finish the whole thing. Of course, picking which car to buy and convincing the mother of my child that it was the right choice took a lot longer :)

Go ahead! Confess how much time you waste on research or tell me how much I am losing by skipping the research. If you have simplified your life then tell me your rules.

Posted in Technology | 1 Comment

It is Alive: Microsoft Interview Questions Site Ported

The original reason I started looking around for a web hosting company actually came online now. Head on over to http://www.softwareinterview.com to check out the new version of the really old questions page which still generates many emails in my very rarely monitored inbox at USC.

This is a good place to tell at least the story of how that page came about. When I was doing my graduate school in Ohio State, I had a few roommates who were going for interviews in Mircosoft. (Yours truly was into research, see…). They were poring over a bunch of questions collected from other people from Ohio State who had interviewed at Microsoft. I took that and added the questions that my roommates were asked and it has been growing since then. For the record, I never interviewed at Microsoft but too many of my friends have. And four of my roomates from Ohio State and USC worked at Microsoft.

Of course, if you read “How do you move Mount Fuji” you will see my name mentioned in the book. The author William Poundstone did actually call me and talk to me about what sort of reaction I get for the website. What you read in the book is true. I think I maintained the site more out of academic interest than anything else. Intellectual pursuits are what separates human from the animal :)

The new site runs on spanking new technology (okay! okay! new for me) of Ruby on Rails. I will write more about in another post.

It also provides an option to add questions instead of the emails people used to send me so do go ahead and fill in all those esoteric and arcane interview questions that you get asked in your interviews. Go ahead. Do it!

Posted in Technology | 1 Comment

C is for Cat: Vagaries of English Pronunciation

Saarang said his first aspirative syllable. We have been repeating A, B and C to him just to engage him for many days and this sunday he started saying sssaah. You know … the way babies go around repeating the same syllable over and over again! We had actually been telling him A is for Apple, B is for Baby and C is for Cat. Then I realized how silly it would sound if I was told see(C) is for kat(Cat) when I start learning syllables. I haven’t got that look from Saarang yet! Maybe all kids should be taught using phonetic alphabet or something similar.

I remember some parent mentioning that in schools here kids are not taught numbers and letters in their correct order but in order of how easy they are to learn. So the numbers with straight lines go first (1, 4, 7) before the curved lines. The alphabets that are easy to voice (maybe the fricatives) go first and as a sound rather than a letter (mmm, da, ta, just like babies make ‘em).

I am just worried that in a few years I will have to sit with Saarang and explain see is for kat and not see is for sat.

Posted in Parenting | 1 Comment

An Experiment goes Boink: Dreamhost Review

A personal homepage I had started long ago and had been meaning to long overhaul is the Microsoft like Interview Questions database. Last month, I was surprised to hear an intern at my company and an old friend I met after a few years mention that they had gone through my page for even hardware interviews. Hmm, it would be worth the time finding a permanent home for the questions if they were really that useful.

The timing was right. I bumped into this web hosting deal with Dreamhost which for the price of a loaded latte would give me the web hosting for an year and then need a latte a month after that. Rules say I had to do some research before signing up (topic for whole another post). It took me longer to search for a domain name than it took for me to signup and have the website up and running!

If you want to check DreamHost out, do use my reference. If you use the promo code BOND I even share my referral bonus as your discount!

Of course, I do have to review Dreamhost, right? If you read reviews around the web about various hosting sites and compare reviews (like I did) you will find positive and negative reviews for every hosting company. The interesting thing about dreamhost is how much I like it and at the same time I can believe people hating it. It is it not a very layman friendly setup. If you are trying to write some HTML and make you webpage then there might be better hosting elsewhere. Of course, this is my first and only hosting experience so YMMV.

I picked the unix hosting plan and you have to know what telnet, ftp and webmail are to create the basic website. If you do not know what PuTTY is then geocities might be a better option. However, for the more powerful users who know a database from a platypus, dreamhost offers a lot of features and tools including great one click install of tools like photo Gallery, WordPress blog, among others. It took me 5 minutes to install WordPress which motivated me to start the blog in the first place.

Oh yeah! I do need to get to those interview questions sometime :)

Posted in Technology | Leave a comment