Ruby Quiz: Gathering Ruby Quiz 2 Data

ruby_quiz.png After running the Ruby Quiz show for almost a year, Mathew Moss, the second Ruby Quiz master had just retired (as a quiz master 🙂 – great work Matt!), passing the ball to Daniel Moore, who just kicked off the third season with the following problem:

I'm building the new Ruby Quiz website and I need your help...

This week's quiz involves gathering the existing Ruby Quiz 2 data from
the Ruby Quiz website: 

Each quiz entry contains the following information:

 * id
 * title
 * description
 * summary

There are also many quiz solutions that belong to each quiz. The quiz
solutions have the following:

 * quiz_id
 * author
 * ruby_talk_reference
 * text 

For some reason, no one (except me) participated this time – so for the first time in history, I am pretty sure my solution is the best of all! w00t!

Daniel did a really great writeup of my solution (which utilized scRUBYt! and Nokogiri) – check it out here (view the code here), so I am not going to do my own writeup this time.

The Top 30 Most Helpful People on #rubyonrails

Just about 2 weeks ago I have been bitching about the #rubyonrails channel (no need to look it up as this article will negate that anyways). Fortunately (for everyone I guess 🙂 some prominent rails guys came after me, gently kicked my ass and challenged me to check out #rubyonrails again (after leaving a bit pissed off about 2 years ago), claiming that the atmosphere has changed drastically.

So, I took their advice, joined the channel, and was indeed pleasantly surprised. During my 2+ weeks of stay, I can’t remember any incident (ok, except the constant trolling on TextMate vs Vim, Mac vs Linunx, Shoulda vs rSpec, jQuery ftw, how RJS sucks, how Java sucks (well, initiated by me ;-)) and found most of the people very friendly and helpful. Also made a few friends and had some great fun.

I also discovered some great #rubyonrails stats by @radarlistener and persuaded him to add a little feature to it: display then number of thanks per all messages. It’s not a huge feature, but we can find out some interesting stuff with it – for example, the signal to noise ratio off different guys: which of them are helping out the most on average (we could probably dig out the reverse info too – a.k.a. help vampires, but that’s outside of the scope of this post).

So, without further ado, here is a top 30 list (the number behind the nick denotes “lines per thanks”, i.e. how much lines the given person had to enter to receive a “thank you”):

  1. pet3r: 69
  2. stympy: 70
  3. octopod: 83
  4. mikeg1a: 90
  5. mf_irc: 97
  6. koppen: 105
  7. noodl: 120
  8. eljo: 120
  9. topfunky: 126
  10. leeo: 128
  11. fcheung: 129
  12. chippy: 137
  13. rainmkr: 138
  14. gerhardlazu: 139
  15. blj: 142
  16. madrobby: 142
  17. darix: 154
  18. toretore: 158
  19. minam: 162
  20. thread: 162
  21. donomo: 166
  22. halorgium: 168
  23. sonofslim: 169
  24. don-o: 170
  25. claudio: 176
  26. melvinram: 180
  27. bitsweat: 180
  28. ddfreyne: 181
  29. archetypo: 183
  30. jacobat: 185

Hey where’s lifo and rsl? Wtf?!!11!1! My script must be buggy… need to spend more time on #rubyonrails to learn this Ruby thingy properly.

Thanks to @radarlistener for his great work on the stats, as well as other great #rubyonrails bots.

Learn at Least One New Language Every Year


I am sure almost all of you heard the now classic advice from the Pragmatic Programmer: Learn at Least One New Language Every Year! Since it is a beginning of a new year, I have seen a lot of bog posts by various people acting upon the advice and choosing to learn a language – this year I decided to follow suit, and learn … Javascript.

I can almost feel the disappointment mounting: What the #&$%^*&#*@ why not Erlang? Or Clojure? Haskell? Scala, Lua… ? Why Javascript? That’s so 1990s…

Why Javascript?

The answer is easy: right now I am a Rails web developer (not a distributed system architect, monad detective, human parenthesis parser etc), and though I know enough Javascript to get by in majority of the cases, I’d like to take it to the next level.

Don’t get me wrong: I understand that the rationale behind learning a new programming language is not (necessarily) the ability to put the newly acquired knowledge to use tomorrow, but rather to discover new patterns / schemes (no pun intended). Thankfully, Javascript means the best of both worlds: you will find a lot of new stuff in there (unless you happen to know some other esoteric languages – Javascript is a dialect of ECMAScript based on Self and Scheme) – for example, unlike most of the mainstream OOP languages (which are class-based), Javascript is prototype-based – while at the same time you get a powerful tool enabling you to create more effective web applications.

Using a Motorized Wheelchair Because you’re too Lazy to Walk

Why do you, as a Rails developer need Javascript? There is Prototype. And script.aculo.us. And RJS. And jQuery. And Dojo. And MooTools. And…

I really have to agree with Adrian Holovaty (of Django fame): “(Relying on server-side frameworks to generate JavaScript) is like using a motorized wheelchair because you’re too lazy to walk”.

