Saturday, 14 July 2012

Software Illness


Every time when I watch the popular TV program 'Satyamev Jayate', I start thinking what might be the issue that could be raised in next episode. This time my mind thought rather differently. It came up what issue  should be raised- 'Illnesses of Indian Software Industry'. Yes there are many, I feel. I'll group them together and refer collectively as software illness.

First of all, we are very bad at following timings. We neither come on time nor leave the office on time. A wrong concept is flourishing in our software industry that those who leave office early or in time, are not sincere at work. This misconcept needs to be cured by the pill of looking at productivity instead of time spent in office. As long as deadlines are met and tasks are completed within time, sitting for longer hours in office should be discouraged. Another illness is one of the culprits behind the above issue- we are driven by managers and not by leaders.

Software is considered to be a job-open field by candidates and as an elite one by parents. This makes many folks opt for software related education and thereafter job. Choice and liking is nowhere taken into consideration. This has led to tremendous mediocrity in our software industry.

A rule of thumb to measure one's success in software career is to look at his onsite abroad assignments. If you don't have any onsite in your CV, janata considers you to be a failure! Another point in rule-book of people states that working with big software brand means you are good. Working with smaller companies is thought of as you are 'not able to fetch a good job'. So a combination of both these things means utter failure!!

I wish we get rid of software illness and make it healthy asap!

Sunday, 1 July 2012

Hypervisor: KVM


In my college days, I used to install VirtualBox on my Windows OS and run Linux inside it. Frankly speaking at that time I didn't know what is a hypervisor and what exactly a hypervisor does! :)

Hypervisor (VirtualBox was my college-days' hypervisor) is used to manage the guest operating systems (Linux was the guest operating system). Wikipedia defines it as:
In computing, a hypervisor, also called virtual machine manager (VMM), is one of many hardware virtualization techniques allowing multiple operating systems, termed guests, to run concurrently on a host computer.

There are two types of hypervisors:
1. Native or bare metal- It runs directly on the host's hardware. Examples: Hyper-V, KVM, XenServer.
2. Hosted- It runs within an OS. Examples: VirtualBox, VMware Workstation.

I recently used KVM(Kernel-based Virtual Machine) while working with OpenStack and it worked fine without any issues.

If you want to work with KVM, first thing you need to check is whether your processor supports hardware virtualization or not. Just run the following command : 
kvm-ok 

If you get the following output that means your processor supports it.
INFO: /dev/kvm exists
KVM acceleration can be used

From whatever I have read, it looks like even if your CPU does not support KVM extensions you can still run virtual machine but it will be very slow.

To install KVM run the following command:
apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils

You need to add your user to the libvirtd group. To do so run the following command:
adduser 'id -un' libvirtd

And then relogin to make your user an effective member of the libvirtd group.

Check if the installation was successful by running the following command:

virsh -c qemu:///system list

I get the following output:

 Id Name                         State
----------------------------------
 24 instance-0000001f     running
 31 win-server-1              running
 34 instance-00000020    running

Initially you will not have any instance running; so you should get the following output:

 Id Name                 State
----------------------------------

I will cover how OpenStack works with KVM in my next post.

Friday, 29 June 2012

OpenStack : An Introduction


OpenStack is a collection of open source projects that can be used for creating and running private/public clouds. It comes under IaaS (Infrastructure as a Service) category of cloud computing. In IaaS model, resources related to computing, network, storage and other infrastructure components are abstracted and provided as a service. 

OpenStack project was founded by Rackspace Hosting and NASA. Rackspace contribted for the Object Storage part while NASA contributed for the Compute part.

Latest (version 5) OpenStack is called ESSEX. It was released on 4/5/2012.

OpenStack services have beed divided into 5 main categories:

Nova - Compute Service

It handles/manages the lifecycle of instances created/running withing OpenStack cloud. Nova features are exposed as web services. It manages compute power, network, authorization, scalability etc.

If you have openstack installed then you can run the following command and check the status of various nova services:

nova-manage service list

Binary                 Host              Zone             Status     State Updated_At
nova-network      ranjank           nova             enabled    :-)   2012-06-11 19:53:03
nova-scheduler    ranjank           nova             enabled    :-)   2012-06-11 19:53:03
nova-volume       ranjank           nova             enabled    :-)   2012-06-11 19:53:03
nova-compute     ranjank           nova             enabled    :-)   2012-06-11 19:53:03
nova-cert             ranjank           nova             enabled    :-)   2012-06-11 19:53:03
nova-compute     ranjank           nova             enabled    :-)   2012-06-11 19:53:03

