We have used Thinking-Sphinx in several projects to implement search engines. Thinking-Sphinx is a wrapper in Ruby to use ActiveRecord with Sphinx. But in the project I’m working right now I had to solve a different problem: the user should be able to search for formatted values, however without using the formatting characters, i.e, suppose a field containing 111.444.777-35, the user should be able to find it searching for 11144477735 (or a substring of it).
The default behaviour for Thinking-Sphinx is to index the exact values for each column it scans, but we can by-pass it. The Thinking-Sphinx index definition allows us to use raw SQL to define which values should be indexed for each attribute. In my case, I used the native PostgreSQL regular expressions functions to get rid of the punctuation characters, indexing only the “clean” version of each value. My database column is called “entity_number”:
Continue reading
Tags: Rails, Ruby, sphinx, thinking-sphinx
Posted in Rails, Ruby | No Comments »
Sending a large number of emails is not an easy task. It can take a lot of time so you need to do it asynchronously. Also, if you are on a shared hosting, you might be limited to a certain number of emails per hour, so you need to divide your list of email addresses in batches and send them at certain intervals.
There’s a plugin that can help us with this: ar_mailer.
This plugin adds a new deliver method to ActionMailer::Base :activerecord. In this delivery method, emails are not actually delivered, they are stored into a database table. A ruby script ar_sendmail can then be run (in a cron job) in order to send the emails saved in the database.
Step by step intructions on how to use the plugin:
1) Install the plugin
./script/plugin install git://github.com/adzap/ar_mailer.git
Add following line to config/environment.rb:
config.gem "adzap-ar_mailer",
Continue reading
Tags: Rails
Posted in General, Rails | No Comments »
Facebook developers already have a useful info on Facebook components documentation, i.e., they count on Facebook FBML wiki as reference.
Thinking of designers and, of course, ourselves as designers, we made a Facebook Graphic User Interface (FBGUI) resource kit for Photoshop to make our work easier.

The purpose is to speed up Facebook interface design, sparing you from drawing all the comps and letting you customize all the texts, buttons and data as you need.
The kit brings the Facebook vector icon and logo. Also, since the focus of this resource are the UI elements, it brings a main window with the header, menu and the chat window for you to set up your realistic mock-ups. Cannot forget to mention all the modal components, comment boxes, buttons, message boxes, tabs, etc.
Needless to say, all the components are full layered, built
Continue reading
Tags: Design
Posted in Design | 26 Comments »
Ruby 1.9 has some cool new features. One of them is the ability to define default values for the arguments passed to code blocks, like in the following example:
pow = proc { |a, b = 2| a**b }
pow.call 3, 3
# 27
pow.call 3
# 9
This is very useful, for instance, when we dynamically create new methods using metaprogramming and want some of the arguments for these methods to be optional.
class MyMath
class < < self
define_method :pow do |base, exponent = 2|
base**exponent
end
end
end
MyMath.pow 3 # 9
MyMath.pow 2, 3 # 8
But in Ruby 1.8.x we can’t do that, we can’t define default values the arguments of a code block. So what if your application runs on 1.8.x and you need to dynamically create methods with optional arguments? There is a solution, not so elegant as the
Continue reading
Tags: Ruby
Posted in General, Rails, Ruby | No Comments »
According to David Heinemeier Hansson, you will never understand it all. Case in point? David himself.
That was the gist of his answer to how a new change to the way rails 3 renders actions in the browser would be handled for older browsers.
DHH gets involved in the parts he cares about and doesn’t worry about the exact details that have been delegated to someone else. He says we should not worry about knowing the whole framework because he doesn’t either. We don’t need to live up to an impossible standard.
Continue reading
Tags: Rails, rails3
Posted in General, Rails | No Comments »
If your Google Chrome browser is acting awkward with fonts like in the picture (displays all “A” characters) instead of serif fonts or of all fonts, you may need to clean your Mac OS X Font Cache.
Here’s how to do it.
Continue reading
Tags: apple, chrome os, google, safari
Posted in General | 2 Comments »
Tomislav Bilic will open the 7th edition of the Web Conference: Startegy in Zagreb, Croatia on March 18, 2010.
Web Conference: Strategy 7 – “Good developer spirit” includes educational lectures, directly and indirectly related to the web development thematic by lecturers who will educate participants on how to improve their knowledge and working environment in their company. The conference will be divided into development and technological issues, and will be the word on access to web development of experienced web professionals who will reveal some of their small business secrets. Also, as part of the conference will be held the ceremony of the Golden Web Award: Strategy.
Continue reading
Tags: inchoo ecommerce team, surgeworks culture
Posted in Surgeworks | No Comments »
Offshore software developer position using Ruby on Rails and web technologies to build web applications for desktop browsers and targeting mobile devices. Also using Rhomobile to make native mobile applications.
Candidate should be a remote worker, must use an Intel Mac running OSX 10.5 or 10.6, should have strong communications skills, good written and spoken English. Availability on IM or Skype required during work hours.
Continue reading
Tags: android, blackberry, community, iPhone, Rails, rhodes, surgeworks culture
Posted in Surgeworks | No Comments »
Dear friend,
Our global Surgeworks team prepared a greeting card for you. Click here to see it.
Merry Christmas and Happy New Year!
Continue reading
Tags: surgeworks culture
Posted in Surgeworks | No Comments »
Everyone can finally download the public beta of Google Chrome for Mac. Many could think this is a piece of software that should only appeal to windows users, since they are the most subject to be unsatisfied by their Internet Explorer standard web experience, however there are reasons for you to try out Chrome even if you’re a happy Safari user.
At least, these are 3 reasons why I’ll try it out.
Continue reading
Tags: apple, chrome os, google, safari
Posted in General | No Comments »
Recent Comments