2 years and a half of ruby on rails

Posted by Mathieu Jobin Mon, 11 Jun 2007 06:13:05 GMT | 2 comments

It has been 2 years and a half already since I had the pleasure to met David H. Hansson also known as DHH. He convinced me to use ruby on rails and swear by it from now on in the first week of November 2004. He was well prepared but it was easy anyway.... with such a nice technology, I can recognize what is good and I loved it right away. What he thought could be a week of arguments about our favorite technology took him only a few hours and then we could concentrate on our work and he helped us a lot.

I am happy I met him while he was not so famous, or at least I did not know him at all. He was just some guy coming which who we are spending a week training. If I had knew him, the whole week would have been so different. Admiring someone leads to much less productivity than just listening to someone. I remember even, before we take the picture before he leaves I remember thinking not being sure why we needed a picture. Now I am very happy to have this picture.

picture

I was working at Combustion Labs in Vancouver and our great boss met DHH in a Chicago conference and decided to hire him to train us for a week. Thank you Mike.

And Thank you David H.H., because of you I now have a tool to suggest to help people write clean code and I of course have the best web development platform. Big Thanks

Posted in ,

Tracking down not found rhtml templates in rubyonrails applications

Posted by Mathieu Jobin Sun, 12 Nov 2006 12:58:41 GMT | no comments

Maybe you've seen this error before?

No rhtml, rxml, rjs or delegate template found for [view_name] (ActionView::ActionViewError)

I have a slightly special setup for my error mailer in one of my rubyonrails applications, as the mailer is not in app/models and the view not in app/views.

This used to work fine, until I changed god knows what and I realized it was broken for a little while. (by now, I, of course, know what broke it). And it was pretty hard to debug because I am using the system-wide installed rubyonrails on a shared hosting on which I don't have root access.

So at first I wanted to put some more logging in there to help me debug this beast. but for some reason, running the application with my own rails in vendor/rails was breaking everything. Can't edit the files, can't run my own, hmm.... what to do?

So today I took the few minutes it was requiring to find the right little place to put the proper logging. One thing I should add, I am an excessively lazy programmer and I like things to be short and sweet. So I did not want to copy paste a 10-15 lines function into my code. but there it is I found this one. template_exists? is only 3 lines of code, so no big deal to copy paste. there is not much chances it will change so much in the future versions of rubyonrails.

module ActionView
        class Base
                def template_exists?(template_path, extension)
                file_path = full_template_path(template_path, extension)
                logger.error(file_path)
                @@method_names.has_key?(file_path) || FileTest.exists?(file_path)
        end
        end
end

Just place this little piece of code at the end of application.rb for example and every templates that are tried will be logged in your development.log or production.log file. It helps very much to track path problems as the regular error message isn't really descriptive.

that's it, enjoy.

Posted in , ,

Do you HATE your programming language?

Posted by Mathieu Jobin Fri, 13 Oct 2006 02:22:00 GMT | no comments

As many of you already know, Google recently released their Code search. After reading about Code search ideas and found Expression of which programming language sucks more. For instance, Python sucks. (thx, paolo). I thought, actually its not about which language suck the most. but what language are the programmer the less Happy with. So I checked a few of them. I'm sure the huge number next to C is related to the fact tons of C code is open sourced and C is also the oldest. but there is a huge difference there.

But finding "qt sucks" in kdelibs source is a bit of a shame. at least for me who literaly love Qt and KDE. Qt (total 11), KDE (total 2)

I am a bit disapointed to find almost none MFC Sucks. It's probably just because there is not much open MFC code. Well, I hope so.

But what I found very interesting and why I am actually posting this. Is because ..... (roulement de tambour)..... No one, programming in Ruby thinks that ruby sucks. For few very simple and straight reasons.... ruby rocks, i love ruby and ruby is fantastic

so go ahead and learn Ruby

and don't forget that people DO love their job and more

Posted in , ,

Gotta Love Dreamhost

Posted by Mathieu Jobin Wed, 04 Oct 2006 02:57:00 GMT | no comments

So Dreamhost recently celebrated their 9th anniversary. and for this event they upped our disk space and bandwidth limit BY TEN (10). Actually, it feels like 20x.

