Articles

Greasemonkey script for pootle

I think one of the most unpleasant tasks when you internationalize a web page is locate missed sentences and translate them.

Pootle allow us to keep a centralized translation repository where translators can work together. But pootle sentences navigation is a little weird and you always finish searching sentences by hand.

NAMED_SCOPE in Ruby on Rails

The has_finder gem has been added to Rails with a different name: named_scope

For better understand let go through the following example:

class Article < ActiveRecord :: Base
named_scope :published, :conditions => {:published => true}

named_scope :containing_the_letter_c, :conditions => "author LIKE '%c%’"
end

Article.published.paginate(:page => 1)

Search from multiple tables in mysql

CREATE TABLE `tagsearch`.`books` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(200) NOT NULL,
`author` varchar(100) NOT NULL,
`price` float(10,2) NOT NULL,
`comment` text,
`created_on` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`updated_on` timestamp NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
)

CREATE TABLE `tagsearch`.`tags` (
`id` int(11) NOT NULL auto_increment,
`tagname` varchar(200) NOT NULL,
`counter` int(10) NOT NULL default '0',

The Third Seattle.RBBQ

Back yard
Figure A Back yard

For the third year in a row, it’s the Seattle.RBBQ at Geoff’s house in Seattle!

Competitor Comedy

Shopify got profiled last week in Practical E-Commerce as cart of the week . According to them they found 300 different Shopping cart packages, I know our market was big but that’s pretty insane.

Anyways, their Cart of the Week feature pits one Cart against another by asking a competitor to comment on the software, CNN style. In our case they asked Rick Wilson of Miva Merchant to comment on Shopify. Here is what he dislikes:

93. RESTful Rails

This is the presentation that I gave to Silicon Valley Ruby on Rails. Some of the topics covered were:

Sorting things out

I recently packed up everything I own and moved. I'd lived in my old place for about nine years and I have the packrat gene on both sides of the family tree, so I had a lot of crap to sort through to figure out what to move and what to trash, as well as which box what should go in. Now that I'm here in the new place, I've had to sort through the remaining stuff to figure out where it all goes. So you might appreciate that sorting has been on my mind a lot lately. (See? It's a topical tie-in. I don't do those often, so I hope it wasn't too awkward.)

Sorting things out

I recently packed up everything I own and moved. I'd lived in my old place for about nine years and I have the packrat gene on both sides of the family tree, so I had a lot of crap to sort through to figure out what to move and what to trash, as well as which box what should go in. Now that I'm here in the new place, I've had to sort through the remaining stuff to figure out where it all goes. So you might appreciate that sorting has been on my mind a lot lately. (See? It's a topical tie-in. I don't do those often, so I hope it wasn't too awkward.)

Arrow Lambdas, a Ruby 1.9 Vignette

Proc, the object-y twin of the syntax-level block, is the subject of a controversial change in Ruby 1.9: the addition of a new literal.

It’s here to stay. Let’s play a bit, shall we?

While we still have Kernel#lambda, in Ruby 1.9 the parser now accepts a literal that looks like the following (to support some great new features such as default arguments and associated blocks):

RORO August meetup roundup and my preso slides

At the RORO Sydney meetup last night we had an awesome line-up of presos, a new venue and a really fun vibe… it’s feeling more like a webjam than a tech meetup!

Articles | Rails Fire

Articles

Shoes Tutorial Note on Heroku

Blog redesigned

After 5 long years of using the same old blog theme, which I’d handcrafted from scratch way back in 2004, I’ve finally got down to refreshing it to a more contemporary look. I’ve also updated the woefully outdated About page.

Here’s a before and after shot:

Blog theme - before and after

Create an object of a type (class) stored in a string

So, you have a class of object stored in a string, and you want to create an object of that class. You cannot assign a type of an object directly (by say @myvar.class = xxx), and the class conversions are limited to the basic built-in classes like to_s, etc. But you can use this trick:

No SQL

Since we have been using I18n in Partigi for the last months we have notice that we were always repeating ourselves when localising a sentence like this:

This film has been saved by 4 friends

