Tuesday, November 04, 2008

WARNING: RubyGems 1.2+ index not found for:

RubyGems will revert to legacy indexes degrading performance.

I was getting this error message while upgrading from Rails 2.1.1 to 2.1.2. Just add github as another gem source.

1. sudo gem sources -a http://gems.github.com

2. sudo gem install rails --version 2.1.2

Monday, November 03, 2008

Rails 2.1.1 Htmldoc 0.2.1 PDF generation

I was getting the error:

NoMethodError (undefined method `size' for false:FalseClass):
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/action_controller/streaming.rb:123:in
`send_data'

Patch the file :
/usr/local/lib/ruby/gems/1.8/gems/htmldoc-0.2.1/lib/htmldoc.rb

with the following:

result.split("\n").each do |line|
+ line.strip!


Reference:

http://textmode.at/2008/5/14/ruby-htmldoc-gem-falseclass-error

Wednesday, October 29, 2008

Using HTTPS in RESTful authentication Rails 2.1.1

If you get the error message:

ActionController::UnknownAction (No action responded to show):

In the sessions controller make sure you have :

ssl_required :new, :create

This will now enable https when someone logins in to the site. All other details can be easily found via Google.

Monday, October 27, 2008

Tagging in Rails 2.1

I had to migrate from Acts As Taggable on Steroids to Acts As Taggable On plugin to get tagging working Rails 2.1.

One migration issue is that context column that is added by this plugin will be null for old data. It must be set to 'tags' for listing tags for a given model. This will make #tag_list display all the tags for that particular model.

Wednesday, October 01, 2008

Dream Machine

I got my Mac Pro 3.2 GHz 2 processor quad core with 16 GB RAM and RAID enabled 15000 rpm SAS drive on oct 29. I am experimenting with 3 monitor setup, two 30 inch Apple Cinema displays and one Samsung 22 inch display.

Let's see how much productivity I can get from this new setup. Only gripe is the hissing noise of the fan. I don't know if it has to do with the SAS drive. I will post my setup photo on rubyplus.org soon.

Thursday, September 11, 2008

Secret to a Developer's Success

In a interview with LinuxDevCenter.com, Matz was asked the "future plans for Ruby", he replied:

loop do
read and reply mails
write code
write document/article/book
write code
end

I think this is an excellent plan to succeed for a developer who is passionate about software development.

Tuesday, September 09, 2008

Integrate ActiveMerchant With Rails

I read the Integrate ActiveMerchant With Rails recipe in the book Enterprise Rails Recipes by Maik Schmidt. This recipe is basically a recipe for disaster.

In a real web application the user must be taken out of the loop as soon as possible. Having a spinner spining or disabling the button or saying don't click the button is a bad design. Take Amazon for instance the user experience on the site is a good example to follow.

As soon as you create an order, you must set it's initial state and process that order in the background. You can use run rake task using a CRON job that processes the orders. What happens if the Gateway is down? What will you recover from network errors? These things happen in the real world and your software that affect the bottom line must be able to handle it.

Monday, August 25, 2008

Winner of Rubyplus.org Rails Documentation Contest

There was only one entry to the contest! That entry was from a prolific Rails contributor Xavier Noria Rami. Congratulations Xavier and keep up the good work.

I will be shipping him a brand new iPhone 3g soon!

Wednesday, August 13, 2008

LaunchBox Unleashes Its First Nine Startups

None of those startup are likely to make any money.

Here is an idea for a startup that can make money:
How about a web app / iPhone app that users can use to check how likely they can get a room with a certain rating in a given location and date? Business travelers will find it very helpful.

Friday, August 08, 2008

Eric Hodel 3000 Logger `load_missing_constant': uninitialized constant Hodel3000CompliantLogger

Rails 2.0 configuration for Hodel 3000 logger blows up in environment.rb. Switching to RAWK. It would be cool to have a Capistrano task that shows the output.

Tuesday, July 29, 2008

Ultrasphinx on Centos

1. yum install bison
2. yum install gcc-c++
3. wget http://www.sphinxsearch.com/downloads/sphinx-0.9.8.tar.gz
4. tar xvf sphinx-x.y.z
5. cd sphinx.x.y.z
6. ./configure
7. make
8. sudo make install

You also need chronic and hpricot gems on your system.

Tuesday, July 22, 2008

Ultrasphinx Search Engine with Rails 2.0.2

ultrasphinx: Anonymous modules have no name to be referenced by

This error is caused due to the autoloading failing to load the required Ultrasphinx files in Rails 2.0.2. The following is the fix:

1. require 'ultrasphinx/fields' in ultrasphinx/configure.rb

2.

production.conf

source episodes_main
{
html_strip = 1
}

index main
{
strip_html = 0
}

3.
In environment.rb

config.after_initialize do
Ultrasphinx::Configure.load_constants
end

Notes:
git clone git://github.com/DrMark/ultrasphinx.git vendor/plugins/ultrasphinx
rm -rf vendor/plugins/ultrasphinx/.git

Tuesday, July 08, 2008

How Google reinvented Ruby Hash or Protocol Buffers by Google

I was laughing out aloud when I saw the following example on Protocol Buffers:

person {
name = "John Doe"
email = "jdoe@example.com"
}

How close is it to Ruby?

person => {
name => "John Doe"
email => "jdoe@example.com"
}

Tuesday, June 17, 2008

no such file to load -- memcache

On Mac OS Leopard:

sudo gem install memcache-client

fixed the issue.

Install memcached and dependencies on Mac OS X

cd src
ls -l
curl -O http://www.monkey.org/~provos/libevent-1.4.4-stable.tar.gz
tar xvzf libevent-1.4.4-stable.tar.gz
cd libevent-1.4.4-stable
./configure --prefix=/usr/local
make
sudo make install
cd ..
ls -l
rm -rf libevent-1.4.4-stable.tar.gz
ls -l
curl -O http://danga.com/memcached/dist/memcached-1.3.0.tar.gz
tar xvzf memcached-1.3.0.tar.gz
cd memcached-1.3.0
./configure --prefix=/usr/local
make
sudo make install

I installed this on Leopard. Original script by Geoffrey Grosenbach http://nubyonrails.com

Thursday, June 12, 2008

How to import a new project into Google code SVN

1. Go to the root of the project
2. svn import -m "Initial checkin" . https://aoror.googlecode.com/svn/trunk/ --username bparanj
3. Accept the authentication by entering 'p'
4. Enter the Google password for your project

Monday, June 09, 2008

Rubyplus Featured on 15 Great Places to Find Screencasts

Josh Catone has compiled a list of 15 Great Places for Screencasts at ReadWriteWeb.

Ryan Bates is my inspiration behind the rubyplus.org site. Rubyplus site is a tool that I use to share my passion for programming with other developers. Its purpose is to ease the pain and introduce the joy of programming in Ruby to other developers. I have learned a lot from his screencasts and I am a big railscasts fan. I have met him personally at Railsconf 2008.

Open Closed Principle in Ruby

Most of the developers in Ruby community only know about DRY principle. There are very few who know about Open Closed Principle in Ruby.

In this episode I will explain this principle and show an example in Rails where this principle can be applied. You will learn when and how you can apply this principle in Ruby.

Podcasting & Screencasting in Rails RailsConf 2008 Presentation

This presentation will definitely make podcasting and screencasting scary for those who want to get started.

The first few videos of my screencasts available at rubyplus.org has poor audio quality. Don't let details take away your focus.

Here's the lesson from my experience: If you're about to start something new, don't spend weeks trying to make the first attempt perfect. Get started as quickly as possible and learn as you go. Tinker, experiment and look for the big things you can tackle as you go. Solve problems when they need to be solved and you won't feel as overwhelmed by all the things that could be fixed.

Last paragraph stolen from: Solve Problems When They Need To Be Solved