So I was using 30% of my 20GB of space (got lot of pictures). and suddenly I am now only using 3% for my new 200GB of space ;) I wonder what would happen if everyone would suddenly decide to fill it up ;)

Dreamhost Host Quota, gotta love 'em

The best part is, I got this account for so cheap, I'm even a bit shy to tell you all the details....

So go ahead and create yourself a Dreamhost account by clicking here and save even more money by using this coupon code. GODREAMHOST20 Simply enter the coupon when you sign up for your account, you will save 20$ dollars on your invoice. its as easy as that.

if you need more info about Dreamhost and what not, feel free to ask me. I used them for a bit more than a year now. And I am simply more satisfied with them every single month.

Posted in , ,

Bad programming practices(tm)

Posted by Mathieu Jobin Tue, 12 Sep 2006 09:01:00 GMT | no comments

Your coming into a forum or an IRC channel, you ask a simple question, yet uncommon. and people are screaming. “Stop, Don’t do it!”, “it’s evil”, “these are bad programming practices, prove me you can’t do without”. And such, before you had time to say more than two lines.

But why is everyone trying to preach absolutely nothing without knowing a thing. They have no clue what I am working on. What would I do with this bit of information and what particular problem I’m trying to solve. but yet, they know it’s evil and I should not do it. Hell, I’m not even sure what I’m gonna do yet. I’m looking for different solutions. What exactly is evil? I have not thought of anything yet.

for people who know C and used to pointer basics have a quick look at the following example.

void foo(&var) {
  var = 42;
}
x = 0;
printf("%d\n", x);
foo(x);
printf("%d\n", x);

I was simply asking if passing a variable by reference in such a way would also be possible in Ruby. I have been refered, among other things, to an excellent page documenting Ruby bindings. I am not sure yet if bindings is the only way to go in order to achieve something as simple as this. but what I do know, though: “ITS EVIL”...

actually, I knew Ruby bindings before. But I wanted to use something simpler, more embedded into the syntax. I thought hearing something different, more C-like that I could use. but getting actual help through all the flames was a challenge on its own. so it’s all I got.

yet, I’m not sure I’ll use it for my particular problem, for one, I was looking for something different and for two, well, its EVIL apprently. And god knows I don’t do EVIL ;)

I got another example, this one happen few months ago. I’m heading into the ruby channel again asking for a ruby+japanese related questions. no anwser, total silent. I figured nobody knows as they are almost all english and don’t deal with japanese stuff. but since Ruby programming language in born in Japan and the japanese community is quite active, I thought asking in Japanese. suddenly I got an answer.

the first one, in japanese was simply answering my question. politely and perfectly. the second one? just english screaming. “This is an english channel, talk in english, this is not a japanese or internation channel, stop, its EVIL.”

god, what the hell. you use computers and ruby you should at least appreciate the multi-cultural side the internet offers us. well, he was probably scared I was flaming about his grand-mother. what else could I think?

anyone has a decent explanation for such behavours? am I the one who is weird/wrong?

Posted in , , , ,

Couple of Rails links

Posted by Mathieu Jobin Wed, 06 Sep 2006 05:28:00 GMT | no comments

Here is a couple of links about rubyonrails performance and m2m features I ran into today. I just want to keep them as I do not have time to go through them all fully and assimilate everthing.

about performance

about has_many :through

My favorite tooltip js library

Posted in , , ,

kikkanji

Posted by Mathieu Jobin Wed, 17 May 2006 04:53:00 GMT | no comments

Here is my latest toy. I made myself a Kanji studying tool. It took me only few hours to build using QtRuby. I find it pretty amazing what I built in this short amount of time even though I don't have much experience with this technology. It is a really impressive technology.

I build up a small kexi (sqlite3) database, which I open with ActiveRecord. I could have used Qt's SQL module, but I'm so used to AR that I did not bother.

I named it kikkanji because I first intended to create a kicker panel applet. but, panel applets are not yet possible with QtRuby. so I had to wait. I instead used Qt Designer and created myself a main window.

kikkanji

download now

comments and feature request are definitely welcome.

Posted in , , , , , , , , ,