Thursday, October 11, 2007

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 

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


Sunday, September 30, 2007

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

Tuesday, August 21, 2007

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

Friday, August 17, 2007

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. 



Thursday, August 16, 2007

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.


Sunday, July 15, 2007

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.

Sunday, July 01, 2007

Ajuby releas 0.5 brings business mashup building one step closer

Ajuby Release 0.5
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.

Wednesday, June 20, 2007

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.

Sunday, June 03, 2007

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

Sunday, April 15, 2007

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.

Tuesday, April 10, 2007

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.


Wednesday, March 07, 2007

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.

Saturday, February 10, 2007

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 #<actioncontroller::routing::routeset:0xb7d34690> (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 #<Class:......

Copy activerecord/lib directory from your installed Rails (wherever you have installed rails version 1.1.6 before above freeze process) to <ajubyhome>/vendor/rails/activerecord/lib directory

Thursday, February 08, 2007

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

Thursday, February 01, 2007

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

<SOAP ENV..>
<SOAP Header..>
</SOAP Header..>
<SOAP body>
<ns1:elemenntname xsi:type="xsd:string"
xmlns:ns1="http://a.b.c/...." >
<ns2:elemenntname xsi:type="xsd:string"
xmlns:ns2="http://a.b.c/...." >

<ns3:elemenntname xsi:type="xsd:string"
xmlns:ns3="http://x.y.z/...." >

</SOAP body>
</SOAP Env...>


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



<SOAP ENV. xmlns:ns1="http://a.b.c/...." xmlns:ns2="http://x.y.z/....">
<SOAP Header..>
</SOAP Header..>
<SOAP body>
<ns1:elemenntname xsi:type="xsd:string">
<ns1:elemenntname xsi:type="xsd:string">

<ns2:elemenntname xsi:type="xsd:string">

</SOAP body>
</SOAP Env...>



benefitof above approach is

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