Subscribe: Rajesh about prodigious revolution of daily life
Added By: Feedage Forager Feedage Grade A rated
Language: English
ajuby  database  domain  find initialize  find  initialize thumbnail  new  rails  release  ruby  soap  string  thumbnail  zimbra 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Rajesh about prodigious revolution of daily life

Rajesh about prodigious revolution of daily life

General blah about what happens around me and Impact of that on my apprehension.

Updated: 2018-02-18T04:51:50.863-08:00


Zimbra MySql connection using MySql Clients


Zimbra uses MySql database and when you try to connect to mysql under zimbra user with following details, it might throw access errors.

user : zimbra
password : [no password]
host: localhost  ( or wherever you have installed the zimbra)

Also , if you already have your own mysql installed before ,  it might conflict for the mysql clients like CocoaMySQL.  To make it work you need to specify the right socket path. Specify 


Once you specify above socket it exactly knows what mysql db to connect to. You can make this work for phpMyAdmin or any other MySQL clients.

Setup Zimbra on your home machine to receive emails from your domain


This was a fun exercise to get Zimbra setup on my laptop to receive emails for some domain that I have registered. Fun came in different shape and size (what I really mean is highs and lows of frustration point). So here it goes.
I have a domain e.g. and I wanted to route all the emails sent for this domain to my laptop where I have setup Zimbra. Before you do this few points to remember and work on
  • You need static IP address or publicly available domain so that MX server can point to your static IP or domain.
  • If you have firewall setup at your home, you will have to open couple of ports to make it work.
(You can skip this step if you have static IP address)

I have DSL at home, so the Dynamic IP address and I have to get a static IP so that mails can be routed consistently to the same IP or domain. So find your outside world IP address first , best way to get this go to and it will tell you your IP address seen by the world. Next thing to do is, map your dynamic IP to some static domain. DynDns provides this kind of support for free. Go ahead and signup and get the free service where you can pick DynDNS domain to map to your dynamic IP address. Let's say you picked from the list.

(Note: Make sure you choose "Specific mailserver will route all mail for my DynDNS host" option in mail routing section and specify your actual domain hosting providers mailserver hostname)

Next step is go your hosting provider where you have your domain hosted ( . Go to your domain's DNS settings and change your Mail server (MX record) to Other mail server option and set

MX 1 / Prio -> 1

Now to your home network firewall setting and open port 80 (http) and 25 ( SMTP) for incoming connections, so that outside world can access your machine on above ports (80 for http connection and 25 for SMTP mail relay). Some firewalls might have port forwarding option also.

Now lets start cranking with Zimbra. Download and install Zimbra as per your operating system specifications. Follow the Zimbra quick start guide for installation . In short
  • Stop anything running on port 80 before you start the install
  • When installation starts it will ask you for domain name and say localhost (do not say , ignore the message installation script message about not finding MX record mapped to localhost.
Once installation is complete , script will try to start the zimbra server. Hopefully server started properly go to https://localhost:7071/zimbraAdmin/ login with the admin username/password you created while installation. You will see localhost already under domains. Now you will have to go create new domain with (your actual domain name) and user for that domain. e.g by going to accounts option.

That should do it. Now you can go to any of your email clients and send an email to and you will see email coming right to your zimbra server. To check email click on in accounts option and click on "View Mail" option on right hand top pane.

acts_as_attachment error : undefined method `find_or_initialize_by_thumbnail_and_parent


You will possibly be seeing this error when you use acts_as_attachment for thumbnailing.

undefined method `find_or_initialize_by_thumbnail_and_parent'

Basically acts_as_attachment is trying to use dynamic finders ( Good article on that is here ) to find and create new object if it is not found. Developers use acts_a_attachment ( instead of attachument_fu; successor of acts_a_attachment works only Rails 1.2 onwards) because it works with older version of Rails (1.1.6) and when you execute thumbnailing you get above message and the reason the dynamic method find_or_initialize_by_thumbnail_and_parent that internally calls find_or_initialize which is available in Edge rails onwards and Rails 1.1.6 does not have that. So kinda defeats the purpose of using acts_a_attachment for Rails 1.1.6.

In any case don't be disappointed and here is the fix ,so you can use everything as it is. Go to your vendors/plugins/acts_as_attachment/lib/technoweenie/acts_as_attachment/instance_methods.rb and look for method find_or_initialize_thumbnail , you need to patch this method to make it work with Rails 1.1.6 ( basically find and create new object seperately)

Replace following

def find_or_initialize_thumbnail(file_name_suffix)
respond_to?(:parent_id) ?
thumbnail_class.find_or_initialize_by_thumbnail_and_parent_id(file_name_suffix.to_s, id) :



        def find_or_initialize_thumbnail(file_name_suffix)
respond_to?(:parent_id) ?
(file_name_suffix.to_s, id) ||>file_name_suffix.to_s,
:parent_id=>id) :>file_name_suffix.to_s)
This should do the trick.

