Sunday, February 19, 2012

Installing Apache Thrift in Ubuntu


Apache Thrift is a RPC framework for scalable cross-language services development which in simpler words allows easy exchange of data such as variables, objects between applications written in different languages. Thrift offers seamless cross language serialization between languages like C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, Smalltalk and OCaml, through Code generation. The advantage of Thrift is that it’s faster than using SOAP since it’s using a binary protocol.

For better understanding of Thrift's architecture which consists of Transports, Protocols and Processors I recommend you to go through the paper I found [1].
Thrift was initially developed at Facebook, and now open sourced as an Apache project. Since I found Thrift is less documented, in this post I'll try to walk through the installation steps in Ubuntu.

I have tested this on Ubuntu 11.11 and 12.04

To install Thrift

Step 1.
First install
sudo apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev

Step 2.
Then Download tar.gz archive from the download site, decompress archive in your home directory:
tar -xvzf thrift-0.8.0.tar.gz

Step 3.
Go to the installation root directory  and run
$ ./configure

Step 4.
A the end of the output you will find something like this

thrift 0.8.0
Building code generators ..... :
Building C++ Library ......... : yes
Building C (GLib) Library .... : no
Building Java Library ........ : yes
Building C# Library .......... : no
Building Python Library ...... : yes
Building Ruby Library ........ : no
Building Haskell Library ..... : no
Building Perl Library ........ : no
Building PHP Library ......... : no
Building Erlang Library ...... : no
Building Go Library .......... : no
Building TZlibTransport ...... : yes
Building TNonblockingServer .. : yes
Using javac .................. : javac
Using java ................... : java
Using ant .................... : /usr/bin/ant
Using Python ................. : /usr/bin/python

Check whether the libraries for your development environment have been code generated. If something is missing skim through the output of configure to find the missing component and install that, and then again run step 3.

Step 5.
Finally from the same directory run
$ make

Step 6.
Now run
$ sudo make install

Now your done

To check whether Thrift is working, run;
$ thrift -version

[1] http://thrift.apache.org/static/thrift-20070401.pdf

Hot deployment of CEP query configuration in WSO2 CEP

WSO2 CEP is an open source CEP server released under Apache License v2.0

WSO2 CEP has an added advantage of flexible integration, such as enabling it to integration with Enterprise Service Buses like WSO2 ESB which can send events across transports into various streams. WSO2 CEP can also be used with Message Brokers (E.g. WSO2 MB) to process messages of the topics CEP has subscribed and publishing back the matching occurrences in MB. Further this can also be used with WSO2 Business Activity Monitor to monitor actionable events on the fly and report them.

WSO2 CEP is designed to support multiple open source CEP engines, with out-of-the-box support for Drools Fusion and EsperTM.

WSO2 CEP's back-end CEP engine, query configuration, and all input and output mappings are represented as buckets. Here we create buckets for each of our use-cases.

In earlier versions of WSO2 CEP cep-config.xml file is the only mean of deploying cep buckets via configuration. Here the configurations will be added only at server start up. From WSO2 CEP 4.0.0 release writing buckets and deploying them in the Server has become very easy via the Axis2 hot deployment.

For hot deployment we just need to write an xml containing the bucket configuration and drop that in the CARBON_HOME/repository/deployment/server/cepbuckets/

Here each bucket configuration file can contain configuration of a single CEP bucket.
This file need to have a .xml extension and follow the cep-config.xsd.

E.g.

<bucket xmlns="http://wso2.org/carbon/cep" .... >
         .... configuration....
</bucket >


Wednesday, November 30, 2011

Lets forget your ubuntu passwords switch to fingerprint reder

Guys I found an interesting  post on fprint that helps all with your logins in Ubuntu.
Just follow the post in;

https://launchpad.net/~fingerprint/+archive/fprint

or in a nutshell
run lsusb in your Terminal and check whether your fingerprint reader has one these
     045e:00bb        05ba:0007        08ff:2580
     045e:00bc        05ba:0008        08ff:5501
     045e:00bd        05ba:000a        1162:0300
     045e:00ca        061a:0110        138a:0001
     0483:2015        08ff:1600        147e:1000
     0483:2016        08ff:2500        147e:2016

If sodo the following

1. Add this PPA to your sources:
      sudo add-apt-repository ppa:fingerprint/fprint
      sudo apt-get update
      sudo apt-get upgrade
2. Install the software:
     sudo apt-get install libfprint0 fprint-demo libpam-fprintd gksu-polkit

Then go to the "User Accounts" and enable fingerprint reader for your account.

All the best ..!

The most interesting thing is, for every sudo you can now sweap your finger.. and no need to type the passwords any more. :-)

for your reference here is a you-tube video
http://www.youtube.com/watch?v=YtcXPXYTR-E

Wednesday, May 18, 2011

Coding NCD and waiting for my first commit


My Gsoc project involves two modules, Messaging Module and the NCD Module. At the meantime when Messaging Module is being fixed by the author. My mentor requested me to work on the NCD Module.

I had no luck with NCD, it didn't work for me at all. With my mentor's guidance, I started fixing NCD to work with the current trunk. I went through the logs and started fixing the issues. After some days of work I finally came out with a working version. But unfortunately I didn't think of the backward compatibility, where I have used jars from the current trunk, and this have made my fix invalid.

Then according to the advice of Ben and Danial, I started rewriting.This time I made NCD to work with OpenMRS 1.6 and above. The code for this is now in the Jira [1] and a code review is also available [2].

Later I too got my commit rights for the NCD module and now I'm waiting for a chance for my first commit.

[1] https://tickets.openmrs.org/browse/NCD-233
[2] https://source.openmrs.org/cru/CR-MOD-128

Got a green signal for the Messaging Module

My Gsoc starts with excitements, where I got an exciting project and a grate mentor! During the last few weeks I got to know lot of new thing, among them the main thing I liked is the introduction of OpenMRS modules.

After Gsoc acceptance the first task assigned to me was to get to know about the Messaging Module. Soon I checkout the code from the module trunk and tried to build that. Unfortunately it didn't work. After several tries I finally got to know that the trunk is not the working version.
With the help of Dieterich Lawson, the author of the Module, I was finally able to build the module from a breach[1]. After some bug fixes by Lawson Messaging Module finally worked for me. Thanks for him.

This was a great relief :) as I got one part of my project stable.

Now I can send mails from OpenMRS to any email accounts. 

[1] http://svn.openmrs.org/openmrs-modules/messaging/branches/lance-armstrong-phr