So true. I am tired of seeing people doing stuff like:

  • Simulating even the most trivial things like $(‘element’).toggle(); with RJS
  • Using oberve_field for everything. The problem is that observe_field in it’s vanilla form sends a request to the server every time you hit a key. It’s easy to replace it with a bit of Javascript knowledge and stop hogging the bandwidth.
  • Instead using Javascript functions like setInterval / setTimeout they are simulating the desired behavior with Prototype / RJS
  • Trying to create great AJAX sites without much clue about Javascript (and just minimal knowledge about Prototype/RJS – spending a week or so on #rubyonrails was enough to experience this in it’s full glory ‘hey plz help bro cuz Im new to AJAX’)
  • Doing all of the above obtrusively – who cares about the totally littered HTML, just get it done somehow

And I am talking about trivial/mundane tasks above – what if you’d like to create your own custom widgets? Optimize your code? Rely on the browser for various things not supported by rails out of the box (e.g. in-browser caching)? Manipulate the DOM? Prototype/RJS won’t do everything instead of you.

(Don’t get me wrong, I am a big fan of jQuery, and application development would be painful and slow without it – I am talking about the fact that in some cases falling back to Javascript is unavoidable and/or ineffective)

Ok, I’ll Still Stick with RJS and I Like it Obtrusive!

Ok, you have been warned. Suddenly It seems not I am the one stuck in the 1990s… but whatever. Ignore JS in your Rails apps at your own peril.

However, Javascript is usable in many other settings too. It’s a general purpose programming language, roughly comparable to Python or Ruby, so it’s a misconception to believe that JS is just some obscure mini-language only good for some browser hacking (similarly as Ruby is believed to be a scripting language, or a language invented to power Rails). So you can do just about anything with Javascript that you would do with, say Ruby.

If you want some interesting specialized usage: building Firefox extensions. Judging by the current trends, browsers are becoming more and more important, according to some people to the point of taking over the place of an operating system. While currently I find that theory a bit far-fetched, it is sure that as a Web developer, you can’t ignore building Firefox extensions. You need a lot of Javascript to do that.

Then there is DOM scripting. You would be amazed to know how powerful DOM manipulation can be once you learn the ropes.

Obviously, you are using a Javascript framework (Prototype, jQuery, mooTools…). Though you can get by quite well with any of them without knowing too much Javascript per se, your effectiveness will go up with the amount of JS knowledge. It’s like learning Rails and ignoring Ruby. You can do it, but sooner or later you’ll hit a wall.

Let’s Hit the Waves

Douglas Crockford’s site looks like a good starting point.
On the book front, I am planning to get these titles (I am not using any referral crap, those below are plain amazon links):

If you have any suggestions, comments, ideas on how to do this thing better, please leave a comment.

Oh, and be prepared for some Javascripts posts in the future 🙂

Getting Real with Balsamiq – Amazing Mockups in a Breeze!



I am sure that if you are a web/IDE/UI developer, want to communicate your ideas visually or even just need to visualize something more complicated than an empty rectangle now and then, you are yearning for a simple tool enabling you to create high-level mockups easily and fast. Photoshop sucks in this regard – it’s neither fast nor simple and not easy to use by any means. Other typical tools (MS Visio for example) are too heavy/bloated/… as well.

Balsamiq mockups to the rescue! Finally a tool with zero learning curve (you don’t even need to have any design skills), is dirt simple to use, and knows exactly the things you need to create beautiful mockups / sketches. Finally you can get real with sketching your thoughts!

Of course this is not to say Balsamiq is just for toying around – quite a few serious designers prefer Balsamiq to MS visio and other, more standard tools out there, so it is definitely a wise choice for more complicated mockups too.

Thanks for the raving, but what’s so good about it?

You have to try it out to get the hang of it, I can’t do that instead of you – but I can try to summarize the things I like the most:

Widget selection: You are creating the mockups by drag and dropping & configuring widgets. The selection of widgets speaks for itself:



It is just great to have widgets like a browser window, different charts, buttons, tabs, tables, stickers, callouts, scratch-outs… you name it.

Widget configuration: setting up the widgets to look ‘real’ is very intuitive and quick. For example setting up a data grid / table: after drag and dropping the table to your mockup, you can set the data up like this (on the left side you can observe the grid data you are entering ; on the right side you can view the result)




Configuring the other widgets is similarly intuitive and easy. You have a box called ‘property inspector’ where you can set up the widget, as well as bring it to the front/send it to the back etc. If the selection still does not meet your needs, request new widgets at balsamiq’s getsatisfaction customer center – indeed the author is extremely focused on customer satisfaction!

great hand-drawn icons – one of my favorite widgets are icons – you get these great ones below out of the box:




laying out the widgets – I really find the auto alignment of widgets with regard to each other super-intuitive and helpful. It totally speeds up the process that you don’t have to care much about the placement of the widgets – it will just look right with minimal moving around, even with a big number of widgets.

simplicity and intuitiveness – you really have to try it yourself, I can’t describe this point. After about 10 minutes of playing around, everything was intuitive and easy, I didn’t even notice and my mockup was ready, because it’s actually fun to work with balsamiq!

outstanding support – I emailed the author, Peldi a few times, and his answer was prompt, kind and 1000% on the ball – solved all my problems instantly! Try to do the same with MS visio 🙂 (just kidding, please don’t)

So What’s the Catch?

There is no spoon! Err… catch. Whatever. Balsamiq is a tiny little bit rough around the edges, but I didn’t find a show stopper bug or missing feature. I ran into really little things, like

  • no “check for updates” feature which is omnipresent on the Mac
  • couldn’t edit charts at all (so if you have 4 separate charts, they are always 2 red/blue lines looking the same)
  • missing minor options for other widgets as well
  • would really like to have the ability to draw with a tablet/mouse (freehand drawing);
  • create custom widgets, by drawing them with a tablet (ok, this is probably too advanced for now)
  • more widgets and icons (though the existing selection is really, really good – had almost anything I needed so far)
  • minor bugfixes (the property editor vanished once and couldn’t bring it back – had this error just once)

If you want to know more

Definitely check out the not-even-2-minute balsamiq screencast to get a better idea what I am babbling about here – then head over to the balsamiq mockup homepage and check out their offer. If you are an open source contributor / blogger / speaker willing to write / talk about balsamiq, you might get it free for free with a great chance (I got it, so it’s definitely possible without publishing a blog that’s read by 100k people).

Conclusion

If you want to communicate your ideas visually, create a quick sketch of a webpage you are going to prototype, a concept of an IDE, or just want to jot down something non-textual quickly, balsamiq is your thing. Definitely try it out – you’ll be hooked in no time, promise!

Quo Vadis, Rails + Merb?


Update: I have been informed by a few prominent Rails guys (including a core team member) that the atmosphere of the Rails irc changed quite a bit recently (and that they are still working on it), so disregard the ‘rails irc is full of douchebags’ section please!

Happy New Year to everyone! I have been totally off the grid for the past 2 weeks, just getting back to work (several hundreds of e-mails in my inbox, ugh) so just a really quick blurb on Rails + Merb (I guess everyone is sick of the topic by now anyways ;-). I am still dizzy after all the eating/drinking/pushing wii fit to the edge/doing nothing/… for 2 weeks, so get ready for some nonsensical rambling :-).