What is special in this sentece is that, depending on the number of friends that saved the film, the sentence could be "This film has been saved by one friend". It can be solved with pluralize helper, but it requires the counter to be at the beginning of the sentence.

Rails: Black Box Testing Complex Models

In this article I will show you how you can perform complete end-to-end testing of very complex models using a method called Black Box Testing.

Correct Format Plugin Released

I have released a new Plugin for Rails, called Correct-Format.
Github URL: github.com/mendable/correct-format

This plugin allows you to automatically correct simple user input mistakes
and format user-input without raising an ActiveRecord Error and without
inserting inconsistently formatted data into your database.

Community Highlights: Rails Prescriptions

Doing Test Driven Development (TDD) effectively is not something that comes easy, even when you’re working with a well structured Rails application. Up until March of this year there really was no guide I could recommend for developers who wanted to learn TDD with Rails.

$stdout.sync = true to flush output immediately

Try this.

5.times do
  putc('.')
  sleep(2)
end

I was hoping that I will get a dot after every two seconds. But that’s not what happens when you run the code. I see nothing for first 10 seconds then I see five dots in one shot. This is not what I wanted.

Amsterdam Meetup: Success!

Thanks to everyone who came out!

I asked those present to share an open source project of theirs. Here are a few:

Joseph Wilk talks about BDD and Cucumber

I had time for a quick chat with Joseph Wilk to talk about Cucumber and BDD!

MC: JosephwilkThanks very much for taking the time to chat - can you tell us a bit about yourself, and what you do?

Articles | Rails Fire

Articles

Double Shot #455

Today, I need to write more words about code.

Dear Railsists, Please Don’t be Obtrusive

obtrusive_or_not.png
Update: thanks to Jon Wood aka jellybob, a prototype demonstration has been added, which is even better than my original jQuery btw as it degrades gracefully. Check it out in the ‘prototype-unobtrusive’ directory.

Aloha on Rails

If you only have the budget to travel to one regional Rails conference this year, this might be a good choice:

...for obvious reasons.

Memoization in Ruby and Python

Wikipedia defines memoization as “an optimization technique used primarily to speed up computer programs by having function calls avoid repeating the calculation of results for previously-processed inputs.”. This typically means caching the returning value of a function in a dictionary of sorts using the parameters passed to the function as a key. This is done in order to reuse that returning value immediately without calculating it again, when the function is invoked with the same arguments.

Swine Flu and the Twitter Gem

In which I wax poetic about the trendy new addition to the Twitter gem.

I had some extra time today and I’ve been spotty on open source work over the past few weeks, so I decided to add support for the Twitter trends API to my Twitter gem.

Getting Started with Ruby on Rails: Installation

Introduction

This article will guide you through the process of installing Ruby on Rails, and any other software that is required to begin using it.

This is the first of two articles, Part 1 will show you how to install Ruby on Rails (on Windows) and Part 2 will show you how to create a basic blog.

In order to create a web application with Rails, you will need the following software:

The Git Parable

I’ve written a blog post over at my personal blog that you all may enjoy. It’s about learning git by looking at how a Git-like system could be built from first principles, and it may help you to understand the concepts that make Git so powerful.

New code contributor index

Xavier Noria (code) and José Espinal (design) have created an awesome code contributor index for Rails core submissions. It’s being updated automatically every night and tracks the number of commits and which particular commits to individuals in the community. You can even track the commits over time, as in who’s been most active this month.

The Ruby Toolbox: See The Most Popular Ruby Libraries By Usage

Toolbox_Red-256x256.pngThe Ruby Toolbox gives Ruby developers a categorized overview of 100 or so different libraries ranked on how commonly used they are.

Evan Dahm South | Rails Fire

Evan Dahm South

2009 Reading list

Recently – for various degrees of recent that is – people really seem to be into programming language design and development.

Simple AWS scripting with boto

Recently – for various degrees of recent that is – people really seem to be into programming language design and development.

Android and me

Recently – for various degrees of recent that is – people really seem to be into programming language design and development.

happynerds.net is online!

Recently – for various degrees of recent that is – people really seem to be into programming language design and development.

Syndicate content