Facebook micro application success trend started


Angel community was watching when Facebook platform launched and they were expecting plenty of applications to launch under Facebook umbrella rapidly and eventually some one will cash in the success in terms of user base. 

I guess exactly same thing happened to Where I have been. Here is the news ( TripAdvisor buys Facebook app for $3 million). This again proves few simple things about consumer space

  • User base, User base, User base
  • Data is more valuable than Technology
Now the race is on and applications will be more aggressive to pan out, attract more and more people. Facebook proved its platform strength after all. 

Our first Ajuby meetup


Even though we have been in quite a few silicon valley ruby meetups with low key Ajuby push by dropping one page Ajuby brochure on the front door, We had our first formal Ajuby meetup today. It went well . Not everyone showed up who RSVP'd for the meetup, there were handfull.

We started with little introduction of Ajuby on how it started, why kind of slides. Then we dived right into high level features of our last release 0.5 ( which I blogged in a seperate post last time). As we were passing thru slides, audience were curious and questions about vision, business model and eventually couple of guys were interested in looking at actual code. I eventually opened Textmate and started walking everyone thru the Ajuby code base. I guess people were curious to know how different Ajuby is from conventional Rails application. Answer was simple, Ajuby is an Rails application with additional directories custom to Ajuby.

Whole take from this exercise was wonderful, curious eyes with valid questions, Discussions will possibly take feedback to feature path, we are helping ourselves and others.

We have a long way to go in this process, lot to learn, lot to provide to the community because we have got from community so much all these years.

iPhone Frenzy.


I just could not stop writing about iPhone. Looking at the craze generated by apple's usual brilliant marketing machine, people went nuts buying iPhone and there are huge group of people who bought iPhone just for pure tinkering and push the mobile development to its limit.

We have seen mobile development for so many years, but what is happening with iPhone front is nothing like any other mobile revolution we have seen so far.

Look at the applications developed for iPhone in a hack-a-thon. If you go thru this list, quite a few of them are potential crowd pullers. If executed well can lead to big money making machine.

On the other hand, I'm wowed ! by speed of development. We will see more of these. iPhone can possibly build parallel world of social communication and media and convert lot of people use mobile phone to do everything that they would do on a personal computer, I mean everything right from emails, chatting with friends, business collaboration and transactions. For developers and nerd community Apple might come up with lightweight portable programming platform , where you can dock iPhone , pipe it to big screen and do your application development.

Ajuby releas 0.5 brings business mashup building one step closer


We are glad to announce Ajuby release 0.5 today. It is very exciting get this release out after long and late hours of work, with tons of fixes and UI consistency across browsers (IE/Firefox/Safari).

This is a milestone release for Ajuby team in terms making integration platform availability (for building Web services/SOAP/XML exchange) , sample applications demonstrating possibility of mashups (SugarCRM and Basecamp conglomerate).

Here is the release information in detail

You can also check out the Ajuby blog for up to date information

To get your hands on this release

It just keeps getting better as wide adoption Rails based application increases, Ajuby slides itself in a right spot to make developers and user community to build integrations to popular business applications like Salesforce, SugarCRM , productivity tools like basecamp and storage solution like Amazon S3 rapidly.

IBM's jump to supply Web 2.0 goodies


I was just wondering how come IBM did not start building tools around web 2.0 productivity yet. There you go, now they are. IBM providing tools for mashup building and collaboration. How should all these online Web 2.0 companies who do the same thing and their bread and butter is dependent on that.
It should be interesting to see how IBM's push for this piece works out. Only thing that is making me worry is that they are bringing Lotus name back in the limelight. I hated Lotus applications, including their email client, lamest email client I have ever seen including the user interface. Their Lotus domino server did not go anywhere. Not sure their intention of pushing Lotus name with Web2.0 wares they are coming up with.
One interesting thing that these big players will do is to bring enterprise applications together with slick Web 2.0 applications, which will drive towards Enterprise 2.0.