Swift - Storage Service

Swift is a distributed virtual object store for OpenStack. It can be used to store large number of objects of any size. It is similar to Amazon S3 (the popular Simple Storage Service from Amazon). It can also be used for backup and archiving of objects.

Glance - Imaging Service

Glance is an OpenStack service for adding, retrieving and deleting VM (Virtual Machine) images.

Running the following command will show me what all the VM images I have added:

glance index

ID                                                                 Name                Disk Format   Container Format    Size
------------------------------------ ------------------------------ -------------------- --------------------
e3ef93d0-efd0-4254-bfc8-575b0894049f     win_server_1                 raw        ovf          21474836480
d61fbaea-de34-45a5-a309-d6b0c3806bf4    win_server_2                 raw        ovf          21474836480
e3f2a4b4-f653-42a2-8742-1b32a55caea3    cirros                              qcow2   bare         9761280
67eb5530-dadb-4ad6-8d15-21f6bc34568a   tty                                  ami         ami         25165824
0c454b27-5c7e-4ec3-a524-33fffad873a2     tty-ramdisk                     ari          ari           5882349
0bbdd345-2200-40eb-b49d-9933b34b2b62 tty-kernel                        aki         aki          4404752

Keystone - Identity Service

Keystone provides authentication and authorization for various OpenStack components like Swift, Glance, Nova etc. There are two ways it can authenticate:

1. Username/Password
2. Auth-Token

Running the following command show the list of keystone users:

keystone user-list

+-----------------------------------------------------------------------------------------------------------+
|                id                                             | enabled |          email                        |    name  
+-----------------------------------------------------------------------------------------------------------+
| eb69c5901d4b4b4aaa8ce0192a1546c2  | True    | rkumar@example.com       | rkumar    
| f13904ef8af5473788bb665bde5a72cc    | True    | akumar@example.com      | akumar    
| fb701ad1cf7f4aa2a8613cbae2066d7a     | False   | skumar@example.com      | skumar    
| 1a737cfa16224cf8be1abdadb334326f    | True    | None                                  | ec2      
| 2ebdab8c9a6c403cb534c4efb12a4013   | True    | None                                  | swift    
| ac921326ac0b42c4b4d000b988d7911a | True    | None                                   | user      
| acf9eca7ded441ed9dea4caaf16aa055     | True    | None                                   | admin    
| ad3da366b4c0463e967a197c868504f0  | True    | None                                   | nova      
| deed0e9553674db299668f8fd0256eb3  | True    | None                                   | glance    
+----------------------------------+---------+--------------------------+------------+

Horizon - UI Service

It is web-based dashboard for managing OpenStack services. It can be used to manage VM-instances, images, users, volumes, object-store etc. You can connect to any instance though VNC from Horizon.

I will cover each of these components in detail in upcoming posts. Keep watching this space.

Monday, 25 June 2012

What is (in) experience?


A girl in my neighborhood has been searching for job since quite some time. She frequently updates me about the interviews attended. Many a times I've heard from her that she was not considered eligible for interview. Reason- She was falling short of number of years of experience in the particular technology she applied for.

Just to apply some filter at events like walk-in, I agree that having some criteria is a must. But otherwise I often feel that company should not be stringent about the number of years of experience in a technology. Suppose a candidate has prior experience in X technology and does not fit in experience criterion for currently applied Y technology. It indirectly means that the candidate's prior experience is waste. Is it really waste, useless? Not actually. While working earlier, the candidate has got familiar to so many things- processes/methodologies followed, team work (this is the most important one I feel!). Leave aside technology. Look at the corporate learning and adopting it. Not everyone adopts, true. But then those who did, should not get rejected merely because of some 'number'!

Looking at the fact that we are in a city where every third person is an IT professional, companies have got ample choice to select a candidate. Companies can keep interviewing till they get a perfect match for their requirements. Why should then one compromise for experience? It is also very likely that a person fitting in the experience criterion will meet the performance expectations. There might arise a tight situation where if a company does not hire required number of candidates in a short period of time, company might lose a client. In that case candidates might be hired who are not actually the right match for project/team/company.

