Aug 29

How can our code take a screenshot of a webpage, and save it to an image file ?

It turns out it’s easy. First, we need to

gem install win32screenshot

Then, write code something like this:

require ‘win32screenshot’
width, height, bmp = Win32::Screenshot.foreground
img = Magick::Image.from_blog(bmp)[0]
img.write(RAILS_ROOT + “/public/images/screenshot.png”)

Voila, and you get the screenshot!

Aug 24

I was a PHP programmer before, I got used to ‘echo’ when trying to debug PHP application.
That’s why when migrating to Ruby from PHP, I used pp a lot. Although it just prints to console, it helps a lot.

But I’ve been wondering all this while, sometimes I got an application error, undefined method ‘pp’, while trying to pretty-print an object on Rails.

I never bothered to find out why, until today where I just happen to.

It turns out we have to require ‘PP’ on our code to make it works. Duh!

And make sure you use lowercase ‘pp’ if you are in a linux environment, otherwise it will say No such file to load

Aug 21

I’m lucky we have the Entrepreneur and Business 2.0 magazines here in Indonesia.

Those two magazines always inspire me new business ideas every time!

The problem with business ideas are, well, they are just ideas until we execute them!

The desire to create a lot of websites has always been in my heart, I just am waiting for more human resources.

Yes, we are trying to hire more talented people. In fact, we never stop placing a job ad for the last six months!