Subscribe: Rajesh about prodigious revolution of daily life
http://bloggershetty.blogspot.com/atom.xml
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
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: 2016-07-27T05:54:06.629-07:00

 



Zimbra MySql connection using MySql Clients

2007-10-11T22:39:15.070-07:00

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 

/opt/zimbra/db/mysql.sock.

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

2007-09-30T12:29:55.499-07:00

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. www.mydomain.com 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 http://whatismyip.com/ 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 yourdomain.webhop.net 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 (www.mydomain.com) . Go to your domain's DNS settings and change your Mail server (MX record) to Other mail server option and set

MX 1 / Prio -> yourdomain.webhop.net 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 127.0.0.1) , 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 mydomain.com. (your actual domain name) and user for that domain. e.g imsam@mydomain.com by going to accounts option.

That should do it. Now you can go to any of your email clients and send an email to imsam@mydomain.com and you will see email coming right to your zimbra server. To check email click on imsam@mydomain.com 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

2007-08-21T14:11:16.137-07:00

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) :
thumbnail_class.find_or_initialize_by_thumbnail(file_name_suffix.to_s)

end

with

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



Facebook micro application success trend started

2007-08-17T11:31:19.546-07:00

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

2007-08-17T08:46:17.082-07:00

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.

2007-07-15T11:43:56.896-07:00

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

2007-07-01T21:18:50.519-07:00

(image)
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

2007-06-20T14:28:34.039-07:00

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

2007-06-03T12:16:25.184-07:00

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...

2007-04-15T11:14:56.544-07:00

(image)
(image)
(image)


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


(image)

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):

2007-04-10T13:19:32.249-07:00

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 ?

2007-03-07T11:37:53.436-08:00

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

2007-02-08T22:40:36.169-08:00

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

2007-02-01T14:16:17.514-08:00

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

2007-02-01T14:14:27.631-08:00

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)

2006-12-28T22:50:45.623-08:00

Requirement
-------------
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.


Solution
-----------
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

2006-12-27T19:19:27.971-08:00

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 = SOAP::WSDLDriverFactory.new("http://api.google.com/GoogleSearch.wsdl")
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

e.g.
- 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

2006-11-27T17:23:50.301-08:00

# 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..

2006-10-10T17:29:17.654-07:00

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

2006-10-09T14:16:50.686-07:00

Issue

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

Reason

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

Solution

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

Bug reported on Sun site by someone.



OpenAppDotOrg Toolkit hits 100 downloads!!.

2006-10-05T21:14:37.668-07:00

(image)
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

2006-10-03T22:08:17.020-07:00

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

2006-08-18T11:43:42.220-07:00

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(File.open("#{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
File.open( "#{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

2006-08-10T21:08:12.613-07:00

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?

2006-08-05T13:05:25.790-07:00

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.