Rails ActionMailer to use Gmail as SMTP relay


Lot of times we run into a situation, where we do not have sendmail available to test emails because of you are not working on a unix environment, which has sendmail support. The only other option you are left with is SMTP email relay and it gets hard again when you do not have SMTP server available. Best option is to use popular email applications like Gmail to send emails. Gmail will not let you send email directly by specifying basic SMTP auth settings in your rails application. It needs to be more secured.

Following blog post from Anatol Pomozov makes it as a slam dunk. This enables all gmailers to have a capability to send emails from their Rails application.

Another alternative is to setup your own SMTP server. You can try msmtp

Macy's 61st Annual Flower show, featuring India this year...



We went to city yesterday to spend a evening, eat some good food and there we bumped into Macy's building. What we see is this


Like every year Macy's celebrates one country in their annual event, this year they were featuring India in their "Macy's 61st Annual Union Square Flower Show". This affiche covered the whole building with amazing art work and vibrant colors representing Indian culture.
The interesting part of this whole event was not inside, it was outside. They had a huge Ganesha idol right up in the main entrance and it was fabulous how it was adding excitement to this whole show. This simply reminded us Ganesh Chaturthi whole India celebrates every year August-September.
As we walked inside Macy's most of things was designed around this theme and some part was designed like Indian bazaar where they were selling more contemporary/ethnic things , with Indian dub music running in the background.
Guess we were lucky to be there and see this marvelous piece of work and gala observance because it was last day of the show.

