Category: ruby

Writing MacOSX System Services with RubyCocoa

Posted by – September 7, 2009

Today I started my study about RubyCocoa and how it works, my first project was a simple system service for MacOSX Leopard where the user can type a portuguese text, select it and translate to english, the user can also type the text in english and execute the system service to translate it back to portuguese.

Here’s what I did:
More

Share

When convention over configuration sucks

Posted by – February 2, 2009

Last saturday I wrote a small application using rails 2.2.2, rails is pretty handy in many ways, when writing models, controllers and views, I could get this application working almost like its jsf version, except for one thing, convention on primary keys.

Rails has a convention on primary keys, if you are using sqlite as database you are limited to use an auto-increment column as primary key, no user provided id is allowed. You can customize the column name of primary key, but nothing more.

To change the column name of your primary key you must call set_primary_key method on your model class, like below:

1
2
3
4
class Supplier < ActiveRecord::Base
   set_table_name "supplier"
   set_primary_key "fid"
end
Share

No way to deploy Rails applications on Apache running under Windows

Posted by – January 20, 2009

After few days trying to run a rails application under apache with “help” of fastcgi module and without any success I’m finally giving up this idea, the reason is simple, I just can’t compile a c code used by fastcgi binding for ruby because of some missing header files and compiler support.

I tried to get the same application running on apache without fastcgi module but it is too sloooow.

The truth is, you can develop rails applications on windows, but please, don’t try to run this applications on apache with fastcgi support, you will waste you time.

To be honest, I don’t have the same problem when running Rails applications on top of JRuby since I can deploy these applications on any servlet container like Tomcat or Jetty.

Share

Gracelets – DSL for JSF Applications

Posted by – September 15, 2008

Sometimes I remeber to visit TSS site to check some news about Java world, one of the threads that catch my attention was the article about use Raven to build Java projects, Raven allows to use your DSLs to write build files on top of Java language, with these DSLs you can do much more than any other build system like Ant but with less code.

You can define your own DSL to solve a specific problem, Raven uses a DSL to write builds scripts, but you can use DSLs to generate XML content, RSS content, HTML pages, SQL statements, create swing applications and to perform unit conversions.

But what about Gracelets? What’s it for?

More

Share

ActiveRecord Rocks But I Can’t Say the Same About Rails Views

Posted by – September 15, 2008

ActiveRecord has proven to be a easy to learn and productive ORM solution, you can define your application model with few lines of code, the syntax is much more concise than any other ORM solution.

But, in other hand, rails doesn’t have a elegant way to work with views, with a lot of loops and conditional expressions in the middle of code, this kind of approach remembers me the PHP coding 8 years ago, where after several lines your code become very hard to understand an maintain.
More

Share