alex brie . net

Posts Tagged ‘Ruby

09 Aug, 2008

Always index your tables. Always

Posted by: Alex In: Ruby| Tips and Tricks

This is going to be brief one: iRead.ro, one of the projects I’m working on during my spare time, was giving me major headaches lately – 2 weeks ago, it took like 15 seconds to render a page. In the last couple of days, it was taking somewhere around 100 seconds to render it; obviously [...]

Other blogs about Ruby or Rails have already touched some of the tips I’m going to show, but it never hurts to remind you these small recipes aimed at Ruby novices:

To my shame as a rubyist, it was only a couple of hours ago that I found out, while reading Ruby Inside about mod_rails and the wonders it does for the Rails community.

16 Jan, 2008

Enumerable iterators (why I love Ruby part 2)

Posted by: Alex In: Rails| Ruby

Got myself a sleepless night recently and killed some time reading the Rubyisms in Rails book. The chapter about Iterators was particularly pleasant, reminding me the beauty of Ruby’s Enumerable class – feels so Lisp-ish and Scheme-ish to write stuff like col.select{..}.collect{..}.join(“, “)
For the curious, here’s a cool excerpt from the book, with Enumerable’s most [...]

07 Nov, 2007

Ruby Metaprogramming part 2

Posted by: Alex In: Rails| Ruby| Tips and Tricks

Last time I discussed Ruby and metaprogramming, I was trying to stay DRY (Don’t Repeat Yourself) while coding some very similar-looking methods. The solution, then was to use class_eval to dynamically add methods into the current class, the way attr_accessor and it’s peers already do.
Today I was having a similar, yet more difficult problem: the [...]

08 Sep, 2007

Ruby: create your code on the fly

Posted by: Alex In: Ruby| Tips and Tricks

Ruby is so powerful it scares me. I’m far from even grasping how powerful it is. Whenever I discover something cool to do with it, I have the urge to tell it to the world.
First, here’s the context:
I’m currently working my way through building a Rails browser game in the style of these ones. For [...]

Here’s the quick story: I was hoping to win the Romanian lottery (6 winning numbers out of 49). On the website, they were having the list of the winning numbers from 1998 to now. So I copy-pasted them all into a text file, and wrote a quick and dirty script to count their appearances and [...]

25 Apr, 2007

Setting up Rails and SQLITE

Posted by: Alex In: Rails| Ruby| Tutorials

If you are interested in web, databases and the like then you probably already heard of SQLITE. If not, here’s a quick intro
SQLITE is a database engine that uses just one file per database. It’s tiny, simple to use and, most importantly, very easy to use with Ruby on Rails. All you need is the [...]

Challenged by a commenter on my website, I spent the last half an hour coding a tiny application that updates your Yahoo Messenger status with your latest Twitter status. It’s Windows only (I’m a Mac user myself, and twitterific does a good job for it).
The reason why it’s a Ruby script and not a self [...]

03 Apr, 2007

Grepping in Ruby

Posted by: Alex In: Ruby| Tutorials

You can’t call yourself a programmer if you never used Grep (or diff, or wget, or regular expressions for the matter). I couldn’t call myself a programmer till the fourth year of college, btw..
Still, grep has a pretty big manual page, and being a casual grep user I never see the need to [...]

Comments Off

My cool colleagues from Trex Global gave me an unusual assignment this week: profile the current implementation of our first two apps, DeferEm and DepreciateEm.
Among the requests, the usual ones:

Request response duration
Execution profile of flow (path taken, time in methods)
SQL Queries made
Analyze and Identify performance bottlenecks – in-memory, sql query exec


aboneaza-te la blogul meu

Categories