Ruby TypeError (singleton can't be dumped):


This error is very interesting and can possibly waste a lot of time , if you do not know the main reason behind it. I'm sharing this here, so that all those programmers who will possibly run into this issue, Google it for solution and will eventually land on my blog post and hopefully I will save someones day.

Issue is : TypeError (singleton can't be dumped): Now when you are running a Rails app, this will be dumped into your development.log or production.log depending on your application environment.

Full trace will look something like this

/usr/local/lib/ruby/1.8/pstore.rb:348:in `dump'
/usr/local/lib/ruby/1.8/pstore.rb:348:in `dump'
/usr/local/lib/ruby/1.8/pstore.rb:326:in `transaction'
/usr/local/lib/ruby/1.8/cgi/session/pstore.rb:90:in `update'
/usr/local/lib/ruby/1.8/cgi/session/pstore.rb:97:in `close'
/usr/local/lib/ruby/1.8/cgi/session.rb:330:in `close'
.//vendor/rails/actionpack/lib/action_controller/base.rb:1015:in `close_session'

Root cause: In your Ruby/Rails code you are trying to add a singleton class in the session, which is against the compatibility rules. So look for pure singleton class or Modules that's getting added to the rails session.

Solution: Have a class inside the Singelton class which will hold the data that you want to store in session and add that to your session. This will work.

37Signals Highrise; Is it another contact management or CRM ?


As 37Signals is pushing for Highrise , its so called "CRM" initiative, I'm sure everyone must be thinking about, is it really a true CRM or just another personal data/contact/task management application combined with few CRM features. As per their blog

Highrise was built to satisfy common scenarios like:
  • See all follow-ups scheduled for this week
  • Review Susan’s notes before calling her contact at the printer
  • Set a reminder to write Steve a thank-you note next Friday
  • Review all conversations I’ve had with Chris from Apple
  • Organize interview responses for potential candidates online
  • See a list of all the designers your company has hired in the past
  • Enter notes from a call with a potential client
  • See all the people your company knows at The New York Times
  • Schedule a follow-up sales call with Jim in 3 months
  • Review all the people tagged “Leads 2006”
So they have proposed features like Leads, conversations, contacts which will fall into mini-CRM domain.
It also sounds like they are taking best of basecamp, campfire, backpack, Ta-Da List and collaborating them in a mini-CRM suite fashion. It would be interesting how this thing gets the wing, and by looking at their track record, I would not be surprised people getting hooked to it. Most of their applications are crisp ,intuitive and great usability. Bottom line gets your and your partner's/customer's job done. Last but not least the first popular "CRM" initiative for Ruby On Rails platform.

Rails 1.2 impact on Ajuby release 0.4


We are running into quite a few issues with latest Rails version 1.2 starting with Theme generator complaining about "named_route" , following is the exception that we get

=> Booting WEBrick...
./script/../config/../vendor/plugins/theme_support/lib/patches/routeset_ex.rb:26:in `create_theme_routes': undefined method `named_route' for # (NoMethodError)
from script/../config/../vendor/plugins/theme_support/lib/patches/routeset_ex.rb:13:in `draw'

Reason is Theme generator is using its own routes extension for its custom routes and as per Rails 1.2 release , Routes section).

So meanwhile we figure out how to fix this or Theme generator comes with fix for Rails 1.2, Following is the fix that you can do

# Lets freeze the Rails for Ajuby release by running following command

> rake rails:freeze:edge TAG=rel_1-1-6

This will take rails 1.1.6 and make rails available within Ajuby framework, (We will eventually go this route. Every release will be bundled with Rails , so one less thing to worry with)

# After above step successfully complete, start the WEBrick and see if you run into any error , if yes possibly you would not have Activerecord core frozen properly. Not sure whether its a bug in the rake process. If you see this error like undefined method "deprecate" or #
Copy activerecord/lib directory from your installed Rails (wherever you have installed rails version 1.1.6 before above freeze process) to /vendor/rails/activerecord/lib directory

Ajuby Release 0.4 is out


We are happy to announce latest release of Ajuby (0.4) out for general access/download on source forge/Google code.

We are gearing up for next release, with interesting features like Module builder. Updates will be on the Ajuby wiki for coming release

Apache Axis namspace quirk in a SOAP response


When you use Apache Axis for your web services implementation , its a wise move but you got to remember its few one off situations, like this one that I'm going to explain.
Apache axis generates namespaces in every single element of the response , which can be very painful for the client if client is going parse and moreover its additional overhead in your SOAP response back to client, you are pushing more data over the wire where it can be avoided. sample looks something like this

xmlns:ns1="http://a.b.c/...." >
xmlns:ns2="http://a.b.c/...." >

xmlns:ns3="http://x.y.z/...." >

So above if you see , its unnecessary data getting duplicated in each element, where as ideally axis should be doing this internally by aggregating namespaces. So what you have to do is add following code in the your services code

org.apache.axis.utils.NSStack namespaceList = new org.apache.axis.utils.NSStack();
namespaceList .add("http://a.b.c./...", "ns1");
namespaceList .add("http://x.y.z./...", "ns2");
soapRespEnv.setNSMappings(namespaceList .cloneFrame());

Where as soapRespEnv is SOAP response envelope fetched from MessageContext. So what will above code do is, it will notify Axis engine to aggregate SOAP response namespaces in the SOAP envelope root. your response would look like below after above change

benefitof above approach is

* Sheer data size reduction, that goes over the wire
* SOAP response looks like very clean.

How to use Dynamic Object invocation in Rails for Models (String to Model conversion)


You have String value of the model (model name) and you want to dynamically invoke methods on this model. This comes handy when you want to parse controller/action and do some neat nifty tricks.

model_name = "invoice"

model_name_capital = model_name.capitalize # => this creates "Invoice"

@object = Object.const_get(model_name).find(:all) # => This is equivalent to Invoice.find_all

Ruby 4 Lines of Web service/SOAP Code Magic


This is amazing to see how easy and simple it is to write a SOAP code in ruby, have a look at the following code. This does call Google search engine by passing some random search query.

require 'soap/wsdlDriver'
factory ="")
service = factory.create_rpc_driver
@service_output = service.doGoogleSearch("xxxxxxxxxxxxxx", "Ajuby", 0, 10, "false", "", "false", "", "latin1", "latin1")

That's it.. @service_output returns what I call it as "Ruby's intelligent data structure" which you can use to get respective data output

- Results: <%=@service_output.estimatedTotalResultsCount%>
- searchTime: <%=@service_output.searchTime%>

Note: Above "xxxxxxxxxxxxx" is the api key that you need to obtain from Google to use their web services, its less than a minute job to get that from google.

Now there is a better and more modular way of writing above code using ActionWebService
where you can manage API's to access outgoing SOAP calls more effectively.

XSD to WSDL Conversion


# Good site to refer contract-first web service and XSL that translates XSD to WSDL
# Also Christian Weyer's jWSCF for Eclipse
# ObjectWeb's Celtix ESB's xsd2wsdl tool

Surprisingly first 2 generates different type of WSDL for same XSD.

Legends/Great Programmers answer simple but important questions..


This one is a classic page, should go in a history of software/hardware. Author of this page has done good job in asking simple but interesting (in terms of these great guys and their outlook towards simple things in their day to day life).
I liked the question "If you had three months to learn one relatively new technology, which one would You choose?". Answers to this question can project one vital thing "What is the interesting technology/concept or thing which you would see helping technology future"

Java String replace: java.lang.IndexOutOfBoundsException: No group 2



If you see java.lang.IndexOutOfBoundsException: No group 2 , when you are doing .replaceFirst(, ) or .replaceAll(, ).


You possibly have "$" character in your target string.


Add java.util.regex.Matcher.quoteReplacement(), before you apply replace function.

Bug reported on Sun site by someone.

OpenAppDotOrg Toolkit hits 100 downloads!!.


Our Ruby/Rails based open source project OpenAppDotOrg finally hits 100 downloads on sourceforge . Groovy!!... See the captured snapshot of that moment on the left. This is just a beginning, we have a long way to go and I will come back to toast 1,000.....of downloads.

Current release 0.2515 includes, things like
  • Common user services (sign up/email support/forgot password etc)
  • User access control
  • Company/User relationship
  • First open source Feed management module

  1. More about the project can be found on our wiki
  2. Download the latest version from sourceforge
  3. Our community on Google groups and openapp forum

Rails Association example: has_many relationship


After a long time, I finally get to write this up. Step by step instructions to build Rails:ActiveRecord: has_many relationship.

Once you start with this , you can sense the power of this meta modeling techique which turns your business application/model building into a snap.

I will write up more going deeper into complex techniques of Rails association, meanwhile few interesting sites explain this as follows

Ruby/Rails tricks and tips with ActiveRecord


I had a simple problem definition:
  • Write a installer application in rails which will take database username, password and database name
  • Creates brand new database
  • Populate the database with schema and reference data.
  • Updates database.yml file
  • Reinitialize the rails activerecord connection context, so that user does not have to restart the application
This is how I solved it. few steps , hopefully this will be usefull for other ppl who wants to do something similar.

# Create new database

ActiveRecord::Base.connection.create_database("rex_boy") #rex_boy new database name.

# Load new database with schema and data.
.........This you can do either by using writing Rake migrate tasks or manually write SQL's to load the schema and data, 1000's of ways to do this. I did using creating using migrations and invoking rake command from rails.

# Read and update the database.yml file with newly created database

## Read the Yml and update with new database name
@config = YAML::load("#{RAILS_ROOT}/config/database.yml")) @config['development']['database']= "rex_boy"

## Now update the yml file back. basically write the database.yml back from @config object "#{RAILS_ROOT}/config/database.yml", 'w' ) do |f| f << @config.to_yaml

# Now the interesting part to reintialize ActiveRecord connection context without restarting the server (Apache or WEBrick or Lighttpd..)

ActiveRecord::Base.configurations = @config ActiveRecord::Base.establish_connection ActiveRecord::Base.connection

This should get you very fancy in terms of building rails based installer application.

Framework comparison


Check this video (almost 340MB) out, Its fun and gives users a quick glance at all the frameworks that author of this video is trying to use. He is comparing J2EE vs Ruby on Rails vs Zope vs TurboGears vs Django.

Rails based framework for Java. Co-existence or contender?


I was sailing thru the net to see if there is anyone doing Rails framework on Java?. so some of the following guys who are doing few things similar to rails, not all.

# Trails: domain driven development framework in the spirit of Ruby on Rails or Naked Objects. Uses Spring, Tapestry, and Hibernate. Probably this one has a long way to go. Not too much happening in this area.
# Sails: Purely framework designed by keeping Rails in mind. Have a download section.It would be interesting to download and play with it.
# Grails: Sounds the closest one to rails, including controller/model generation, scaffolding etc, its written in Groovy
# JBoss Seam: Probably most active and adopted project as compared to above. Seam uses EJB3 and Hibernate (both, I wonder why?. Probably things around Transaction support and things like heavy weight vs light weight components usage).

I will keep watching this space and add if i run into any other puppy who wants to be or do things like rails in Java.