My gut reaction to the very first article on the merger:

Someone thought it is funny to post April’s fools articles under the XMas tree.

After seeing about 3 more articles of the same kind:

Oh wow, there is a post-some-BS-which-is-a-bad-joke-even-for-april’s-fools meme going on! How amusing!

After actually reading the articles and digging around some more:

FUCK this is for real!!!

After calming down a bit and thinking it through:

This totally sucks. RIP Merb (2006-2008)

Sorry guys, I just can’t join the grandiose Rails+merb merger celebration just yet (I’ll pop a few bottles after Rails 3 will hit the streets AND it will (mostly) work as promised though – but I am skeptical). I was happy that there is a new community which is different from the Rails one (of which I consider myself part of, by the way) – I joined the merb irc and voilà – everyone was 100% helpful (no exceptions) even with the smallest things, and even beyond merb (I remember a great discussion on some fake data generators/factory girl style fixture replacement plugins which was started just because I asked a quick question on something totally different). How about the Rails irc? I don’t really know as I joined just once about 1.5 years ago but was turned down quickly by abrasive comments and overall behavior (e.g. a comment along the lines of “dude if you are still using habtm anywhere (and not has-many-through), get a life and/or go back to your java thingy” – I don’t even agree with this statement by the way, but that’s a different story). Of course I am not saying the rails irc is always like this, and/or that all the rails guys are douchebags (I am not, for example 😉 but I heard similar stories from more people, unfortunately.

Just for the record – I am still a Ruby and Rails fanatic (please no comments like ‘it is maybe time to check out django’ – no, it’s definitely not, the rails climate has never been better), I am doing all my professional work with Rails since 2 years, own tons of Rails books, sleeping in DHH pajamas etc. so I am not attacking Rails in any way. From that perspective I couldn’t be happier – Rails will become faster, more modular, less bloated etc. (I am sure you know all the bullet points from the other articles) and I have no doubt this is more or less going to happen. I am mourning over merb. The community. The influx of new ideas which maybe look bullshit when uttered/prototyped but have a chance to get into the framework because there is almost no bureaucracy. The competition. The monoculture (will Rails eventually eat Sinatra too?). The very fact that something like this just happened – a true black swan, in my opinion.

Of course, I am aware of the huge benefits too – first of all, the reverse ‘divide et impere’ effect, turning enemies into allies – who wouldn’t like to have Yehuda Katz (which indirectly means Engine Yard, to some extent), Matt Aimonetti and a ton of other kick-ass coders/evangelists in their ranks? Not to talk about the other great things – you obviously read about it all over the web already, so I am not going to duplicate that information again. However, in spite of all this awesomeness, something just does not feel right… this is not how it should have happened.

Just in case anyone cares what I am doing in this situation: I am packing my bags. Porting over Bob the Biller(tm), my first serious merb code to Rails. Advising my clients not to start merb projects from now on. Sorry merb, not long ago it felt like a beginning of a beautiful friendship – too bad you passed away prematurely. Rails, here I come again!