But yeah, if I were to hire a person for my team, I'd have looked for a candidate no less than my set criteria :) At the same time I'd not want to miss hiring a bright person just because of shortage of experience! Anyway, there is no foolproof approach of selecting a candidate. After all, good judgment comes from experience and experience comes from bad judgment!! Agree??

Monday, 18 June 2012

Repeated Mistakes


Sometimes I learn things by difficult ways. Reason- I ignore/skip a step....that step is seemingly undue, unimportant. I've been preparing images and promotional banners since long. Many a times the thought of jotting down the font and size of text that I put in an image had invaded my mind. Every time I thought 'next time, not now'. Even while preparing cover page of my ebook, I skipped writing notes about font details. My laziness-cum-ignorance slapped me hard when I'd to prepare cover image for printed version of the same ebook of mine. I could neither recollect the font nor could I find a perfect match by trying various fonts. I was relieved to find an online app which tells us font from the uploaded image. I did upload the cover image of ebook. But since different texts were styled differently, the app couldn't give me any result :(

Lesson- Now every time I work with images, I take no time to create a notes.txt file in the same folder. A consciously adopted habit! It reminds me of the saying that we were being told during childhood days (Just extracting the gist, I'm not good at translating anything from my mothertongue to English;) )- 'Punish by beating with a rod and intelligence comes in bulk'!!

Wednesday, 13 June 2012

Java Populars Crossed 20K!


Finally overcoming the 'nervous nineteen thousands', the Chrome extension Java Populars has 20K+ active users! And yes, it has also maintained its 5 star rating!! Thanks to all the users.

Since last few months I daily used to visit Java Populars page at least once a day....with high hopes of crossing the benchmark of 20K. I recently added a task to my ToDo list- adding promotional banners to all my extensions. I'd been planning to add them since long but kept on postponing it. And I could see very clearly that banner was the magical wand! Within a few days after adding banner, the number of users crossed this milestone. So there I learn a lesson- not to ignore such tasks, in fact take them to higher priority.


For those Java folks who have not yet tried this extension yet, here is the link:
https://chrome.google.com/webstore/detail/oapojegdcjjaeehmicinhimakliedchj

Wednesday, 23 May 2012

Bootstrapping...


I've got quite large number of apps functional by now. For many of them I discuss enhancements with my colleagues often. Most of the times outcome of such productive discussions- some escape my memory while some get jotted down in spreadsheet (Thankfully I never forget bug fixes!). I know spreadsheet is not a very decent way of managing change requests. There are many tools like Jira which I've already used them at some or the other point of time in work. But then my tasks get surrounded more with tools rather than main activity- like one for source control, one for change management, one for test management and so on. First and foremost step here comes is installation and setup. Still I'll say okay for this. But if a developer working with me is new to any of these tools, much of his time is spent in getting familiar with them.

Very recently I've come across an awesome software which fulfills my requirement...and in fact of any company which cannot afford outsourcing its maintenance tasks. It is BootStrapToday . Name itself is intuitive. It is a smart Application Lifecycle Management platform on SaaS model. Anyone can just BootStrap a project in no time, no download and no installation! Automation part in this is based on activity log. Its intelligence can identify critical files or resources. It can identify contributions from different developers in the team. Suppose a new team member joins and he is assigned a ticket and he modifies a critical file while fixing bug. Then system can automatically create a review ticket and assign it to someone most familiar with the file. In short the intelligent automation will help software teams identify the bugs earlier and save huge cost in the project.
BootStrapToday is my choice....what is yours?

Thursday, 17 May 2012

Search- An Introduction


We are well familiar with searching for results in RDBMS. Simply write the 'Like' query and you get the results. Unfortunately this simple method is useful for simple use cases only! With huge data, the query will keep everything busy while fetching the results. Lets get to a very high level of difficulty. We search in Google and get so many results with a search- images, text, maps, videos and much more. My understanding tells me that the type of data decides which table it should reside at. In that case, our search should navigate through all those tables and get us the results. Difficult situation indeed!

Lucene is a full-text indexing and searching library originally written in Java (now in many more languages like C++, C# and PHP). Best thing- it is open source.

Lucene has got parsers for respective type of document. Parsers do their assigned job and pass on the text to next level, i.e. analyzer. This is the place where tokens are generated. Analyzer pulls out the tokens and its related info from the text content. It then writes this info in Lucene's index files. Analyzers are components which pre-process input text. Since the search string has to be processed the same way that the indexed text was processed, the same Analyzer must be used for both indexing and searching, else we'll get invalid search results.

Lucene gives performace as high as 95GB/hour. Its incremental indexing is also equally fast as batch indexing and index size is just about 20-30% of the text content. In terms of searching as well, Lucene is very powerful- best results returned first in ranked searching, many powerful query types like phrase query and range query, sorting by fields, field-based search, merging of results for multiple index search.

Lucene along with Solr search server is being used for real-time search in Twitter and various other sites like Wikipedia. Solr is open source enterprise search platform by Apache Lucene. Solr is written in Java and works as a standalone full-text search server within a servlet container. Its major features include powerful full-text search, faceted search, dynamic clustering, database integration, rich document format handling, and geospatial search. Solr uses Lucene Java search library at its core for full-text indexing and search, and has REST-like HTTP/XML and JSON APIs that make it easy to use from almost any programming language. Popular sites using Solr are Instagram, AOL, eBay, Cisco, digg, reddit, MTV Networks and Goldman Sachs.

Another wonderful item in this set is Luke! Luke is a handy diagnostic and development tool which accesses existing Lucene indexes and allows to display and modify their content.

Wednesday, 9 May 2012

Finally...


And finally it's out! It was indeed a long way....but this is not the end. The next phase of journey begins now.

I don't have any word in my active dictionary which can exactly tell how am I feeling now! To put it simply- it's  a wonderful feeling!!

You can get the ebook here:
http://www.lulu.com/shop/anuja-ranjan-kumar/a-fascinating-journey/ebook/product-20114174.html

And can look at my spotlight here:
http://www.lulu.com/spotlight/Anuja

Happy reading!

Tuesday, 8 May 2012

Here is the Preview


Chapter 2 of book A Fascinating Journey, following chapter 1- Obituary, is given here in preview.

An Encounter with God- Part I

I’d just finished writing the obituary and was keeping its copies at various locations. When I was about to keep it in a cupboard full of old books, my dad came and snatched it from me. Anyway the obituary was meant to be publicly read later. But the fact that my dad snatched it from me triggered my anger. To take revenge of this act, I went surreptitiously in his room and opened the cupboard and started shuffling contents. Here is something very interesting that I found in one of his diaries. To give you background (which would make it interesting for you too to read the content), my dad used to teach engineering students at that time. This is as-is what was written:
No sooner had I started teaching in the class, I heard a hoarse voice, “Sir.” I was flabbergasted by the urge shown for learning! I became curious. The student went on, “Sir you must make an effort to protect our interests. We have umpteen problems.”
To pacify him I muttered, “I promise you that I will take up your case with the boss.”
“Sir you are pulling our legs. Sir I’m talking of the actual GOD. With the other day’s incident we are convinced that you must have had some inkling about the future course.”
I was comprehensively beaten in my own game. However, I put forth a brave front. “Look, I do not intend to leave soon. I want to live. It was all fictitious.”
Still he did not budge. “Sir, we also do not want you to leave so soon. But in case…….. Sir, we’ll always remember you and will always have a huge place in our hearts for you. Sir, you must protect our plight.”
I started wilting under the pressure. “I assure you that I will project your case at the very first opportunity.”
“Sir, your promise does not seem to have much conviction.”
I was thoroughly cornered. As usual, my credibility came to the fore. “All right, I will represent your case. Let me know your woes.”
“Sir, our woes are unheard. Here I have written them down.”
I made the last attempt to wriggle out through the quagmire. “But I do not think I will be able to carry your list with me.”
“Sir, we have thought about that too! We will just acquaint you with our problems. Sir, I’m speaking on behalf of the whole student community. Firstly, we do not understand Maths, particularly Calculus. Can it be simplified? Secondly, the Strength of Materials makes our hearts pretty brittle. What is the antidote for this? Thirdly, Hydraulics makes us sink to abysmal depths. Is there some sort of saver? Fourthly, can Thermodynamics laws be modified a bit to suit the students’ requirements- particularly the concept of Entropy? Fifthly, can the movement of electrons be stopped so that Basic Electronics can altogether be eliminated? And lastly, administrative problems………….”
“Enough,” I shouted. By this time I had lost all my patience. I yelled, “The crib you are making is frivolous. God just made nature to obey certain laws. He has no hand in all these subjects. How the hell can I take up your case?”
The student was well conversant with my weakness. So he went on unabashedly, “Sir but…..what we are asking is only the putting forward of our problems and nothing else.”
I meekly surrendered once again. “But how do you think that HE would give an instant hearing?”
The student was adamant. “Sir you request Chitragupta (He is considered to be the assistant of Yamraj, the Lord of Death). If he does not listen then bribe him. Even with this if he tries to be funny then threaten him with dire consequences.”
My defense totally collapsed because of this persistent onslaught. “Okay, I know you will resort to any means. You seem to be desperate.”
“Sir, I was sure, you will listen to us. Thanks a lot. We wish you speedy journey!”
“Okay, okay. I will try my best. In case I am granted interview immediately, I will fight your case in toto. And I will arrange to convey the gist of my dialogue with HIM through some way or the other. I hope it satisfies you all.”
This agonizing conversation consumed all my previous periods. It left me parched in throat. Anyway, I honor my promises. After all, they are meant to be kept! I do hope the student community will wait for my telepathic communication regarding my dialog with HIM- as and when it takes place.
***
Read what happens next in An Encounter with God- Part II.
***
Interview of Ms. Anuja gives a good overview of her book A Fascinating Journey (Our questions are marked as ‘Q’ and her answers as ‘A’):

Q. We got to hear that you’d an appointment with God. True?
A. Partially. It was actually my dad. To know the details read both the parts of An Encounter with God.

Q. Have you written your biography too?
A. It is actually Obituary. It is better to write about our life in brief on our own, I feel. Something important may get missed if it is left for someone else to write. One chapter contains my autobiography, but that is as an English enthusiast.

Q. Have your writing skills ever helped you in job or in friend-circle?
A. There are two sides of a coin. Sometimes this skillset helps as in The Untold Story while sometimes it makes me face Travails of Writing.

Q. Are you coining your own words while writing?
A. Seldom. An Autobiography of a Word Addict has some of them while What is What gives meanings of some words in simple language.

Q. You seem to be very conscious about words. What else are you conscious about?
A. You’ll get to understand how conscious I am about handwriting once you read Bad Handwriting.

Q. When I’d read your stuff once, I realized that you use chess terms a lot. Are you a chess player?
A. I do play chess. But it is mainly my dad. Stale-Mate will tell you about this chess champion.

Q. Which all forms of writing have you tried your hands at?
A. I’ve been blogging since a long time, now I have written a book and once had given an advertisement A Suitable Ad in classifieds.

Q. You use many impressive phrases in your speech. It must be helping in building your impression.
A. That is left for you to decide whether I get advantage or have to bear side-effects of such phrases. Come On and Since You Have Asked will help you to conclude on this matter.

Q. Overheard....you are connected with film industry.
A. Seems you’ve read my Suna hai.... (Overheard). To answer your question, in a way I can say yes...but only if my friend’s film gets released. She is still working on producing a film. Read more in Raftar.

Q. Do you have interest in movies?
A. I’ve already learnt lesson that we must have interest in movies, especially when it is to be watched with others. Rang De Basanti will tell you what lesson I’d got to learn.

Q. Do you write only such entertaining stuff and not bothered about any of the present issues in the world?
A. It’s not true that I’m not bothered about any of the issues that our society is facing. Is Frankenstein Being Created? will tell you that I care equally about those issues.

Q. What is your favorite hobby?
A. Difficult question. Hobby Development Attempts and My Photography Fiasco can best explain why it is so difficult to answer this question.

Q. Are you going to take retirement from your main job?
A. Already taken. My decision-taking phase is narrated in In Need of Second Opinion and present phase in its succeeding chapter.

Q. How good are you at kitchen?
A. I do know some tips and tricks. I got to learn a lot during my secretarial appointment related to food. You’ll get to know in Cul-De-Sac. And yes, I’m extremely and consistently good at preparing tea. You’ll know its reason in Tea Preparation.

Q. We got to know that all the items which you own are very expressive, just like you. Keen to know if true.
A. The Day of Shock will definitely answer your curiosity.

Q. Are you an introvert or you are a very social person?
A. At present very social. I’m always looking forward for group parties as in The Last Drink. Also I never miss attending any function which is why I got to attend A Special Wedding. Bhankas is also an outcome of being so extrovert.

Q. Then you must be preferring to roam too, correct?
A. Good guess. That is why A Memorable Visit and My First Flight Journey got penned down.

Q. Which is your dream place to visit?
A. It is Kailash and Manasarovar. Travelogue will best explain you what makes it as dream destination.

Q. One of your close friends told me that you love surprises. Is it really so?
A. Indeed I love surprises. Just that I hate when it is with respect to any test or interview. Surprise Test will tell you that. For interviews I prepare beforehand. You’ll learn that in Interview Which Never Took Place.

Q. You seem to be a cool person. Do you ever get angry?
A. Thanks. I’m cool but certain things trigger my anger. In fact some of those things are silly mistakes and some are environmental factors. I’ll better not say anything about it, else I may lose my temper. Better read I Get Cheesed Off.

Q. It was nice talking to you. Have you ever been in my shoes i.e. have you ever interviewed anyone?
A. I’ve not played interviewer’s role same as yours. I’ve interviewed many candidates for job openings as in As an Interviewer.

Q. Lastly, any advice for the youths?
A. I believe that one can learn a lot from other’s experiences. Rather than experiencing everything on our own, one must learn from other’s experiences. I won’t call it as advice, but as tips. I’ve given some important tips in Letter to Future Professionals. Let Us Develop Hobbies is a suggestive chapter for any age-group.

And it is Ready...


Writing after a real long time. I'd been writing, re-writing and editing the writings but offline. I'm glad to share that my book is ready for publishing. Just wait for a couple of days. Question must be popping in your mind, "If book is ready then why not publish it right now?" Answer is simple- someone told me its an auspiscious day. With this answer, I'm sure to get tagged as.....(list is too huge to be added here). But to some extent I agree that I believe that doing so and so will attract luck. I remember the days of board exam when I used to wear the same dress for few of the papers :) It feels funny now, but yes I used to do that and I got the results too, I felt!! See I've not changed a wee bit!!!

Very soon I'll post a blog that will give you an overview of the book and later will post its preview. As of now let me tell you that it is a non-technical book, so NO cxf, nosql, java etc.etc. Stay tuned....

Saturday, 18 February 2012

Wrapping and Unwrapping JSON response in CXF

Q. How to drop root element in the JSON response?
A. You need to set the JSONProvider's dropRootName property to true. Here is a sample cxf config for this:

<jaxrs:server id="${service.name}" address="/">
	<jaxrs:schemaLocations>
	<jaxrs:schemaLocation>classpath:${service.def}.xsd</jaxrs:schemaLocation>
	</jaxrs:schemaLocations>
	<jaxrs:serviceBeans>
	<ref bean="${service.ref}" />
	</jaxrs:serviceBeans>
	<jaxrs:providers>
	<bean class="org.apache.cxf.jaxrs.provider.JSONProvider">
	<property name="dropRootName" value="true"></property>
	</bean>
	</jaxrs:providers>
	<jaxrs:extensionMappings>
	<entry key="json" value="application/json" />
	</jaxrs:extensionMappings>
</jaxrs:server>
Q. How to wrap the JSON response with a name?
A. You need to set the JSONProvider's supportUnwrapped property to true and also set the wrapperName for the root element (If you have more than one wrapperName then use wrapperMap property). Here is a sample cxf config for this:

<jaxrs:client id="${service.name}" 
	address="${service.url}" 
	serviceClass="${service.class}"
	inheritHeaders="true">
	<jaxrs:headers>
	<entry key="Content-Type" value="application/json" />
	</jaxrs:headers>
	<jaxrs:providers>
	<bean class="org.apache.cxf.jaxrs.provider.JSONProvider">
	<property name="supportUnwrapped" value="true"></property>
	<property name="wrapperName" value="${response.wrapper.name}"></property>
	</bean>
	</jaxrs:providers>
</jaxrs:client>
In case you are intersted in knowing how JSONProvider uses the wrapperName mentioned above while reading the JSON data, here is the code-snippet:

protected String getRootName(Class cls, Type type) throws Exception {
	String name = null;
	if (wrapperName != null) {
	name = wrapperName;
	} else if (wrapperMap != null) {
	name = wrapperMap.get(cls.getName());
	}
	if (name == null) {
	QName qname = getQName(cls, type, null, false);
	if (qname != null) {
	name = qname.getLocalPart();
	String prefix = qname.getPrefix();
	if (prefix.length() > 0) {
	name = prefix + "." + name;
	}
	}
	}
	if (name == null) {
	throw new WebApplicationException(500);
	}
	return "{\"" + name + "\":";
}

Tuesday, 14 February 2012

CAP THEOREM


Wikipedia (http://en.wikipedia.org/wiki/CAP_theorem) - In theoretical computer science the CAP theorem, also known as Brewer's theorem, states that it is impossible for a distributed computer system to simultaneously provide all three of the following guarantees: Consistency, Availability and Partition tolerance.

There is a nice diagram available on the web (http://www.nijee.com/2011/02/golden-key-to-distributed-computing-is.html) - "Visual Guide to NoSQL Systems" which talks about which NoSQL DB fits where based on CAP theorem. This theorem was put forward by Eric Brewer. CAP theorem in brief states that a system can have only two out of three properties- Consistency, Availability and Partition-tolerance.

An application is considered to be consistent if an operation is performed fully or not at all. If the operation gets performed half-way, inconsistency gets created. To give you an example, there are many deals sites at present. Some of the deals are limited to a specific count say 100. Suppose you are the 100th consumer of the deal, you are about to pay for it and in the meanwhile someone else also selects the same deals and makes payment. Both of you cannot become the 100th consumer of the deal. So while you've confirmed to your selection of a deal, the second one should not be proceeded to make payment at all.

Availability states that the service remains available. Taking the same example as above, if you want to buy something in a deal but the site itself refuses to open, may be because of heavy traffic i.e.non-availability of service, is of no use.

Partitioning will not be needed if all your data resides and runs in a single box. But where the amount of data is huge it is very likely that there will be partition and data will be distributed. For a system to be partition-tolerant, it should respond correctly in every case except the case of total network failure.

In most of the NoSQL DBs, consistency is being compromised. Typically choosing one DB may not solve all your problems. Select one keeping certain features of your application in mind and feel free to go for another one for other modules. Also this doesn't mean removing relational database completely. Personally I always prefer to keep relational DB in my applications and use it at certain places where it really makes sense to use it!

In fact if your application is large enough, you can use a combination of NoSQL databases- utilizing the required features of each one of them, plus use a traditional database.

Monday, 6 February 2012

Mobile Apps


Recently I was looking into some of the cross-platform mobile development tools like RhoMobile, PhoneGap, Titanium, Worklight, Sencha Touch, appMobi etc and during that I developed some of the apps just to test the compatibility with various mobile devices and the features these frameworks support. Though some of the feature-rich applications are under development, I developed some very basic applications just for fun. You may want to have a look at these:

Bollywood Tweets
https://market.android.com/details?id=com.viracct.tweets



TechCrunch Updates







Friday, 3 February 2012

Popular Chrome Extension

We are glad to let you know that our Chrome extension 'Java Populars' has really become popular! It has got 10K+ active users with an average rating of 5 stars!!

Those who have not tried it yet, must be now definitely keen to know what is this extension all about. Here is a brief summary of it.

Very useful for Java developers- Java Populars! It is very likely that you'll have doubts in Java or have issues during development or deployment. You google it and you get thousands of related results. You may get lost in those thousands of sites to pick up the good solution. Rather go to the sites listed under Java Populars.

Have a glance:
Right click on the extension's icon to navigate to the options page. Options page gives you a way to customize your list. You can remove from the default list by unchecking the respective. To add your own links enter the url in the textbox and select the respective checkbox.
 




























 
 You get to see the customized list as shown:















Here is the link to download the extension:
https://chrome.google.com/webstore/detail/oapojegdcjjaeehmicinhimakliedchj

Tuesday, 3 January 2012

NoSQL...Hang on a sec


There are tons of articles/tutorials/blogs/presentations available online but one has to be very careful in deciding whether to go for NoSQL or not. And if you decide to use NoSQL, then which database/datastore is the right choice for you.

Now to answer the first question of whether to go with NoSQL or not, first you should understand your requirement in detail. There are n number of points to consider, mentioning a few important points here:

1. How big is your data? What happens if you store it in a relational database like MySQL or Oracle? How many tables do you need to create? How many columns per table you will have on an average and most important thing is how many rows each table will have?

2. Also in a relational database, schema needs to be created first. Do you need some flexibility over there? Like in one of my projects I was working on a logging module and the structure of the logs was of various types. So I wanted to have flexible schema for it.

3. Some applications require fast data retrieval where as some require fast write access and some require both. Think about Google Search where fast data retrieval is very important where as application like Twitter where people tweet a lot (i.e. lots of write operation).

4. Its not just the application speed that matters but also the concurrent read and write access that should be taken into consideration. Think about the number of Facebook users writing simultaneously on various sections of the website.

5. Is indexing, caching etc not a solution to your problem? Because in some application introducing just caching solves the problem. (Atually I was a bit confused about whether to include lines like this in this post or not because talking about performance improvements/optimizing existing applications in all together a different topic and beyond the scope of this post.)

6. Are you creating application for Analytics?

7. Does your application have social-network features? Because Facebook itself is a big inspiration to go for NoSQL if you are using similar features. Facebook Engineering Notes is a good place to read about latest technologies used at Facebook (http://www.facebook.com/Engineering?sk=notes) and if the interest level increases consider reading Facebook Engineering Papers (http://www.facebook.com/Engineering?sk=app_190322544333196). I also like Facebook Tech-Talks LIVE.

Before I proceed toward which db is appropriate for your application here is a brief intro about few NoSQL databases.

Though there are 100+ NoSQL databases available (here is the list - http://nosql-database.org/), I am mentioning a few popular ones:

-MongoDB (http://www.mongodb.org/): Any of the languages can be used like Java, C, C++, PHP. It is written in C++. Data interchange format is BSON (Binary JSON).

-CouchDB (http://couchdb.apache.org/): Written in Erlang with javascript as main query language. Uses JSON and REST as protocol. Useful in case where data changes very often and you want to run predefined queries.

-Cassandra (http://cassandra.apache.org/): Written in Java while Thrift is used for external client-facing API. It supports a wide range of languages (Thrift languages). It brings together the best blend of features of Google's BigTable and Amazon's Dynamo. Cassandra was developed and later open-sourced by FaceBook.

-HBase (http://hbase.apache.org/): It is built on top of Hadoop. Written in Java. It is used when realtime read/write access to big data is needed.
First two of the databases are based on document store while rest two on column store(aka ColumnFamilies).

-Neo4j (http://neo4j.org/):  NOSQL graph database.
-Redis (http://redis.io/): advanced key-value store.

Now once you are convinced that your application requires NoSQL, here are a few points which will help you decide which NoSQL database/datastore is suited for you:

My approach is to choose the one which suites your application data model. If your application has something like a social-graph (some of the social networking features) then use a graph database like Neo4j. If your application requires storing very large amount of data and processing it then use column oriented database like HBase (Google's BigTable belongs to ColumnFamilies).
If you want fast lookups then you can go for something like Redis which supports key/value pairs. When data-structure can vary and you need a document type storage go for something like mongoDB. If your application requires high concurrency and low latency data access then go for Membase.

Now even if you have chosen the appropriate NoSQL database still there are certain things which you should make a note of :

1. Whether the db you have chosen in easy to manage and administer.

2. Developer's angle - Do you have the right set of people who can get started quickly on this. Does it have enough forums and community support. Affirmative answers for these questions is must since NoSQL DBs are still in the stage of emergence and have not matured yet.

3. How actively open source community is building tools/frameworks/utilities around it in order to make the developer's life easy.

At the end, there is a nice diagram available on the web (http://www.nijee.com/2011/02/golden-key-to-distributed-computing-is.html) - "Visual Guide to NoSQL Systems" which talks about which NoSQL db fits where based on CAP theorem. Typically choosing one db may not solve all your problems. Select one keeping certain features of your application in mind and feel free to go for another one for other modules. Also this doesn't mean removing relational database completely. Personally I always prefer to keep relational db in my applications and use it at certain places where it really makes sense to use it!

Recommended sites:

Since I am a regular reader of High Scalability site, I would recommend going though this URL : http://highscalability.com/blog/category/nosql . It has 38 nice articles on NoSQL which will really make you happy :)

Apart from this InfoQ also has good content for NoSQL: http://www.infoq.com/nosql/

Another hot place these days to get smart answers is Quora. Do read various NoSQL related queries and their nice answers written by top Developers/Engineers/Architects from top organizations like Facebook, Twitter, LinkedIn, Amazon and various other hot startups at the following URL : http://www.quora.com/NoSQL

The list is indeed big but I am not going to publish too many urls to divert your attention :)