Nov 8

This happened to me today when using ActiveResource.

For example, Order.find(:all), whereby Order is an ActiveResource object, always returns the ‘cant mass-assign’ error.

The error is really not informative.

So after a couple of head-scratching hours, it turns out that if the result of Order.find(:all) includes a Shipment object, for example, then we should not have an ActiveRecord app/models/shipment.rb in our application.

It’s just a naming conflict it seems. I’m not really sure why this happens, but hopefully this helps others who may encounter the same problem.

Oct 29

Thank you so much for those of you who have contacted us lately. We truly appreciate the interest. We are however, unfortunately, very short staffed. Seems like finding new clients is easier than hiring talented engineers!

For now we wouldnt want to hire many people at once, because we never want to lay off our engineers, even after our contracts with our clients are over.

Also, training and making sure all new engineers are up to the standard would be more difficult if we hire engineers too agressively.

That’s why we’re taking a more modest approach when hiring.  Currently our rate of head-count growth is an additional of one engineer per month.

But rest assured, we are doing the best we can to satisfy your development needs!

Oct 14

Ever that kind of error when trying to use HttpMock to test your ActiveResource client code ?

I got that error, and for hours couldnt figure out why. I have followed the tests in the library (such as test/base_test.rb):

ActiveResource::HttpMock.respond_to do |mock|
mock.get “/people/1.xml”, {}, @somexml

Well, it turns out that I need to set .site = “http://localhost” on the ActiveResource class I’m using!

Hope this helps anyone who experience the same problem as mine.

But if you are developing both the web service client and the provider, it’s better to just execute the XML request to the provider application instead of doing HttpMock. Because well, it’s a local connection, so it’s fast. Also it can help find bugs in the provider application.

Sep 15

The order of which we load fixtures to our tables will need to be defined when we use foreign key constraints on our tables.

These would likely be the errors when doing rake db:fixtures:load

rake aborted!
Mysql::Error: #23000Cannot delete or update a parent row: a foreign key constraint fails

Basically it’s because rake db:fixtures:load loads fixtures (empties the tables and inserts back) alphabetically.

Here is the solution (which works great) from Mr. Olesen.. Basically just write the order in your environment.rb :

ENV[’FIXTURES’] ||= ‘accounts,developers,users’

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!

May 15

After almost a year, our office with an area of about 1100 square feet, is getting very crowded.

There are 11 people working there, and the shared internet has gotten pretty slow.

Today, we officially move to a new, much better office in south Bandung!

With an area of about 3500 square feet, nicer neighborhood, we just love this new place!
Moreover, we subscribe to two internet providers to get more bandwidth!

This new office will definitely boost our productivity and comfort for our engineers. Yay!

May 5

A client of us requires line-by-line code checking (literally), and not just code that works; it must be clean.

Their standard is very high. To match their standard (which we believe not impossible to achieve), starting today we will do regular training to each and everyone of our engineers.

Before each training, participants must read ahead the topics to be discussed. We will discuss the topics from these books first: Test Driven Development by Kent Beck, the Programming Ruby book, and Agile web development with Rails

I believe practice alone is not sufficient without strong theoretical foundation. That is why reading Rails books and beyond is VERY important.

May 4

I was introduced to Trac about half a year ago, very nice and helpful!

Trac is not the only one project management tool out there of course, but I think it’s one of the best.

But setting it up (including the SVN integration) could be difficult. Especially on a shared hosting.

I came across this site, SVN Repository. It gives you unlimited Trac (and SVN) instances for only $6.95 a month. Very beneficial indeed! I can now give my clients who didnt have project management tool, a Trac each!

« Previous Entries Next Entries »