<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8996157773659370402</id><updated>2011-11-03T18:50:16.653+05:30</updated><category term='Programing'/><category term='java script'/><category term='GXT'/><category term='CSS'/><category term='Java'/><category term='ideas'/><category term='movies'/><category term='My First Post'/><category term='monologues'/><category term='Politics'/><category term='experiences'/><title type='text'>Questzen</title><subtitle type='html'>Reality is a perception. Perceptions are not always based on facts, and are strongly influenced by illusions. Inquisitiveness is hence indispensable</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>79</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-8162649640779191087</id><published>2011-08-14T01:05:00.002+05:30</published><updated>2011-08-14T01:41:09.334+05:30</updated><title type='text'>The art of mastering</title><content type='html'>Everyone wants experts, no one like mediocre. So what makes one an expert? Simple – deliberate practice. Malcolm gladwell, in ‘Outliers’ says that it takes 10000 hours to master any subject. How about programming?  A person doing a 40hr week does around 2000 hours of programming, so that is 5 years. Hence the reason, most job positions ask for 5-9 yrs of experience. As simple as it sounds, it is disheartening to know that it is not true.  I have seen programmers with 2-3yrs experience out perform their seniors. How is it possible then?&lt;br /&gt;&lt;br /&gt;The answer lies in the fact that programming is a thought process; it is not a tangible entity. Once you know and believe that you can program, you need to apply it. The application is the process of mastery. Good programmers are good because, they spent time solving problems by pondering. The process of programming is not a straight forward verb. It is thought process that involves coming up with solutions or looking out for alternatives; and understanding them so that one can apply them in their truest form (not by pasting the code found elsewhere). &lt;br /&gt;&lt;br /&gt;Good programmers try to minimize their technical debt (described by martin fowler). They try to be hands on. Most good programmers have the following traits.&lt;br /&gt;1.	Understand problems, and categorize them into known and unknown (or solvable on their own or need help)&lt;br /&gt;2.	Try to devise more than one solution, how so ever bad the stupid solution be&lt;br /&gt;3.	Discuss the hard case solutions with others to seek more inputs. (like a riddle/puzzle)&lt;br /&gt;4.	Read books (and gain insights from others who had been through the same) a smart cut approach.&lt;br /&gt;5.	Learn different programming paradigms (not languages aka syntax)&lt;br /&gt;&lt;br /&gt;Ever wondered what is the difference between a programmer and a designer/architect? A good programmer is like a artist. Given a tough job, the goal of a good programmer is to realize it in its spirit. Good programmers circumvent problems and take solutions that burden them the least. A designer is a mature programmer, One can call oneself a designer when one devises a goal and achieves it. &lt;br /&gt;&lt;br /&gt;Designers’ genuinely discover themselves to be so. They set forth goals and achieve them in a way that acts as an example to others. One can never be a good designer by virtue of a title or experience. Design is a discovery process, unlike programming. The true benchmark in my opinion is when a designer devises a solution all by himself and finds out that it is in fact a standard/recommended practice. Designers are above the implementation details and should realize that by achieving things the way they want , and not by the way the obvious solutions allow.&lt;br /&gt;If a designer sets goals and cannot achieve them, then it is inadequate. Good designers preach and practice, not to substantiate their gospel but to discover new means.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-8162649640779191087?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/8162649640779191087/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=8162649640779191087' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/8162649640779191087'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/8162649640779191087'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/08/art-of-mastering.html' title='The art of mastering'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-249960029661816030</id><published>2011-08-13T23:47:00.003+05:30</published><updated>2011-08-14T00:55:32.118+05:30</updated><title type='text'>Behind the interview door</title><content type='html'>Getting a job is a momentous occasion. No matter, how much you yearn - you always go through the dreaded interview phase. Now don’t get me wrong. I am not saying that interviews have to be miserable. I am used to sitting on either side of the desk. While it is a joy to interview candidates who fit the bill; It rarely happens. No amount of preparation can guarantee a success. Interviewees aspire to go by the ‘book’ (answering everything under the sun). However good interviewers don’t go by the book, they are great listeners. I had many a great opportunity to share the hall with some of them and I found the lessons invaluable. I am writing this for the benefit of many, with whom I shared and will share the experience.&lt;br /&gt;While CV may say many things, there are certain things which become obvious only during the human interaction. The most prominent ones are below (in no particular order).  The traits that make an interviewee most endearing are the ones I listed below.&lt;br /&gt;&lt;h3&gt;Confidence/ Humility:&lt;/h3&gt; Do this by the correct measure. Don’t miss the hallmark listed in bold (the Job description). If it is for a sales/marketing/PR  alike position, you can get away by overselling yourselves. For technical interview never promise things which you cannot deliver. I will let you a secret, the other side of the bench, also comprises of human beings, who themselves have done as many mistakes as you have done, if not more.  They will be your future colleagues/supervisors. They reached their current position by committing those errors and are quite wary. &lt;br /&gt;So what is the right measure? Simple tell them what you are good at, what you like and what you have done. It may not be a good idea to tell them what you don’t want, if you desperately need the job. In the long run however, you will find that the decent interviewer rejected you, not because you were bad but because you deserved better. I have been rejected roles in the final rounds with the comment from senior managers/leads saying there is an ‘aspiration mismatch’. Why hire a horse to do the donkeys’ work?&lt;br /&gt;&lt;h3&gt;Presence of mind:&lt;/h3&gt; Listen, always listen first and ask for time if required. Ask sensible questions, If making a guess – spell it out loudly (I am not sure, can I guess!) It does wonders. There are dumb questions which get thrown to you, and smart answers which make the rational clear. Don’t jump the context unless you have struck a chord with the interviewer’s wavelength. &lt;br /&gt;Interviewers also fumble; their wording is confusing at times, so ask questions so that you can think better. Do this before you admit defeat.  If a interviewer is keen, hints will be thrown to you, counter points will be raised. This is your chance to take control. See someone is genuinely willing to hear  you!&lt;br /&gt;&lt;h3&gt;Honesty/Sincerity:&lt;/h3&gt;  If above fails, admit your lack of knowledge or ignorance. It may be a morale breaker for you, but definitely not for the interview. People wish to judge on the merit and the intent. You won’t be punished for your lack of know how. No one can master every damn thing, but you definitely need to master the relevant. Even an indication that you are on the right course is a welcoming sight. There are only two things one has to do, communicate things which one has done and create trust about your ability to learn and adapt to new factors.&lt;br /&gt;&lt;h3&gt;Never assume that you can drive the interview:&lt;/h3&gt;	While it is true that most interviews have a defined timeline. It is never a good idea to gauge by the number of interviews and duration. The real metric is the quality of the hire. Technical folks tend to be adamant, so unless you give answers they don’t relent. It is never a good idea to procrastinate/show-off. Questions which ask you about your areas of comfort are to be viewed as the opening gambit. Sometimes pretty straight questions may come asking you to rate yourselves. The number is asked to judge ones perception of caliber and not as an answer. It is the interviewers’ job to do that. The best thing one can do is blend with the flow, like a sugar cube in milk, not obvious but definitely perceivable.&lt;br /&gt;Interviewers also ask questions which sound dumb or outrageous; this is done just to set a context like a cold start.&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;Think and communicate your thoughts/concerns&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;Raise questions and point out flaws (politely)&lt;br /&gt;Wait for the control to be given to you, pounce by giving relevant examples from your experience.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;Always keep in mind that your preparation has started since the day you started working (or you joined college) and continual learning is indispensable. &lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;Never badmouth anyone. Infact this is one place where you can show-off you diplomatic skills. &lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-249960029661816030?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/249960029661816030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=249960029661816030' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/249960029661816030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/249960029661816030'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/08/hiring-right-behind-interview-curtain.html' title='Behind the interview door'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-3517154493382160544</id><published>2011-07-10T17:24:00.002+05:30</published><updated>2011-07-10T17:40:51.884+05:30</updated><title type='text'>Social Innovation - Communal participation (2)</title><content type='html'>In the earlier post, I listed out certain catalysts who have spent a significant time &amp; effort in social causes. They are not to be seen as NGOs spending monies. These guys come under a different league. The inviting thing about social innovation, is that this can be copied/mimicked, and the plagiarist attitude is actually helpful. Anyone set up a franchise of a rural call center or courier service, and contribute in a meaningful way. I envy the HR in such organizations (near 0 attrition).&lt;br /&gt;&lt;br /&gt;If deaf and dumb can run courier services, why not laundromats &amp; cleaners? With 3G in India, why not have a call center that can transcribe and reinterpret the signs to verbal dialect targeted towards focus groups?. Why not come up with financial planning for rural farmers who have a different set of needs. Why not have a facebook for challenged/access deprived users? Can you have a broadcast station for deaf?&lt;br /&gt;&lt;br /&gt;These ideas have great potential, and I for sure will not ask for any credit ;). Certain seemingly simple questions like transliteration of sign lang to text, have made me realize the complexity of the &lt;a href="http://en.wikipedia.org/wiki/List_of_sign_languages"&gt;problem&lt;/a&gt;. Until then I would encourage and make an effort to participate in every effort that aids this cause.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-3517154493382160544?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/3517154493382160544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=3517154493382160544' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3517154493382160544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3517154493382160544'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/07/social-innovation-communal_10.html' title='Social Innovation - Communal participation (2)'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-7499253699115744046</id><published>2011-07-10T16:34:00.004+05:30</published><updated>2011-07-10T17:23:56.675+05:30</updated><title type='text'>Social Innovation - Communal participation (1)</title><content type='html'>&lt;span style="font-style:italic;"&gt;Thanks to eenadu.net&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Example 1&lt;/h3&gt;&lt;br /&gt;Who: &lt;a href="http://lmgtfy.com/?q=dhruv+lakra"&gt;Dhruv Lakra&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;What he did: &lt;a href="http://miraklecouriers.wordpress.com/"&gt;Enabled the challenged folks to stand up for themselves&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My moto for him: Teach a man how to fish...&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Example 2&lt;/h3&gt;&lt;br /&gt;Who: &lt;a href="http://en.wikipedia.org/wiki/Harish_Hande"&gt;Harish Hande&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;What he did: &lt;a href="http://www.selco-india.com"&gt;Brought sustainable power to masses&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My moto for him: Your actions speak louder than your qualification.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Example 3&lt;/h3&gt;&lt;br /&gt;Who: &lt;a href="http://lmgtfy.com/?q=saloni+malhotra+desicrew"&gt;Saloni malhotra&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;What she did: &lt;a href="http://desicrew.in/index.html"&gt;Proved that IT is not about A.C buildings&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My moto for her: 'IT' makes sense&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Example 4&lt;/h3&gt;&lt;br /&gt;Who: Ramana Babu Killi&lt;br /&gt;&lt;br /&gt;What he did: &lt;a href="http://greenbasics.org/index.html"&gt;Reached out to rural farmers&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-7499253699115744046?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/7499253699115744046/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=7499253699115744046' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7499253699115744046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7499253699115744046'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/07/social-innovation-communal.html' title='Social Innovation - Communal participation (1)'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-8563924836117383942</id><published>2011-05-31T13:02:00.003+05:30</published><updated>2011-05-31T13:40:36.386+05:30</updated><title type='text'>Maven and Ant</title><content type='html'>'Build' is more of a process than a tool. Build tools have come a long way, writing custom bat/shell scripts is no longer acceptable. Ant became the defacto standard for java shops. Then came Maven, for a developer working on a single project, the build tool would not be a major concern. It is just another tool in the arsenal. &lt;br /&gt;&lt;br /&gt;A good Ant script is configurable, readable, modular and extensible. Properties and semantically sound naming conventions are must for a good script. This is analogous to writing maintainable code and carries the same penalty, none of the above conventions are mandatory, implying that hastily written scripts can end up in production environment.&lt;br /&gt;&lt;br /&gt;Maven strongly enforces the concept of life-cycles. Plugins are used to carry out tasks (similar to ant tasks). Archetypes define the xml structure. All of these make it a bit more difficult to deviate from standards. Maven rules over Ant when it comes to standardisation. Almost anyone can use a maven build file (pom), where as certain build.xml files have known to have caused nightmares. &lt;br /&gt;&lt;br /&gt;So why isn't everything mavenized? Answer: simplicity. Almost every developer working on a project know the libraries &amp; versions required. Unless you are building a library/framework, one can be certain about build invariants (libraries). So 75.23455623% [random number generated by a fickle brain :)] of the projects meant for end-user consumption are happy with a working ant script. They don't need to haggle over dependency resolution. These are guys who don't care if SCM/CI are built-in or whether a GUI exists for viewing the jar files.&lt;br /&gt;&lt;br /&gt;To conclude the discussion, decide in which environment you would be working. If it is a environment with diverse projects that may use your code one day, go with Maven as it is more polite to advanced users. If you work on personal projects/college assigments/maverick prototypes, Ant fits your bill.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-8563924836117383942?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/8563924836117383942/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=8563924836117383942' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/8563924836117383942'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/8563924836117383942'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/05/maven-and-ant.html' title='Maven and Ant'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-502333311722693473</id><published>2011-04-13T13:03:00.004+05:30</published><updated>2011-04-13T14:35:46.304+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Java HashMap with time base expiry policy</title><content type='html'>I recently had to come with this data-structure, later I found that google collections has a &lt;span style="font-weight:bold;"&gt;MapMaker&lt;/span&gt; which essentially does the same. Posting some ideas and the code I have written here.&lt;br /&gt;&lt;br /&gt;There are broadly two different ideas:&lt;br /&gt;1. Create a time tracker along with the hashMap. Then run a thread to detect and delete expired items&lt;br /&gt;2. Create a new hashMap periodically while flushing the contents of old map. &lt;br /&gt;&lt;br /&gt;I have implemented the first kind. This makes use of jdk 6 concurrency features&lt;br /&gt;&lt;br /&gt;&lt;table bgcolor="#dddddd" border="1" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;package test;&lt;br /&gt;&lt;br /&gt;import java.util.Collections;&lt;br /&gt;import java.util.HashMap;&lt;br /&gt;import java.util.HashSet;&lt;br /&gt;import java.util.Map;&lt;br /&gt;import java.util.Set;&lt;br /&gt;import java.util.concurrent.ConcurrentHashMap;&lt;br /&gt;import java.util.concurrent.Executors;&lt;br /&gt;import java.util.concurrent.ScheduledExecutorService;&lt;br /&gt;import java.util.concurrent.ThreadFactory;&lt;br /&gt;import java.util.concurrent.TimeUnit;&lt;br /&gt;import java.util.concurrent.locks.ReentrantReadWriteLock;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Thread safe object map, which clears objects after a specified time. The objects are stored &lt;font color="blue"&gt;in&lt;/font&gt; the&lt;br /&gt; * underlying hashMap.  &lt;br /&gt; * @author rongkan&lt;br /&gt; *&lt;br /&gt; */&lt;br /&gt;&lt;font color="blue"&gt;public&lt;/font&gt; final &lt;font color="blue"&gt;class&lt;/font&gt; TimeLimitedCacheMap {&lt;br /&gt;        &lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; final ConcurrentHashMap&amp;lt;String, Object&amp;gt; objectMap = &lt;font color="blue"&gt;new&lt;/font&gt; ConcurrentHashMap&amp;lt;String, Object&amp;gt;(10);&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; final ConcurrentHashMap&amp;lt;String, Long&amp;gt; timeMap = &lt;font color="blue"&gt;new&lt;/font&gt; ConcurrentHashMap&amp;lt;String, Long&amp;gt;();&lt;br /&gt;    /* I need a shared lock, readwrite lock is an excellent candidate.&lt;br /&gt;     * evcition is run with writeLock, put/remove with readLock &lt;br /&gt;     */&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; final ReentrantReadWriteLock accessLock = &lt;font color="blue"&gt;new&lt;/font&gt; ReentrantReadWriteLock();&lt;br /&gt;    &lt;font color="green"&gt;//private final ReentrantLock accessLock = new ReentrantLock();&lt;/font&gt;&lt;br /&gt;     &lt;font color="blue"&gt;private&lt;/font&gt; final Runnable evictor = &lt;font color="blue"&gt;new&lt;/font&gt; Runnable() {&lt;br /&gt;        &lt;br /&gt;        /* evictor thread removes data, and changes map state. This is&lt;br /&gt;         * &lt;font color="blue"&gt;in&lt;/font&gt; conflict with put() and remove(). So we need sync &lt;font color="blue"&gt;for&lt;/font&gt; these operations  &lt;br /&gt;         * &lt;br /&gt;         * In &lt;font color="blue"&gt;case&lt;/font&gt; you are wondering why evictor needs sync (it just calls remove() right?)&lt;br /&gt;         * eviction is a compound action that spans more than a single remove(). It enters&lt;br /&gt;         * into a conflict with put()&lt;br /&gt;         * &lt;br /&gt;         * evictor: start looping ------------------------------&amp;gt; keyset is stale, evictor removes the recent put &amp;amp; armagedon comes &lt;br /&gt;         * Thrd1:---------------------&amp;gt;put(same key, &lt;font color="blue"&gt;new&lt;/font&gt; object)&lt;br /&gt;         * &lt;br /&gt;         */&lt;br /&gt;        @Override&lt;br /&gt;        &lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;void&lt;/font&gt; run() {&lt;br /&gt;            &lt;font color="green"&gt;// avoid runs on empty maps&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;if&lt;/font&gt;(timeMap.isEmpty()){&lt;br /&gt;                Thread.yield();&lt;br /&gt;            }&lt;br /&gt;            long currentTime = System.nanoTime();&lt;br /&gt;            accessLock.writeLock().lock();&lt;br /&gt;            Set&amp;lt;String&amp;gt; keys = &lt;font color="blue"&gt;new&lt;/font&gt; HashSet&amp;lt;String&amp;gt;(timeMap.keySet());&lt;br /&gt;            accessLock.writeLock().unlock();&lt;br /&gt;            /* First attempt to detect &amp;amp; mark stale entries, but don't delete&lt;br /&gt;             * The hash map may contain 1000s of objects dont' block it. The returned&lt;br /&gt;             * Set returned may be stale, implying:&lt;br /&gt;             * 1. contains keys &lt;font color="blue"&gt;for&lt;/font&gt; objects which are removed by user, &lt;font color="blue"&gt;using&lt;/font&gt; remove() (not a problem)&lt;br /&gt;             * 2. contains keys &lt;font color="blue"&gt;for&lt;/font&gt; objects which are updated by user, &lt;font color="blue"&gt;using&lt;/font&gt; put() [a big problem]&lt;br /&gt;             */&lt;br /&gt;            Set&amp;lt;String&amp;gt; markedForRemoval = &lt;font color="blue"&gt;new&lt;/font&gt; HashSet&amp;lt;String&amp;gt;(10);&lt;br /&gt;            &lt;font color="blue"&gt;for&lt;/font&gt; (String key : keys) {&lt;br /&gt;                long lastTime = timeMap.&lt;font color="blue"&gt;get&lt;/font&gt;(key);&lt;br /&gt;                &lt;font color="blue"&gt;if&lt;/font&gt;(lastTime == 0){&lt;br /&gt;                    continue;&lt;br /&gt;                }&lt;br /&gt;                long interval = currentTime - lastTime;&lt;br /&gt;                long elapsedTime = TimeUnit.NANOSECONDS.convert(interval, expiryTimeUnit);&lt;br /&gt;                &lt;font color="blue"&gt;if&lt;/font&gt;(elapsedTime &amp;gt; expiryTime){&lt;br /&gt;                    markedForRemoval.add(key);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            &lt;br /&gt;            /* Actual removal call, which runs on the objects marked earlier.&lt;br /&gt;             * Assumption: marked objects.size() &amp;lt; hashmap.size()&lt;br /&gt;             * Do not delete blindly, check &lt;font color="blue"&gt;for&lt;/font&gt; staleness before calling remove&lt;br /&gt;             */&lt;br /&gt;            accessLock.writeLock().lock();&lt;br /&gt;            &lt;font color="blue"&gt;for&lt;/font&gt; (String key : markedForRemoval) {&lt;br /&gt;                long lastTime = timeMap.&lt;font color="blue"&gt;get&lt;/font&gt;(key);&lt;br /&gt;                &lt;font color="blue"&gt;if&lt;/font&gt;(lastTime == 0){&lt;br /&gt;                    continue;&lt;br /&gt;                }&lt;br /&gt;                long interval = currentTime - lastTime;&lt;br /&gt;                long elapsedTime = TimeUnit.NANOSECONDS.convert(interval, expiryTimeUnit);&lt;br /&gt;                &lt;font color="blue"&gt;if&lt;/font&gt;(elapsedTime &amp;gt; expiryTime){&lt;br /&gt;                    remove(key);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            accessLock.writeLock().unlock();&lt;br /&gt;        }&lt;br /&gt;    };&lt;br /&gt;    &lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; final ScheduledExecutorService timer = Executors.newSingleThreadScheduledExecutor(&lt;font color="blue"&gt;new&lt;/font&gt; MyThreadFactory(&lt;font color="blue"&gt;true&lt;/font&gt;));&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; final &lt;font color="blue"&gt;class&lt;/font&gt; MyThreadFactory implements ThreadFactory {&lt;br /&gt;        &lt;br /&gt;        &lt;font color="blue"&gt;private&lt;/font&gt; boolean isDaemon = &lt;font color="blue"&gt;false&lt;/font&gt;;&lt;br /&gt;        &lt;br /&gt;        &lt;font color="blue"&gt;public&lt;/font&gt; MyThreadFactory(boolean daemon){&lt;br /&gt;            isDaemon = daemon;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        @Override&lt;br /&gt;        &lt;font color="blue"&gt;public&lt;/font&gt; Thread newThread(Runnable r) {&lt;br /&gt;            Thread t = &lt;font color="blue"&gt;new&lt;/font&gt; Thread(r);&lt;br /&gt;            t.setDaemon(isDaemon);&lt;br /&gt;            &lt;font color="blue"&gt;return&lt;/font&gt; t;&lt;br /&gt;        }        &lt;br /&gt;        &lt;br /&gt;    };&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; final long expiryTime;&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; final TimeUnit expiryTimeUnit;&lt;br /&gt;    &lt;br /&gt;    /**&lt;br /&gt;     * Users can play around with evictionDelay and expiryTime.&lt;br /&gt;     * 1. Large evictionDelay =&amp;gt; less frequent checks, hence chances of finding expired Objects are more&lt;br /&gt;     * 2. Lean evictionDelay =&amp;gt; aggressive checks, and hence more sync overhead with put() and remove()&lt;br /&gt;     * 3. Large expiryTime =&amp;gt; increases the time object stays &lt;font color="blue"&gt;in&lt;/font&gt; object map and less chance of cache miss (cache miss is bad)&lt;br /&gt;     * 4. Lean expiryTime =&amp;gt; by itself does not force object to be removed aggressively, needs lean eviction to be configured &lt;br /&gt;     * &lt;br /&gt;     * In &lt;font color="blue"&gt;case&lt;/font&gt; you are wondering, above picture is not complete. &lt;br /&gt;     * Another key aspect is &amp;quot;Arrival Periodicty&amp;quot;, or the rate at which put() is called.&lt;br /&gt;     * &lt;br /&gt;     * Ideally: expiryTime == arrival periodicity + 1 [read '+1' as slightly greater]&lt;br /&gt;     *             evictionDelay == expiryTime + 1&lt;br /&gt;     * &lt;br /&gt;     * For random arrival times, which is a more common scenario, use the following pointers &lt;br /&gt;     * 1. eviction Delay &amp;gt; expiry Time&lt;br /&gt;     *         Here user needs to think of the impact of stale hit (define how stale is stale!)&lt;br /&gt;     * 2. eviction Delay &amp;lt; arrival time&lt;br /&gt;     *         This has higher chances of cache miss and accidental treatment as failure     * &lt;br /&gt;     * 3. eviction Delay &amp;lt; expiry Time&lt;br /&gt;     *         Unwanted eviction run(s) resulting &lt;font color="blue"&gt;in&lt;/font&gt; sync overhead on map&lt;br /&gt;     * 4. eviction Delay &amp;gt; arrival Time&lt;br /&gt;     *         Unwanted eviction run(s) resulting &lt;font color="blue"&gt;in&lt;/font&gt; sync overhead on map&lt;br /&gt;     *  &lt;br /&gt;     * @param initialDelay, time after which scheduler starts&lt;br /&gt;     * @param evictionDelay, periodicity with which eviction is carried out  &lt;br /&gt;     * @param expiryTime, age of the object, exceeding which the object is  to be removed&lt;br /&gt;     * @param unit&lt;br /&gt;     */&lt;br /&gt;    &lt;font color="blue"&gt;public&lt;/font&gt; TimeLimitedCacheMap(long initialDelay, long evictionDelay, long expiryTime, TimeUnit unit){&lt;br /&gt;        timer.scheduleWithFixedDelay(evictor, initialDelay, evictionDelay, unit);&lt;br /&gt;        &lt;font color="blue"&gt;this&lt;/font&gt;.expiryTime = expiryTime;&lt;br /&gt;        &lt;font color="blue"&gt;this&lt;/font&gt;.expiryTimeUnit = unit;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /* The intention is to prevent user from modifying the object Map,&lt;br /&gt;     * I want all adds/removals to be suspended. synchronizing on objectMap&lt;br /&gt;     * would also work, but locks are easier to read without scope issues of {} &lt;br /&gt;     * &lt;br /&gt;     * Concurrent hashMap would have allowed put and remove to happen concurrently.&lt;br /&gt;     * I did not use conc-map, because&lt;br /&gt;     * 1. I want to update another map (timeMap)&lt;br /&gt;     * 2. I want to sync the operation with evictor thread&lt;br /&gt;     * &lt;br /&gt;     * The unfortunate invariants: &lt;br /&gt;     *     1. sync between evictor and put()&lt;br /&gt;     *  2. sync between evictor and remove()&lt;br /&gt;     *  imply&lt;br /&gt;     *  3. sync lock between put() and remove()&lt;br /&gt;     *  &lt;br /&gt;     *  3. is unfortunate side effect, as you need to sync all exposed invariants on the same lock.&lt;br /&gt;     *  Lock duplication won't help. If I create putLock() and removeLock(), they will allow put() and remove()&lt;br /&gt;     *  to happen concurrently, but will not help two put()/remove() calls to happen &lt;font color="blue"&gt;in&lt;/font&gt; parallel.   &lt;br /&gt;     */&lt;br /&gt;    &lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;void&lt;/font&gt; put(String key, Object value) {        &lt;br /&gt;        accessLock.readLock().lock();&lt;br /&gt;        Long nanoTime = System.nanoTime();&lt;br /&gt;        timeMap.put(key, nanoTime);&lt;br /&gt;        objectMap.put(key, value);&lt;br /&gt;        accessLock.readLock().unlock();        &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /* Read comments &lt;font color="blue"&gt;for&lt;/font&gt; put() they apply here as well.&lt;br /&gt;     * If had not allowed remove(), life would have been zillion times simpler. &lt;br /&gt;     * However, an undoable action is quite bad.&lt;br /&gt;     */&lt;br /&gt;    &lt;font color="blue"&gt;public&lt;/font&gt; Object remove(Object key) {        &lt;br /&gt;        accessLock.readLock().lock();&lt;br /&gt;        &lt;font color="green"&gt;//accessLock.lock();&lt;/font&gt;&lt;br /&gt;        Object value = objectMap.remove(key);&lt;br /&gt;        timeMap.remove(key);&lt;br /&gt;        &lt;font color="green"&gt;//accessLock.unlock();&lt;/font&gt;&lt;br /&gt;        accessLock.readLock().unlock();&lt;br /&gt;        &lt;font color="blue"&gt;return&lt;/font&gt; value;&lt;br /&gt;        &lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    /* Clone requires locking, to prevent the edge &lt;font color="blue"&gt;case&lt;/font&gt; where &lt;br /&gt;     * the map is updated with clone is &lt;font color="blue"&gt;in&lt;/font&gt; progress &lt;br /&gt;     */&lt;br /&gt;    &lt;font color="blue"&gt;public&lt;/font&gt; Map&amp;lt;String, Object&amp;gt; getClonedMap(){&lt;br /&gt;        accessLock.writeLock().lock();&lt;br /&gt;        HashMap&amp;lt;String, Object&amp;gt; mapClone = &lt;font color="blue"&gt;new&lt;/font&gt; HashMap&amp;lt;String, Object&amp;gt;(objectMap);&lt;br /&gt;        accessLock.writeLock().unlock();&lt;br /&gt;        &lt;font color="blue"&gt;return&lt;/font&gt; Collections.unmodifiableMap(mapClone);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-502333311722693473?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/502333311722693473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=502333311722693473' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/502333311722693473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/502333311722693473'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/04/java-hashmap-with-expiration-policy.html' title='Java HashMap with time base expiry policy'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-2706067965403829283</id><published>2011-03-18T20:07:00.003+05:30</published><updated>2011-04-13T13:46:58.636+05:30</updated><title type='text'>GXT Nuggets: Hipocrite's combo box</title><content type='html'>&lt;h3&gt;Bananas for the code monkey&lt;/h3&gt;&lt;br /&gt;Ever faced a situation where you want to show the user some information 'X' but you actually need 'Y' for the backend logic? Say you have an employee entity with a employee details and a auto-generated PK. You have designed a form to show the employee details, based on the user selection (in a drop-down combo). A hiprocrite's combo is up for this task. It shows employee name/number in the UI but secretly holds the PK deep down.&lt;br /&gt;&lt;br /&gt;You may wonder why all the fuss, why not just set the state in the drop down. Works wonderfully provided you 'remember' the state's 'key'. If I have 10 such forms, this involves 10 if() stmts atleast. To overcome this and let the contract-driven design make life easier for us, I re-invented the combo box. I added an adaptive behaviour in form of DynamicProperyEditor. This enables us to query for various model properties without excessive intrusion.&lt;br /&gt;&lt;br /&gt;&lt;table bgcolor="#dddddd" border="1" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;&lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;class&lt;/font&gt; DynamicPropertyEditor&amp;lt;Data extends BaseModelData&amp;gt; extends ListModelPropertyEditor&amp;lt;BaseModelData&amp;gt;{&lt;br /&gt;    &lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; String propertyName;                                &lt;br /&gt;        &lt;br /&gt;    &lt;font color="blue"&gt;public&lt;/font&gt; DynamicPropertyEditor(String property) {&lt;br /&gt;        &lt;font color="blue"&gt;this&lt;/font&gt;.propertyName = property;&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    &lt;font color="blue"&gt;public&lt;/font&gt; String getStringValue(Data value){        &lt;br /&gt;        &lt;font color="blue"&gt;return&lt;/font&gt; value.&lt;font color="blue"&gt;get&lt;/font&gt;(propertyName);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;font color="blue"&gt;public&lt;/font&gt; String getPropertyName() {&lt;br /&gt;        &lt;font color="blue"&gt;return&lt;/font&gt; propertyName;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;class&lt;/font&gt; X10ComboBox&amp;lt;D extends BaseModelData&amp;gt; extends ComboBox&amp;lt;D&amp;gt; {&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; DynamicPropertyEditor&amp;lt;D&amp;gt; dynamicPropertyEditor = &lt;font color="blue"&gt;null&lt;/font&gt;;&lt;br /&gt;    &lt;br /&gt;    &lt;font color="blue"&gt;public&lt;/font&gt; DynamicPropertyEditor&amp;lt;D&amp;gt; getDynamicPropertyEditor(){&lt;br /&gt;        &lt;font color="blue"&gt;return&lt;/font&gt; dynamicPropertyEditor;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;void&lt;/font&gt; setDynamicPropertyEditor(DynamicPropertyEditor&amp;lt;D&amp;gt; dynamicPropertyEditor) {&lt;br /&gt;        &lt;font color="blue"&gt;this&lt;/font&gt;.dynamicPropertyEditor = dynamicPropertyEditor;&lt;br /&gt;    }&lt;br /&gt;    @Override&lt;br /&gt;    &lt;font color="blue"&gt;public&lt;/font&gt; ListModelPropertyEditor&amp;lt;D&amp;gt; getPropertyEditor() {&lt;br /&gt;                ....&lt;br /&gt;                }                &lt;br /&gt;}&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-2706067965403829283?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/2706067965403829283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=2706067965403829283' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/2706067965403829283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/2706067965403829283'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/03/gxt-nuggets-hipocrites-combo-box.html' title='GXT Nuggets: Hipocrite&apos;s combo box'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-3880893822975969411</id><published>2011-03-18T19:42:00.003+05:30</published><updated>2011-03-18T20:03:40.162+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='GXT'/><title type='text'>GXT Nuggets: Preventive form validation</title><content type='html'>&lt;h3&gt;Bananas for the code monkey&lt;/h3&gt;&lt;br /&gt;It is always a good idea to prevent users from doing unwarranted things. Thats the whole idea of client side validation. (Client-side validation is one good way of catching errors before the code hits server, so....blah blah).&lt;br /&gt;&lt;br /&gt;The general notion in UI is to accept user input using forms.(XSS, URL mangling etc left aside). In GXT, we can actually mandate/direct the hasty users to enter the correct data without cluttering the UI with error messages. The notion is simple, prevent the buttons from being enabled until all the validations are honored.&lt;br /&gt;&lt;br /&gt;This is achieved using a &lt;b&gt;FormButtonBinding&lt;/b&gt; object. The actual code:&lt;br /&gt;&lt;table bgcolor="#dddddd" border="1" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;&lt;font color="blue"&gt;private&lt;/font&gt; FormPanel createLabelSearchPanel(String formHeader, String keywordLabel, String submitLabel) {&lt;br /&gt;        FormPanel formPanel = &lt;font color="blue"&gt;new&lt;/font&gt; FormPanel();&lt;br /&gt;        &lt;br /&gt;        formPanel.setLabelAlign(FormPanel.LabelAlign.RIGHT);&lt;br /&gt;        formPanel.setHeading(formHeader);&lt;br /&gt;        formPanel.setFieldWidth(DashboardConstants.FIELD_WIDTH);&lt;br /&gt;        formPanel.setLabelWidth(DashboardConstants.LABEL_WIDTH);&lt;br /&gt;        formPanel.setFrame(&lt;font color="blue"&gt;true&lt;/font&gt;);&lt;br /&gt;        formPanel.setAutoHeight(&lt;font color="blue"&gt;true&lt;/font&gt;);&lt;br /&gt;        FormData formData = &lt;font color="blue"&gt;new&lt;/font&gt; FormData(&amp;quot;-10&amp;quot;);&lt;br /&gt;        &lt;br /&gt;        TextField&amp;lt;BaseModelData&amp;gt; textField = TextFieldFactory.getDefault().getTextField(keywordLabel, &amp;quot;(Enter Search Key)&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;        formPanel.add(textField, formData);&lt;br /&gt;        &lt;br /&gt;        Button searchButton = &lt;font color="blue"&gt;new&lt;/font&gt; Button(submitLabel, &lt;font color="blue"&gt;new&lt;/font&gt; SubmitButtonListener(formPanel));        &lt;br /&gt;        formPanel.getButtonBar().add(searchButton);&lt;br /&gt;        &lt;br /&gt;        FormButtonBinding binding = &lt;font color="blue"&gt;new&lt;/font&gt; FormButtonBinding(formPanel);&lt;br /&gt;        binding.addButton(searchButton);&lt;br /&gt;        formPanel.setButtonAlign(HorizontalAlignment.CENTER);&lt;br /&gt;        &lt;br /&gt;        &lt;font color="blue"&gt;return&lt;/font&gt; formPanel;&lt;br /&gt;    }&lt;br /&gt;------------------------------------------&lt;br /&gt;&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; TextField&amp;lt;BaseModelData&amp;gt; createTextField(final String fieldLabel, final String defaultText, final String defaultValue) {&lt;br /&gt;        final TextField&amp;lt;BaseModelData&amp;gt; textField = &lt;font color="blue"&gt;new&lt;/font&gt; TextField&amp;lt;BaseModelData&amp;gt;();&lt;br /&gt;        textField.setFieldLabel(fieldLabel);&lt;br /&gt;        textField.setEmptyText(defaultText);&lt;br /&gt;        textField.setSelectOnFocus(&lt;font color="blue"&gt;true&lt;/font&gt;);&lt;br /&gt;        textField.setAllowBlank(&lt;font color="blue"&gt;true&lt;/font&gt;);    &lt;br /&gt;        &lt;font color="blue"&gt;return&lt;/font&gt; textField;&lt;br /&gt;    }&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-3880893822975969411?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/3880893822975969411/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=3880893822975969411' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3880893822975969411'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3880893822975969411'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/03/gxt-nuggets-preventive-form-validation.html' title='GXT Nuggets: Preventive form validation'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-354051651373785839</id><published>2011-02-09T11:08:00.003+05:30</published><updated>2011-02-09T11:50:49.133+05:30</updated><title type='text'>Clutter free eclipse installations</title><content type='html'>The core principle of eclipse is plugin based architecture. This worked so well, that the eclipse eco-system is thriving with a plethora of addons. Earlier versions of eclipse (2.1 and earlier) were simple zip files, you could copy the whole directory structure and run it on any other machine. With the advent of 3.0, it is no longer the case. &lt;br /&gt;&lt;br /&gt;Eclipse versions determine the target platform based on the configuration. Incompatible configurations can cause crashes. In such extreme cases, the only resort is to search for all conflicting workspace configurations, reinstall eclipse with required plugins and reload the workspace projects.&lt;br /&gt;&lt;br /&gt;The latest versions come with P2 installer. P2 installations simplifies the burden of downloading large zip files. &lt;a href="http://www.ibm.com/developerworks/opensource/library/os-eclipse-equinox-p2/index.html"&gt;This &lt;/a&gt;ibm article describes how to share plugins across different installations.&lt;br /&gt;&lt;br /&gt;However, advanced users prefer seggregating plugins under a single location. Like all EMF plugins under one directory and python plugins in a different directory. Then create links to such. The benefit of this approach, you can remove and add features and plugins by a simple add/removal of link file. This also implies less memory utilization, you will be able to tweak you VM args to make use of optimal memory, without burdening the system. Implying better overall performance.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://michaelscharf.blogspot.com/2009/02/p2-how-i-install-plugins-in-extension.html"&gt;Michael &lt;/a&gt;wrote an excellent article in this regards. Happy tweaking!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-354051651373785839?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/354051651373785839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=354051651373785839' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/354051651373785839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/354051651373785839'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/02/clutter-free-eclipse-installations.html' title='Clutter free eclipse installations'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-597868861465430490</id><published>2011-02-03T18:58:00.002+05:30</published><updated>2011-02-03T19:04:19.155+05:30</updated><title type='text'>The punctuation of parsing</title><content type='html'>Awk scripts when interacting with shell tend to be problematic. Reason awk assumes a different parsing criteria which is incompatible with the shell's own expectation. For e.g: The quotes and whitespaces (',"," ") have a definitive meaning in korn shell, which conflicts with awks. Running the script with&lt;br /&gt;&lt;pre&gt; set -x &lt;/pre&gt; flag shows the details.&lt;br /&gt;&lt;br /&gt;So a script snippet that would work on command line&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;awk 'BEGIN {RS="_EOL@"}' 'END {print $NF}" a.txt&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;is to be transformed to:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;ETL_RECORD_DELIMITER="_EOL@"&lt;br /&gt;cmd=`awk BEGIN{RS="\"$ETL_RECORD_DELIMITER\""}" "END{print" "NR} a.txt`&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The white spaces are to be demarcated using " ", if you missed the gist.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-597868861465430490?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/597868861465430490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=597868861465430490' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/597868861465430490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/597868861465430490'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/02/punctuation-of-parsing.html' title='The punctuation of parsing'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-4494654921371071143</id><published>2011-01-19T11:45:00.002+05:30</published><updated>2011-01-19T12:33:17.226+05:30</updated><title type='text'>Learning everywhere</title><content type='html'>World is your playground, play if possible; if not learn to play; alteast try to learn to play; you will appreciate things more.&lt;br /&gt;&lt;br /&gt;This applies to programming as well. Programmers who know more than one programming paradigms deliver better outcomes. Very early on, I was misinformed that javascript doesn't care for invariants. The folks discussing this were my seniors, had thorough handson experience on C++ and Java. They are reknown for their sane and lucid code. They were working on a GUI generator (HTML UI) and using embedded js for validation. They did not knew unobstrusive JS. All they wanted was some validation on client UI that was realized using &lt;pre&gt; onclick="validateForm()" &lt;/pre&gt;. The statement now seems silly, but from their point of view, it is akeen to writing business invariants in sed or grep. I couldn't grasp why one could not write class invariants in javascript, so asked them and got a response that in javascript everything was public  (access scope). It was only a couple of years later I learnt the better parts.&lt;br /&gt;&lt;br /&gt;My intent is not to demean any, but to highlight that even the best of the team is often blinded by competence. If one doesnot empty his pot, how can one fill fresh water! Another example comes from SQL, sql is declarative hence no imperative syntax. While it is true for the most part, certain implementations specific functions say &lt;pre&gt;case...when, coallesce, nullif&lt;/pre&gt; can be used to impart imperativeness.&lt;br /&gt;&lt;br /&gt;Java developers are a different breed, some just write procedural code, mask it under the name of OOPS and live with it. Some advance to proper OOPS, design and architect properly. A few others master AOP, MDD, ORM and try to be a bit more smart. JavaScript programmers on the other hand are the most eccentric ones. A true master uses functional, procedural, prototyping, event handling/messaging &amp; OOP concepts to the fullest. While it is true that JS allows a whole gamut of things, it is still not fully seen beyond webservers. However, it is one of the few areas that indicates life beyond the know IDE realm.&lt;br /&gt;&lt;br /&gt;Learning new languages may or may not be fun, but understanding and appreciating the concepts is definitely delightful. When I started with JRuby, the concept of blocks was the most enticing. The brevity of code was just not plausible in Java. Python had similar givings. When I moved to GWT, the concept of callbacks and message bus usage was obvious to me (naturally, they are defacto occurences in JS apps). I found certain developers crack their heads trying to propogate references/spoil interface definitions all in an attempt to meet the goals. I just wish they read a bit more. &lt;br /&gt;&lt;br /&gt;Programmers who claim to be good with languages are not exempt. Ask them to come up with a proper word document, they do it -  do it with style corruption. Most of us do not even understand what style/doc corruption is. We donot use styles. If we showed the same zeal towards MSWord, the world would be more pleasent to us. A close analogy is learning to type (finger typing or soft typing). My friends and collegues at times express their awe, well I have trained some portion of my brain to instinctively use a qwerty keyboard, (my friends can do it, but they never cared, if only you saw their stupendously long combo movements on arcade games).&lt;br /&gt;&lt;br /&gt;My mom cooks great food. Serving several dishes working on them simultaneously is not a straight chore. I used to wonder how she did that. I observed that she planned ahead, cut her veggies and gathered her spices ahead. Even when the flame is up, she knew the order and quantity required; and accordingly &lt;quote&gt;batched&lt;/quote&gt; her job. All good cooks are great planners, the plans don't always work - but planning is indispensable. Last time I was deploying a project, I took a leaf from her and prepared a check list. After a couple of reviews, we use it pre deployment, to identify what all needs to be done. A thorough deployment without a need to revisit is a small achievement, but a happy one. I am not saying that the deployment worked because I can cook things; all I am saying is that I can appreciate a intangible task in a better way.&lt;br /&gt;&lt;br /&gt;All we need to do is keep an open mind to suggestions, and a realization that we are ignorant for the most part. Ignorance is a bliss, knowledge is power. I am happy that I have forgotten my calclus (Ignorance) but not my friends :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-4494654921371071143?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/4494654921371071143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=4494654921371071143' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4494654921371071143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4494654921371071143'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/01/learning-everywhere.html' title='Learning everywhere'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-4305061337399561672</id><published>2011-01-19T10:23:00.002+05:30</published><updated>2011-01-19T10:56:02.217+05:30</updated><title type='text'>Coder cannon</title><content type='html'>An article on &lt;a href="http://itmanagement.earthweb.com/entdev/article.php/11070_3921006_1/Should-Younger-Developers-be-Paid-More.htm"&gt;/.&lt;/a&gt; about new developers getting better monetary benefits than seniors made me ponder about IT. &lt;br /&gt;&lt;br /&gt;To give an example. In the world of stock market, if one were to estimate the worthiness of a stock/asset, it can be simply done by monitoring the topline growth for a given period. Another option would be find out the profitability of the company (Assets - Liabilities). However, one often finds stocks trading at a much higher price (indicated by P/E). This is very much like real-estate, where the price is driven not by the cost, but by the valuation.&lt;br /&gt;&lt;br /&gt;IT valuations are taken more personally -  to heart. It is expected that niche technologies deserve niche pays. For the most part, professional IT is about picking some data, transforming it and presenting it. Game devs and System programmers are prominent exceptions. I used to wonder why a SAP analyst makes more than a Java programmer, or a C++ programmer. &lt;br /&gt;&lt;br /&gt;Indian IT companies often take a different route. They just force the programmers on to a technology. The results of cold, passionless work are the ones that give a bad name. No university can teach passion. A good organisation and leader can instill a drive, but lack of passion causes one to burnout. Another surprising facet of IT: I recollect seeing a job posting in 2009, asking for GWT experts with 5+yrs of experience. Did the job poster even know when GWT came into existance? On one hand, you can see new technologies as an opportunity to move ahead in life, on the otherhand you may have a "dejavu" moment. Indian IT's cream are adept at catching up with the game, and the whey just sulks. &lt;br /&gt;&lt;br /&gt;Western IT is more passionate, they master the one prime thing they chose. I have consultants coming from far more diverse backgrounds into IT. While their IT skills are mediocre (beyond their comfort zone), the rich experience they bring is invalueable. Seniors are valueable, not because they have grown in age but because they can mentor and communicate better. New developers on the other hand can go anywhere. It is either a hit or miss scenario. &lt;br /&gt;&lt;br /&gt;If you want your seniors for their soft-skills, make it clear to them. If you want them for their technical skills, tell them clearly the direction being taken. Who knows, some of them may just take a break - learn the new stuff and may prove even more valueable. One harsh thing about large IT projects is the fact that, no one is indispensable. All seniors were once n00bs, they remember that well enough. If they are comfortable in their current roles and don't want to move out, you can always blame the demand-supply curve. We still have cobol &lt;strike&gt;dinosaur&lt;/strike&gt; dragon tamers around, don't we!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-4305061337399561672?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/4305061337399561672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=4305061337399561672' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4305061337399561672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4305061337399561672'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/01/coder-cannon.html' title='Coder cannon'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-4871711397888383288</id><published>2011-01-17T13:27:00.003+05:30</published><updated>2011-01-19T11:02:00.001+05:30</updated><title type='text'>JMX - Remote applications</title><content type='html'>Post jdk 5, JMX has become part of the standard distribution. The default MBeans provided, provide quite a good view of the VM characteristics. However, connecting to remote applications (running on different VM) is not a very straight forward task. The tricky part is the difficult to find documentation about the rmiserver and the URL format to be used for lookup. &lt;br /&gt;&lt;br /&gt;Sample JVM_ARGS:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;-Dcom.sun.management.jmxremote.port=&lt;em&gt;5000&lt;/em&gt; (put your own non-conflicting port)&lt;br /&gt;-Dcom.sun.management.jmxremote&lt;br /&gt;-Dcom.sun.management.jmxremote.authenticate=false&lt;br /&gt;-Dcom.sun.management.jmxremote.ssl=false&lt;br /&gt;-Djava.rmi.server.hostname=&lt;MY_HOST_IP&gt;&lt;br /&gt;&lt;br /&gt;which would look like&lt;br /&gt;-Djava.rmi.server.hostname=&lt;em&gt;144.203.88.87&lt;/em&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The actual call would look like: &lt;strong&gt;java $JVM_ARGS MY_APP&lt;/strong&gt;. This would invoke the JVM with an JMX Agent running on &lt;em&gt;5000&lt;/em&gt; port, on a remote server whose ip-address is &lt;em&gt;144.208.88.87&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Now open the jconsole application, invoke your application. Assuming that the application runs for a significant period of time (so that we can actually initiate the handshake and gather stats), enter the following in the &lt;strong&gt;Remote Process&lt;/strong&gt; field &lt;br /&gt;&lt;pre&gt;&lt;br /&gt;service:jmx:rmi://144.203.88.87:5000/jndi/rmi://144.203.88.87:5000/jmxrmi&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thats it! we are good to go.&lt;br /&gt;&lt;br /&gt;Some good pointers on interwebs:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://stackoverflow.com/questions/834581/remote-jmx-connection"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;a href="http://stackoverflow.com/questions/151238/has-anyone-ever-got-a-remote-jmx-jconsole-to-work"&gt;here&lt;/a&gt; and &lt;br /&gt;&lt;a href="http://download.oracle.com/javase/1.5.0/docs/guide/management/faq.html"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-4871711397888383288?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/4871711397888383288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=4871711397888383288' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4871711397888383288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4871711397888383288'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/01/jmx-remote-applications.html' title='JMX - Remote applications'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-5266446028324901266</id><published>2011-01-11T12:44:00.002+05:30</published><updated>2011-01-11T13:26:30.511+05:30</updated><title type='text'>About SqlLoader</title><content type='html'>SqlLoader is a utility provided by oracle, for loading data into database. This is analogous to db2export/import provided by db2. Most databases provide such utilities. Typical applications of such utilities: Migration of data (data only), creating a file based backup (as disk space is cheaper than the SAN disk space).&lt;br /&gt;&lt;br /&gt;There are two prominent types of sql loader functionality.&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Conventional loading&lt;br /&gt;&lt;li&gt;Direct path loading&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Conventional loading&lt;/h3&gt;&lt;br /&gt;Sample command:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; msg=`sqlldr $oracleuser/$oraclepasswd@$ORACLE_SID control=${controlFile} data=${csvFile} direct=false bad=${badFile} log=${logFile} errors=${errors} rows=100000`&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Conventional load acts as if someone is firing insert commands using oracle client. The indexes are preserved. Other users are not affected while the load happens.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Direct path loading&lt;/h3&gt;&lt;br /&gt;Sample command: (Note the &lt;span style="font-weight:bold;"&gt;direct=true&lt;/span&gt; part)&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; msg=`sqlldr $oracleuser/$oraclepasswd@$ORACLE_SID control=${controlFile} data=${csvFile} direct=true bad=${badFile} log=${logFile} errors=${errors} skip_index_maintenance=false `&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Sqlloader tries to write data directly into database, we can configure it to skip logging, bypass indices and write data directly. However this affects other users/transactions that are trying to read/write data to the same table.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Behind the scenes&lt;/h3&gt;&lt;br /&gt;Sql loader takes two major inputs. Control file, that dictates the nature of load. Data file that contains the data.&lt;br /&gt;Sample control file for direct path load:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;unrecoverable&lt;br /&gt;load data&lt;br /&gt; APPEND&lt;br /&gt;&lt;br /&gt; into table vendor_data.ds_sp_data&lt;br /&gt; REENABLE DISABLED_CONSTRAINTS&lt;br /&gt; fields terminated by "," optionally enclosed by '|'&lt;br /&gt; trailing nullcols&lt;br /&gt;(type_id FILLER, FEED_DATA_SOURCE FILLER, LINE_NUM, batch_id,  corp_actions_id, split_factor, ric CHAR(20) , record_type CHAR(2) , ds_type_id CHAR(8) , adjust_volume CHAR(1) , ds_file_date DATE "YYYY-MM-DD", split_date DATE "YYYY-MM-DD", file_code CHAR(4) , file_ext CHAR(1) , split_factor_val)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Sample control file for conventional load&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;OPTIONS (SKIP=1)&lt;br /&gt;load data&lt;br /&gt; APPEND&lt;br /&gt; into table vendor_data.feed_run_status_record_type&lt;br /&gt;REENABLE DISABLED_CONSTRAINTS&lt;br /&gt;fields terminated by "," optionally enclosed by '|'&lt;br /&gt;trailing nullcols&lt;br /&gt;(ETL_SEP FILLER,RUN_ID, TYPE_ID, REGION_CODE, FEED_ID, FILE_NAME CHAR(255), RECORD_TYPE, RECORD_COUNT, FAILURE_COUNT, INSERT_COUNT,  STATUS_CODE, EXCEPTION CHAR(3000))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Sample of data loaded by the above: &lt;br /&gt;(Using '------' as line separator of visual illustration only, it is not part of the data)&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;|21825|,|/u/datamgmt/TEST6/data/datascope/data//18251217.M|,|2|,|414146|,|SFE|,||,|1|,|21825|,|IRF|,|FUT|,|XSFE|,|M|,|NBBc1=|,|RY|,||,|NZ BANKBILL DEC9|,|2010-12-17|,|N|,|1825|,|0|&lt;br /&gt;--------&lt;br /&gt;|21825|,|/u/datamgmt/TEST6/data/datascope/data//18251217.M|,|3|,|414146|,|SFE|,||,|1|,|21825|,|IRF|,|FUT|,|XSFE|,|M|,|NBBc2=|,|RY|,||,|NZ BANKBILL MAR0|,|2010-12-17|,|N|,|1825|,|0|&lt;br /&gt;--------&lt;br /&gt;|21825|,|/u/datamgmt/TEST6/data/datascope/data//18251217.M|,|4|,|414146|,|SFE|,||,|1|,|21825|,|IRF|,|FUT|,|XSFE|,|M|,|NBBc3=|,|RY|,||,|NZ BANKBILL JUN0|,|2010-12-17|,|N|,|1825|,|0|&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;'unrecoverable' is supported only in direct path load&lt;br /&gt;&lt;li&gt;APPEND is faster than INSERT&lt;br /&gt;&lt;li&gt;FILLER columns are skipped&lt;br /&gt;&lt;li&gt;CHAR(x) fields help sqlldr load fields that exceed default varchar limit of 127&lt;br /&gt;&lt;li&gt;SKIP indicates the number of lines to skip&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;A good article on &lt;a href="http://www.dba-oracle.com/tips_sqlldr_loader.htm"&gt;SqlLoader &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-5266446028324901266?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/5266446028324901266/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=5266446028324901266' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/5266446028324901266'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/5266446028324901266'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/01/about-sqlloader.html' title='About SqlLoader'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-2798045509379115776</id><published>2011-01-11T12:30:00.003+05:30</published><updated>2011-01-11T12:44:12.470+05:30</updated><title type='text'>Extracting data using sql queries</title><content type='html'>I will just list down the commands that achieve this. The prerequisites for running these are to be managed by the users/admin.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;For Db2:&lt;/h3&gt;&lt;br /&gt;Do a sanity check&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;db3 "connect to $DB_SVR user $db2user using $db2passwd"&lt;br /&gt;connectionStatus=$?&lt;br /&gt; if [ $connectionStatus != 0 ]&lt;br /&gt; then&lt;br /&gt;            #sendmail or raise an alert&lt;br /&gt;        fi&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Run the command:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;fetchDataSql=" export to ${filePath}_data of del modified by coldel| ${query} "&lt;br /&gt; &lt;br /&gt; log "Extracting data using:: ${fetchDataSql}"&lt;br /&gt; db2 "${fetchDataSql}"&lt;br /&gt; extractionStatus=$?&lt;br /&gt; if [ $extractionStatus -eq 0 ] || [ $extractionStatus -eq 2 ]&lt;br /&gt; then&lt;br /&gt;  log "Preparing the output file"&lt;br /&gt;  echo ${title} &gt; ${filePath}&lt;br /&gt;  cat ${filePath}_data &gt;&gt; ${filePath}&lt;br /&gt;  rm -f ${filePath}_data &lt;br /&gt;  log "########################################################################################"&lt;br /&gt;  log "##  Data Extraction process completed successfully."&lt;br /&gt;  log "########################################################################################"     &lt;br /&gt; else&lt;br /&gt;  log "########################################################################################"&lt;br /&gt;  log "##   Alert!!Problems extracting data from ${tableName}, return status::$extractionStatus "&lt;br /&gt;  log "########################################################################################"&lt;br /&gt;  send_mail "Alert!!Problems extracting data from ${tableName}, return status::$extractionStatus" ${FAILURE}&lt;br /&gt;  terminate_db&lt;br /&gt;  exit 4   &lt;br /&gt; fi&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The terminate function just closes the db connection&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;function terminate_db {&lt;br /&gt; log "Close database connection"&lt;br /&gt; db2 "terminate"&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt; For Oracle:&lt;/h3&gt;&lt;br /&gt;Load the oracle client variables into the environment. Ask you admin for details.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#Loading the oracle client&lt;br /&gt;export ORACLE_BASE="/xyz/oracle/sqlnet/11.1.0/product/11.1.0/client_1"&lt;br /&gt;export ORACLE_HOME="$ORACLE_BASE"&lt;br /&gt;export PATH="$ORACLE_BASE/bin":"$ORACLE_BASE/perl/bin":"$ORACLE_BASE/sqldeveloper":$PATH&lt;br /&gt;export LD_LIBRARY_PATH="$ORACLE_BASE/lib":$LD_LIBRARY_PATH&lt;br /&gt;export PERL5LIB="$ORACLE_BASE/perl/lib/5.8.3":"$ORACLE_BASE/perl/lib/site_perl/5.8.3":$PERL5LIB&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Query for results&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;values=`sqlplus  -s ${oracleuser}/${oraclepasswd}@${ORCL_SVR} &lt;&lt; EOF&lt;br /&gt;   SET LINESIZE 1000&lt;br /&gt;   SET HEAD OFF&lt;br /&gt;   SET FEEDBACK OFF&lt;br /&gt;   ${query};&lt;br /&gt;   exit;&lt;br /&gt;   EOF`&lt;br /&gt;extractionStatus=$?&lt;br /&gt;if [ $extractionStatus -eq 0 ] || [ $extractionStatus -eq 2 ]&lt;br /&gt; then&lt;br /&gt;  log "########################################################################################"&lt;br /&gt;  log "##   Preparing the output file::${filePath}"&lt;br /&gt;  log "########################################################################################"&lt;br /&gt;  echo ${title} &gt; ${filePath}&lt;br /&gt;  echo ${values} &gt; ${filePath}_data.txt&lt;br /&gt;  sed 's/VDB_SEP/\n/g' &lt; ${filePath}_data.txt &gt;&gt;${filePath}&lt;br /&gt;  rm -f ${filePath}_data.txt&lt;br /&gt;                log "########################################################################################"&lt;br /&gt;  log "##   Data Extraction process completed successfully."&lt;br /&gt;  log "########################################################################################"     &lt;br /&gt; else&lt;br /&gt;  log "########################################################################################"&lt;br /&gt;  log "##   Alert!!Problems extracting data from ${tableName}, return status::$extractionStatus "&lt;br /&gt;  log "########################################################################################"&lt;br /&gt;  exit 4   &lt;br /&gt;fi&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-2798045509379115776?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/2798045509379115776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=2798045509379115776' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/2798045509379115776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/2798045509379115776'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/01/extracting-data-using-sql-queries.html' title='Extracting data using sql queries'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-3473492113689533635</id><published>2011-01-11T11:52:00.003+05:30</published><updated>2011-01-11T12:02:41.219+05:30</updated><title type='text'>Paginated fetch queries</title><content type='html'>Without much fuss, &lt;h3&gt;For DB2:&lt;/h3&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;select * from &lt;br /&gt;    ( &lt;br /&gt;        select ROW_NUMBER() OVER () rowNum, t1.* from @tableName@ t1 &lt;br /&gt;        where blah.. blah..        &lt;br /&gt;    ) &lt;br /&gt;    as t00, &lt;br /&gt;    ( &lt;br /&gt;        select count(COL_1) as totalPageRecordCount from @tableName@ t2 &lt;br /&gt;        where blah.. blah..&lt;br /&gt;    ) &lt;br /&gt;    as t01 &lt;br /&gt;where rowNum between @start@ and @end@&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;For Oracle:&lt;/h3&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;select min_t.*, count_t.* from &lt;br /&gt;    ( &lt;br /&gt;        select rownum as row_num, max_t.* from &lt;br /&gt;            ( &lt;br /&gt;                select t1.* &lt;br /&gt;                from @data_tablename@ t1&lt;br /&gt;                where blah.. blah..&lt;br /&gt;                order by t1.rowid -- order by rowid for consistent results&lt;br /&gt;            ) max_t &lt;br /&gt;        where  &lt;br /&gt;           rownum &lt;= @end@ &lt;br /&gt;    ) min_t, &lt;br /&gt;    ( &lt;br /&gt;        select count(*) as totalPageRecordCount &lt;br /&gt;        from @data_tablename@ t1&lt;br /&gt;        where blah.. blah..&lt;br /&gt;    ) count_t &lt;br /&gt;where &lt;br /&gt;    row_num &gt;= @start@&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note that ordering by row_id ensures consistent data fetch results.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-3473492113689533635?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/3473492113689533635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=3473492113689533635' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3473492113689533635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3473492113689533635'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2011/01/paginated-fetch-queries.html' title='Paginated fetch queries'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-6308766041733989792</id><published>2010-12-20T11:09:00.002+05:30</published><updated>2010-12-20T11:44:15.098+05:30</updated><title type='text'>Importance of layout design in GXT/Sencha</title><content type='html'>Views tend to be dynamic. That is what web2.0 is all about! However we tend to run into murky waters, especially when the requirements tend to be even more dynamic. Since the past couple of months I have been working on a codebase with a set of requirements that tend to fall into 'feature creep' territory. As any other developer, handling the people aspect itself is a challenge. One would definitely strive to keep the technical challenges to a minimum.&lt;br /&gt;&lt;br /&gt;AJAX UI's have an implicit uncertainity overhead. In the case of GXT it is inability of the framework to re-render a component. The conversation thread goes like this:&lt;br /&gt;them: I need a table to show contents, with pagination support&lt;br /&gt;me: OK!&lt;br /&gt;.&lt;br /&gt;. couple of weeks later...&lt;br /&gt;.&lt;br /&gt;them: Can I have client side filter, you know what i kind of feel lost in the haystack&lt;br /&gt;me: Ok!&lt;br /&gt;.&lt;br /&gt;. couple of weeks later...&lt;br /&gt;.&lt;br /&gt;them: That was great, every thing is fantasitc. I was wondering if the filtering can can happen on serverside as well&lt;br /&gt;me: ?!! Ok, lets try. Hey done&lt;br /&gt;.&lt;br /&gt;. couple of weeks later...&lt;br /&gt;.&lt;br /&gt;them: Can I have edit feature?&lt;br /&gt;me: Sigh! ok.&lt;br /&gt;.&lt;br /&gt;. couple of weeks later...&lt;br /&gt;.&lt;br /&gt;them: Now see, I want a notification to popup if there are any unsave changes&lt;br /&gt;me: (What do I do? Where should I incorporate the trigger point? What happens if the user does something else? Should I go with the ugly popup dialogs.Grrr..)  Ok&lt;br /&gt;&lt;br /&gt;Wait, GXT why don't you support dynamic modifications to rendered components! &lt;h3&gt;Road block&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;Now to address this in a sane fashion, I have to design my panels with the highest possible widgets and hide them, only to reenable them later. Like most UI developers I feel frustrated as the code base of the last 6 months tends to look like a ragshack. Rewritting it is easy (3-4 days) but why is the world so cruel :(&lt;br /&gt;&lt;br /&gt;Over the weekend I wrote the most crucial components, adding sanity and fresh breath of life to myself and people down the line. I know that the challenge is not yet over. Atleast I am wise enought to understand the technical challenges involved. Blessed are thou, whose get a standardised requirement specification. End of my rant&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-6308766041733989792?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/6308766041733989792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=6308766041733989792' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6308766041733989792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6308766041733989792'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2010/12/importance-of-layout-design-in.html' title='Importance of layout design in GXT/Sencha'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-1394602822904984966</id><published>2010-05-20T19:05:00.003+05:30</published><updated>2010-05-20T19:11:56.925+05:30</updated><title type='text'>GWT: Illustrating usage of previous components</title><content type='html'>Let the code do the talking.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Scenario: Using a listener&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;RenderGrid is a class responsible for drawing tables when some event strikes&lt;br /&gt;&lt;br /&gt;&lt;table bgcolor="#dddddd" border="1" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;&lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;class&lt;/font&gt; RenderGrid {&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; MessageSender sender = &lt;font color="blue"&gt;new&lt;/font&gt; MessageSender();&lt;br /&gt;  &lt;br /&gt;  @SuppressWarnings(&amp;quot;unused&amp;quot;)&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; MessageListener&amp;lt;RenderGrid&amp;gt; listener = &lt;font color="blue"&gt;new&lt;/font&gt; MessageListener&amp;lt;RenderGrid&amp;gt;(&lt;font color="blue"&gt;this&lt;/font&gt;){    &lt;br /&gt;    @SuppressWarnings(&amp;quot;unchecked&amp;quot;)&lt;br /&gt;    @Override&lt;br /&gt;    &lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;void&lt;/font&gt; messageRecieved(MessageEvent event) {&lt;br /&gt;      &lt;font color="blue"&gt;if&lt;/font&gt;(event.getEventType().equals(IEventConstants.TABLE_MODEL_FETCH_EVENT)){&lt;br /&gt;        /*&lt;br /&gt;        some super foo bar&lt;br /&gt;        */&lt;br /&gt;        sender.fireEvent(&lt;font color="blue"&gt;new&lt;/font&gt; MessageEvent(IEventConstants.UNMASK_APP_EVENT));&lt;br /&gt;      }&lt;br /&gt;      &lt;font color="blue"&gt;else&lt;/font&gt; &lt;font color="blue"&gt;if&lt;/font&gt;(event.getEventType().equals(IEventConstants.MULTI_TABLE_FETCH_EVENT)){&lt;br /&gt;        MultiViewModel multiViewModel = (MultiViewModel) event.getNewValue();&lt;br /&gt;        tableHelper.renderGrid(multiViewModel);&lt;br /&gt;      }&lt;br /&gt;      &lt;font color="blue"&gt;else&lt;/font&gt; &lt;font color="blue"&gt;if&lt;/font&gt;(event.getEventType().equals(IEventConstants.CATEGORY_FETCH_EVENT)){&lt;br /&gt;        /* &lt;br /&gt;        more foo bar&lt;br /&gt;        */&lt;br /&gt;      }&lt;br /&gt;            &lt;br /&gt;    }    &lt;br /&gt;  };&lt;br /&gt;      &lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; TabPanel tabPanel = &lt;font color="blue"&gt;null&lt;/font&gt;;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; TableHelper tableHelper = &lt;font color="blue"&gt;null&lt;/font&gt;;&lt;br /&gt;  &lt;br /&gt;  RenderGrid(TabPanel tabPanel){&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.tabPanel = tabPanel;&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.tabPanel.setResizeTabs(&lt;font color="blue"&gt;false&lt;/font&gt;);  &lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.tabPanel.setAnimScroll(&lt;font color="blue"&gt;true&lt;/font&gt;);  &lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.tabPanel.setTabScroll(&lt;font color="blue"&gt;true&lt;/font&gt;);  &lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.tabPanel.setCloseContextMenu(&lt;font color="blue"&gt;true&lt;/font&gt;);&lt;br /&gt;    tableHelper = &lt;font color="blue"&gt;new&lt;/font&gt; TableHelper(tabPanel);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Scenario: Using a sender&lt;/h3&gt;&lt;br /&gt;SubmitButtonListener listens to form button, and then creates a transfer-object from the form contents and passes its as an event on to the message bus&lt;br /&gt;&lt;table bgcolor="#dddddd" border="1" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;@SuppressWarnings(&amp;quot;unchecked&amp;quot;)&lt;br /&gt;&lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;class&lt;/font&gt; SubmitButtonListener extends SelectionListener {&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; FormPanel formPanel = &lt;font color="blue"&gt;null&lt;/font&gt;;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; MessageSender sender = &lt;font color="blue"&gt;new&lt;/font&gt; MessageSender();&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; SubmitButtonListener(FormPanel formPanel) {&lt;br /&gt;    String formHeader = formPanel.getHeading();&lt;br /&gt;    &lt;font color="blue"&gt;if&lt;/font&gt;(formHeader == &lt;font color="blue"&gt;null&lt;/font&gt; || formHeader.trim().isEmpty()){&lt;br /&gt;      throw &lt;font color="blue"&gt;new&lt;/font&gt; RuntimeException(&amp;quot;Form needs to have a header, contract violation &lt;font color="blue"&gt;in&lt;/font&gt; &amp;quot;+&lt;font color="blue"&gt;this&lt;/font&gt;);&lt;br /&gt;    }&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.formPanel = formPanel;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  @Override&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;void&lt;/font&gt; componentSelected(ComponentEvent ce) {&lt;br /&gt;    String formHeader = formPanel.getHeading();    &lt;br /&gt;    FormBean bean = FormBeanFactory.createFormBean(formPanel);        &lt;br /&gt;    sender.fireEvent(&lt;font color="blue"&gt;new&lt;/font&gt; MessageEvent(formHeader,&lt;font color="blue"&gt;null&lt;/font&gt;,bean));        &lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-1394602822904984966?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/1394602822904984966/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=1394602822904984966' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1394602822904984966'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1394602822904984966'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2010/05/gwt-illustrating-usage-of-previous.html' title='GWT: Illustrating usage of previous components'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-741440045207808325</id><published>2010-05-20T18:32:00.004+05:30</published><updated>2010-05-20T18:55:25.783+05:30</updated><title type='text'>GWT-GXT Building message-event framework/bus</title><content type='html'>I decided to go with the simplest event model, based on message broad-cast. The fundamental principle is to have a central universal listener and receiver, all interested parties would hang-around this guy.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;                      |--------|&lt;br /&gt;                      |        |&lt;br /&gt;Sender1 -------\      |        |      |------ Listener 1&lt;br /&gt;Sender2 --------\-----| Event- |------|------ Listener 2&lt;br /&gt;Sender3 --------/-----| Bus    |------|------ Listener 3&lt;br /&gt;Sender4 -------/      |        |      |------ Listener 4&lt;br /&gt;                      |        |&lt;br /&gt;                      |--------|&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h3&gt; Sender &lt;/h3&gt;&lt;br /&gt;&lt;table bgcolor="#dddddd" border="1" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;package org.myxyz.listeners;&lt;br /&gt;&lt;br /&gt;&lt;font color="green"&gt;//import com.google.gwt.event.shared.HandlerManager;&lt;/font&gt;&lt;br /&gt;&lt;font color="green"&gt;//import com.google.gwt.event.shared.HandlerRegistration;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;import org.myxyz.custom.X10HandlerManager;&lt;br /&gt;import org.myxyz.custom.X10HandlerRegistration;&lt;br /&gt;&lt;br /&gt;&lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;class&lt;/font&gt; MessageSender{&lt;br /&gt;      &lt;br /&gt;  /**&lt;br /&gt;   * &lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; &lt;font color="blue"&gt;static&lt;/font&gt; final long serialVersionUID = -382336739840212254L;&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; MessageExchange exchange = MessageExchange.getMessageExchange();&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; X10HandlerManager sender = &lt;font color="blue"&gt;null&lt;/font&gt;;&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; MessageSender() {    &lt;br /&gt;    sender = &lt;font color="blue"&gt;new&lt;/font&gt; X10HandlerManager(&lt;font color="blue"&gt;this&lt;/font&gt;);    &lt;br /&gt;    X10HandlerRegistration handlerRegistration = sender.addHandler(MessageEvent.getType(), exchange);&lt;br /&gt;    exchange.registerSender(&lt;font color="blue"&gt;this&lt;/font&gt;, handlerRegistration);&lt;br /&gt;  }      &lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Fire an event.&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;void&lt;/font&gt; fireEvent(MessageEvent event) {&lt;br /&gt;    sender.fireEvent(event);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt; MessageListener &lt;/h3&gt;&lt;br /&gt;&lt;table bgcolor="#dddddd" border="1" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;package org.myxyz.listeners;&lt;br /&gt;&lt;br /&gt;import com.google.gwt.event.shared.EventHandler;&lt;br /&gt;&lt;br /&gt;&lt;font color="blue"&gt;public&lt;/font&gt; abstract &lt;font color="blue"&gt;class&lt;/font&gt; MessageListener&amp;lt;T&amp;gt; implements EventHandler{  &lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; MessageExchange exchange = MessageExchange.getMessageExchange();  &lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; T source = &lt;font color="blue"&gt;null&lt;/font&gt;;&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; MessageListener(){&lt;br /&gt;    &lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; MessageListener(T source){&lt;br /&gt;    exchange.addHandler(&lt;font color="blue"&gt;this&lt;/font&gt;);  &lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.source = source;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; T getSource(){&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; source;&lt;br /&gt;  }&lt;br /&gt;    &lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; abstract &lt;font color="blue"&gt;void&lt;/font&gt; messageRecieved(MessageEvent pEvent);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt; MessageEvent &lt;/h3&gt;&lt;br /&gt;&lt;table bgcolor="#dddddd" border="1" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;package org.myxyz.listeners;&lt;br /&gt;&lt;br /&gt;import org.myxyz.custom.X10GwtEvent;&lt;br /&gt;&lt;br /&gt;&lt;font color="green"&gt;//import com.google.gwt.event.shared.GwtEvent;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;@SuppressWarnings(&amp;quot;unchecked&amp;quot;)&lt;br /&gt;&lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;class&lt;/font&gt; MessageEvent extends X10GwtEvent&amp;lt;MessageListener&amp;gt; {&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; &lt;font color="blue"&gt;static&lt;/font&gt; final X10GwtEvent.Type&amp;lt;MessageListener&amp;gt; TYPE = &lt;font color="blue"&gt;new&lt;/font&gt; X10GwtEvent.Type&amp;lt;MessageListener&amp;gt;();&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; String eventType = &lt;font color="blue"&gt;null&lt;/font&gt;;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; Object newValue = &lt;font color="blue"&gt;null&lt;/font&gt;;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; Object oldValue = &lt;font color="blue"&gt;null&lt;/font&gt;;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; Object source = &lt;font color="blue"&gt;null&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;static&lt;/font&gt; Type&amp;lt;MessageListener&amp;gt; getType() {&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; TYPE;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; MessageEvent(String eventType) {&lt;br /&gt;    super();&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.eventType = eventType;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; MessageEvent(String eventType, Object oldValue, Object newValue) {&lt;br /&gt;    super();&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.eventType = eventType;&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.oldValue = oldValue;&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.newValue = newValue;&lt;br /&gt;  }&lt;br /&gt;    &lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; MessageEvent(String eventType, Object oldValue, Object newValue, Object source) {&lt;br /&gt;    super();&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.eventType = eventType;&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.oldValue = oldValue;&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.newValue = newValue;&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.source = source;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  @Override&lt;br /&gt;  &lt;font color="blue"&gt;protected&lt;/font&gt; &lt;font color="blue"&gt;void&lt;/font&gt; dispatch(MessageListener handler) {&lt;br /&gt;    handler.messageRecieved(&lt;font color="blue"&gt;this&lt;/font&gt;);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  @Override&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; Type&amp;lt;MessageListener&amp;gt; getAssociatedType() {&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; TYPE;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; String getEventType() {&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; eventType;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; Object getNewValue() {&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; newValue;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; Object getOldValue() {&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; oldValue;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; Object getSource() {&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; source;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt; MessageExchange &lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;table bgcolor="#dddddd" border="1" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;package org.myxyz.listeners;&lt;br /&gt;&lt;br /&gt;import java.util.HashMap;&lt;br /&gt;import java.util.Iterator;&lt;br /&gt;&lt;br /&gt;import com.google.gwt.event.shared.EventHandler;&lt;br /&gt;import org.myxyz.custom.X10HandlerManager;&lt;br /&gt;import org.myxyz.custom.X10HandlerRegistration;&lt;br /&gt;&lt;br /&gt;@SuppressWarnings(&amp;quot;unchecked&amp;quot;)&lt;br /&gt;&lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;class&lt;/font&gt; MessageExchange extends MessageListener {&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * &lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; &lt;font color="blue"&gt;static&lt;/font&gt; final long serialVersionUID = 1623583201346713682L;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; &lt;font color="blue"&gt;static&lt;/font&gt; final MessageExchange singleton = &lt;font color="blue"&gt;new&lt;/font&gt; MessageExchange();&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; X10HandlerManager dispatcher = &lt;font color="blue"&gt;new&lt;/font&gt; X10HandlerManager(&lt;font color="blue"&gt;this&lt;/font&gt;);&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; HashMap&amp;lt;MessageSender,X10HandlerRegistration&amp;gt; registeredSenders = &lt;font color="blue"&gt;new&lt;/font&gt; HashMap&amp;lt;MessageSender,X10HandlerRegistration&amp;gt;(10);&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; HashMap&amp;lt;MessageListener,X10HandlerRegistration&amp;gt; registeredListeners = &lt;font color="blue"&gt;new&lt;/font&gt; HashMap&amp;lt;MessageListener,X10HandlerRegistration&amp;gt;(10);&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;static&lt;/font&gt; MessageExchange getMessageExchange(){&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; singleton;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; MessageExchange() {    &lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;void&lt;/font&gt; messageRecieved(MessageEvent pEvent) {&lt;br /&gt;    dispatcher.fireEvent(pEvent);&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; synchronized &amp;lt;H extends EventHandler&amp;gt; X10HandlerRegistration addHandler(MessageListener handler) {&lt;br /&gt;    X10HandlerRegistration handlerRegistration = registeredListeners.&lt;font color="blue"&gt;get&lt;/font&gt;(handler);&lt;br /&gt;    &lt;font color="blue"&gt;if&lt;/font&gt;(handlerRegistration == &lt;font color="blue"&gt;null&lt;/font&gt;) {&lt;br /&gt;      handlerRegistration = dispatcher.addHandler(MessageEvent.getType(), handler);&lt;br /&gt;      registeredListeners.put(handler, handlerRegistration);&lt;br /&gt;    }&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; handlerRegistration;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;int&lt;/font&gt; getHandlerCount() {&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; dispatcher.getHandlerCount(MessageEvent.getType());&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; synchronized &amp;lt;H extends EventHandler&amp;gt; &lt;font color="blue"&gt;void&lt;/font&gt; removeHandler(MessageListener handler) {&lt;br /&gt;    &lt;font color="blue"&gt;if&lt;/font&gt;(registeredListeners.&lt;font color="blue"&gt;get&lt;/font&gt;(handler) != &lt;font color="blue"&gt;null&lt;/font&gt;){&lt;br /&gt;      registeredListeners.&lt;font color="blue"&gt;get&lt;/font&gt;(handler).removeHandler();&lt;br /&gt;      registeredListeners.remove(handler);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; synchronized &lt;font color="blue"&gt;void&lt;/font&gt; registerSender(MessageSender sender, X10HandlerRegistration handlerRegistration){    &lt;br /&gt;    &lt;font color="blue"&gt;if&lt;/font&gt;(handlerRegistration != &lt;font color="blue"&gt;null&lt;/font&gt;) {&lt;br /&gt;      registeredSenders.put(sender, handlerRegistration);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; synchronized &lt;font color="blue"&gt;void&lt;/font&gt; unRegisterSender(MessageSender sender){  &lt;br /&gt;    X10HandlerRegistration handlerRegistration = registeredSenders.&lt;font color="blue"&gt;get&lt;/font&gt;(sender);&lt;br /&gt;    &lt;font color="blue"&gt;if&lt;/font&gt;(handlerRegistration != &lt;font color="blue"&gt;null&lt;/font&gt;) {&lt;br /&gt;      handlerRegistration.removeHandler();&lt;br /&gt;      registeredSenders.remove(sender);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  @Override&lt;br /&gt;  &lt;font color="blue"&gt;protected&lt;/font&gt; &lt;font color="blue"&gt;void&lt;/font&gt; finalize() throws Throwable {&lt;br /&gt;    &lt;font color="blue"&gt;for&lt;/font&gt; (Iterator&amp;lt;X10HandlerRegistration&amp;gt; iterator = registeredListeners.values().iterator(); iterator.hasNext();) {&lt;br /&gt;      X10HandlerRegistration handlerRegistration = iterator.next();&lt;br /&gt;      handlerRegistration.removeHandler();&lt;br /&gt;    }    &lt;br /&gt;    &lt;font color="blue"&gt;for&lt;/font&gt; (Iterator&amp;lt;X10HandlerRegistration&amp;gt; iterator = registeredSenders.values().iterator(); iterator.hasNext();) {&lt;br /&gt;      X10HandlerRegistration handlerRegistration = iterator.next();&lt;br /&gt;      handlerRegistration.removeHandler();&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-741440045207808325?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/741440045207808325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=741440045207808325' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/741440045207808325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/741440045207808325'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2010/05/gwt-gxt-building-message-event.html' title='GWT-GXT Building message-event framework/bus'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-6210633368208776795</id><published>2010-05-20T18:11:00.004+05:30</published><updated>2010-05-20T19:00:16.232+05:30</updated><title type='text'>GXT-GWT fixing the transmission</title><content type='html'>&lt;h3&gt; Why reinvent the wheel &lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;Simply said, the wheel is ok, the transmission is bad; the chassis is not strong enough. So I am starting with it! Sorry for the uber-sized post. The following three files are actually provided by GWT framework and I had to extend them to fix one issue with the code. I have created a custom package, which contains these files. My event-driven framework is centered around this building block.&lt;br /&gt;&lt;br /&gt;Finally, this code is governed by apache licence. (Not me, Google says so). Please respect it, even though it is no rocket science  ;)&lt;br /&gt;&lt;br /&gt;&lt;h4&gt; Customized code from GWT HandlerManager &lt;/h4&gt;&lt;br /&gt;&lt;table bgcolor="#dddddd" border="1" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;@SuppressWarnings(&amp;quot;unchecked&amp;quot;)&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; &amp;lt;H extends EventHandler&amp;gt; List&amp;lt;H&amp;gt; handleQueuedAddsAndRemoves() {&lt;br /&gt;    List&amp;lt;H&amp;gt; handlers = &lt;font color="blue"&gt;new&lt;/font&gt; ArrayList&amp;lt;H&amp;gt;(10);&lt;br /&gt;    &lt;font color="blue"&gt;if&lt;/font&gt; (deferredDeltas != &lt;font color="blue"&gt;null&lt;/font&gt;) {&lt;br /&gt;      &lt;font color="blue"&gt;try&lt;/font&gt; {&lt;br /&gt;        &lt;font color="blue"&gt;for&lt;/font&gt; (AddOrRemoveCommand c : deferredDeltas) {&lt;br /&gt;          EventHandler newHander = c.execute();&lt;br /&gt;          &lt;font color="red" size="4"&gt;/*Here was a problem, that exists no more*/&lt;/font&gt;&lt;br /&gt;          &lt;font color="blue"&gt;if&lt;/font&gt;(newHander != &lt;font color="blue"&gt;null&lt;/font&gt;){  &lt;br /&gt;            handlers.add((H) newHander);&lt;br /&gt;          }&lt;br /&gt;        }&lt;br /&gt;      } finally {&lt;br /&gt;        deferredDeltas = &lt;font color="blue"&gt;null&lt;/font&gt;;&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; handlers;&lt;br /&gt;  }&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt; The complete set of modified files &lt;/h3&gt;&lt;br /&gt;&lt;h4&gt;Extended HandlerManager :: X10HandlerManager&lt;/h4&gt;&lt;br /&gt;&lt;table bgcolor="#dddddd" border="1" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;/*&lt;br /&gt; * This is customized version of HandlerManager provided by google. The purpose of &lt;font color="blue"&gt;this&lt;/font&gt;&lt;br /&gt; * extension is to enable user triggered events to bypass ISSUE 101&lt;br /&gt; * &lt;br /&gt; * Fixed ISSUE 101: To support event handling when event handlers are added as part of event processing&lt;br /&gt; * &lt;br /&gt; * Licensed under the Apache License, Version 2.0 (the &amp;quot;License&amp;quot;); you may not&lt;br /&gt; * use &lt;font color="blue"&gt;this&lt;/font&gt; file except &lt;font color="blue"&gt;in&lt;/font&gt; compliance with the License. You may obtain a copy of&lt;br /&gt; * the License at&lt;br /&gt; * &lt;br /&gt; * http:&lt;font color="green"&gt;//www.apache.org/licenses/LICENSE-2.0&lt;/font&gt;&lt;br /&gt; * &lt;br /&gt; * Unless required by applicable law or agreed to &lt;font color="blue"&gt;in&lt;/font&gt; writing, software&lt;br /&gt; * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS, WITHOUT&lt;br /&gt; * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the&lt;br /&gt; * License &lt;font color="blue"&gt;for&lt;/font&gt; the specific language governing permissions and limitations under&lt;br /&gt; * the License.&lt;br /&gt; */&lt;br /&gt;package org.myxyz.custom;&lt;br /&gt;&lt;br /&gt;import java.util.ArrayList;&lt;br /&gt;import java.util.HashMap;&lt;br /&gt;import java.util.List;&lt;br /&gt;import java.util.Map;&lt;br /&gt;&lt;br /&gt;import com.google.gwt.event.shared.EventHandler;&lt;br /&gt;import com.google.gwt.event.shared.HandlerRegistration;&lt;br /&gt;import org.myxyz.custom.X10GwtEvent.Type;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Manager responsible &lt;font color="blue"&gt;for&lt;/font&gt; adding handlers to event sources and firing those&lt;br /&gt; * handlers on passed &lt;font color="blue"&gt;in&lt;/font&gt; events.&lt;br /&gt; */&lt;br /&gt;&lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;class&lt;/font&gt; X10HandlerManager {&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;static&lt;/font&gt; &lt;font color="blue"&gt;int&lt;/font&gt; CONFIGURED_DEPTH = 5;&lt;br /&gt;  /**&lt;br /&gt;   * Interface &lt;font color="blue"&gt;for&lt;/font&gt; queued add/remove operations.&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; interface AddOrRemoveCommand {&lt;br /&gt;    /*ISSUE 101*/&lt;br /&gt;    &lt;font color="blue"&gt;public&lt;/font&gt; EventHandler execute();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Inner &lt;font color="blue"&gt;class&lt;/font&gt; used to actually contain the handlers.&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; &lt;font color="blue"&gt;static&lt;/font&gt; &lt;font color="blue"&gt;class&lt;/font&gt; HandlerRegistry {&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; final HashMap&amp;lt;X10GwtEvent.Type&amp;lt;?&amp;gt;, ArrayList&amp;lt;?&amp;gt;&amp;gt; map = &lt;font color="blue"&gt;new&lt;/font&gt; HashMap&amp;lt;X10GwtEvent.Type&amp;lt;?&amp;gt;, ArrayList&amp;lt;?&amp;gt;&amp;gt;();&lt;br /&gt;&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; &amp;lt;H extends EventHandler&amp;gt; &lt;font color="blue"&gt;void&lt;/font&gt; addHandler(Type&amp;lt;H&amp;gt; type, H handler) {&lt;br /&gt;      ArrayList&amp;lt;H&amp;gt; l = &lt;font color="blue"&gt;get&lt;/font&gt;(type);&lt;br /&gt;      &lt;font color="blue"&gt;if&lt;/font&gt; (l == &lt;font color="blue"&gt;null&lt;/font&gt;) {&lt;br /&gt;        l = &lt;font color="blue"&gt;new&lt;/font&gt; ArrayList&amp;lt;H&amp;gt;();&lt;br /&gt;        map.put(type, l);&lt;br /&gt;      }&lt;br /&gt;      l.add(handler);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; &amp;lt;H extends EventHandler&amp;gt; &lt;font color="blue"&gt;void&lt;/font&gt; fireEvent(X10GwtEvent&amp;lt;H&amp;gt; event, boolean isReverseOrder) {&lt;br /&gt;      Type&amp;lt;H&amp;gt; type = event.getAssociatedType();&lt;br /&gt;      &lt;font color="blue"&gt;int&lt;/font&gt; count = getHandlerCount(type);&lt;br /&gt;      &lt;font color="blue"&gt;if&lt;/font&gt; (isReverseOrder) {&lt;br /&gt;        &lt;font color="blue"&gt;for&lt;/font&gt; (&lt;font color="blue"&gt;int&lt;/font&gt; i = count - 1; i &amp;gt;= 0; i--) {&lt;br /&gt;          H handler = &lt;font color="blue"&gt;this&lt;/font&gt;.&amp;lt;H&amp;gt; getHandler(type, i);&lt;br /&gt;          event.dispatch(handler);&lt;br /&gt;        }&lt;br /&gt;      } &lt;font color="blue"&gt;else&lt;/font&gt; {&lt;br /&gt;        &lt;font color="blue"&gt;for&lt;/font&gt; (&lt;font color="blue"&gt;int&lt;/font&gt; i = 0; i &amp;lt; count; i++) {&lt;br /&gt;          H handler = &lt;font color="blue"&gt;this&lt;/font&gt;.&amp;lt;H&amp;gt; getHandler(type, i);&lt;br /&gt;          event.dispatch(handler);&lt;br /&gt;        }&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    /* ISSUE 101 */&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; &amp;lt;T extends EventHandler&amp;gt; &lt;font color="blue"&gt;void&lt;/font&gt; fireForSkippedHandler(X10GwtEvent&amp;lt;T&amp;gt; event, boolean isReverseOrder, List&amp;lt;T&amp;gt; handlers) {&lt;br /&gt;            &lt;br /&gt;      &lt;font color="blue"&gt;int&lt;/font&gt; count = handlers.size();&lt;br /&gt;      &lt;font color="blue"&gt;if&lt;/font&gt; (isReverseOrder) {&lt;br /&gt;        &lt;font color="blue"&gt;for&lt;/font&gt; (&lt;font color="blue"&gt;int&lt;/font&gt; i = count - 1; i &amp;gt;= 0; i--) {&lt;br /&gt;          T handler =  handlers.&lt;font color="blue"&gt;get&lt;/font&gt;(i);&lt;br /&gt;          event.dispatch(handler);&lt;br /&gt;        }&lt;br /&gt;      } &lt;font color="blue"&gt;else&lt;/font&gt; {&lt;br /&gt;        &lt;font color="blue"&gt;for&lt;/font&gt; (&lt;font color="blue"&gt;int&lt;/font&gt; i = 0; i &amp;lt; count; i++) {&lt;br /&gt;          T handler = handlers.&lt;font color="blue"&gt;get&lt;/font&gt;(i);&lt;br /&gt;          event.dispatch(handler);&lt;br /&gt;        }&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    @SuppressWarnings(&amp;quot;unchecked&amp;quot;)&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; &amp;lt;H&amp;gt; ArrayList&amp;lt;H&amp;gt; &lt;font color="blue"&gt;get&lt;/font&gt;(X10GwtEvent.Type&amp;lt;H&amp;gt; type) {&lt;br /&gt;      &lt;font color="green"&gt;// This cast is safe because we control the puts.&lt;/font&gt;&lt;br /&gt;      &lt;font color="blue"&gt;return&lt;/font&gt; (ArrayList&amp;lt;H&amp;gt;) map.&lt;font color="blue"&gt;get&lt;/font&gt;(type);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; &amp;lt;H extends EventHandler&amp;gt; H getHandler(X10GwtEvent.Type&amp;lt;H&amp;gt; eventKey, &lt;font color="blue"&gt;int&lt;/font&gt; index) {&lt;br /&gt;      ArrayList&amp;lt;H&amp;gt; l = &lt;font color="blue"&gt;get&lt;/font&gt;(eventKey);&lt;br /&gt;      &lt;font color="blue"&gt;return&lt;/font&gt; l.&lt;font color="blue"&gt;get&lt;/font&gt;(index);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; &lt;font color="blue"&gt;int&lt;/font&gt; getHandlerCount(X10GwtEvent.Type&amp;lt;?&amp;gt; eventKey) {&lt;br /&gt;      ArrayList&amp;lt;?&amp;gt; l = map.&lt;font color="blue"&gt;get&lt;/font&gt;(eventKey);&lt;br /&gt;      &lt;font color="blue"&gt;return&lt;/font&gt; l == &lt;font color="blue"&gt;null&lt;/font&gt; ? 0 : l.size();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; boolean isEventHandled(X10GwtEvent.Type&amp;lt;?&amp;gt; eventKey) {&lt;br /&gt;      &lt;font color="blue"&gt;return&lt;/font&gt; map.containsKey(eventKey);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; &amp;lt;H&amp;gt; &lt;font color="blue"&gt;void&lt;/font&gt; removeHandler(X10GwtEvent.Type&amp;lt;H&amp;gt; eventKey, H handler) {&lt;br /&gt;      ArrayList&amp;lt;H&amp;gt; l = &lt;font color="blue"&gt;get&lt;/font&gt;(eventKey);&lt;br /&gt;      boolean result = l.remove(handler);&lt;br /&gt;      &lt;font color="blue"&gt;if&lt;/font&gt; (l.size() == 0) {&lt;br /&gt;        map.remove(eventKey);&lt;br /&gt;      }&lt;br /&gt;      assert result : &amp;quot;Tried to remove unknown handler: &amp;quot; + handler + &amp;quot; from &amp;quot; + eventKey;&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; &lt;font color="blue"&gt;int&lt;/font&gt; firingDepth = 0;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; boolean isReverseOrder;&lt;br /&gt;&lt;br /&gt;  &lt;font color="green"&gt;// map storing the actual handlers&lt;/font&gt;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; HandlerRegistry registry;&lt;br /&gt;&lt;br /&gt;  &lt;font color="green"&gt;// source of the event.&lt;/font&gt;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; final Object source;&lt;br /&gt;&lt;br /&gt;  &lt;font color="green"&gt;// Add and remove operations received during dispatch.&lt;/font&gt;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; List&amp;lt;AddOrRemoveCommand&amp;gt; deferredDeltas;&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Creates a handler manager with the given source. Handlers will be fired&lt;br /&gt;   * &lt;font color="blue"&gt;in&lt;/font&gt; the order that they are added.&lt;br /&gt;   * &lt;br /&gt;   * @param source&lt;br /&gt;   *            the event source&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; X10HandlerManager(Object source) {&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;(source, &lt;font color="blue"&gt;false&lt;/font&gt;);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Creates a handler manager with the given source, specifying the order &lt;font color="blue"&gt;in&lt;/font&gt;&lt;br /&gt;   * which handlers are fired.&lt;br /&gt;   * &lt;br /&gt;   * @param source&lt;br /&gt;   *            the event source&lt;br /&gt;   * @param fireInReverseOrder&lt;br /&gt;   *            &lt;font color="blue"&gt;true&lt;/font&gt; to fire handlers &lt;font color="blue"&gt;in&lt;/font&gt; reverse order&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; X10HandlerManager(Object source, boolean fireInReverseOrder) {&lt;br /&gt;    registry = &lt;font color="blue"&gt;new&lt;/font&gt; HandlerRegistry();&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.source = source;&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.isReverseOrder = fireInReverseOrder;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Adds a handle.&lt;br /&gt;   * &lt;br /&gt;   * @param &amp;lt;H&amp;gt;&lt;br /&gt;   *            The type of handler&lt;br /&gt;   * @param type&lt;br /&gt;   *            the event type associated with &lt;font color="blue"&gt;this&lt;/font&gt; handler&lt;br /&gt;   * @param handler&lt;br /&gt;   *            the handler&lt;br /&gt;   * @&lt;font color="blue"&gt;return&lt;/font&gt; the handler registration, can be stored &lt;font color="blue"&gt;in&lt;/font&gt; order to remove the&lt;br /&gt;   *         handler later&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; &amp;lt;H extends EventHandler&amp;gt; X10HandlerRegistration addHandler(X10GwtEvent.Type&amp;lt;H&amp;gt; type, final H handler) {&lt;br /&gt;    assert type != &lt;font color="blue"&gt;null&lt;/font&gt; : &amp;quot;Cannot add a handler with a &lt;font color="blue"&gt;null&lt;/font&gt; type&amp;quot;;&lt;br /&gt;    assert handler != &lt;font color="blue"&gt;null&lt;/font&gt; : &amp;quot;Cannot add a &lt;font color="blue"&gt;null&lt;/font&gt; handler&amp;quot;;&lt;br /&gt;    &lt;font color="blue"&gt;if&lt;/font&gt; (firingDepth &amp;gt; 0) {&lt;br /&gt;      enqueueAdd(type, handler);&lt;br /&gt;    } &lt;font color="blue"&gt;else&lt;/font&gt; {&lt;br /&gt;      doAdd(type, handler);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; &lt;font color="blue"&gt;new&lt;/font&gt; X10HandlerRegistration(&lt;font color="blue"&gt;this&lt;/font&gt;, type, handler);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Fires the given event to the handlers listening to the event's type.&lt;br /&gt;   * &lt;br /&gt;   * Note, any subclass should be very careful about overriding &lt;font color="blue"&gt;this&lt;/font&gt; method,&lt;br /&gt;   * as adds/removes of handlers will not be safe except within &lt;font color="blue"&gt;this&lt;/font&gt;&lt;br /&gt;   * implementation.&lt;br /&gt;   * &lt;br /&gt;   * @param event&lt;br /&gt;   *            the event&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; &amp;lt;H extends EventHandler&amp;gt; &lt;font color="blue"&gt;void&lt;/font&gt; fireEvent(X10GwtEvent&amp;lt;H&amp;gt; event) {&lt;br /&gt;    &lt;font color="green"&gt;// If it not live we should revive it.&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;if&lt;/font&gt; (!event.isLive()) {&lt;br /&gt;      event.revive();&lt;br /&gt;    }&lt;br /&gt;    Object oldSource = event.getSource();&lt;br /&gt;    event.setSource(source);&lt;br /&gt;    &lt;font color="blue"&gt;try&lt;/font&gt; {&lt;br /&gt;      firingDepth++;&lt;br /&gt;&lt;br /&gt;      registry.fireEvent(event, isReverseOrder);&lt;br /&gt;&lt;br /&gt;    } finally {&lt;br /&gt;      /*ISSUE 101*/      &lt;br /&gt;      &lt;font color="blue"&gt;int&lt;/font&gt; eventTries = 0;&lt;br /&gt;      do {&lt;br /&gt;        eventTries++;        &lt;br /&gt;        List&amp;lt;H&amp;gt; newHandlers = handleQueuedAddsAndRemoves();  &lt;br /&gt;        /* pass the event to newly added handlers alone */&lt;br /&gt;        registry.fireForSkippedHandler(event, isReverseOrder, newHandlers);&lt;br /&gt;      } &lt;font color="blue"&gt;while&lt;/font&gt;(eventTries &amp;lt; CONFIGURED_DEPTH &amp;amp;&amp;amp; deferredDeltas != &lt;font color="blue"&gt;null&lt;/font&gt;);&lt;br /&gt;    }&lt;br /&gt;    &lt;font color="blue"&gt;if&lt;/font&gt; (oldSource == &lt;font color="blue"&gt;null&lt;/font&gt;) {&lt;br /&gt;      &lt;font color="green"&gt;// This was my event, so I should kill it now that I'm done.&lt;/font&gt;&lt;br /&gt;      event.kill();&lt;br /&gt;    } &lt;font color="blue"&gt;else&lt;/font&gt; {&lt;br /&gt;      &lt;font color="green"&gt;// Restoring the source for the next handler to use.&lt;/font&gt;&lt;br /&gt;      event.setSource(oldSource);&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Gets the handler at the given index.&lt;br /&gt;   * &lt;br /&gt;   * @param &amp;lt;H&amp;gt;&lt;br /&gt;   *            the event handler type&lt;br /&gt;   * @param index&lt;br /&gt;   *            the index&lt;br /&gt;   * @param type&lt;br /&gt;   *            the handler's event type&lt;br /&gt;   * @&lt;font color="blue"&gt;return&lt;/font&gt; the given handler&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; &amp;lt;H extends EventHandler&amp;gt; H getHandler(X10GwtEvent.Type&amp;lt;H&amp;gt; type, &lt;font color="blue"&gt;int&lt;/font&gt; index) {&lt;br /&gt;    assert index &amp;lt; getHandlerCount(type) : &amp;quot;handlers &lt;font color="blue"&gt;for&lt;/font&gt; &amp;quot; + type.getClass() + &amp;quot; have size: &amp;quot; + getHandlerCount(type)&lt;br /&gt;        + &amp;quot; so do not have a handler at index: &amp;quot; + index;&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; registry.getHandler(type, index);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Gets the number of handlers listening to the event type.&lt;br /&gt;   * &lt;br /&gt;   * @param type&lt;br /&gt;   *            the event type&lt;br /&gt;   * @&lt;font color="blue"&gt;return&lt;/font&gt; the number of registered handlers&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;int&lt;/font&gt; getHandlerCount(Type&amp;lt;?&amp;gt; type) {&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; registry.getHandlerCount(type);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Does &lt;font color="blue"&gt;this&lt;/font&gt; handler manager handle the given event type?&lt;br /&gt;   * &lt;br /&gt;   * @param e&lt;br /&gt;   *            the event type&lt;br /&gt;   * @&lt;font color="blue"&gt;return&lt;/font&gt; whether the given event type is handled&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; boolean isEventHandled(Type&amp;lt;?&amp;gt; e) {&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; registry.isEventHandled(e);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Removes the given handler from the specified event type. Normally,&lt;br /&gt;   * applications should call {@link HandlerRegistration#removeHandler()}&lt;br /&gt;   * instead.&lt;br /&gt;   * &lt;br /&gt;   * @param &amp;lt;H&amp;gt;&lt;br /&gt;   *            handler type&lt;br /&gt;   * &lt;br /&gt;   * @param type&lt;br /&gt;   *            the event type&lt;br /&gt;   * @param handler&lt;br /&gt;   *            the handler&lt;br /&gt;   * @deprecated This method is likely to be removed along with &amp;quot;listener&amp;quot;&lt;br /&gt;   *             interfaces &lt;font color="blue"&gt;in&lt;/font&gt; a future release. If you have a reason it&lt;br /&gt;   *             should be retained beyond that time, please add your comments&lt;br /&gt;   *             to GWT &amp;lt;a href=&lt;br /&gt;   *             &amp;quot;http:&lt;font color="green"&gt;//code.google.com/p/google-web-toolkit/issues/detail?id=3102&amp;quot;&lt;/font&gt;&lt;br /&gt;   *             &amp;gt;issue 3102&amp;lt;/a&amp;gt;&lt;br /&gt;   */&lt;br /&gt;  @Deprecated&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; &amp;lt;H extends EventHandler&amp;gt; &lt;font color="blue"&gt;void&lt;/font&gt; removeHandler(X10GwtEvent.Type&amp;lt;H&amp;gt; type, final H handler) {&lt;br /&gt;    &lt;font color="blue"&gt;if&lt;/font&gt; (firingDepth &amp;gt; 0) {&lt;br /&gt;      enqueueRemove(type, handler);&lt;br /&gt;    } &lt;font color="blue"&gt;else&lt;/font&gt; {&lt;br /&gt;      doRemove(type, handler);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Not part of the &lt;font color="blue"&gt;public&lt;/font&gt; API, available only to allow visualization tools&lt;br /&gt;   * to be developed &lt;font color="blue"&gt;in&lt;/font&gt; gwt-incubator.&lt;br /&gt;   * &lt;br /&gt;   * @&lt;font color="blue"&gt;return&lt;/font&gt; a map of all handlers &lt;font color="blue"&gt;in&lt;/font&gt; &lt;font color="blue"&gt;this&lt;/font&gt; handler manager&lt;br /&gt;   */&lt;br /&gt;  Map&amp;lt;X10GwtEvent.Type&amp;lt;?&amp;gt;, ArrayList&amp;lt;?&amp;gt;&amp;gt; createHandlerInfo() {&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; registry.map;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; &lt;font color="blue"&gt;void&lt;/font&gt; defer(AddOrRemoveCommand command) {&lt;br /&gt;    &lt;font color="blue"&gt;if&lt;/font&gt; (deferredDeltas == &lt;font color="blue"&gt;null&lt;/font&gt;) {&lt;br /&gt;      deferredDeltas = &lt;font color="blue"&gt;new&lt;/font&gt; ArrayList&amp;lt;AddOrRemoveCommand&amp;gt;();&lt;br /&gt;    }&lt;br /&gt;    deferredDeltas.add(command);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; &amp;lt;H extends EventHandler&amp;gt; &lt;font color="blue"&gt;void&lt;/font&gt; doAdd(X10GwtEvent.Type&amp;lt;H&amp;gt; type, final H handler) {&lt;br /&gt;    registry.addHandler(type, handler);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; &amp;lt;H extends EventHandler&amp;gt; &lt;font color="blue"&gt;void&lt;/font&gt; doRemove(X10GwtEvent.Type&amp;lt;H&amp;gt; type, final H handler) {&lt;br /&gt;    registry.removeHandler(type, handler);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; &amp;lt;H extends EventHandler&amp;gt; &lt;font color="blue"&gt;void&lt;/font&gt; enqueueAdd(final X10GwtEvent.Type&amp;lt;H&amp;gt; type, final H handler) {&lt;br /&gt;    defer(&lt;font color="blue"&gt;new&lt;/font&gt; AddOrRemoveCommand() {&lt;br /&gt;      &lt;font color="blue"&gt;public&lt;/font&gt; EventHandler execute() {&lt;br /&gt;        doAdd(type, handler);&lt;br /&gt;        &lt;font color="blue"&gt;return&lt;/font&gt; handler;&lt;br /&gt;      }&lt;br /&gt;    });&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; &amp;lt;H extends EventHandler&amp;gt; &lt;font color="blue"&gt;void&lt;/font&gt; enqueueRemove(final X10GwtEvent.Type&amp;lt;H&amp;gt; type, final H handler) {&lt;br /&gt;    defer(&lt;font color="blue"&gt;new&lt;/font&gt; AddOrRemoveCommand() {&lt;br /&gt;      &lt;font color="blue"&gt;public&lt;/font&gt; EventHandler execute() {&lt;br /&gt;        doRemove(type, handler);&lt;br /&gt;        &lt;font color="blue"&gt;return&lt;/font&gt; &lt;font color="blue"&gt;null&lt;/font&gt;;&lt;br /&gt;      }&lt;br /&gt;    });&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  @SuppressWarnings(&amp;quot;unchecked&amp;quot;)&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; &amp;lt;H extends EventHandler&amp;gt; List&amp;lt;H&amp;gt; handleQueuedAddsAndRemoves() {&lt;br /&gt;    List&amp;lt;H&amp;gt; handlers = &lt;font color="blue"&gt;new&lt;/font&gt; ArrayList&amp;lt;H&amp;gt;(10);&lt;br /&gt;    &lt;font color="blue"&gt;if&lt;/font&gt; (deferredDeltas != &lt;font color="blue"&gt;null&lt;/font&gt;) {&lt;br /&gt;      &lt;font color="blue"&gt;try&lt;/font&gt; {&lt;br /&gt;        &lt;font color="blue"&gt;for&lt;/font&gt; (AddOrRemoveCommand c : deferredDeltas) {&lt;br /&gt;          EventHandler newHander = c.execute();&lt;br /&gt;          /*ISSUE 101*/&lt;br /&gt;          &lt;font color="blue"&gt;if&lt;/font&gt;(newHander != &lt;font color="blue"&gt;null&lt;/font&gt;){  &lt;br /&gt;            handlers.add((H) newHander);&lt;br /&gt;          }&lt;br /&gt;        }&lt;br /&gt;      } finally {&lt;br /&gt;        deferredDeltas = &lt;font color="blue"&gt;null&lt;/font&gt;;&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; handlers;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Extended GWTEvent :: X10GWTEvent &lt;/h4&gt;&lt;br /&gt;&lt;table bgcolor="#dddddd" border="1" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;/*&lt;br /&gt; * This is customized version of GWTEvent provided by google. The purpose of &lt;font color="blue"&gt;this&lt;/font&gt;&lt;br /&gt; * extension is to enable user triggered events to bypass ISSUE 101&lt;br /&gt; * &lt;br /&gt; * Fixed ISSUE 101: To support event handling when event handlers are added as part of event processing&lt;br /&gt; *  &lt;br /&gt; * Copyright 2009 Google Inc.&lt;br /&gt; * &lt;br /&gt; * Licensed under the Apache License, Version 2.0 (the &amp;quot;License&amp;quot;); you may not&lt;br /&gt; * use &lt;font color="blue"&gt;this&lt;/font&gt; file except &lt;font color="blue"&gt;in&lt;/font&gt; compliance with the License. You may obtain a copy of&lt;br /&gt; * the License at&lt;br /&gt; * &lt;br /&gt; * http:&lt;font color="green"&gt;//www.apache.org/licenses/LICENSE-2.0&lt;/font&gt;&lt;br /&gt; * &lt;br /&gt; * Unless required by applicable law or agreed to &lt;font color="blue"&gt;in&lt;/font&gt; writing, software&lt;br /&gt; * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS, WITHOUT&lt;br /&gt; * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the&lt;br /&gt; * License &lt;font color="blue"&gt;for&lt;/font&gt; the specific language governing permissions and limitations under&lt;br /&gt; * the License.&lt;br /&gt; */&lt;br /&gt;package org.myxyz.custom;&lt;br /&gt;&lt;br /&gt;import com.google.gwt.event.shared.EventHandler;&lt;br /&gt;import com.google.gwt.event.shared.GwtEvent;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Root of all GWT events. All GWT events are considered dead and should no&lt;br /&gt; * longer be accessed once the {@link X10HandlerManager} which originally fired&lt;br /&gt; * the event finishes with it. That is, don't hold on to event objects outside&lt;br /&gt; * of your handler methods.&lt;br /&gt; * &lt;br /&gt; * @param &amp;lt;H&amp;gt;&lt;br /&gt; *            handler type&lt;br /&gt; * &lt;br /&gt; */&lt;br /&gt;&lt;font color="blue"&gt;public&lt;/font&gt; abstract &lt;font color="blue"&gt;class&lt;/font&gt; X10GwtEvent&amp;lt;H extends EventHandler&amp;gt; {&lt;br /&gt;  /**&lt;br /&gt;   * Type &lt;font color="blue"&gt;class&lt;/font&gt; used to register events with the {@link X10HandlerManager}.&lt;br /&gt;   * &amp;lt;p&amp;gt;&lt;br /&gt;   * Type is parameterized by the handler type &lt;font color="blue"&gt;in&lt;/font&gt; order to make the addHandler&lt;br /&gt;   * method type safe.&lt;br /&gt;   * &amp;lt;/p&amp;gt;&lt;br /&gt;   * &lt;br /&gt;   * @param &amp;lt;H&amp;gt;&lt;br /&gt;   *            handler type&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;static&lt;/font&gt; &lt;font color="blue"&gt;class&lt;/font&gt; Type&amp;lt;H&amp;gt; {&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; &lt;font color="blue"&gt;static&lt;/font&gt; &lt;font color="blue"&gt;int&lt;/font&gt; nextHashCode;&lt;br /&gt;    &lt;font color="blue"&gt;private&lt;/font&gt; final &lt;font color="blue"&gt;int&lt;/font&gt; index;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Constructor.&lt;br /&gt;     */&lt;br /&gt;    &lt;font color="blue"&gt;public&lt;/font&gt; Type() {&lt;br /&gt;      index = ++nextHashCode;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;font color="green"&gt;// We override hash code to make it as efficient as possible.&lt;/font&gt;&lt;br /&gt;    @Override&lt;br /&gt;    &lt;font color="blue"&gt;public&lt;/font&gt; final &lt;font color="blue"&gt;int&lt;/font&gt; hashCode() {&lt;br /&gt;      &lt;font color="blue"&gt;return&lt;/font&gt; index;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    &lt;font color="blue"&gt;public&lt;/font&gt; String toString() {&lt;br /&gt;      &lt;font color="blue"&gt;return&lt;/font&gt; &amp;quot;Event type&amp;quot;;&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; boolean dead;&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; Object source;&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Constructor.&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;protected&lt;/font&gt; X10GwtEvent() {&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Returns the type used to register &lt;font color="blue"&gt;this&lt;/font&gt; event. Used by handler manager to&lt;br /&gt;   * dispatch events to the correct handlers.&lt;br /&gt;   * &lt;br /&gt;   * @&lt;font color="blue"&gt;return&lt;/font&gt; the type&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; abstract Type&amp;lt;H&amp;gt; getAssociatedType();&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Returns the source that last fired &lt;font color="blue"&gt;this&lt;/font&gt; event.&lt;br /&gt;   * &lt;br /&gt;   * @&lt;font color="blue"&gt;return&lt;/font&gt; object representing the source of &lt;font color="blue"&gt;this&lt;/font&gt; event&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; Object getSource() {&lt;br /&gt;    assertLive();&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; source;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * This is a method used primarily &lt;font color="blue"&gt;for&lt;/font&gt; debugging. It gives a &lt;font color="blue"&gt;string&lt;/font&gt;&lt;br /&gt;   * representation of the event details. This does not override the toString&lt;br /&gt;   * method because the compiler cannot always optimize toString out&lt;br /&gt;   * correctly. Event types should override as desired.&lt;br /&gt;   * &lt;br /&gt;   * @&lt;font color="blue"&gt;return&lt;/font&gt; a &lt;font color="blue"&gt;string&lt;/font&gt; representing the event's specifics.&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; String toDebugString() {&lt;br /&gt;    String name = &lt;font color="blue"&gt;this&lt;/font&gt;.getClass().getName();&lt;br /&gt;    name = name.substring(name.lastIndexOf(&amp;quot;.&amp;quot;) + 1);&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; &amp;quot;event: &amp;quot; + name + &amp;quot;:&amp;quot;;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * The toString() &lt;font color="blue"&gt;for&lt;/font&gt; abstract event is overridden to avoid accidently&lt;br /&gt;   * including &lt;font color="blue"&gt;class&lt;/font&gt; literals &lt;font color="blue"&gt;in&lt;/font&gt; the the compiled output. Use&lt;br /&gt;   * {@link GwtEvent} #toDebugString to &lt;font color="blue"&gt;get&lt;/font&gt; more information about the&lt;br /&gt;   * event.&lt;br /&gt;   */&lt;br /&gt;  @Override&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; String toString() {&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; &amp;quot;An event type&amp;quot;;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Asserts that the event still should be accessed. All events are&lt;br /&gt;   * considered to be &amp;quot;dead&amp;quot; after their original handler manager finishes&lt;br /&gt;   * firing them. An event can be revived by calling&lt;br /&gt;   * {@link GwtEvent#revive()}.&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;protected&lt;/font&gt; &lt;font color="blue"&gt;void&lt;/font&gt; assertLive() {&lt;br /&gt;    assert (!dead) : &amp;quot;This event has already finished being processed by its original handler manager, so you can no longer access it&amp;quot;;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Should only be called by {@link X10HandlerManager}. In other words, do&lt;br /&gt;   * not use or call.&lt;br /&gt;   * &lt;br /&gt;   * @param handler&lt;br /&gt;   *            handler&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;protected&lt;/font&gt; abstract &lt;font color="blue"&gt;void&lt;/font&gt; dispatch(H handler);&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Is the event current live?&lt;br /&gt;   * &lt;br /&gt;   * @&lt;font color="blue"&gt;return&lt;/font&gt; whether the event is live&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;protected&lt;/font&gt; final boolean isLive() {&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; !dead;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Kill the event. After the event has been killed, users cannot really on&lt;br /&gt;   * its values or functions being available.&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;protected&lt;/font&gt; &lt;font color="blue"&gt;void&lt;/font&gt; kill() {&lt;br /&gt;    dead = &lt;font color="blue"&gt;true&lt;/font&gt;;&lt;br /&gt;    source = &lt;font color="blue"&gt;null&lt;/font&gt;;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Revives the event. Used when recycling event instances.&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;protected&lt;/font&gt; &lt;font color="blue"&gt;void&lt;/font&gt; revive() {&lt;br /&gt;    dead = &lt;font color="blue"&gt;false&lt;/font&gt;;&lt;br /&gt;    source = &lt;font color="blue"&gt;null&lt;/font&gt;;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Set the source that triggered &lt;font color="blue"&gt;this&lt;/font&gt; event.&lt;br /&gt;   * &lt;br /&gt;   * @param source&lt;br /&gt;   *            the source of &lt;font color="blue"&gt;this&lt;/font&gt; event, should only be &lt;font color="blue"&gt;set&lt;/font&gt; by a&lt;br /&gt;   *            {@link X10HandlerManager}&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;void&lt;/font&gt; setSource(Object source) {&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.source = source;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Extended HandlerRegistration :: X10HandlerRegistration&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;&lt;table bgcolor="#dddddd" border="1" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;/*&lt;br /&gt; * This is customized version of HandlerRegistration provided by google. The purpose of &lt;font color="blue"&gt;this&lt;/font&gt;&lt;br /&gt; * extension is to enable user triggered events to bypass ISSUE 101&lt;br /&gt; * &lt;br /&gt; * Fixed ISSUE 101: To support event handling when event handlers are added as part of event processing&lt;br /&gt; * &lt;br /&gt; * Copyright 2008 Google Inc.&lt;br /&gt; * &lt;br /&gt; * Licensed under the Apache License, Version 2.0 (the &amp;quot;License&amp;quot;); you may not&lt;br /&gt; * use &lt;font color="blue"&gt;this&lt;/font&gt; file except &lt;font color="blue"&gt;in&lt;/font&gt; compliance with the License. You may obtain a copy of&lt;br /&gt; * the License at&lt;br /&gt; * &lt;br /&gt; * http:&lt;font color="green"&gt;//www.apache.org/licenses/LICENSE-2.0&lt;/font&gt;&lt;br /&gt; * &lt;br /&gt; * Unless required by applicable law or agreed to &lt;font color="blue"&gt;in&lt;/font&gt; writing, software&lt;br /&gt; * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS, WITHOUT&lt;br /&gt; * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the&lt;br /&gt; * License &lt;font color="blue"&gt;for&lt;/font&gt; the specific language governing permissions and limitations under&lt;br /&gt; * the License.&lt;br /&gt; */&lt;br /&gt;package org.myxyz.custom;&lt;br /&gt;&lt;br /&gt;import com.google.gwt.event.shared.EventHandler;&lt;br /&gt;import com.google.gwt.event.shared.HandlerRegistration;&lt;br /&gt;import org.myxyz.custom.X10GwtEvent.Type;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Default implementation of {@link HandlerRegistration}.&lt;br /&gt; */&lt;br /&gt;&lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;class&lt;/font&gt; X10HandlerRegistration implements HandlerRegistration {&lt;br /&gt;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; final X10HandlerManager manager;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; final EventHandler handler;&lt;br /&gt;  &lt;font color="blue"&gt;private&lt;/font&gt; final Type&amp;lt;?&amp;gt; type;&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Creates a &lt;font color="blue"&gt;new&lt;/font&gt; handler registration.&lt;br /&gt;   * &lt;br /&gt;   * @param &amp;lt;H&amp;gt;&lt;br /&gt;   *            Handler type&lt;br /&gt;   * &lt;br /&gt;   * @param manager&lt;br /&gt;   *            the handler manager&lt;br /&gt;   * @param type&lt;br /&gt;   *            the event type&lt;br /&gt;   * @param handler&lt;br /&gt;   *            the handler&lt;br /&gt;   */&lt;br /&gt;  &lt;font color="blue"&gt;protected&lt;/font&gt; &amp;lt;H extends EventHandler&amp;gt; X10HandlerRegistration(X10HandlerManager manager, Type&amp;lt;H&amp;gt; type, H handler) {&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.manager = manager;&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.handler = handler;&lt;br /&gt;    &lt;font color="blue"&gt;this&lt;/font&gt;.type = type;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Removes the given handler from its manager.&lt;br /&gt;   */&lt;br /&gt;  @SuppressWarnings( { &amp;quot;unchecked&amp;quot;, &amp;quot;deprecation&amp;quot; })&lt;br /&gt;  &lt;font color="green"&gt;// This is safe because when the elements were passed in they conformed to&lt;/font&gt;&lt;br /&gt;  &lt;font color="green"&gt;// Type&amp;lt;H&amp;gt;,H.&lt;/font&gt;&lt;br /&gt;  &lt;font color="blue"&gt;public&lt;/font&gt; &lt;font color="blue"&gt;void&lt;/font&gt; removeHandler() {&lt;br /&gt;    manager.removeHandler((Type&amp;lt;EventHandler&amp;gt;) type, handler);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  EventHandler getHandler() {&lt;br /&gt;    &lt;font color="blue"&gt;return&lt;/font&gt; handler;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-6210633368208776795?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/6210633368208776795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=6210633368208776795' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6210633368208776795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6210633368208776795'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2010/05/gxt-gwt-code-nuggets.html' title='GXT-GWT fixing the transmission'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-7021560583240896292</id><published>2010-05-15T23:41:00.004+05:30</published><updated>2010-05-16T00:12:08.501+05:30</updated><title type='text'>Event handling in GXT-GWT</title><content type='html'>This is the way I like to handle events. Note the ease with which the MessageSenders and MessageListeners can be "weaved" using aop/annotations. Unfortunately, I am not going the aop way for the time being.&lt;br /&gt;&lt;br /&gt;The big picture:&lt;br /&gt;&lt;h3&gt;Architecture diagram of a GWT-GXT application&lt;/h3&gt;&lt;br /&gt;&lt;img src="http://imgur.com/7bbi0.png" alt="" title="Hosted by imgur.com" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Using a message listener&lt;/h3&gt;&lt;br /&gt;&lt;img src="http://imgur.com/cELGj.png" alt="" title="Hosted by imgur.com" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Using a message sender&lt;/h3&gt;&lt;br /&gt;The SubmitButtonListener is a button listener. I tend to separate UI events from business/semantic events. The message sender is used to fire the event. There is another reason why this separation was required, GWT EventHandler code cannot register listeners, while a event is being processed. I re-wrote the custom code and wanted to use it only for semantic events. &lt;br /&gt;&lt;img src="http://imgur.com/AJYbb.png" alt="" title="Hosted by imgur.com" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-7021560583240896292?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/7021560583240896292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=7021560583240896292' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7021560583240896292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7021560583240896292'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2010/05/event-handling-in-gxt-gwt.html' title='Event handling in GXT-GWT'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-380997725828885852</id><published>2010-04-14T23:59:00.002+05:30</published><updated>2010-04-15T00:14:00.688+05:30</updated><title type='text'>Event Bus and event handling</title><content type='html'>Event bus is a rather simple notion, that is of great aid. Think of a telephone network; to communicate between two ends, one would require a line of communication. In most programming languages, an object reference serves this purpose. Having a line of communication between any two end-points quickly becomes a problem with a complexity of O(N^2). Simple combinatorics says we need nC2 lines i.e N(N-1)/2 lines between N unique parties. &lt;br /&gt;&lt;br /&gt;Telephone exchanges provide a rather good solution to this. Instead of creating a line between every end-point. We create a line to the exchange for every new party. So N parties would need N lines. This is an O(N) solution, with a linear ordering. How does this look in program terms? There are several solutions, but I prefer the one describe here. I prefer distinguishing MessageSenders, MessageListeners, so I typically create two classes for each. Then I need a MessageExchange, which happens to be a listener as well as a sender. All senders speak with the exchange and all listeners listen against the exchange. The exchange broadcasts any event received to all the parties. &lt;br /&gt;&lt;br /&gt;I have ignored one finer aspect of this pattern, The message itself. Messages are typically implementation specific. In java I prefer to use PropertyEvent. This is a generic event which takes three arguments: EventName, OldValue, NewValue. This generic nature of the event suits me really well. I tried incorporating the same philosophy in GWT. The listeners are called MessageHandlers in GWT. However, the GWT message handlers have an inherent problem ( as of GWT 2.0). Whilst an event is being processed, other handlers cannot be hooked up and hence cannot receive events. I had to rewrite the contract to fix this. More on this in the next post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-380997725828885852?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/380997725828885852/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=380997725828885852' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/380997725828885852'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/380997725828885852'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2010/04/event-bus-and-event-handling.html' title='Event Bus and event handling'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-1048586162460428584</id><published>2010-03-29T00:21:00.002+05:30</published><updated>2010-03-29T01:04:29.972+05:30</updated><title type='text'>Event models and Event driven programming</title><content type='html'>Traditional web applications have a sequential flow, A form which is filled and submitted to controller, and some magic before showing a html page. Rich GUI on the other hand supported event driven flow. A button clicked on form causes the controller/presenter to sense data from widgets (data-binding), then some magic and finally a view is shown to the user. If the logic of rendering is built into view it is MVC, if any intermediate intelligent helper is present it is MVP. Until the advent of AJAX, web applications could not benefit from event driven style of programming. Reason: server-side code could not listen on client side entities.&lt;br /&gt;&lt;br /&gt;What is event driven code any way? Lets understand what is not event driven. A program is typically a list of chores. This is procedural. The program is to be thought of a continuous loop only pausing for inputs. Once an input is given the program runs and marks an internal state (session state).  Then there is another input, the program again runs and updates the internal state. Some of these states are shown to the user using conditional logic. This is not important, the important point is to note how the program is processing inputs in a sequential pattern. In case you are wondering, I made the most blatant assumptions about multi-tasking abilities of the underlying process. In reality, the inputs are accepted in a different thread/process and passed on using multi-threading and multi-processing. Thus simulating the concurrent execution and support for multi-user paradigm.&lt;br /&gt;&lt;br /&gt;In event driven, the program is thought to be comprised of multiple standalone modules each of which can be triggered independently. A user inputs triggers only portions of program, depending on their nature. The state is set in these portions. The user inputs assume no sequential flow. There can be multiple triggers and no assumptions are made about order of triggering. The keyboard is a good analogy, to play a tune the user selects the keys and changes the state. Most real world tasks are event-driven. Unfortunately, in CS the mind set is rather procedural. &lt;br /&gt;&lt;br /&gt;Do you see any problems with event-driven approach? Event driven code relies on underlying sequential code. This causes unwanted side-effects. For eg: if the code itself is capable of creating events or user triggers multiple events the order in which events are raised cause a huge furore, nearly impossible to debug as they are difficult to be repeated. I once had a code which ran perfectly in debug mode when I was stepping through and just refused to yield in run mode. Mea-culpa. The solution prevent user-inputs when undesired (by locking the application). Try to queue up events if required.&lt;br /&gt;&lt;br /&gt;Another problem, the observer-observable pattern causes a mesh. It is nearly impossible to keep track of who is listening to whom. The whereabouts of event are cryptic when visualising the big picture. Another problem, the observers need a handle/reference to observable. So there would be unwanted reference propagation. The solution, I call it message exchange. I tried to address this issue by  making a bulletin analogy. Observables are only observed by the bulletin, in turn the bulletin takes the responsibility of broadcasting the events globally. Observers only listen to bulletin. The bulletin is sort of radio station or telephone exchange. &lt;br /&gt;&lt;br /&gt;Think of this mathematical problem, if there are N houses with telephones and each of them need a line to call other, how many lines are required? N(N-1)/2 is the answer. It is O(N^2). For 10 houses it would be 45, for 12 houses it is 66. A difference of 2 and see the extra lines required. With a message exchange the increase is linear. For 10 houses we need 10 lines and for 12 houses it is 12 lines. The penalty is paid in real-world in terms of dropped calls or busy tones. Under the sufficient assumption that computers are fast, we can get away with this. However, it is always a good practice to freeze the application and thus preventing unwanted inputs. One may wonder about concurrency, in a properly designed application the freeze would be applicable for a single user (especially session state). Another advantage of message exchange is the ability to debug/analyse the application. The testability of application also improves greatly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-1048586162460428584?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/1048586162460428584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=1048586162460428584' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1048586162460428584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1048586162460428584'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2010/03/event-models-and-event-driven.html' title='Event models and Event driven programming'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-2484074887471545537</id><published>2010-03-28T23:04:00.004+05:30</published><updated>2010-03-29T00:21:25.991+05:30</updated><title type='text'>Patterns to UI, MVC and MVP</title><content type='html'>To begin with the most common patterns are MVC and MVP. Model View Controller and Model View Presenter, for the few who may not know. Both of them deal with one major fact, categorising or boxing intelligence. Model represents an idea and actions that can be conducted. Controller performs the actions and decides when/where/whether or not to perform the actions. View is the camera man or the commentator who showcases the whole play. MVC unfortunately is interpreted in a diverse fashion. Presenters on other hand act like the intelligent chaps on whom view can rely. Having a separate intelligent view model changes most MVC architectures to MVP. The view model needs to provide information required for rendering widgets and hence is a composition of other view models. If the view observes view model/presenter it is called passive MVP, on the other hand if view model dictates the changes it is active MVP.&lt;br /&gt;&lt;br /&gt;Think of it as an orchestra, model is the theme Bethoven/Mozart/Bollywood dance/Americal Idol etc. Controller is the composer/director. S/he directs/delegates to the actors. The camera just captures the show. To do that effectively, the view needs to understand what is to be shown. The camera doesn't show the whole act - the rehearsals/the makeup/the merchandise are all skipped. This knowledge is obtained from the controller. If the spectators come to a decision based on the view and trigger appropriate action. The action needs to be understood by controller. The dumb view cannot do that, so it has one more trick, a mechanism to convey intent to Controller. Note that view and controller are mostly aware of each other. This is MVC-1, Another option is to keep the view unaware of controller and model making use of observer pattern (pure MVC). Often, as it is perceived that view is a reflection of model rather than controller, the view acts as an observer on model. So changes made by controller on model are immediately shown to user. &lt;br /&gt;&lt;br /&gt;The most important facts about MVC now. However, there is an additional overhead in MVC. The view is not a simple reflection of model. View is a bells and whistles representation. Like putting up a high-light color for invalid values or showing a tabular list. Where does this logic go? In traditional MVC, the answer is open for interpretation. Some use another layer of objects say a view model that listens on model and computes the logic required by the dumb view. This can be orchestrated by the controller where view model is another controller(pure MVC) or can be a direct observer on model, thus acting as a view model (MVC-1). Both of them can be called variants of Presentation model (as both address the grievances of view).&lt;br /&gt;&lt;br /&gt;MVP is similar but different, Model View Presenter skips the controller part. MVC mostly deals with full-fledged views and doesn't care about widgets. MVP emphasies on widgets and view constituents. In the later view is not a single entity, but a structure of entities. The rational for MVP comes from the observation that, in UI models there is little need for controller arbitration. There is a new guy called presentation model who is understood by views and who manipulates the models. How is it different from Controller. They are similar remember, the controller doesn't speak of widgets, controller speaks of forms and content to be shown. Presenter speaks to widgets. Controller orchestrates the symphony between view and model. Presenter orchestrates only view and observes the model. Most often you realise that view and controller are coupled to form a presenter. MVP is what most of us desire as the explicit flow dictation by controller is too cumbersome (if I am allowed to say so). &lt;br /&gt;&lt;br /&gt;An analogy for MVP, think of a refrigerator with automatic defrost feature. The user puts water into the frost shelf. The fridge senses the frost levels time to time (observes) and turns on/off the power. In sense the fridge is a presentor model. If it were MVC, the user puts water in the freezer and explictly states the time (to avoid frost). Checks the frost level and adjusts the cooling level. The interactions are explicit, the fridge doesn't sense changes, the user senses them and in turn becomes the controller.&lt;br /&gt;&lt;br /&gt;In your application, you can detect the pattern used (MVC or MVP) by looking for the intelligence built into the code. In case of MVP the presenters are fully automated and pass information to widgets. In case of MVC, the rendering intelligence is pushed to view.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-2484074887471545537?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/2484074887471545537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=2484074887471545537' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/2484074887471545537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/2484074887471545537'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2010/03/patterns-to-ui-mvc-and-mvp.html' title='Patterns to UI, MVC and MVP'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-9004887590388816114</id><published>2010-03-28T22:40:00.003+05:30</published><updated>2010-03-28T23:04:19.147+05:30</updated><title type='text'>Coffee cup analogy to code/design aesthetics</title><content type='html'>Code aesthetics are often understated, good developers copy, great developers don't care and greater ones steal. Larry Wall once said: &lt;quote&gt;"easy things are easy and hard things are possible"&lt;/quote&gt;. Nothing else in the world gives a better description when it comes to requirement realisation. Most of us have read design patterns and have understood code etiquette. Some great programmers don't, they get away with it owing to their greatness, but the code monster catches up. It is said that if smart code is written, then you need to be 200% smarter to debug it. The essence of people centered development can thus be simplified as writing simple code which other educated peers can easily grasp.&lt;br /&gt;&lt;br /&gt;There is often as debate on whether HTML/XML are to be construed as programming languages. To start the discussion they are not turing complete, and one of them is a mark up language and other is a data descriptor. What is turing complete, in simple words any language that can simulate condition branching (if-else) and goto (evil JMP) are turing complete. They in essence can read any arbitrary input and act upon it. HTML and XML don't qualify in this regards. What about GUI? GUI is just an abstract realisation of underlying program. Imagine a coffee cup, the coffee is the essence, the cup is the interface. It is not coffee, however it is a coffee cup when it holds coffee. Without coffee it is any other cup. Same with GUI, gui becomes the app just as coffee-cup is synonymous with coffee. &lt;br /&gt;&lt;br /&gt;An application can do several things; a coffee cup can only serve one task, provide access to coffee. Keep this in mind. Most of us do this, and complain about nasty the application is :(. It is the cup that is spoiling the taste not the coffee par say. The cup might be leaking or cracking or lacking an handle, this spoils the whole coffee experience. So the greatness of coffee cannot be appreciated without a good cup. The cup need not be aesthetic, it is not required to be a masterpiece, it needs to do one thing that matters the most.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-9004887590388816114?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/9004887590388816114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=9004887590388816114' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/9004887590388816114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/9004887590388816114'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2010/03/coffee-cup-analogy-to-codedesign.html' title='Coffee cup analogy to code/design aesthetics'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-3314893778203543880</id><published>2010-03-28T19:36:00.002+05:30</published><updated>2010-03-28T22:40:37.738+05:30</updated><title type='text'>Laws that govern usability  and pragmatic usage</title><content type='html'>&lt;h3&gt;Fitts' law&lt;/h3&gt;&lt;br /&gt;Fitts' law is quite intuitive, even a toddler knows that, you always go for the largest cookie/candy/cake/blah-blah...; even when it doesn't fit in the mouth. Might be the evolutionary instinct to pick up the most healthy objects! Well human vision can broadly perceive two kinds of visual inputs. Our brains are fine tuned to focus (a predatory trait), when we do that our peripheral vision takes a back seat. Then we do have peripheral vision, which kicks in autonomic-ally; more like a gag reflex. Like seeing a car coming or ball being passed from the back of your eye. Practice can enhance these traits, an archer would focus where as a ping-pong player relies on the lateral part.&lt;br /&gt;&lt;br /&gt;Reading involves focus, so when someone looks at the screen, s/he immediately feels an urge to know what's around. So any attention grabbing activity attracts attention. The essence of this rule is simple, try to keep things together and highlight the action arena by making it big and closer to points in focus. Also, avoid placing unwanted focus-grabbers (remember lack of annoyances). Areas of application: Buttons, Labels, images, check boxes and radio buttons and almost every thinkable UI component that supports mouse activity.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Steerings' Law&lt;/h3&gt;&lt;br /&gt;Fitts' law highlights the point and click activity, Steerings' law extrapolates it to 'drag/draw' action. Wondering about things that fit into this? Stylus and tablets and pens and laser-pointers and touch-screens and pinch gestures WHOA... never thought of this before. On a typical application, you tend to use scroll-bars which `were` bad-ass as per this rule, (no wonder eldery folks hate UI). Try to customize the scrollbar, even more problems, people who have learnt UI rarely recognize the customized scrollbars. Now you have two problems. The you may have cross-browser issues (hundred's of problems). &lt;br /&gt;&lt;br /&gt;So why are we even discussing this. Some widgets are not that popular and can benefit from steering's law. For example, most image-editing apps have a palette, It is customary nowadays to enable drag and drop on palette contents (point-click-relax and point-click-relax vs. point-click-drag-relax with focus thrown somewhere in between). Every such widget needs to support margin of motion. The user should never be constricted to a specific area. &lt;br /&gt;&lt;br /&gt;On a side note: How to improve scroll bar? Add a on-hover effect which enlarges the scroll bar making it easier to click.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Crossing action is rarely seen supported in most UI applications, so we will put is aside for the time being.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-3314893778203543880?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/3314893778203543880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=3314893778203543880' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3314893778203543880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3314893778203543880'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2010/03/laws-that-govern-usability-and.html' title='Laws that govern usability  and pragmatic usage'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-4496825160409994569</id><published>2010-03-25T23:52:00.003+05:30</published><updated>2010-03-26T00:25:46.543+05:30</updated><title type='text'>Laws that govern usability</title><content type='html'>Paraphrased and extracted form Wikipedia:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Fitts' law:&lt;/b&gt;  The time required to rapidly move to a target area is a function of the distance to and the size of the target. Fitts's law is used to model the act of pointing.&lt;br /&gt;&lt;br /&gt;Consequence, use big areas and try to keep them close to preceding action area. If it is not possible try to increase distance between conflicting hotspots, to help preferred areas.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;             BAD                                    BAD&lt;br /&gt;Content 1: ----------  o              Content 2: ----------         [  ]&lt;br /&gt;           ----------                            ----------&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;             GOOD&lt;br /&gt;Content 3: ----------  [  ]&lt;br /&gt;           ----------&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Accot-Zhai_steering_law:&lt;/b&gt; It is easier/faster to navigate through a wider tunnel than a narrower one. Also, it is easier to navigate through a tunnel with thinner wall(s).&lt;br /&gt;&lt;br /&gt;Consequence, for fluid motion - enable more space. That is don't force the user to perform orthogonal tasks (straight drags) provide margin of action.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Example 1:&lt;br /&gt;&lt;br /&gt;----------     Hard          ----------&lt;br /&gt;|        |    -- \           |        |&lt;br /&gt;|        |    -- /           |        |&lt;br /&gt;----------                   ----------&lt;br /&gt;&lt;br /&gt;Dragging/moving from left to right, is harder in above case than that in below.&lt;br /&gt;&lt;br /&gt;-----               -----&lt;br /&gt;|   |    Easy       |   |&lt;br /&gt;|   |    ---\       |   |&lt;br /&gt;|   |    ---/       |   |            &lt;br /&gt;|   |               |   |&lt;br /&gt;|   |               |   |&lt;br /&gt;-----               -----&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Laws of crossing:&lt;/b&gt; It is easier to cross an object in a perpendicular direction. Crossing is an action which looks like a strike (drag) and is considered to be easier to achieve than pointing.&lt;br /&gt;&lt;br /&gt;Using past illustration, crossing (top to down) is harder in Example 2 than in Example 1.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-4496825160409994569?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/4496825160409994569/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=4496825160409994569' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4496825160409994569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4496825160409994569'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2010/03/laws-that-govern-usability.html' title='Laws that govern usability'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-4751405711975246149</id><published>2010-03-25T22:20:00.006+05:30</published><updated>2010-03-25T23:40:31.883+05:30</updated><title type='text'>Usability a simplified and quantified</title><content type='html'>In continuation to the long rant, which I felt didn't do justice to aspiring learners; I decided to come up with a more tangible definition. Usability is all about not having annoyances or minimising them to such a level that people can easily adapt. What are annoyances? Nice question, to quantify a good user friendly app we need to quantify annoyances. Annoyances in this article are quantified with a margin/window of acceptability. There cannot be an absolute definition.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt; Annoyances story&lt;/h3&gt;&lt;br /&gt;The user who sits before any tool, intends to convey his intention and get his work done. The ability to convey the intention needs to be of absolute priority. Every step that separates him from the goal is annoyance. What are the possible intermediateries? Think of what all can be done with the tool, say the computer. Typing, clicking, drag-drop, scroll, context-switching, reading... name it. All these are annoyances. Unfortunately we cann't communicate telepathically. So we have to rely on these. Think of a series of actions that take the user closer to the action/intent. The shortest sequence of steps wins the game. This is usability.&lt;br /&gt;&lt;br /&gt;So if some of you feel that, counting all these alternatives and arriving at a conclusion is usability, you are bang on. Usability has nothing to do with a GUI application. A command line app can also suffer from these pitfalls. For example: the simple &lt;b&gt;`rm`&lt;/b&gt; command on unix, which deletes a file or files can be used as an illustration. &lt;b&gt;rm *.c&lt;/b&gt; deletes all c files in the current directory, however before each delete it prompts for user interference. This is an annoyance, a useful one if the deletion is unintentional, but an annoyance in intentional cases. This command has another thoughtful alternative &lt;b&gt;`rm -f`&lt;/b&gt;, which forces the delete action with out user interference.&lt;br /&gt;&lt;br /&gt;Some common examples of usability in this scenario, are ability to perform direct actions, like click of a button or by a sequence of keystrokes. Toolbars and Menubars are excellent examples of these.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Focus and friends &lt;/h3&gt;&lt;br /&gt;Another aspect of usability is not to dissuade/distract the user. How do we inadvertently do this? By causing the user to pay attention to lots of unwanted detail. MS-Office does this, try looking at the menu/tool options. This is still better than other alternatives. Exposing a great deal of information causes user to loose his/her focus. Focus is the keyword. Think of it as a snipers scope. The field of vision is pretty much narrowed. This actually forms a circular picture. However, we rarely see circular interfaces. IPod is a brilliant exception though. Why don't we see them? It was not always the case, In case you had seen a grandfather radio with round knobs, you would realise it. Early mechanical devices had this. Most dslr cameras have similar dials.&lt;br /&gt;&lt;br /&gt;GUI apps are intended to convey textual information for the most part. One can argue about multi-media and graphical representations, but let us generalize a bit. Humans are taught to read text in a linear fashion, horizontally or vertically depending on the cultural and linguistic backdrop. Circles don't use space effectively. If you were to fill a box with balls against cubes, there would be empty spaces. This is another reason. The space efficient ones are not used to save space but on the contrary, to emphasize on space. Space is a very important aspect. Reason, it helps people focus better, what is easier to identify a needle in a haystack or a needle on a table?&lt;br /&gt;&lt;br /&gt;To enable better focus, space is a pre-requisite. What else? Well contrast and Fitt's law. Imagine borat in a corporate setting, funny and easily catches attention. Imagine him on a beach setting, not as easy to see. Contrast here implies ability to stand-out of the context. Fitt's law speaks of the same. Yes, I mentioned it earlier, Fitt's law in simple terms: The larger the object and closer to the context, the easier it gets picked.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;No silver bullets&lt;/h3&gt;&lt;br /&gt;Adherence to above points doesn't result in usable apps, non-adherence causes annoying apps. Remember our definition of usability, eliminate annoyances. Confusing words in the first line? Well let me explain, It is important to understand rules so that we know how to break them. Adherence only helps in understanding, non-adherence at times help improve upon them. Lets see an example. Regardless of what I have stated, users like to focus, in fact so much that they become impatient if there is nothing to focus. Like the waiting time for a screen to load. So we need to distract their focus, causing them to switch to some other annoyance (a minor one), like a animation or a simple message or a change of color. This minor details make a lot of difference. &lt;br /&gt;&lt;br /&gt;&lt;h3&gt; Ghosts that haunt &lt;/h3&gt;&lt;br /&gt;So simply put, usability is ease of focusing and features aiding in focusing. Lets see some anti-focus patterns. Small text is a killer, the focal circle contains too much detail. Asking for user interference is another killer, ever heard of UAC in Windows Vista. To be fair, a security concious person likes it, I do and I am a sceptic :). If a distraction comes up and goes away repetitively, it is an annoyance. For example, alert sounds or animations begging for attention. Do you know that certain visuals can induce epilepsy in certain demographics? You wont' certainly like talking to their lawyers, would you. Another major annoyance is small UI controls that violate Fitts' law. Why in the world is a radio button/check box so small? If you adhere to web standards, you would notice that clicking on the label lets to select the small UI control. Try yahoo, Pretty convenient isn't it. The problem with UI controls is that, the vendor owns them, and it is difficult to have customised UI controls. Note to self: let your grand-ma try the UI before shipping it.&lt;br /&gt;&lt;br /&gt;Finally, device dependent interfaces have their own faulty assumptions. Some people are happy using mouse (most windows users). Some others with keyboard (Vi editor any one). Focus switching on an app needs to consider these two major demographics (at least, if I may add). In the next article we shall see some key components and their strengths and weaknesses.&lt;br /&gt;&lt;br /&gt;::The most intuitive interface know to mankind is the nipple, the rest are just leant::&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-4751405711975246149?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/4751405711975246149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=4751405711975246149' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4751405711975246149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4751405711975246149'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2010/03/usability-simplified-and-quantified.html' title='Usability a simplified and quantified'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-6924837146627144027</id><published>2010-03-25T00:35:00.003+05:30</published><updated>2010-03-25T01:14:35.381+05:30</updated><title type='text'>What makes UI development painful</title><content type='html'>UI development is a strange area, almost everyone loves it. Almost, everyone in the beginning. Then there are haters, almost everyone hates code developed by others. Then comes a new demographic, those how hate their own code. Why is it such a tumultuous relationship?&lt;br /&gt;&lt;br /&gt;To understand this, we need to understand the relative frame of reference or the background perspective. Most developers don't work on UI for the most part of their time. They work of back-end solutions which require little user interaction. Like a automation which takes inputs once and then goes on its way. The results are not very apparent, until someone tests them. The defects once fixed are mostly fixed (subjective really, but assuming presence of a skilled person). There would be new defects but not the same ones and people perceive the end result in a boolean fashion (YES it works or NO).&lt;br /&gt;&lt;br /&gt;UI on the other hand is an aesthetic, scientific and subjective dilemma. &lt;h3&gt;Aesthetics!&lt;/h3&gt; Not the ones you perceive, whilst I agree that visual aesthetics are required, I am not speaking of them. What I mean to state is the design aesthetics, how easy it is for a complete stranger (who happens to be developer) to appreciate the classiness of code, ease of fixing and tweaking. &lt;h3&gt;Scientific&lt;/h3&gt; kick me if you want, &lt;b&gt;usability&lt;/b&gt; is a science, a cultural philosophy, a psychological undertaking. How many of us have read this, let alone understand? Added to this is the technical complexity, does my solution e platform support these features? do the requirement specs agree with this? &lt;h3&gt;Subjective&lt;/h3&gt; This is slightly different from usability, as the usability definition covers the most part. I will relent if someone claims this needs to be grouped under usability, but it is my blog buddy. I call it subjective because of one question, When was the last time you were absolutely sure that your POV is same as that of the worlds. Not even mass media (cinema, popular literature, advts.) achieve this. &lt;br /&gt;&lt;br /&gt;In the beginning, UI is all green and hunky-dory. I want a button/panel/widget/name it, I write and see it immediately. Wow from self, Wow from boss, Wow from stakeholders. Then comes the ugly monster, "Its all nice, now I need this and want this". Ok, a minor setback. Go back, jump into your RAMBO pants to save the world and achieve this. Not bad is it, repeat this 100 times. The testing team, the users, the changing requirements, the neighbourhood kid, grandma next door...God-dammit, stop! had enough. The world is insane, I quit. Then the boss says, dude what do I pay you for. Get it done. A big sigh.&lt;br /&gt;&lt;br /&gt;Why so many questions? Simple, UI evolves and everyone perceives it. It is not taken for granted like back-end code. So where to start-off, Keep the following in mind.&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Nothing is perfect, not even the solution architecture being used. Ever heard of leaky abstractions? Go google it&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Design patterns are not meant to be read, but practiced&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Learn, learn alot; read, read a lot; what ticks, what doesn't; how the technology works. Question everything. Try to mimic the ones you liked&lt;/li&gt;&lt;br /&gt;&lt;li&gt;People complain of minor annoyances, because repeated annoyances are irky. Annoyances force them to learn, A good UI is forgiving and robust, if they miss these they will complain. Ask any windows user who moved to MAC&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Don't try to write smart code or quick fixes. You need to be twice as smart to debug it/fix it. Invest time. If you don't have time now, how will you spare it later on?&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;I will post about tricks that will save the day in later posts. Keep reading.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-6924837146627144027?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/6924837146627144027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=6924837146627144027' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6924837146627144027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6924837146627144027'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2010/03/what-makes-ui-development-painful.html' title='What makes UI development painful'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-6843802616114246337</id><published>2009-06-08T12:10:00.002+05:30</published><updated>2009-06-08T13:06:56.264+05:30</updated><title type='text'>Wailing is our Birth Right, ... right?</title><content type='html'>If you happen to read dilbert, you would appreciate working on software (no sarcasm). Dilbert exaggerates the ignorance of the non-techie manager, claims to throw light on the self-righteous attitude and ineptitude of human beings. Dilbert in fact represents every thing a typical slashdotter/digger represents. I hate dilbert for that, but I love much more for being that. My geekiness quotient may not be as high, but nerd-meter rarely fails to tune to the frequencies of the nerd stations.&lt;br /&gt;&lt;br /&gt;Most folks who enter an organisation (barring the freshers) have a good amount of apprehension, once you get them talking, you will find that almost everyone has some thing or other to say. Most of them crib about their boss/collegues, and other choose to complain about of the following A.) Company B.) Work/Work culture C.) Compensation.&lt;br /&gt;&lt;br /&gt;To be fair to the management, Team building is not an easy exercise. Team is more than sum of the individuals. Most workers agree with this, but their egos don't. This is the core cause of resentment. Human tendency to compare with peers always leads them to confusion. To make a judicious decision, one needs to think of the pros-cons and evaluate them. Unfortunately, we don't do that when giving our commentary (free-speech any one). Life would have been more simpler and logical if introspection was built into our gene code. Humans are not logical, as Jim Kirk correctly summarised.&lt;br /&gt;&lt;br /&gt;A greek philosopher from Athens, was once found squatting besides the citadels' entrance. A passerby came to him asking how the people of city would behave. The wise man in turn asked the stranger, where he came from and how the people over there treated him. The stranger told him that he was from sparta and was full of praise for spartans. The wise man told him that the athens would be no different. Some time passed by and another stranger came to him with a similar inquiry. The stranger many qualms and complaints about the sparta. The wise man's reply was still the same.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-6843802616114246337?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/6843802616114246337/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=6843802616114246337' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6843802616114246337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6843802616114246337'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2009/06/wailing-is-our-birth-right-right.html' title='Wailing is our Birth Right, ... right?'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-1771678712289039864</id><published>2009-04-30T23:43:00.000+05:30</published><updated>2009-04-30T23:46:44.939+05:30</updated><title type='text'>Puzzles and more physics</title><content type='html'>To cut the long story short, visit http://www.faqs.org/faqs/puzzles/archive/physics/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-1771678712289039864?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/1771678712289039864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=1771678712289039864' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1771678712289039864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1771678712289039864'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2009/04/puzzles-and-more-physics.html' title='Puzzles and more physics'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-3677392622887361907</id><published>2009-04-22T09:28:00.001+05:30</published><updated>2009-04-22T09:33:00.527+05:30</updated><title type='text'>2^6 things you wish you did!</title><content type='html'>Found this on digg, the original source seems to be down (digg effect?)&lt;br /&gt;&lt;br /&gt;This is Google's cache of http://laptoplogic.com/resources/64-things-every-geek-should-know. It is a snapshot of the page as it appeared on 21 Apr 2009 10:39:57 GMT. The current page could have changed in the meantime. Learn more&lt;br /&gt;&lt;br /&gt; 64 Things Every Geek Should Know&lt;br /&gt;&lt;br /&gt;April 21, 2009 at 03:04:28 AM, by Blair Mathis  &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;If you consider yourself a geek, or aspire to the honor of geekhood, here's an essential checklist of must-have geek skills. &lt;br /&gt;&lt;br /&gt;The term 'geek', once used to label a circus freak, has morphed in meaning over the years. What was once an unusual profession transferred into a word indicating social awkwardness. As time has gone on, the word has yet again morphed to indicate a new type of individual: someone who is obsessive over one (or more) particular subjects, whether it be science, photography, electronics, computers, media, or any other field. A geek is one who isn't satisfied knowing only the surface facts, but instead has a visceral desire to learn everything possible about a particular subject. &lt;br /&gt;&lt;br /&gt;A techie geek is usually one who knows a little about everything, and is thus the person family and friends turn to whenever they have a question. If you're that type of person and are looking for a few extra skills to pick up, or if you're a newbie aiming to get a handhold on the honor that is geekhood, read on to find out what skills you need to know. &lt;br /&gt;&lt;br /&gt;1. The Meaning of Technical Acronyms&lt;br /&gt;USB - Universal Serial Bus &lt;br /&gt;GPU - Graphics Processing Unit &lt;br /&gt;CPU - Central Processing Unit &lt;br /&gt;SATA - Serial ATA &lt;br /&gt;HTML - Hyper-text Markup Language &lt;br /&gt;HTTP - Hypertext Transfer Protocol &lt;br /&gt;FTP - File Transfer Protocol &lt;br /&gt;P2P - Person to Person data sharing &lt;br /&gt;2. How to Reset RAM&lt;br /&gt;If you rolled your eyes here, that is a good thing. If not, you have many things to learn, young padawan. It's amazing how few people know how to do this. If you're unsure, hit up the link below to find out how:&lt;br /&gt;&lt;br /&gt;http://www.yousaytoo.com/sudjarwo/how-to-reset-ram-in-a-computer/29133 &lt;br /&gt;3. Identify Keyloggers&lt;br /&gt;&lt;br /&gt;Internet cafes are the most likely place you'll find them, followed by library, perhaps, and maybe even you own house if you've some unscrupulous friends/family. Identity theft groups warn about keyloggers and advocate checking out the keyboard yourself before continuing. Can you identify a keylogger, however, if one is plugged into the back of the system?&lt;br /&gt;&lt;br /&gt;Here's what one looks like:&lt;br /&gt;&lt;br /&gt;Hit up this link for excellent info on keyloggers on public computers and how to protect yourself:&lt;br /&gt;&lt;br /&gt;, http://www.ghacks.net/2007/06/28/how-to-defeat-most-keyloggers-on-public-computers/ &lt;br /&gt;4. Surf the Web Anonymously&lt;br /&gt;We won't make any assumptions about why you may need this particular skill, but the fact remains that every geek should know how to traverse the Internet with the highest amount of security possible. &lt;br /&gt;&lt;br /&gt;Aside from the safest method--which is using a connection that is not yours--you will need the ultimate in proxies...Tor. Tor is an onion-routing system which makes it 'impossible' for someone to find out who you actually are. &lt;br /&gt;&lt;br /&gt;5. Bypass a Computer Password on All Major Operating Systems&lt;br /&gt;Obviously you shouldn't use this to gain unlawful access to a computer. If you're a geek, however, you'll eventually end up in a situation where someone forgets their password, you acquire a machine with an operating system you cannot access, or similar situation. &lt;br /&gt;&lt;br /&gt;See this tutorial for info on how to bypass the password on the three major operating systems: Windows, Mac, and Linux.&lt;br /&gt;&lt;br /&gt;http://www.joetech.com/2009/01/29/how-to-crack-the-account-password-on-any-operating-system/ &lt;br /&gt;6. Find a Users IP Address on AIM&lt;br /&gt;Knowing someones IP address is actually pretty useless in this case, but most people don't realize that. If someone is harassing you via AIM and you can't get them to stop, discovering their IP and sending it to them--with a nicely worded threat of law enforcement involvement should they not stop--is likely enough to send them scamping away with tail between legs. &lt;br /&gt;&lt;br /&gt;http://www.elitehackers.info/forums/archive/index.php/t-2827.html &lt;br /&gt;7. Hide a File Behind a JPEG&lt;br /&gt;So you need a nice spot to hide your blackmail personal files. You could, of course, bury them deeply within a series of random, useless folders, but there's always the chance of them being discovered. A password protected RAR is the best choice, but it's a bit obvious despite the most boring title you could give it. &lt;br /&gt;&lt;br /&gt;A sneaky person would hide the important file behind a completely random and boring family reunion photo, where no person in their right mind would shift through. &lt;br /&gt;&lt;br /&gt;http://www.online-tech-tips.com/computer-tips/hide-file-in-picture/ &lt;br /&gt;8. Crack a Wifi Password&lt;br /&gt;This is one of those things you don't need to do (hopefully), but that you still need to know just for the sake of knowledge. A strong WPA password is very secure, but most people don't want to bother learning a convoluted series of letters, numbers, and symbols, instead opting for random everyday words. &lt;br /&gt;&lt;br /&gt;A good overall tutorial on wifi and cracking can be found here: http://docs.lucidinteractive.ca/index.php/Cracking_WEP_and_WPA_Wireless_Networks&lt;br /&gt;&lt;br /&gt;9. Monitor Network Traffic&lt;br /&gt;&lt;br /&gt;The Internet is a vast place with a bit of everything. Whether you're curious about what your roommate is downloading, your kid is getting into, or any leeches living around you who've unscrupulously breached your wifi, knowing how to analyze network traffic is an invaluable skill. &lt;br /&gt;&lt;br /&gt;Here is a list of dozens of network analyzers, as well as some general info to get you started: http://www.slac.stanford.edu/xorg/nmtf/nmtf-tools.html&lt;br /&gt;&lt;br /&gt;10. Recover Master Boot Record&lt;br /&gt;A virus or other problem can lead to an MBR error, which will make it impossible to access install. Many users would simply become frustrated and reinstall, but not you! Every geek should know how to recover the master book record. &lt;br /&gt;&lt;br /&gt;Here is an excellent guide to get started: http://www.ntfs.com/mbr-damaged.htm&lt;br /&gt;&lt;br /&gt;11. Retrieve Data off Hard Drive&lt;br /&gt;There will come some point in your life when a hard drive craps out sans warning. It could be due to a number of reasons--physical damage, file corruption, etc. There are computer service centers that would be happy to extract the data for a (hefty) fee; a true geek would be the one working at center, not taking his or her drive there. &lt;br /&gt;&lt;br /&gt;To find out how to retrieve data off a damaged hard drive, read here: http://laptoplogic.com/resources/5-ways-to-retrieve-data-off-a-crashed-hard-drive&lt;br /&gt;&lt;br /&gt;12. Load Rockbox onto an MP3 Player&lt;br /&gt;The firmware that comes on your average mp3 player is intended for those who are scared of advanced features; often, the only audio settings available are a few prearranged EQs. If you're an audiophile--or simply frustrated with the lack of control over your music settings--Rockbox is the firmware for you. Open source and free, it can be installed on several different types of players and enables full control over what you listen to. &lt;br /&gt;&lt;br /&gt;http://rockbox.org &lt;br /&gt;13. Unbrick a Smartphone&lt;br /&gt;No geek can resist the allure of flashing the newest beta firmware onto their shiny smartphone. The byproduct of that is sometimes a bricked phone, which would leave many sobbing into their pillow at night. To avoid rendering your $400 gadget into a door stopper, learn the fine art of unbricking and then flash away. &lt;br /&gt;&lt;br /&gt;As the method used to fix a phone will vary, this is the best place to start looking for answers: http://www.howardforums.com/&lt;br /&gt;&lt;br /&gt;14. Replace a Laptop Keyboard&lt;br /&gt;Keyboards get gummy after awhile. If you use yours a lot (aka: all day), then you probably eat over it at some point. Crumbs get into the keys and things are sticking, and before you know it, you need a new keyboard.&lt;br /&gt;&lt;br /&gt;http://www.refurbished-laptop-guide.com/how-to-remove-a-laptop-keyboard.html&lt;br /&gt;&lt;br /&gt;15. Rip Streaming Videos&lt;br /&gt;Streaming videos are officially in vogue. We're not going to make any assumptions about what type of videos you are streaming and may want to keep, but no matter what it is, any geek could rip them while sipping a Red Bull and watching the latest episode of BSG. &lt;br /&gt;&lt;br /&gt;Here's a hint to get you started: http://applian.com/download-videos/&lt;br /&gt;&lt;br /&gt;16. Strip Windows DRM&lt;br /&gt;DRM is incredibly annoying. With many online stores now offering DRM-free mp3 audio files, it would seem it's not as big of an issue as it used to be. That is not not the case, however, with all videos bearing a DRM as well as music of a higher-quality than MP3. &lt;br /&gt;&lt;br /&gt;Stripping Windows DRM is not legal. If you're a geek, your probably don't care: http://undrm.info/remove-DRM-protection/FairUse4WM-freeware-DRM-removal-Windows-software-Strip-copy-protection-from-WMV-ASF-WMA-Windows-Media-Player.htm&lt;br /&gt;&lt;br /&gt;17. Homebrew Hack Game Systems&lt;br /&gt;Gaming consoles are notorious for having features you can't use simply because the manufacturer decided to lock them down. As a geek, you can't just be satisfied with the features they decided to give you. No, you have to crack that case open and take a peek inside. Every geek should know how to homebrew hack their system and unlock it's full potential. &lt;br /&gt;&lt;br /&gt;18. Find a Website IP Address Without Web/Command Prompt Access&lt;br /&gt;Some school admins think they're being sneaky when they lock down the command prompt and block all major IP search websites and block all the websites you actually want to visit. Of course, that is child's play for any geek. &lt;br /&gt;&lt;br /&gt;First, to get a new command prompt, open Notepad and type: command.com. Then, save as "cmd.bat". You now have a command prompt. &lt;br /&gt;&lt;br /&gt;Now, open the command prompt and type "ping http://www.website.com/" to find the IP address of that website. &lt;br /&gt;&lt;br /&gt;Enter the website into the browser and you will officially have impressed all your friends. &lt;br /&gt;&lt;br /&gt;19. Bypass School or Work Website Blocks&lt;br /&gt;What is a horrific situation for an average computer user is a simple irritation for an everyday geek. To bypass a website block/filter, simply enter that websites IP address in instead of the actual site address. &lt;br /&gt;&lt;br /&gt;20. Screw with Wifi Leeches&lt;br /&gt;Nobody likes a wifi leech. At best, they're simply using up your valuable bandwidth. At the worst--and far more likely, they're stealing your identity and watching your activities. After watching your network and identifying the leech, use this trick to flip their browser upside down and let them know you don't appreciate the intrusion. &lt;br /&gt;&lt;br /&gt;http://tech.nocr.at/hacking-security/baffle-wifi-leeches-with-an-upside-down-ternet-2/&lt;br /&gt;&lt;br /&gt;21. Hexadecimal and Binary Number Systems&lt;br /&gt;Everyone knows the normal, everyday digit system used. It takes a special--possibly psychotic person--to also know hexadecimal and binary number systems. &lt;br /&gt;&lt;br /&gt;Here is an excellent interactive tutorial on learning the two systems: http://www.wisc-online.com/objects/index_tj.asp?objID=DIG1102&lt;br /&gt;&lt;br /&gt;22. How to Hot Wire a Car&lt;br /&gt;If your family always turns to you any time their computer hiccups, their DVD player needs fixed, or their home security system doesn't activate, it's only a matter of time before someone asks you how to hot wire a car. Wouldn't it be great to be able to answer them?&lt;br /&gt;&lt;br /&gt;To learn this unique skill, read here: http://howto.wired.com/wiki/Hot_Wire_Your_Car&lt;br /&gt;&lt;br /&gt;23. Increase Wifi Range&lt;br /&gt;With so many small portable gadgets gaining more and more sophisticated web browsers, in addition to gaming systems like the PSP and DS, getting the most use out of your wifi is practically a geek necessity. &lt;br /&gt;&lt;br /&gt;Here is a good guide on extending your wifi's range: http://www.mavromatic.com/archives/000451&lt;br /&gt;&lt;br /&gt;24. Carrying a Computer Cleaning Arsenal on Your USB Drive&lt;br /&gt;A good geek prepares for their friends stupidity. No matter how many times you tell them to stop downloading porn, they keep doing it until their machine is so infected it can't drag itself into a grave. An arsenal of portable malware cleaners, a portable task manager, anti-virus, etc, will make those impromptu purging sessions all the easier. &lt;br /&gt;&lt;br /&gt;25. Running an Operating System from a USB Thumb Drive&lt;br /&gt;Most people don't even understand what the magical operating system is. As a geek, you should transcend that basic knowledge and have a small operating system on your thumb drive handy for those times you need computer access but don't know the password to a nearby computer. &lt;br /&gt;&lt;br /&gt;http://www.pendrivelinux.com/&lt;br /&gt;&lt;br /&gt;26. Understand What "There's no Place Like 127.0.0.1" Means&lt;br /&gt;A lot of geeks wear this shirt as a short hand code for their computer finesse--or maybe just to screw with other people who stare but cannot figure out what it means. No matter the reason, if you'd like an answer, check out the link below. &lt;br /&gt;&lt;br /&gt;http://www.tech-faq.com/127.0.0.1.shtml &lt;br /&gt;27. Read 1337 At Normal Speed&lt;br /&gt;Sure, everyone knows about it and it's no longer cool, but if you're going to proclaim yourself as a geek, you should be able to read it full speed. Who wants to choke in front of the wannabe that learned to read it full speed and flaunts it in your face?&lt;br /&gt;&lt;br /&gt;http://www.wikihow.com/Read-and-Write-in-1337 &lt;br /&gt;28. At Least One Fictional Language&lt;br /&gt;And not only should you know a fictional language, but you should use it to say something about yourself. Do you choose Klingon or Quenya? &lt;br /&gt;&lt;br /&gt;Here's a list of constructed languages: http://en.wikipedia.org/wiki/List_of_constructed_languages&lt;br /&gt;&lt;br /&gt;29. How to Survive in a Linux Argument&lt;br /&gt;Linux is gaining an all around higher standing in the geeksphere, and it's bound to enter a conversation at some point (which will invariably end up turning into an argument). If you want to keep up, you'll need to understand the basic points of Linux, as well as the general info of all basic things. &lt;br /&gt;&lt;br /&gt;Here's a good place to read and gain a foothold: http://www.linux.com/articles/feature/&lt;br /&gt;&lt;br /&gt;30. Identify Major Constellations&lt;br /&gt;For those times you venture from the air-conditioned, computer filled basement of your parents house (or something like that), look up at the stars and have yourself a Galileo moment. The stars may just be dots to many people, but with the handy website below, you'll be stopping man-belts and lions in no time. &lt;br /&gt;&lt;br /&gt;http://www.sky-watch.com/astronomy-guide/major-constellations.html &lt;br /&gt;31. Use a Camera in Manual Mode&lt;br /&gt;Sure, you could just use auto mode like everyone else too afraid to learn what some letters and numbers mean, but then you wouldn't be much of a geek, would you? The oft-ignored dial on a camera is the key that unleashes the best quality photos possible, and every geek should be a whiz at using one. &lt;br /&gt;&lt;br /&gt;http://digital-photography-school.com/digital-camera-modes &lt;br /&gt;32. Who Mulder and Scully Are&lt;br /&gt;It seems that in the plethora of geek websites, there always appears a joke about Mulder and Scully, the two main characters from the X-Files. If you don't know who they are, you'll be left in the dark, alone, contemplating what exactly it was you were doing in the 90's that you wouldn't understand the joke. &lt;br /&gt;&lt;br /&gt;http://en.wikipedia.org/wiki/Mulder_and_Scully_(song)&lt;br /&gt;&lt;br /&gt;33. Javascript&lt;br /&gt;HTML is running the world (not really). Everyone knows some HTML and it makes them feel empowered. As a geek, you want to transcend that basic knowledge others share and know a little more. JavaScript is the answer--it is easy to learn if you're not actually interested in web programming, but simply curious, and it looks scary to anyone who doesn't know it. &lt;br /&gt;&lt;br /&gt;http://www.yourhtmlsource.com/javascript/basicjavascript.html&lt;br /&gt;&lt;br /&gt;34. How to Unlock an iPhone&lt;br /&gt;Sure, most geeks wouldn't be caught dead with an iPhone, but what about your friends? You're the smart techie, they'll expect your to know how to unlock it. &lt;br /&gt;&lt;br /&gt;http://www.pcworld.com/article/137223/how_to_unlock_an_iphone.html&lt;br /&gt;&lt;br /&gt;35. How to Install Mac OS X on a PC&lt;br /&gt;Just because you don't want Mac on your PC doesn't mean you shouldn't know how to do it. Knowledge is power, right? Go ahead, use this to stump your friends and family. &lt;br /&gt;&lt;br /&gt;http://dailyapps.net/2007/10/hack-attack-install-leopard-on-your-pc-in-3-easy-steps/ &lt;br /&gt;36. Build a PC&lt;br /&gt;If you purchase a ready-made PC, you can be sure of one thing--you're paying more than you should. Assembling your own PC isn't too hard, and is the first thing you should be aiming to accomplish as a geek. &lt;br /&gt;&lt;br /&gt;Here is a massive article on assembling your own PC: http://www.pcmech.com/byopc/&lt;br /&gt;&lt;br /&gt;37. Tethering a Smartphone&lt;br /&gt;Nothing like a little wifi on the move, eh? Tethering a smartphone means using the Internet on your laptop/netbook via your cell phone. Of course, the method to do this depends on your phone, but here's an article to get your started:&lt;br /&gt;&lt;br /&gt;http://www.tech-recipes.com/rx/2276/smartphones_bb_treo_tether_modem_usa_carriers/ &lt;br /&gt;38. Wiring a Home Theater System&lt;br /&gt;Home theater systems used to consist of a TV and a chair. Gone are those days of simplicity, however, and setting up a modern system can be pure mind-boggling horror. Where does the modulator go, why does the DVD player have no video and the cable box no sound?&lt;br /&gt;&lt;br /&gt;Here's a tutorial, including excellent diagrams, to show you how: http://www.prillaman.net/ht_info_8-wiring.html&lt;br /&gt;&lt;br /&gt;39. Replacing a Laptop LCD&lt;br /&gt;Laptop LCDs are vulnerable to many different mishaps: accidental pressure spots, shadows, airsoft pellets.... No matter, there will come a point when you need to swap your LCD for a new one. Now, as a geek, you probably don't have an extended warranty. If that's the case, here are some excellent pages and pictures on replacing the display:&lt;br /&gt;&lt;br /&gt;http://www.fonerbooks.com/laptop_4.htm &lt;br /&gt;40. Make a Laptop Cooling Pad&lt;br /&gt;Can you believe these cost $50?! A geek will need one, because data crunching/DVD ripping/videos playing/rendering at the same times tends to cause excess heat. Instead of shelling out your hard earned dollars, make your own like so: http://www.instructables.com/id/Lazy-mans-laptop-cooler/&lt;br /&gt;&lt;br /&gt;41. Unleash a Laser Pointer's full potential&lt;br /&gt;A normal person uses a laser pointer to drive their dog crazy. A geek uses it to melt butter for their grilled cheese sandwich. To unless a laser pointer's full strength, crack open the case, fry the resistor with a hot soldering iron, then snap it back together and keep it away from flesh/eyes/airplanes. The pointer will burn out after a few hours, but what a fun few hours they will be. &lt;br /&gt;&lt;br /&gt;Note: this is dangerous. Don't do anything stupid.&lt;br /&gt;&lt;br /&gt;42. Keyboard Shortcuts&lt;br /&gt;This will depend on your operating system and the apps you use, so there's no tutorial available. However, that is irrelevant--you're a geek, you can find them yourself. Shortcuts are the difference between a slow computer user and a geek. The geek will always will out in a speed contest, because they do practically everything from their keyboard. &lt;br /&gt;&lt;br /&gt;43. Soldering Glasses Together&lt;br /&gt;&lt;br /&gt;Nerds use tape on broken glasses; geeks use solder. 'Nuff said. &lt;br /&gt;&lt;br /&gt;44. How to Execute a Shell Script&lt;br /&gt;If you're a true geek, you'll need to do this at some point. Below are instructions on how to do so. Remember: always be cautious when running a script, you don't want your computer to turn into a door stop, now do ya?&lt;br /&gt;&lt;br /&gt;http://www.mcsr.olemiss.edu/unixhelp/scrpt/scrpt1.2.html &lt;br /&gt;45. How to Hack a Pop Machine&lt;br /&gt;Okay, so stealing isn't cool. Still, hacking is simply a misunderstood art, right? So hacking a pop machine isn't really stealing, because it's not about the pop, it about the pleasure of getting your way. Or something like that. (Newsflash, it is illegal, don't do it.) If you want to try your fingers at getting a free Coke, check out this link:&lt;br /&gt;&lt;br /&gt;http://skattertech.com/soda-machine-hack/ &lt;br /&gt;46. Turn a Laptop into a Digital Picture Frame&lt;br /&gt;So you want to show off pictures of your dog and that girl you once met, but you want to do it in an uber geeky way. Any schmuck can go to Walmart and buy a digital picture frame for a grossly inflated price. But you...oh, you're too smart for that. No, instead you'll find an old laptop on eBay for $5 and turn it into a true work of art. &lt;br /&gt;&lt;br /&gt;http://repair4laptop.org/notebook_picture_frame.html &lt;br /&gt;47. How to Mod a Flash Drive Case&lt;br /&gt;All the geeks are doing it.... Whatever. The case your flash drive came in is probably weak and most certainly plain. Why not jazz it up with your own unique style? &lt;br /&gt;&lt;br /&gt;Here's one such case mod, and dozens of related projects: http://www.instructables.com/id/Metal-USB---Flash-drive-case-mod/&lt;br /&gt;&lt;br /&gt;48. Do Cool Things to Altoids Tins&lt;br /&gt;People are obsessed with these things. Altoids tins are durable, small, and just begging to be filled with LEDs, mp3 players, audio amps, and maybe some snuff. A good geek will find millions of uses for these little metal wonders. If you need a mental boost, however, here's some interesting links:&lt;br /&gt;&lt;br /&gt;http://www.squidoo.com/altoids-tins &lt;br /&gt;49. Convert Cassette Tapes to Digital Audio Files&lt;br /&gt;If your geekhood started in the 90's, then you probably have a least a few (dozen) cassette tapes still sitting around. Why not breathe digital life into them before they fall ill to mortal fate? &lt;br /&gt;&lt;br /&gt;http://lifehacker.com/software/mp3/alpha-geek-how-to-digitize-cassette-tapes-222394.php &lt;br /&gt;50. Lock Your Computer with a USB Drive&lt;br /&gt;You don't want anyone getting into your files while you're gone. A normal password would be enough to keep most people out, but what if you got super-secret X files on your computer? You can lock your machine down with a USB drive via these instructions:&lt;br /&gt;&lt;br /&gt;http://lionjkt.wordpress.com/2008/12/31/how-to-lock-your-computer-with-usb-drive/ &lt;br /&gt;51. Run Your Own Ethernet Line&lt;br /&gt;Wifi has taken the place of a wired connection in many homes, and with good reasons--you can go anywhere, no cables necessary. What about those...sensitive...activities that you'd rather the neighborhood script kiddie didn't see on your wifi? An Ethernet cable is your solution. &lt;br /&gt;&lt;br /&gt;To wire your own Ethernet, hit up this link: http://www.ertyu.org/steven_nikkel/ethernetcables.html&lt;br /&gt;&lt;br /&gt;52. Set Up a Streaming Media Server&lt;br /&gt;With digital files becoming the ultimate medium, many people have hundreds of gigabytes worth of music, videos, and pictures. You could keep them on a portable hard drive, but then you're have to take it everywhere, and only one person could use it at a time. The solution is a streaming media server, something no geek can live without. &lt;br /&gt;&lt;br /&gt;http://www.n00tz.net/2008/07/vlc-media-server-ubuntu-hardy/ &lt;br /&gt;53. Setting up a VPN&lt;br /&gt;If you're like most geeks, you can't live without your computers. They store your life in some poetic fashion, holding files you feel a personal connection with.... Anyway, if you are at work and suddenly realize you left an important picture at home (or you need blackmail material pronto), having a VPN ready to go will save you big time. &lt;br /&gt;&lt;br /&gt;http://www.computernetworkinghelp.com/content/view/41/1/ &lt;br /&gt;54. Turn Webcams into Security Cameras&lt;br /&gt;Is someone stealing your Netflix DVDs? Do you suspect it is a fat hairy man in his boxers taking them each morning? If so, you can get your proof using a couple webcams and a bit of software.&lt;br /&gt;&lt;br /&gt;http://www.simplehelp.net/2006/09/27/how-to-use-your-pc-and-webcam-as-a-motion-detecting-and-recording-security-camera/ &lt;br /&gt;55. Control Your House Lights with a Computer&lt;br /&gt;Controlling the lights in your house via computer is a great way to freak out the neighborhood kids ding-dong-ditching (assuming you wire up a Halloween scream motion sensor, also). If you reasons are less nefarious, you simply use it to turn on and off lights without having to life ye butt from thy seat, which is a good reason in itself. &lt;br /&gt;&lt;br /&gt;http://www.instructables.com/id/Control-lights-in-your-house-with-your-computer/ &lt;br /&gt;56. Play Retro Games without Retro Consoles&lt;br /&gt;This applies to the geeks who enjoy gaming. Setting up an emulation PC on your TV is a great way to relive those games of old.&lt;br /&gt;&lt;br /&gt;57. Put LEDs Inside a Lightbulb&lt;br /&gt;The days of hot incandescent and mercury-laden fluorescent are gone, and in are the days of long lasting, low heat, low consumption LEDs. As any good geek, you want to be able to say "I was doing X long before it became mainstream." Here's your chance--the following link will show you how to put an LED inside a lightbulb, something sure to stump your friends the same way Grandpa's ship-in-a-wine-bottle used to stump you. &lt;br /&gt;&lt;br /&gt;http://blog.makezine.com/archive/2006/06/make_a_led_bulb.html &lt;br /&gt;58. Create Music with Keyboard&lt;br /&gt;How awesome is KeyBored? This little app gives all of your QWERTY keys a piano note. When you type, it sounds like an infant monkey punching a keyboard. If you've got some musical chops, it won't take you long to figure out the Star Wars theme or find a hidden musical message in Counter Strike control buttons. &lt;br /&gt;&lt;br /&gt;http://thebatman.net/keybored/ &lt;br /&gt;59. Make Your Office Ergonomic&lt;br /&gt;Face it--you spend a lot of time at your desk. You might even have a few extra pounds and pallid skin to show for it. While those things are temporary, far to common and more serious is the carpal tunnel, eye strain, and back problems you'll develop from having a poor workspace. &lt;br /&gt;&lt;br /&gt;Hit up this link to create a body-friendly workspace that will keep you limber and flexible: http://www.ergotron.com/tabid/305/language/en-US/default.aspx&lt;br /&gt;&lt;br /&gt;60. Adding a Third Monitor&lt;br /&gt;Studies show that dual monitor increase work productivity by 30%. As a geek, you'll need a third monitor to equal the dual setup of a layman (if that makes sense). While any hack with a VGA port can add a second monitor, it takes a true geek to add a third (or more). This will vary based on graphics/OS, so hit up Google for a tutorial or two. &lt;br /&gt;&lt;br /&gt;61. How to Convert a DVD to x264 (or XviD or DivX)&lt;br /&gt;It might seem like child's play to you, but many individuals do not understand the fine art of converting a DVD into a digital file, let alone the careful skills it takes to achieve a happy balance between size and quality. &lt;br /&gt;&lt;br /&gt;Here is an excellent tutorial demonstrating how to rip a DVD with the multi-platform free software Handbrake: http://howto.diveintomark.org/ipod-dvd-ripping-guide/&lt;br /&gt;&lt;br /&gt;62. Flash System BIOS&lt;br /&gt;Ya gotta do it some time, so stop putting it off and man up. Flashing the BIOS on your laptop might seem scary (as it should--fear keeps you on your toes and prevents mistakes), but it's not (actually, it is, but if you even understand why you need to do this, you've gotta have at least a few chops by now). Warning--you can seriously bork your computer doing this!&lt;br /&gt;&lt;br /&gt;http://www.pcstats.com/articleview.cfm?articleID=1605 &lt;br /&gt;63. How to Irrecoverably Protect Data&lt;br /&gt;TrueCrypt, my friends. Learn to use TrueCrypt. If you have ask why, you don't need it. &lt;br /&gt;&lt;br /&gt;64. The Fastest way to Kill a Computer&lt;br /&gt;It's said that you have to get into a killers mind to understand their weaknesses, right? Same goes for the unfortunate boobs who always kill their laptops. Here's a list of all the different ways you can accidentally kill a computer--arm your family and friends, and save yourself grief (because it's surely you they will call when something goes horribly, horribly wrong). &lt;br /&gt;&lt;br /&gt;http://www.pcstats.com/articleview.cfm?articleID=1720&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-3677392622887361907?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/3677392622887361907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=3677392622887361907' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3677392622887361907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3677392622887361907'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2009/04/26-things-you-wish-you-did.html' title='2^6 things you wish you did!'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-5770255897792907166</id><published>2009-03-29T22:43:00.002+05:30</published><updated>2009-03-29T23:15:58.726+05:30</updated><title type='text'>Argument against business process expression languages</title><content type='html'>After a long awaited vacation, I'm back in office, It has been a refreshing experience. The next thing I see is myself getting invited into a meeting room and being shown assigned to a team dealing with work-flows. These are my first thoughts after looking at what I have in my plate...&lt;br /&gt;&lt;br /&gt;The most interesting thing about workflow software, is the ability to plug-in custom rules. They are highly configurable and customisable. Typically every workflow consists of series of acitivities with transitions connecting them. There are business rules written on top of these, which essentially dictate the life-cycle of the flow. In addition to this, there is a provision for forms (for user interaction). There is a strong constraint (what can/not be done) on the usage of these. These contracts/interfaces are designed for the most specific purpose of writing/wiring processes and come with a GUI designer. This provides superb illustration of what is happening where. So what is that, which struck a wrong note?&lt;br /&gt;&lt;br /&gt;The entire suite is designed with the noble intention that non-techie folks can use them. So the language is designed to be declarative (in the sense you specify what is needed and don't dictate how it is accomplished). There is an editor which assists in writing code using this syntax. This whole thing assumes that programing in general purpose languages is tricky and meant for programmers alone, (Utterly wrong IMO). Any imperative language is same in the sense, you have assignment, conditional and looping constructs. Some are better in that they provide rich data structures and memory management. A language meant for writing rules tries to emulate these in a more elaborate form. Did the authors ever heard about 3rd generation languages like BASIC and COBOL? They were supposed to be user friendly (read like english).&lt;br /&gt;&lt;br /&gt;I have to strongly disagree with the 'noble intention', one may ask why?, the answer: I am not a business analyst and I am being asked to fix defects in code written with myriad syntax! If it were so easy in the first place, the analysts themselves would fix them, why me? Isn't it the case where magic turns into mayhem? Why invent a language instead of specifying a framework with a strong contract?&lt;br /&gt;&lt;br /&gt;I may be complaining out of frustration, but I am not yet speaking of my inability to customise the UI, or introduce some kind of pattern for the sake of consistency. Understanding a moderately large workflow (not authoring) itself is taxing. I will probably need another break, so when is my next vacation...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-5770255897792907166?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/5770255897792907166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=5770255897792907166' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/5770255897792907166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/5770255897792907166'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2009/03/argument-against-business-process.html' title='Argument against business process expression languages'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-544453483653810950</id><published>2009-01-01T17:25:00.002+05:30</published><updated>2009-01-01T19:42:36.934+05:30</updated><title type='text'>Web development framework - Struts 1 - part2</title><content type='html'>In this post, we will see some nuances involved in struts-config.xml, as described earlier, struts-config is set of guidelines for actionservlet that help request delegation.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Struts config example&lt;/h3&gt;&lt;br /&gt;The following xml file illustrates some of the common features. &lt;br /&gt;&lt;table bgcolor="#dddddd" style="border:1px solid red" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;&lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;?xml&lt;/font&gt; version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; ?&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="blue"&gt;&amp;lt;!&lt;/font&gt;&lt;font color="maroon"&gt;DOCTYPE&lt;/font&gt; struts-config PUBLIC &amp;quot;-//Apache Software Foundation//DTD Struts Configuration 1.2//EN&amp;quot; &amp;quot;http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;struts-config&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;form-beans&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;form-bean&lt;/font&gt; name=&amp;quot;SimpleFormBean&amp;quot; type=&amp;quot;org.ui.beans.SimpleFormBean&amp;quot;&lt;font color="blue"&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;form-beans&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;global-exceptions&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;global-exceptions&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;global-forwards&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;forward&lt;/font&gt; name=&amp;quot;welcome&amp;quot;  path=&amp;quot;/Welcome.do&amp;quot;&lt;font color="blue"&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;forward&lt;/font&gt; name=&amp;quot;success&amp;quot;  path=&amp;quot;/success.jsp&amp;quot;&lt;font color="blue"&gt;/&amp;gt;&lt;/font&gt;        &lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;forward&lt;/font&gt; name=&amp;quot;showLogin&amp;quot; path=&amp;quot;/csaLogin.jsp&amp;quot;&lt;font color="blue"&gt;/&amp;gt;&lt;/font&gt;        &lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;global-forwards&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;action-mappings&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;        &lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;action&lt;/font&gt; input=&amp;quot;/csaLogin.jsp&amp;quot; name=&amp;quot;SimpleFormBean&amp;quot; parameter=&amp;quot;simpleShow&amp;quot; path=&amp;quot;/show&amp;quot; scope=&amp;quot;session&amp;quot; type=&amp;quot;org.ui.actions.SimpleStrutsAction&amp;quot;&lt;font color="blue"&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;action&lt;/font&gt; path=&amp;quot;/Welcome&amp;quot; forward=&amp;quot;/welcomeStruts.jsp&amp;quot;&lt;font color="blue"&gt;/&amp;gt;&lt;/font&gt;        &lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;action-mappings&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;message-resources&lt;/font&gt; parameter=&amp;quot;com/myapp/struts/ApplicationResource&amp;quot;&lt;font color="blue"&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;message-resources&lt;/font&gt; key=&amp;quot;newBundle&amp;quot; parameter=&amp;quot;com/myapp/struts/NewResource&amp;quot;&lt;font color="blue"&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;font color="green"&gt;&lt;font color="blue"&gt;&amp;lt;!&lt;/font&gt;&lt;font color="maroon"&gt;--&lt;/font&gt; ========================= Validator plugin ================================= --&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;plug-in&lt;/font&gt; className=&amp;quot;org.apache.struts.validator.ValidatorPlugIn&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;set-property&lt;/font&gt;&lt;br /&gt;            property=&amp;quot;pathnames&amp;quot;&lt;br /&gt;            value=&amp;quot;/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml&amp;quot;&lt;font color="blue"&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;plug-in&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;struts-config&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;The config file is made up  of three major aspects: formbeans, action mappings, message-resources. ActionServlet processes the action mappings and identifies the action to be used for the current request. The 'path' attribute influences the decisions. The action element in xml also specifies the target action class in 'type' attribute and form bean to be used using 'name' attribute. The form bean listed in 'name' also listed under form beans element in the config xml file. The class used for bean representation is mentioned here. An action element can also directly map to a html or jsp file.&lt;br /&gt;&lt;br /&gt;The action class contract dictates the use of execute() method. (however, using dispatch action forms with parameters, we can call any method of our choice). The form-bean as discussed earlier, is a good candidate for validation actions.&lt;br /&gt;&lt;br /&gt;An example of how validations would look.&lt;br /&gt;&lt;br /&gt;&lt;table bgcolor="#dddddd" style="border:1px solid red" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;&lt;font color="blue"&gt;public&lt;/font&gt; ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {&lt;br /&gt;       ActionErrors errors = &lt;font color="blue"&gt;new&lt;/font&gt; ActionErrors();&lt;br /&gt;       &lt;font color="blue"&gt;if&lt;/font&gt; (getName() == &lt;font color="blue"&gt;null&lt;/font&gt; || getName().length() &amp;lt; 1) {&lt;br /&gt;           errors.add(&amp;quot;name&amp;quot;, &lt;font color="blue"&gt;new&lt;/font&gt; ActionMessage(&amp;quot;error.name.required&amp;quot;));           &lt;br /&gt;       }&lt;br /&gt;       &lt;font color="blue"&gt;if&lt;/font&gt;(getNumber() &amp;lt;= 0){&lt;br /&gt;           errors.add(&amp;quot;number&amp;quot;,&lt;font color="blue"&gt;new&lt;/font&gt; ActionMessage(&amp;quot;error.posnumber.needed&amp;quot;,getNumber()));&lt;br /&gt;       }&lt;br /&gt;       {&lt;br /&gt;           &lt;font color="blue"&gt;int&lt;/font&gt; x = (&lt;font color="blue"&gt;int&lt;/font&gt;)getNumber();&lt;br /&gt;           double y = x;&lt;br /&gt;           &lt;font color="blue"&gt;int&lt;/font&gt; res = ((Double)y).compareTo(getNumber());&lt;br /&gt;           &lt;font color="blue"&gt;if&lt;/font&gt;(res != 0){&lt;br /&gt;               errors.add(&amp;quot;number&amp;quot;,&lt;font color="blue"&gt;new&lt;/font&gt; ActionMessage(&amp;quot;error.integer.needed&amp;quot;,getNumber()));&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;       &lt;font color="blue"&gt;return&lt;/font&gt; errors;&lt;br /&gt;   }&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;The jsp file meant to use the errors looks like this:&lt;br /&gt;&lt;br /&gt;&lt;table bgcolor="#dddddd" style="border: 1px solid red" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;  &amp;lt;div id=&amp;quot;page1&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;html:errors bundle=&amp;quot;newBundle&amp;quot;/&amp;gt;            &lt;br /&gt;            &amp;lt;html:form action=&amp;quot;show.do&amp;quot; method=&amp;quot;post&amp;quot;&amp;gt;&lt;br /&gt;                &amp;lt;div &lt;font color="blue"&gt;class&lt;/font&gt;=&amp;quot;fields&amp;quot;&amp;gt;&lt;br /&gt;                    &amp;lt;label &lt;font color="blue"&gt;for&lt;/font&gt;=&amp;quot;user&amp;quot;&amp;gt;USER&amp;lt;/label&amp;gt; &amp;lt;html:text property=&amp;quot;name&amp;quot; &amp;gt;&amp;lt;/html:text&amp;gt;&lt;br /&gt;                    &amp;lt;html:errors bundle=&amp;quot;newBundle&amp;quot; property=&amp;quot;name&amp;quot;&amp;gt;&amp;lt;/html:errors&amp;gt;&lt;br /&gt;                    &amp;lt;label &lt;font color="blue"&gt;for&lt;/font&gt;=&amp;quot;user-id&amp;quot;&amp;gt;USER-ID&amp;lt;/label&amp;gt;&amp;lt;html:text property=&amp;quot;number&amp;quot; &amp;gt;&amp;lt;/html:text&amp;gt;&lt;br /&gt;                    &amp;lt;html:errors  property=&amp;quot;number&amp;quot;&amp;gt;&amp;lt;/html:errors&amp;gt;&lt;br /&gt;                &amp;lt;/div&amp;gt;&lt;br /&gt;                &amp;lt;span &lt;font color="blue"&gt;class&lt;/font&gt;=&amp;quot;buttons&amp;quot;&amp;gt;                    &lt;br /&gt;                    &amp;lt;html:submit property=&amp;quot;submitType&amp;quot; value=&amp;quot;submit1&amp;quot;/&amp;gt;&lt;br /&gt;                    &amp;lt;html:submit property=&amp;quot;submitType&amp;quot; value=&amp;quot;submit2&amp;quot;/&amp;gt;                    &lt;br /&gt;                &amp;lt;/span&amp;gt;&lt;br /&gt;            &amp;lt;/html:form&amp;gt;&lt;br /&gt;            &lt;br /&gt;        &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;The attribute &lt;em&gt;bundle="newBundle"&lt;/em&gt; is another aspect, the message properties can be customised (one of the starting steps for internationalisation, no we won't be looking at it in this post). We can have as many message/resource bundles as we like. Have a look at struts-config.xml. The bundle attribute in error tags should map to the key attribute given in struts config.&lt;br /&gt;&lt;br /&gt;That summarised our discussion on basic struts.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-544453483653810950?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/544453483653810950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=544453483653810950' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/544453483653810950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/544453483653810950'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2009/01/web-development-framework-struts-1_01.html' title='Web development framework - Struts 1 - part2'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-1337986571700290220</id><published>2009-01-01T16:31:00.003+05:30</published><updated>2009-01-01T17:24:18.738+05:30</updated><title type='text'>Web development framework - Struts 1 - part1</title><content type='html'>For web development in j2ee, one needs to know about basic deployment strategy. The 'basic' stuff includes, knowledge of web server and configuration files required by the framework. For servlet/jsp applications web.xml, or deployment descriptor is the key. Production apps have their own framework and come with their own framework (scripts and config files), this is not the objective of this exercise though.&lt;br /&gt;&lt;br /&gt;To simplify development, people have been developing utilities. Struts is one such aid. Supported by Apache. This is over and above the basic strategy. Struts dictates that the users provide config file(s). Let us see the various aspects involved in configuration in this blog.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Web.xml&lt;/h3&gt;&lt;br /&gt;Web.xml is the starting point for any web application. For a struts application the web.xml looks in the following fashion.&lt;br /&gt;&lt;table bgcolor="#dddddd" style="border:1px solid orange" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;&lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;?xml&lt;/font&gt; version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;web-app&lt;/font&gt; version=&amp;quot;2.4&amp;quot; xmlns=&amp;quot;http://java.sun.com/xml/ns/j2ee&amp;quot; xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot; xsi:schemaLocation=&amp;quot;http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;servlet&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;servlet-name&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;action&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;servlet-name&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;servlet-class&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;org.apache.struts.action.ActionServlet&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;servlet-class&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;init-param&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;param-name&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;config&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;param-name&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;param-value&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;/WEB-INF/struts-config.xml&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;param-value&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;init-param&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;init-param&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;param-name&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;debug&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;param-name&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;param-value&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;2&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;param-value&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;init-param&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;init-param&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;param-name&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;detail&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;param-name&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;param-value&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;2&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;param-value&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;init-param&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;load-on-startup&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;2&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;load-on-startup&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;servlet&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;servlet-mapping&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;servlet-name&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;action&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;servlet-name&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;url-pattern&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;*.do&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;url-pattern&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;servlet-mapping&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;session-config&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;session-timeout&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            30&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;session-timeout&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;session-config&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;welcome-file-list&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;welcome-file&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;index.jsp&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;welcome-file&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;welcome-file-list&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;jsp-config&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;taglib&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;taglib-uri&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;/WEB-INF/struts-bean.tld&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;taglib-uri&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;taglib-location&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;/WEB-INF/struts-bean.tld&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;taglib-location&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;taglib&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;taglib&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;taglib-uri&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;/WEB-INF/struts-html.tld&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;taglib-uri&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;taglib-location&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;/WEB-INF/struts-html.tld&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;taglib-location&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;taglib&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;taglib&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;taglib-uri&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;/WEB-INF/struts-logic.tld&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;taglib-uri&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;taglib-location&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;/WEB-INF/struts-logic.tld&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;taglib-location&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;taglib&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;taglib&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;taglib-uri&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;/WEB-INF/struts-nested.tld&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;taglib-uri&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;taglib-location&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;/WEB-INF/struts-nested.tld&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;taglib-location&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;taglib&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;taglib&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;taglib-uri&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;/WEB-INF/struts-tiles.tld&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;taglib-uri&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;            &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;taglib-location&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;/WEB-INF/struts-tiles.tld&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;taglib-location&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;taglib&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;jsp-config&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;web-app&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;To understand the above, one needs to have some know how of relation between: servlet-class, servlet-name and servlet-mapping. They are supposed to provide degrees of freedom to various stakeholders namely: the java developer, the server admin or (author of deployment descriptor) and the network admin responsible for url allocation.&lt;br /&gt;&lt;br /&gt;All struts applications try to mock front-controller pattern. (A true front controller has no logic what so ever and just delegates, it is left to application designers to come up with the delegators/handlers. In struts 1.xx this is achieved only by using a 'request processor', which is not the default. The delegation logic is held by front-controller in default case. The user can configure the delegation rules). The front-controller is called 'ActionServlet' and is part of struts library.  In the above example all urls that match the regex *.do are mapped to this servlet. There are some initialization parameters given to action servlet, the most important of these is the 'config' parameter, we supply struts-config.xml(s) here. Multiple config.xmls are allowed and are comma separated. The config.xmls contain the rules to be followed for request delegation. These are used by ActionServlet.&lt;br /&gt;&lt;br /&gt;When a request hits actionservlet, the servlet tries to map it to the appropriate action. Action is a specialised controller. ActionServlet also maps the request parameters to a bean, called as form-bean in struts lingo. By the time request reaches action class, the form-bean gets populated and acts as a data structure. Validation of parameters can be done in the Action class, but the most appropriate location would be form-bean, as per ObjectOriented model. We will see more of struts-config.xml in the next part&lt;br /&gt;&lt;br /&gt;Last but not the least are tld definitions provided at the end. These have more to do with jsp tag-libs than struts framework. Think of them as helper classes.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Note&lt;/h4&gt;&lt;br /&gt;Struts 2 and Spring framework are ideologically more similar than struts 1. In the former, user is allowed to dictate the front-controller (dispatch servlet), user is not forced to extend framework classes. This amounts to greater freedom of design (loose coupling or framework agnostic design). However, how many times did we see an application design change radically?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-1337986571700290220?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/1337986571700290220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=1337986571700290220' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1337986571700290220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1337986571700290220'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2009/01/web-development-framework-struts-1.html' title='Web development framework - Struts 1 - part1'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-4455210635374607054</id><published>2008-12-26T01:35:00.001+05:30</published><updated>2008-12-26T01:35:40.257+05:30</updated><title type='text'>The Other side, the Ugly side - Slumdog millionaire</title><content type='html'>As statistical evidence suggests, most Indian movies are cheap imitations. Some (moi) feel that they drain the energy and test the patience limits. Bollywood's definition of sensuality is not something 'original'. The industry where dreams are sold has a strange appeal, which I rarely understood. Watching Indian movies is like watching a magician's show, the caveat, you already know the tricks.&lt;br /&gt;&lt;br /&gt; But once in a while, when you expect the least, the rabbit is out , a real one which you would watch with child like amusement. Now that is a rarity. What is so intriguing! you tell me.&lt;br /&gt;&lt;br /&gt;The "Slumdog millionaire" is one of those rare gems, not a bollywood movie though, it is based on the popular book 'Q and A' by Vikas Swarup. If you haven't read the book, don't miss this one. An uncouth movie with an arcane and predictable ending, but captivating it is. A bunch of lies, but beautiful ones they all are. A story teller's story which I have missed since a long time is what helped me stick. Go find out what is in for you. As the credits started rolling, I was in for another shock, so will you be when you see the name AR Rahman.&lt;br /&gt;&lt;br /&gt;==spoiler==&lt;br /&gt;A street rag, goes out to be a winner. Not much help is it, but remember that I am not going to be the one shouting kajol's name on the way out of the movie, Gupt. Wiki would definitely help, but why bother! See what I found on wiki after watching the movie,&lt;br /&gt;&lt;br /&gt;"Rotten Tomatoes reported that 93% of critics gave the film positive write-ups, based upon a sample of 135, with an average score of 8.1/10.[20] At Metacritic, which assigns a normalized rating out of 100 to reviews from mainstream critics, the film has received an average score of 86, based on 35 reviews."&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-4455210635374607054?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/4455210635374607054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=4455210635374607054' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4455210635374607054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4455210635374607054'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/12/other-side-ugly-side-slumdog.html' title='The Other side, the Ugly side - Slumdog millionaire'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-2437165508866365641</id><published>2008-12-04T16:24:00.002+05:30</published><updated>2008-12-04T17:00:57.626+05:30</updated><title type='text'>Kick starting with hibernate</title><content type='html'>ORM is no rocket science, it is a very useful tool though. The idea of a tool to help manage transactions and bean bindings is a developer's paradise. So how do we start off? Download hibernate from internet, along with it the not so obvious slf4j-simple-xxx.jar and slf4j-api-xxx.jar files are needed.&lt;br /&gt;&lt;br /&gt;Place these in you project class path. The next step is writing the mapping files. The file hibernate.cfg.xml is the one which spells out the all encompassing details like those of the database, connection pool etc. The &amp;lt entity &amp;gt.hbm.xml files contain the object mapping information along any operation specific information.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt; A sample hibernate config xml for MySQL &lt;/h3&gt;&lt;br /&gt;&lt;table bgcolor="#dddddd" border="1" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;&lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;?xml&lt;/font&gt; version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="blue"&gt;&amp;lt;!&lt;/font&gt;&lt;font color="maroon"&gt;--&lt;/font&gt;&lt;br /&gt;    Document   : hibernate.cfg.xml.xml&lt;br /&gt;    Created on : 02 November 2008, 19:31&lt;br /&gt;    Author     : Kanthi Swaroop Rongala&lt;br /&gt;--&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="blue"&gt;&amp;lt;!&lt;/font&gt;&lt;font color="maroon"&gt;DOCTYPE&lt;/font&gt; hibernate-configuration PUBLIC&lt;br /&gt;        &amp;quot;-//Hibernate/Hibernate Configuration DTD 3.0//EN&amp;quot;&lt;br /&gt;        &amp;quot;http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;hibernate-configuration&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;session-factory&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;        &lt;font color="green"&gt;&lt;font color="blue"&gt;&amp;lt;!&lt;/font&gt;&lt;font color="maroon"&gt;--&lt;/font&gt; Database connection settings --&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="blue"&gt;&lt;b&gt;property name=&amp;quot;connection.driver_class&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;com.mysql.jdbc.Driver&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;property&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="blue"&gt;&lt;b&gt;property name=&amp;quot;connection.url&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;jdbc:mysql://localhost/hospital_care&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;property&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="blue"&gt;&lt;b&gt;property name=&amp;quot;connection.username&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;root&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;property&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="blue"&gt;&lt;b&gt;property name=&amp;quot;connection.password&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;property&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;        &lt;font color="green"&gt;&lt;font color="blue"&gt;&amp;lt;!&lt;/font&gt;&lt;font color="maroon"&gt;--&lt;/font&gt; JDBC connection pool (use the built-in) --&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="blue"&gt;&lt;b&gt;property name=&amp;quot;connection.pool_size&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;1&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;property&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;        &lt;font color="green"&gt;&lt;font color="blue"&gt;&amp;lt;!&lt;/font&gt;&lt;font color="maroon"&gt;--&lt;/font&gt; SQL dialect --&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="blue"&gt;&lt;b&gt;property name=&amp;quot;dialect&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;org.hibernate.dialect.MySQL5Dialect&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;property&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;        &lt;font color="green"&gt;&lt;font color="blue"&gt;&amp;lt;!&lt;/font&gt;&lt;font color="maroon"&gt;--&lt;/font&gt; Enable Hibernate's automatic session context management --&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="blue"&gt;&lt;b&gt;property name=&amp;quot;current_session_context_class&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;thread&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;property&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;!&lt;/font&gt;&lt;font color="maroon"&gt;--&lt;/font&gt; Disable the second-level cache  &lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="blue"&gt;&lt;b&gt;property name=&amp;quot;cache.provider_class&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;org.hibernate.cache.NoCacheProvider&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;property&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;        --&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;        &lt;font color="green"&gt;&lt;font color="blue"&gt;&amp;lt;!&lt;/font&gt;&lt;font color="maroon"&gt;--&lt;/font&gt; Echo all executed SQL to stdout --&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="blue"&gt;&lt;b&gt;property name=&amp;quot;show_sql&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;true&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;property&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="blue"&gt;&lt;b&gt;property name=&amp;quot;format_sql&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;true&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;property&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;!&lt;/font&gt;&lt;font color="maroon"&gt;--&lt;/font&gt; Drop and re-create the database schema on startup &lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="blue"&gt;&lt;b&gt;property name=&amp;quot;hbm2ddl.auto&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;create&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;property&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;        --&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;!&lt;/font&gt;&lt;font color="maroon"&gt;--&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="blue"&gt;&lt;b&gt;property name=&amp;quot;transaction.factory_class&amp;quot;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;org.hibernate.transaction.JDBCTransactionFactory&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;property&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;        --&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;mapping&lt;/font&gt; resource=&amp;quot;model/resources/Doctor.hbm.xml&amp;quot;&lt;font color="blue"&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;mapping&lt;/font&gt; resource=&amp;quot;model/resources/Patient.hbm.xml&amp;quot;&lt;font color="blue"&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;        &lt;font color="blue"&gt;&amp;lt;&lt;/font&gt;&lt;font color="maroon"&gt;mapping&lt;/font&gt; resource=&amp;quot;model/resources/Appointment.hbm.xml&amp;quot;&lt;font color="blue"&gt;/&amp;gt;&lt;/font&gt;&lt;br /&gt;    &lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;session-factory&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color="blue"&gt;&amp;lt;/&lt;/font&gt;&lt;font color="maroon"&gt;hibernate-configuration&lt;/font&gt;&lt;font color="blue"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;Note that I have placed all my xmls in a different package called model.resources. What about the hibernate.cfg.xml location? We can move it as well.&lt;br /&gt;&lt;br /&gt;See the following:&lt;br /&gt;&lt;table bgcolor="#dddddd" border="1" cellpadding="16"&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;font color="black" face="Courier New" size="2"&gt;public class HibernateUtil {&lt;br /&gt;&lt;br /&gt;    private static SessionFactory sessionFactory = null;&lt;br /&gt;    private String CONFIG_FILE_PATH = &amp;quot;/model/resources/hibernate.cfg.xml&amp;quot;;&lt;br /&gt;    &lt;br /&gt;    private HibernateUtil(){&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    private SessionFactory create() {&lt;br /&gt;        try {&lt;br /&gt;            // Create the SessionFactory from hibernate.cfg.xml&lt;br /&gt;            sessionFactory = new Configuration().configure(CONFIG_FILE_PATH).buildSessionFactory();&lt;br /&gt;        } catch (Throwable ex) {&lt;br /&gt;            // Make sure you log the exception, as it might be swallowed&lt;br /&gt;            System.err.println(&amp;quot;Initial SessionFactory creation failed.&amp;quot; + ex);&lt;br /&gt;            throw new ExceptionInInitializerError(ex);&lt;br /&gt;        }&lt;br /&gt;        return sessionFactory;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static SessionFactory getSessionFactory() {&lt;br /&gt;        if(sessionFactory == null){&lt;br /&gt;            HibernateUtil utils =  new HibernateUtil();&lt;br /&gt;            utils.create();&lt;br /&gt;        }&lt;br /&gt;        return sessionFactory;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;Hope this helps in giving you that well deserved push&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-2437165508866365641?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/2437165508866365641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=2437165508866365641' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/2437165508866365641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/2437165508866365641'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/12/kick-starting-with-hibernate.html' title='Kick starting with hibernate'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-275909113732519515</id><published>2008-12-04T16:15:00.002+05:30</published><updated>2008-12-04T16:24:16.815+05:30</updated><title type='text'>Dynamic proxy</title><content type='html'>Every one knows compiled code is type safe and is static. It is not possible to dynamically type the behaviour in such cases. C, C++, Java … they all fit the bill. Java has this interesting feature called Dynamic proxies which promises what it spells. Now how the hell can… well it is not exactly dynamic!. There is a provision for plugging functionality (not just behaviour) at run time without major code changes. So should we really be calling it Dynamic?&lt;br /&gt;&lt;br /&gt;As life goes on, let’s see an example. Suppose I have come legacy code/tested code/production code/my own kitchen sink code/tutorial code…Tan(90). The purpose of the code can be as simple as that of a logger. Now I want to impart some extra functionality (not just behaviour), say an actionlistener, whoa!! On a logger!! (Bear with me for the sake of example). Now how would be do that:&lt;br /&gt;&lt;ol&gt;&lt;li&gt; Implement the interface&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Create a wrapper class which uses composition&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;Not bad?, and where would be place this? In our code base of course! Dynamic proxies offer yet another way of doing things.&lt;br /&gt;&lt;br /&gt;Think of a utility that creates a wrapper for the interfaces you want and lets you inspect the calls being made. Armed with this knowledge the lone ninja developer can render a killer app, well that is the idea at least. This utility is part of java since jdk1.3 and is called the Proxy.&lt;br /&gt;&lt;br /&gt;Starring…coming to your nearest desktop…&lt;br /&gt;import java.lang.reflect.InvocationHandler;&lt;br /&gt;import java.lang.reflect.Proxy;&lt;br /&gt;&lt;br /&gt;What exactly are these? Proxy helps you by creating the implementing class alias proxy and InvocationHandler helps you with the inspection/introspection. Proxy needs a set of interfaces and InvocationHandler needs to be hand coded.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Some code snippets&lt;/h3&gt;&lt;br /&gt;&lt;table bg border="1" cellpadding="16" style="color:#dddddd;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;span style="font-family:Courier New;font-size:85%;color:black;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; interface IAppLogger {&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:blue;"&gt;void&lt;/span&gt; logError(String txt);&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:blue;"&gt;void&lt;/span&gt; logInfo(String txt);&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:blue;"&gt;void&lt;/span&gt; logWarning(String txt);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; GenericInvocationHandler implements InvocationHandler {&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;   &lt;span style="color:blue;"&gt;public&lt;/span&gt; Object invoke(Object proxy, Method method, Object[] args) throws Throwable {&lt;br /&gt;       StringBuilder sb = &lt;span style="color:blue;"&gt;new&lt;/span&gt; StringBuilder();       &lt;br /&gt;       sb.append(" Calling ---&amp;gt; ");&lt;br /&gt;       sb.append(method.getName());&lt;br /&gt;       sb.append("(");               &lt;br /&gt;       sb.append(")");&lt;br /&gt;       System.out.println(sb.toString());&lt;br /&gt;       &lt;span style="color:green;"&gt;//donothing proxy&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:green;"&gt;//return method.invoke(obj, args);&lt;/span&gt;&lt;br /&gt;       &lt;span style="color:blue;"&gt;return&lt;/span&gt; &lt;span style="color:blue;"&gt;null&lt;/span&gt;;&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; ProxyGen {&lt;br /&gt;  &lt;br /&gt;   &lt;span style="color:blue;"&gt;public&lt;/span&gt; Object createProxy(Class[] interfaces, InvocationHandler handler){&lt;br /&gt;       ClassLoader cl= ProxyGen.&lt;span style="color:blue;"&gt;class&lt;/span&gt;.getClassLoader();&lt;br /&gt;       &lt;span style="color:blue;"&gt;return&lt;/span&gt; Proxy.newProxyInstance(cl, interfaces , handler);&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   /**&lt;br /&gt;    * @param args the command line arguments&lt;br /&gt;    */&lt;br /&gt;   &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; main(String[] args) {&lt;br /&gt;       GenericInvocationHandler handler = &lt;span style="color:blue;"&gt;new&lt;/span&gt; GenericInvocationHandler(&lt;span style="color:blue;"&gt;new&lt;/span&gt; AppLogger());&lt;br /&gt;       ProxyGen factory = &lt;span style="color:blue;"&gt;new&lt;/span&gt; ProxyGen();&lt;br /&gt;       ActionListener proxyObj2 = (ActionListener) factory.createProxy(&lt;span style="color:blue;"&gt;new&lt;/span&gt; Class[]{IAppLogger.&lt;span style="color:blue;"&gt;class&lt;/span&gt;, ActionListener.&lt;span style="color:blue;"&gt;class&lt;/span&gt;}, handler);&lt;br /&gt;       proxyObj2.actionPerformed(&lt;span style="color:blue;"&gt;null&lt;/span&gt;);&lt;br /&gt;       IAppLogger proxyObj = (IAppLogger) proxyObj2;&lt;br /&gt;       proxyObj.logError("abc");&lt;br /&gt;       proxyObj.logInfo("abc");&lt;br /&gt;       proxyObj.logWarning("abc");&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;As the whims of the butterfly go, in a flap of wing the requirements change. We now have a new technique under our belt.&lt;br /&gt;&lt;br /&gt;I have seen a generic logging example on net as part of my learning, thank you Google, once again!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-275909113732519515?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/275909113732519515/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=275909113732519515' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/275909113732519515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/275909113732519515'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/12/dynamic-proxy.html' title='Dynamic proxy'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-5579791324633953252</id><published>2008-11-06T21:29:00.000+05:30</published><updated>2008-11-06T21:30:20.943+05:30</updated><title type='text'>Top 25 Geek Blogs</title><content type='html'>The title says it all.&lt;br /&gt;http://cellphones.org/blog/news/top-25-geek-blogs&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-5579791324633953252?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/5579791324633953252/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=5579791324633953252' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/5579791324633953252'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/5579791324633953252'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/11/top-25-geek-blogs.html' title='Top 25 Geek Blogs'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-7844564658894925444</id><published>2008-10-30T21:47:00.004+05:30</published><updated>2008-10-30T22:12:32.282+05:30</updated><title type='text'>HTML - Buttons as Links</title><content type='html'>UI designers pursue their job with the idea of getting a clean and pleasing finish. That is their job, however this single focus causes them to ignore the periphery. Accessability and Technical realisation take a back seat. A really good designer would provide a solution that is solvable and not some thing which is impossible.&lt;br /&gt;&lt;br /&gt;What is an impossible design? Think of cramping a list of names into a horizontal row without any due consideration for 'screen estate', now if anyone does a Ctrl++ to increase the font size what would happen? It is impossible to support all resolutions, but most often the min and max constraints can be frozen, not having them defined causes even more confusion.&lt;br /&gt;&lt;br /&gt;What is a solvable problem then! The unfortunate truth about web-dev is lack of standard environment. The browsers, CSS, java script all tend to vary. Removing backward compatibility is a sin, but that is the burden these age old browsers have to carry. The new kids on the block (Chrome), Good luck!.&lt;br /&gt;&lt;br /&gt;Nuf of cribbing and coming to point, one of our teams was given this task of submitting forms using links. Now HTML supports form submissions on buttons and images alone! So what did they do, went ahead and used images. Not bad unless you think of resizing text. Like most puzzles which we face, I happened to run into this conversation and started twiddling with the source. Look where we are Maa. &lt;br /&gt;&lt;br /&gt;&lt;div style="border:1px solid orange"&gt;&lt;br /&gt;    &amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;&lt;br /&gt;&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;Untitled Document&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;/* Works on Firefox2+ but not on IE6 :(*/&lt;br /&gt; .link a&gt;input{&lt;br /&gt;  background:none; &lt;br /&gt;  border:0; &lt;br /&gt;  border-bottom:1px blue solid; &lt;br /&gt;  padding:0; &lt;br /&gt;  height:1.2em; &lt;br /&gt;  cursor:pointer; &lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; .link a&gt;input:hover{&lt;br /&gt;  background:none; &lt;br /&gt;  border:0; &lt;br /&gt;  border-bottom:1px red solid; &lt;br /&gt;  padding:0; &lt;br /&gt;  height:1.2em; &lt;br /&gt;  cursor:pointer; &lt;br /&gt;  font-weight:600;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt; &amp;lt;div class="link"&amp;gt; &amp;lt;a&amp;gt; &amp;lt;input type="button" value="submit"/&amp;gt; &amp;lt;/a&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;div class="link"&amp;gt; &amp;lt;a&amp;gt; &amp;lt;input type="button" value="crap"/&amp;gt; &amp;lt;/a&amp;gt; &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-7844564658894925444?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/7844564658894925444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=7844564658894925444' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7844564658894925444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7844564658894925444'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/10/html-buttons-as-links.html' title='HTML - Buttons as Links'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-7857490561027178911</id><published>2008-10-22T16:05:00.002+05:30</published><updated>2008-10-22T16:12:35.603+05:30</updated><title type='text'>Stack Overflow</title><content type='html'>StackOveflow: A new preoccupation and time killer! Explains a slump in my blogging activities.&lt;br /&gt;&lt;br /&gt;Nuf said, the real reason why I fell in love with SO cannot be explained, it has to be experienced. Have a look at this post (warning java script knowledge is mandatory) &lt;a href="http://stackoverflow.com/questions/61088/hidden-features-of-javascript#65028"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-7857490561027178911?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/7857490561027178911/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=7857490561027178911' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7857490561027178911'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7857490561027178911'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/10/stack-overflow.html' title='Stack Overflow'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-4315871565364990359</id><published>2008-09-28T03:31:00.003+05:30</published><updated>2008-09-28T03:51:28.545+05:30</updated><title type='text'>Religion for me 2</title><content type='html'>Now when I read about, people fighting eachother for their beliefs, I was surprised. Infact I was depressed. I feared some of my friends and neighbours would be hurt. So I started paying more attention to the differences. The differences were those I never cared for. They were the most superficial ones. I don't know why and how they became so important, so as usual started asking others. The answer, it was told so in the books.&lt;br /&gt;&lt;br /&gt;As a student of logic, I found religion unexplicable. The most difficult thing to comprehend was the irrepressible quest to force ones own ideals on others. Then I found that the books actually force certains aspects on individuals. For me, Religion was no longer a way of life, it was a totalitarian structure with helped individuals intrepret things in many ways. It became a abhorence, more like a power structure or political structure. My knowledge of history didn't help here. &lt;br /&gt;&lt;br /&gt;My angst was targeted towards the religious symbols. I started to interpret things in a different fashion. Religion was set out as a means of bringing social order to a society. When these isolated societies started to come in contact, they had to fend themselves and religion became a voice and power. God had nothing to do with it. God, wouldn't even care if people worshipped him or not. Religion says that God is the most powerful one and he saves the people. They don't give out compelling reasons why God would do so, what binds God to carry out the obligation and the consequences of not doing so. God wouldn't be hurt by things I do or don't do. Individuals are incapable of causing any harm, are do they? All they are capable of doing is hurt others.&lt;br /&gt;&lt;br /&gt;Does God exists? I don't know, frankly I don't even care. I even wonder, what would the believers of respective religions do, if God himself tells them that they need to change their beliefs, they may call it a bluff/fraud and attack. So what do I want to do, I find some aspects of life appealing, like enjoying a nice laugh/conversation. Showing appreciation towards others and caring for others in my own capacity. I wouldnt' want this silly religion thing to interfere in any of these.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-4315871565364990359?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/4315871565364990359/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=4315871565364990359' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4315871565364990359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4315871565364990359'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/09/religion-for-me-2.html' title='Religion for me 2'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-3877093135454786581</id><published>2008-09-28T03:10:00.002+05:30</published><updated>2008-09-28T03:31:03.067+05:30</updated><title type='text'>Religion for me</title><content type='html'>I grew up in a family which observed reverence to GOD. I remember the early days when my mom and dad used to take me to holy shrines and asked me to pray, they infact used to prompt me to ask for blessings!! My normal prayer was 'God, give me good conscience, help me with my studies, I will behave myself'. I am not going to spell out the religious order which my family belongs for it defies the purpose of this blog. When I grew up, I used to see people who never had any consideration to the ideals promoted by my family, I also saw people who went throught the strict regimen. As a kid, I once bychance went into a neighbour's house, they belonged to a different religious order, I saw the people over there uttering their prayers and I followed them with my own words - quoted above. I could see the lady of the house smiling in agreement.&lt;br /&gt;&lt;br /&gt;One another time, I happened to step into the prayer room of a different neighbours. I used to enjoy the stories told by the elders and asked them if I could have the book of stories. They told me I couldn't and I wouldn't' understand the writing as well. I asked why? They told me it was the holy book and even they wouldn't touch it normally. I didn't feel bad as I remember my mom warning me with the books in our house. (Technically speaking, those were scriptures, but for a 11 year old they are all books!). The best part of all the religions was the festivals we used to have. We could jump of school and enjoy the sweets. My mother never objected! I even used to help our neighbours with the preperations. The same was the case in our school. I used to observe that some of our teachers/students used to take a special eatery. Once I joined the line just to try that. Later my friends asked me when we converted! I said no!! I just wanted to eat what you guys are having.&lt;br /&gt;&lt;br /&gt;For me all the stories had the same moral, all my friends and their parents taught the same. Later when I found what others saw as reigion, I was in for a shock. Will continue rest in my next posting...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-3877093135454786581?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/3877093135454786581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=3877093135454786581' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3877093135454786581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3877093135454786581'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/09/religion-for-me.html' title='Religion for me'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-6248489581587959798</id><published>2008-09-25T19:53:00.003+05:30</published><updated>2008-09-25T19:57:55.924+05:30</updated><title type='text'>Global Singletons, Good and Bad</title><content type='html'>I am just quoting my opinion someone elses article. The actual article can be found at:&lt;br /&gt;&lt;a href="http://misko.hevery.com/2008/08/17/singletons-are-pathological-liars/"&gt;singletons-are-pathological-liars&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Why is global bad? Yeah, I know what your are thinking, and no, I am not joking. There are certain languages like JS which are quite powerful and yet have limited ability to comeup with walls (modularity).&lt;br /&gt;&lt;br /&gt;Global is bad because:&lt;br /&gt;a. It causes namespace conflict&lt;br /&gt;b. It exposes the state in a unwarranted fashion&lt;br /&gt;&lt;br /&gt;When it comes to Singletons&lt;br /&gt;a. The explicit OO way of calling them, prevents the conflicts, so point a. is not an issue&lt;br /&gt;b. Singletons without state are (like factories) are not a problem. Singletons with state can again fall in two categories, those which are immutable or write once and read many (config/property files). These are not bad. Mutable Singletons, which are kind of reference holders are the ones which you are speaking of.&lt;br /&gt;&lt;br /&gt;Now if they are designed to act as application cache, you may see a lack of adequate cohesion. So what do we do! Using the pathelogical lies analogy, hide the unpleasant details, in private methods or in interfacing Adaptors (IOC). Make sure that these kinds of singletons are restricted to above sections of code and for the rest of application they become person-nongrata. Finally when you test the application, you won’t see the singletons. Not fool proof, but just makes it a wee bit difficult to accidentally modify things.&lt;br /&gt;&lt;br /&gt;If we are exposing state of instance to Singletons in any other way, it is a bad OO design.&lt;br /&gt;&lt;br /&gt;Quoting Dalai Lama, “Know your rules well, so that you can break them”.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-6248489581587959798?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/6248489581587959798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=6248489581587959798' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6248489581587959798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6248489581587959798'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/09/global-singletons-good-and-bad.html' title='Global Singletons, Good and Bad'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-740000216179042080</id><published>2008-09-25T19:30:00.002+05:30</published><updated>2008-09-25T19:51:15.112+05:30</updated><title type='text'>Appreciation and Irony</title><content type='html'>Today my mail box is bombarded with mails, all showering appreciation for some work I did last week. Am I happy? yes I am guilable. On the other hand, I am still trying to maintain the vulcanistic composure, I have quite a few good reasons too. After the toil of working for 5 years, this is the first time I am put in limelight! The unfortunate part is that, I did quite a few things in the past which would exceed the current 'achievement', if it is the right word. Most often, my peers and superiors would show their admiration, verbally and sincerely. Today it is different. Lets see how.&lt;br /&gt;&lt;br /&gt;I am working for a client, who happens to be contractor who manages third party contractor. I am with one of the third party suppliers. There was an issue, which would affect the whole design framework. I wouldn't spell out the issue in the current post, thats not the point anyway. The proposal for that solved the problem without causing any major design changes. So our client and the actual authority were really impressed. This caused a cascade of mails. When you prepare a recipe, or shoot a nice picture, you would like knowledgable people to acknowledge it. People without the intimate understanding of nuances just follow the crowd. When you see someone buying a camera or tv, they go with the brand. These would seldom try new things, no matter how good they are and this has nothing to do with being acquainted with the product.&lt;br /&gt;&lt;br /&gt;The cascade caused the senior management of our company, just jumped the bandwagon. Now, I know some really good tasks carried out by some of our team, I personally did some stuff which overshawdows the current task. The chance of not being able to give a solution was alway lurking around. The difference was, in the exposure I recieved this time. Thinking of all those old times, I just wonder at the ways persistance pays, when you least expect it. This political embargo I am carrying with me probably will get some mileage during my review meetings, but the baggage of my team members staring at me like they used to do when you top your class or play that crucial shot in a field game, is unwarranted.&lt;br /&gt;&lt;br /&gt;I just get a feeling that things are overdone in real world, and have to remind myself that even olympians are forgotten&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-740000216179042080?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/740000216179042080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=740000216179042080' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/740000216179042080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/740000216179042080'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/09/appreciation-and-irony.html' title='Appreciation and Irony'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-774531980143469952</id><published>2008-09-12T04:40:00.001+05:30</published><updated>2008-09-12T04:42:47.090+05:30</updated><title type='text'>Lost world</title><content type='html'>Typical applications of ANTLR would be in parsing domain. My first interaction with ANTLR was for a data generation application. We had this system which consume huge xml streams. The schema types were defined via xsi and testing the code for all conditions was inhumane! Even coming  up with data for functional flows was painful. So the solution was to comeup with a template of the xml (using schema) and another template for possible datatypes. Parse the template, create a inmemory tree and walk the tree several times (using custom java code). We picked up a random domain value for substitution for each walk and ended up having a comprehensive data sets. There were certain correlation problems though and it was a different story.&lt;br /&gt;&lt;br /&gt;I am writing this as I became a bit nostalgic seeing http://blog.centuryminds.com/2008/09/antlr-tutorial-dependency-injection-language/. Err when was the last time I learned something new!?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-774531980143469952?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/774531980143469952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=774531980143469952' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/774531980143469952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/774531980143469952'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/09/lost-world.html' title='Lost world'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-4158104763900748328</id><published>2008-09-12T03:55:00.003+05:30</published><updated>2008-09-12T04:16:08.117+05:30</updated><title type='text'>Working with non-semantic elements</title><content type='html'>Most often, when a web page is putforth for review, the reviewers look for typical 'classitis', 'divitis' problems. Use of pseudo selectors needs more in depth inspection. Use of non-semantic entities are most often frowned upon. Infact the foremost guiding principle for a good html page, is to leverage the page content for styles (and not styles for content). Atleast that was what I thought of till date. &lt;br /&gt;&lt;br /&gt;Recently when coding for a tricky piece of java script behaviour. I happened to come up with a simple solution that violated the guiding principles. The exact problem is irrelavent, but just to satisfy the curiosity, it has something to do with footer behaviour which varies with the page content. The crux of the solution was to rely on certain invariants on screen (images in this case) and position/scale/stretch my footer. What appealed the most was the idea of introducing non-obtrusive style invaraints at a template level and use them as guides to setup the behaviour rest of the page.&lt;br /&gt;&lt;br /&gt;How about having an 'gif' border around the content or a absolute/fixed positioned images? Most of the time there may be some, if they don't why not introduce an element of transparent gif (not for spacing purpose). The intention is to simplify the javascript part, especially computing offsets and widths becomes a lot more easier. Just to clarify, this idea/pattern suits only code relevant to behavioural aspects. (The presentational aspects should be in CSS alone).&lt;br /&gt;&lt;br /&gt;The next time, someone asks me to align textboxes or labels (from a behavioural point), I will definitely consider this approach.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-4158104763900748328?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/4158104763900748328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=4158104763900748328' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4158104763900748328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4158104763900748328'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/09/working-with-non-semantic-elements.html' title='Working with non-semantic elements'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-1059883023346112919</id><published>2008-09-06T17:19:00.007+05:30</published><updated>2008-09-06T17:46:36.221+05:30</updated><title type='text'>Google Chrome and abberations</title><content type='html'>Chromes on the face of it looks great! Today while trying out the POC for a problem we ran into, I encountered this wierd fact. Chrome is still in beta phase, and there is a long learning line anyway. &lt;br /&gt;&lt;br /&gt;My guess: I can only say that, !important rules are ignored on stylesheets linked using js.(no speculations!)&lt;br /&gt;&lt;br /&gt;Without much fuss, some code snippet. Sorry for not being able to host this on a site&lt;br /&gt;&lt;br /&gt;The html block&lt;br /&gt;&lt;pre style="border:1px solid gray"&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;!-- &lt;br /&gt;    Document   : longdiv&lt;br /&gt;    Created on : 06-Sep-2008, 09:59:00&lt;br /&gt;    Author     : kanthi swaroop&lt;br /&gt;        &lt;br /&gt;    !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;&lt;br /&gt;--&gt;&lt;br /&gt;&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&amp;gt;&lt;br /&gt;&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;&lt;br /&gt;    &amp;lt;head&amp;gt;&lt;br /&gt;        &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/&amp;gt;&lt;br /&gt;        &amp;lt;title&amp;gt;TODO supply a title&amp;lt;/title&amp;gt;        &lt;br /&gt;        &amp;lt;link type="text/css" rel="stylesheet" href="../css/demo.css"/&amp;gt;&lt;br /&gt;        &amp;lt;script src="../js/adjustLayout.js"&amp;gt;            &lt;br /&gt;        &amp;lt;/script&amp;gt;&lt;br /&gt;    &amp;lt;/head&amp;gt;&lt;br /&gt;    &amp;lt;body&amp;gt;&lt;br /&gt;        &amp;lt;div id="header"&amp;gt;&lt;br /&gt;            Some space&lt;br /&gt;        &amp;lt;/div&amp;gt;&lt;br /&gt;        &amp;lt;div class="outer"&amp;gt;&lt;br /&gt;            &amp;lt;div class="left"&amp;gt;&lt;br /&gt;                &amp;lt;span id="long"&amp;gt;&lt;br /&gt;                    longtext____longtext____longtext____longtext____longtext____longtext____longtext____longtext____longtext____longtext____longtext____&lt;br /&gt;                &amp;lt;/span&amp;gt;&lt;br /&gt;                &amp;lt;span id="short"&amp;gt;&lt;br /&gt;                    The plain stuff&lt;br /&gt;                &amp;lt;/span&amp;gt;&lt;br /&gt;            &amp;lt;/div&amp;gt;&lt;br /&gt;            &lt;br /&gt;            &amp;lt;div class="right"&amp;gt;                &lt;br /&gt;                DON'T__BLOCH__ME____DON'T__BLOCH__ME____DON'T__BLOCH__ME____DON'T__BLOCH__ME&lt;br /&gt;            &amp;lt;/div&amp;gt;&lt;br /&gt;        &amp;lt;/div&amp;gt;        &lt;br /&gt;    &amp;lt;/body&amp;gt;        &lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There are two files, demo.css and override.css, using js we attempt try to include the override.css when necessary. override.css applies only to standard compliant browsers.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt; demo.css &lt;/h3&gt;&lt;br /&gt;&lt;pre style="border:1px solid orange"&gt;&lt;br /&gt;/* &lt;br /&gt;Document   : demo&lt;br /&gt;Created on : 06-Sep-2008, 10:06:20&lt;br /&gt;Author     : kanthi swaroop&lt;br /&gt;Description:&lt;br /&gt;This stylesheet is supposed to be overridden in special cases via java script.&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;* {&lt;br /&gt;    margin : 0;&lt;br /&gt;    padding : 0;    &lt;br /&gt;    color : #000000;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;&lt;br /&gt;#long{&lt;br /&gt;display:none;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#short{&lt;br /&gt;display:block;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;*/&lt;br /&gt;#long{&lt;br /&gt;    display:block;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#short{&lt;br /&gt;    display:none;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;root, div { &lt;br /&gt;    display: block;&lt;br /&gt;    border : 1px solid #000000;    &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;body {&lt;br /&gt;    font-size: 62.5%;&lt;br /&gt;    font-family: Arial,Helvetica,sans-serif;    &lt;br /&gt;    height: 100%;&lt;br /&gt;    background-color: #9999ff;        &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;div, span {    &lt;br /&gt;  font-size: 110%;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;span {&lt;br /&gt;    background-color:orange;&lt;br /&gt;    display: inline;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;body, .outer{&lt;br /&gt;    margin: 0 auto;&lt;br /&gt;    width: 1024px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.outer {&lt;br /&gt;    position: absolute;&lt;br /&gt;    height:100%;&lt;br /&gt;    overflow:auto;&lt;br /&gt;    background-color: #999999;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.left {&lt;br /&gt;    float: left;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.right {&lt;br /&gt;    float: right;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.left, .right  {    &lt;br /&gt;    /*height: 10em;&lt;br /&gt;    */&lt;br /&gt;    height: auto;&lt;br /&gt;    width: 49%;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt; override.css &lt;/h3&gt;&lt;br /&gt;&lt;pre style="border:1px solid orange"&gt;&lt;br /&gt;/* &lt;br /&gt;    Document   : override&lt;br /&gt;    Created on : 06-Sep-2008, 11:12:35&lt;br /&gt;    Author     : kanthi swaroop&lt;br /&gt;    Description:&lt;br /&gt;        The following are to be overriden only for standard compliant browsers.&lt;br /&gt;        I know, I am using !important.&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.left, .right {&lt;br /&gt;    width:100% !important; &lt;br /&gt;    clear: both !important;&lt;br /&gt;    &lt;br /&gt;    _width:49%;&lt;br /&gt;    _clear: none;&lt;br /&gt;    &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt; Java script &lt;/h3&gt;&lt;br /&gt;Some java script.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border:1px solid green"&gt;&lt;br /&gt;/* &lt;br /&gt; The script part&lt;br /&gt;Author: kanthi swaroop&lt;br /&gt; */&lt;br /&gt;window.onload = function adjust(aEvent){&lt;br /&gt;    aEvent = aEvent || window.event;&lt;br /&gt;    var newLink = document.createElement("link");&lt;br /&gt;    newLink.href = "../css/override.css";&lt;br /&gt;    newLink.rel = "stylesheet";&lt;br /&gt;    newLink.type = "text/css";&lt;br /&gt;    &lt;br /&gt;    var hasChildren = document.body.hasChildNodes();&lt;br /&gt;    if(hasChildren) {&lt;br /&gt;        document.body.insertBefore(newLink, document.body.firstChild);&lt;br /&gt;    }&lt;br /&gt;    else {&lt;br /&gt;        document.body.appendChild(newLink);&lt;br /&gt;    }&lt;br /&gt;    alert("Bye");&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-1059883023346112919?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/1059883023346112919/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=1059883023346112919' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1059883023346112919'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1059883023346112919'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/09/google-chrome-and-abberations.html' title='Google Chrome and abberations'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-1364733772845352642</id><published>2008-08-17T18:29:00.003+05:30</published><updated>2008-08-17T18:54:16.696+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='monologues'/><title type='text'>Questionning questions - Rashmon</title><content type='html'>Most often we hear people asking for concise and compact answers. This is only acceptable when the two parties share a common understanding of the context. Due to the inherent ambiguity of the natural languages is the cause of the problem. More so, if one of the parties tries to play with words (showoff!) and other ignoramus obiliges. &lt;br /&gt;&lt;br /&gt;An example of this is the popular illustration: "Panda eats, shoots and leaves" vs. "Panda eats, shoots, and leaves". The difference is that, of a panda doing what pandas do, or a clinteastwood western classic.&lt;br /&gt;&lt;br /&gt;More dangerous are the glitches that show up when some one with a uncanny knack for finding loopholes (lawyers!) comesup with a ridiculous conclusion that wasn't even half expected. This makes, usage of simple language and active voice, of paramount importance. I have recently read a joke to illustrate this:&lt;br /&gt;&lt;br /&gt;David and John were walking by a church. David suddenly had one of those electrifying moments and popped a question to John.&lt;br /&gt;David: "John, is it ok to smoke and pray at the same time".&lt;br /&gt;John: "Why don't we ask the preacher."&lt;br /&gt;David: "Ok" (goes into the church)&lt;br /&gt;David: "Father, Is it ok to smoke while praying to God?"&lt;br /&gt;Priest: "Son, such things are unacceptable while praying"&lt;br /&gt;(David comesout and tells John)&lt;br /&gt;John: "Are you sure about that? I will go and ask once again" (John goes in)&lt;br /&gt;John: "Father, Is it ok to pray when we do other things in life"&lt;br /&gt;Priest: "Son, It is the most ideal thing to do"&lt;br /&gt;&lt;br /&gt;(Moral: Ask the right questions to get the right answers)&lt;br /&gt;&lt;br /&gt;In the movie "Rashmon" the director Akira Kurosawa, showcases the human eccentricity in narration and interpretation of the events. Life would be a better place, if every interviewer/questioner deals with fact finding than interpretation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-1364733772845352642?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/1364733772845352642/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=1364733772845352642' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1364733772845352642'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1364733772845352642'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/08/questionning-questions-rashmon.html' title='Questionning questions - Rashmon'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-6966199845591443088</id><published>2008-08-08T14:21:00.003+05:30</published><updated>2008-08-17T18:54:31.329+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='monologues'/><title type='text'>Pleasant surprises</title><content type='html'>Every one who has worked with UI designers (people who swear by Fireworks and Photoshop) know how insolent they can be. We laymen, find it difficult to appreciate how much effort has gone into a button or some other image, until we put things side by side. Programmers don't care for the gloss that shows up, designers and end users do. So do sales folks. Never ignore the fact that it is the cream that sells the cake and not the crust.&lt;br /&gt;&lt;br /&gt;When you see a button, you should feel like clicking it. Not like the button images that the current template uses. A button bulges up, takes a large font and has a finish that pops out. Like Disney’s animal pictures, with huge eyes and soft texture. These are achieved by tinkering around opacities, gradients, crops and colour combinations. Sounds simple, next time try going for a round of shopping with a bunch of girls. You can appreciate the nuances (rather forced to).&lt;br /&gt;&lt;br /&gt;After all, we are not Borg, we do have individual tastes. That said, the next time you go shopping dont' forget to check the cakes' crust as well!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-6966199845591443088?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/6966199845591443088/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=6966199845591443088' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6966199845591443088'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6966199845591443088'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/08/pleasant-surprises.html' title='Pleasant surprises'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-5698162249379041491</id><published>2008-07-18T18:55:00.003+05:30</published><updated>2008-08-17T18:55:06.729+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='java script'/><title type='text'>Some java script snippets - Using Event Handler - part 2</title><content type='html'>&lt;h4&gt; Earlier we saw how to define a cross browser compatible event handler, we will see how to use it. Three different styles are demonstrated&lt;br /&gt;&lt;br /&gt;Note: Copy the code into notepad or someother custom editor for more legibility&lt;/h4&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;/**************************************************************************&lt;br /&gt;Sample Event Listener definition begins&lt;br /&gt;**************************************************************************/&lt;br /&gt;&lt;br /&gt;var Handles = function(){&lt;br /&gt;    &lt;br /&gt;    var test1 = function (aEvent){    &lt;br /&gt;        alert(1);&lt;br /&gt;    }&lt;br /&gt;    var test2;&lt;br /&gt;    return {&lt;br /&gt;        test1: test1,&lt;br /&gt;        test2: test2&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;Handles.prototype.test2 = function test2(aEvent){&lt;br /&gt;    alert(2);&lt;br /&gt;}&lt;br /&gt;var HANDLES = new Handles();&lt;br /&gt;/**************************************************************************&lt;br /&gt;Event Listener definition ends&lt;br /&gt;**************************************************************************/&lt;br /&gt;&lt;br /&gt;function init(){&lt;br /&gt;    cleanup();    &lt;br /&gt;    /* Three different ways to register functions, &lt;br /&gt;       the event Type and function's name are parameters  */&lt;br /&gt;    // test1 is defined in HANDLES&lt;br /&gt;    HANDLER.registerEventHandlerWithType("load", "HANDLES.test1");&lt;br /&gt;    // test2 is added as prototype later on&lt;br /&gt;    HANDLER.registerEventHandlerWithType("load", "Handles.prototype.test2");    &lt;br /&gt;    // cleanup is a globally visible function&lt;br /&gt;    HANDLER.registerEventHandlerWithType("unload", "cleanup");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function cleanup() {&lt;br /&gt;    /* Three different ways to unregister functions */    &lt;br /&gt;    HANDLER.unregisterEventHandlerWithType("load", "HANDLES.test1");&lt;br /&gt;    HANDLER.unregisterEventHandlerWithType("load", "Handles.prototype.test2");    &lt;br /&gt;    HANDLER.unregisterEventHandlerWithType("unload", "cleanup");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;The html code for the above contains&lt;/h4&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&amp;gt;&lt;br /&gt;&amp;lt;!-- &lt;br /&gt;    Document   : test2&lt;br /&gt;    Created on : 03-Jul-2008, 11:24:42    &lt;br /&gt;--&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;  &amp;lt;head&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;    &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;script type="text/javascript" src="../js/File1.js"&amp;gt;            &lt;br /&gt;        &amp;lt;/script&amp;gt; &lt;br /&gt;        &amp;lt;script type="text/javascript" src="../js/File2.js"&amp;gt;            &lt;br /&gt;        &amp;lt;/script&amp;gt;&lt;br /&gt;        &amp;lt;script type="text/javascript" &amp;gt;&lt;br /&gt;            init();            &lt;br /&gt;        &amp;lt;/script&amp;gt;&lt;br /&gt;  &amp;lt;/head&amp;gt;&lt;br /&gt;  &amp;lt;body onload="observeEvent(event)" onresize="observeEvent(event)"&amp;gt;&lt;br /&gt;    &amp;lt;div&amp;gt;&lt;br /&gt;        Me&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-5698162249379041491?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/5698162249379041491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=5698162249379041491' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/5698162249379041491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/5698162249379041491'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/07/some-java-script-snippets-using-event.html' title='Some java script snippets - Using Event Handler - part 2'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-742487011691273772</id><published>2008-07-18T18:42:00.004+05:30</published><updated>2008-08-17T18:55:06.729+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='java script'/><title type='text'>Some java script snippets - Event Handler  - part 1</title><content type='html'>&lt;h4&gt; This is the first part of a sample event handler. We will see the declaration here &lt;br /&gt;&lt;br /&gt;Note: Copy the code into notepad or someother custom editor for more legibility&lt;br /&gt;&lt;/h4&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;     var HANDLER = new EventHandler();&lt;br /&gt;/**************************************************************************&lt;br /&gt;Event Handler definition begins&lt;br /&gt;**************************************************************************/&lt;br /&gt;/* Cross browser event handler, that allows multiple handlers to handle the event */&lt;br /&gt;function EventHandler () {    &lt;br /&gt;    /* This is an array of eventHandler arrays, essentially a hashMap &lt;br /&gt;    defined using associative arrays.&lt;br /&gt;    Example content at run time would be&lt;br /&gt;    events["onload"] = ["adjustDiv", "centerAlignText"...];&lt;br /&gt;    where righthand side is a array of event Handling functions&lt;br /&gt;    */&lt;br /&gt;    var eHandler = this;&lt;br /&gt;    eHandler.events = [];&lt;br /&gt;    &lt;br /&gt;    function getHandlersForEventType(aEventType) {&lt;br /&gt;        /* if this is the first time we are listening the event,&lt;br /&gt;        create handlers array&lt;br /&gt;        */        &lt;br /&gt;        if(eHandler.events[aEventType]==undefined) {&lt;br /&gt;            eHandler.events[aEventType] = [];&lt;br /&gt;        }&lt;br /&gt;        return eHandler.events[aEventType];&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    function detectEvent(event) {&lt;br /&gt;        // grab the event object (IE uses a global event object)&lt;br /&gt;        event = event || ((this.ownerDocument || this.document || this).parentWindow || window).event;&lt;br /&gt;        return event;&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    function registerEventHandlerWithType(aEventType, handlerFnc){        &lt;br /&gt;        var handlers = getHandlersForEventType(aEventType)&lt;br /&gt;        handlers[handlerFnc] = handlerFnc;        &lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    function unregisterEventHandlerWithType(aEventType, handlerFnc){&lt;br /&gt;        var handlers = getHandlersForEventType(aEventType);&lt;br /&gt;        /* if this handler is not registered*/&lt;br /&gt;        if(handlers[handlerFnc]==undefined) {&lt;br /&gt;            return;&lt;br /&gt;        }    &lt;br /&gt;        delete handlers[handlerFnc];    &lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    function handleEvent(aEvent){&lt;br /&gt;        aEvent = detectEvent(aEvent);        &lt;br /&gt;        var handlers = getHandlersForEventType(aEvent.type);&lt;br /&gt;        var diagMsg = "";&lt;br /&gt;        for(var handle in handlers){     &lt;br /&gt;            // construct the method call from the function name and pass parameter            &lt;br /&gt;            eval(handle)(aEvent);&lt;br /&gt;        }&lt;br /&gt;        /* stop the event bubbling now, this ensures browser compatibility */&lt;br /&gt;        if(typeof aEvent.cancelBubble != undefined){            &lt;br /&gt;            // IE event model&lt;br /&gt;            aEvent.cancelBubble = true;&lt;br /&gt;        }        &lt;br /&gt;        if (aEvent.stopPropagation){            &lt;br /&gt;            // Gecko event model&lt;br /&gt;            aEvent.stopPropagation();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    return {&lt;br /&gt;        /* public methods that are being exposed */&lt;br /&gt;        registerEventHandlerWithType: registerEventHandlerWithType,        &lt;br /&gt;        unregisterEventHandlerWithType: unregisterEventHandlerWithType,&lt;br /&gt;        handleEvent: handleEvent        &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**************************************************************************&lt;br /&gt;Event Handler definition ends&lt;br /&gt;**************************************************************************/&lt;br /&gt;&lt;br /&gt;function observeEvent(aEvent){    &lt;br /&gt;    HANDLER.handleEvent(aEvent);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-742487011691273772?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/742487011691273772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=742487011691273772' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/742487011691273772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/742487011691273772'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/07/some-java-script-snippets-event-handler.html' title='Some java script snippets - Event Handler  - part 1'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-7995761669104712867</id><published>2008-07-18T18:30:00.002+05:30</published><updated>2008-08-17T18:55:29.458+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='experiences'/><title type='text'>How to post code?</title><content type='html'>Markup tags are detected using '&amp;lt' and '&amp;gt'. So these are skipped when encountered. This is the reason we don't see content making use of these symbols (well-formed xml content for example). Indentation is another aspect. Luckily the '&amp;ltpre&amp;gt' tag comes to our rescue. If we want to paste some code, we need to escape the '&amp;lt' and '&amp;gt' so that they are rendered properly. Rather than doing it manually, there are certain resources that help us accomplish the same. Certainly we can write our own custom code, another lazy way I found out is to use the following&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.bware.biz/default.htm?http://www.bware.biz/DotNet/Tools/CodeFormatter/WebClient/CodeToHtml.aspx"&gt;http://www.bware.biz/default.htm?http://www.bware.biz/DotNet/Tools/CodeFormatter/WebClient/CodeToHtml.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.stanford.edu/~bsuter/js/convert.html"&gt;http://www.stanford.edu/~bsuter/js/convert.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-7995761669104712867?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/7995761669104712867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=7995761669104712867' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7995761669104712867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7995761669104712867'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/07/how-to-post-code.html' title='How to post code?'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-467018110529259758</id><published>2008-07-18T17:47:00.004+05:30</published><updated>2008-08-17T18:56:02.964+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programing'/><title type='text'>Robust Web Design - part 4 -last</title><content type='html'>&lt;h4&gt;Beware of java programmers in guise of java script programmers&lt;/h4&gt;&lt;br /&gt;Will you ever use a Japanese interpreter for your trip to China? Just because things appear the same doesn’t mean they are the same. One may understand things, but is it sufficient? I personally feel that there are two styles of programming, sniper style and landmine style. One has precision and the other has visibility. Good programmers use precision, they know what to do and the impact of what they are doing. Others still in the learning cycle, try to apply intution or make assumption. Learning languages helps, learning the purpose of the language is saviour. Ever heard about the ‘Golden hammer anti-pattern’? It is important to know what to use and where to use it.&lt;br /&gt;&lt;br /&gt;Java script shares a lot in common with Java, human minds being very adaptive at least perceive so. The reality is different. It is easier for a Java programmer to master java script. All I am interested is, if any effort is invested in that direction.&lt;br /&gt;&lt;br /&gt;&lt;h5&gt;Philosophical differences between Java and Java script:&lt;/h5&gt;&lt;br /&gt;1. Java is static typed, java script is dynamic; there is no type checking in place so use of proper naming convention is vital.&lt;br /&gt;2. Java is application language with support for class invariants. Java script was designed to live in web browsers (I know jdk 6, FX and desktop support, but please…). Web browsers are not supposed to support business invariants, they support view (V of MVC). If someone uses Math library in java script, take him into custody.&lt;br /&gt;3.Java doesn’t support closures (not yet till jdk 6). Java script does. In case, you are wondering, Closure is just a set of statements that can be passed here and there (as parameter). It is just a different style of doing things, you know!!&lt;br /&gt;4.Java is inherently object oriented most of the time with a central control structure. Java script on the other hand is functional and event-driven.&lt;br /&gt;&lt;br /&gt;One symptom of java programmer not doing his homework, is use of ‘==’/’!=’ in place of ‘===’/‘!==’. &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Namespace contamination horrors&lt;/h4&gt;&lt;br /&gt;A good java script programmer tries to keep namespace contamination to a minimum by using object based style. ‘Revealing module pattern’ and ‘Singleton’ are some examples. We can also get huge performance benefits by reusing objects than recreating them. Magic numbers in code can be kept to a minimum using the above. In fact a good piece of work also show cases, cross browser compatible event handling.&lt;br /&gt;&lt;br /&gt;Some references: On java script &lt;a href="http://www.klauskomenda.com/code/javascript-programming-patterns/"&gt;patterns&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We can achieve similar things in CSS by using a unique template id and referring to it in all selectors. This non-semantic declaration is worth its cost. When programming in a large team, these decisions become important.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;The class of web 2.0: IE, Mozilla, Opera…&lt;/h4&gt;&lt;br /&gt;Each of us is unique, that aspect makes ‘each’ of ‘us’. So are browsers. Some prominent aspects I left of earlier are summarised here&lt;br /&gt;&lt;br /&gt;&lt;h5&gt;Event model&lt;/h5&gt;&lt;br /&gt;W3C standard even model speaks of three phases capture, target and bubble. Not all browsers support this. So there is a need to hack into the event model and support the least common factor. A custom event model should also prevent function overriding, (usually happens when two different functions are tied to the same event)&lt;br /&gt;&lt;br /&gt;&lt;h5&gt;Dom model&lt;/h5&gt;&lt;br /&gt;Not all browsers support Dom functions uniformly. We need to have a custom common wrapper library for the most useful ones and refer to the library. These assets can be reused across assignments.&lt;br /&gt;&lt;br /&gt;&lt;h5&gt;Xslt wonder&lt;/h5&gt;&lt;br /&gt;Java script is not the only way to present a view. Certain sections of the user community/application may be reluctant to use scripts. Xslt is the answer for such. It is rich specification with support for reg-ex as well!&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;AJAX, JQuery, DOJO and others&lt;/h4&gt;&lt;br /&gt;We discussed the group of java script dissidents; as the world exists we also have a section of aficionados. These guys are those who enjoy the privilege of huge broadband, fast processors and humungous main memory when compared to the past era (read 4 years ago). Writing our own scripts and testing for cross browser compatibility is painful. Why not ask someone else to help us out here? Dojo, JQuery, YUI from yahoo, GWT from Google, JMaki and several others have been targeting these goals.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-467018110529259758?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/467018110529259758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=467018110529259758' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/467018110529259758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/467018110529259758'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/07/robust-web-design-part-4-last.html' title='Robust Web Design - part 4 -last'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-3936287940692887007</id><published>2008-07-18T17:43:00.002+05:30</published><updated>2008-08-17T18:56:02.964+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programing'/><title type='text'>Robust Web Design - part 3</title><content type='html'>Third posting&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;CSS – Domino effect&lt;/h4&gt;&lt;br /&gt;A home made avalanche vs. a child’s play kit? Is something I used to wonder when I first understood the purpose of CSS. I would never teach CSS to someone who is starting web-design, who cares about consistent styling or the fact that the way content is uniformly laid, ok I was kidding. These things are better learnt by feeling the flare, the flare of inconsistent design, the wrath of the end-user, the harm to ones own pride, the legend of Zelda, the story of war craft…(ok I exaggerated a bit). &lt;br /&gt;&lt;br /&gt;CSS even its simplest form (inline style definition) shows its’ merits. Forget about layouts, forget about cross browser compatibility. The amount of code that is reduced (read more coffee breaks) is itself rewarding. “The lesser the code, the fewer bugs” -  a well known adage. I used to correlate CSS with Dominos. Remember those videos on youtube. Anyone who designs a large project faces the same challenges. Things rarely go so well when put to practice. So there are certain firewalls, redundancies put in place. CSS is essentially huge collection of domino chips, with provisions for firewalls and redundancies (read CSS selectors). These provisions allow certain chips (rules) to take precedence over others. Each chip (rule) causes an effect (sets style properties). The game is to place the chips and firewalls appropriately. The challenge is the game floor. Not every stadium/court is the same! There are certain tricks and tips to raise our bar, when playing in not so friendly arenas (hacks). These tricks work well for that given court alone and don’t go well with the big picture.&lt;br /&gt;&lt;br /&gt;A check list for the techies:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Learn your selectors&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Negotiate for the most recent browsers and restrict their number (I know I sound like a weasel)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Overwrite browser defaults&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Negotiate for the minimum window size, especially height of the scrollable content in px. May be critical for java script disabled scenarios. Fluid layouts need specs in ems&lt;/li&gt; &lt;br /&gt;&lt;li&gt;Avoid mixing margin &amp; width attributes. Inconsistencies across browsers rise from the misinterpretation of box-model&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Alternatively; use padding, and/or border styles with width and color matching the background; to achieve the same effect&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Avoid tables for layout. Most accessibility problems rise from this fact&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Seek dispensation for complex UI features. Almost, all known browsers till date fail the Acid tests. It is difficult to achieve standard compliance using non-standard compliant user agents&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Avoid CSS expressions&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Try to build your styles based on the least common selectors&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Test your styles across browsers&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;a. Test for well formed content in absence of CSS&lt;br /&gt;b. Test for accessibility&lt;br /&gt;c. Test for text enlarge, compact scenarios&lt;br /&gt;d. Avoid classitis and divitis. Use grouped declaration of selectors and pseudo declarations. Divitis may not be avoided always&lt;br /&gt;e. Document the use of extraneous divs (if any being used for layout)&lt;br /&gt;f. Separate styles based on usage pattern i.e. layout, color, font-styles&lt;br /&gt;g. Use a namespace to avoid style-conflict&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Horror of hacks&lt;/h4&gt;&lt;br /&gt;Ever heard of 3 pixel jog? Knowing your browser is of paramount importance. There is a difference in addressing symptoms and addressing the cause. Which one would you prefer? There are a huge number of resources that speak about these. I personally like ‘CSS Mastery’ by Andy Budd and ‘Pro CSS Techniques’ from Apress. I haven’t read others, but I feel one or two books help you realise the game.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-3936287940692887007?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/3936287940692887007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=3936287940692887007' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3936287940692887007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3936287940692887007'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/07/robust-web-design-part-3.html' title='Robust Web Design - part 3'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-1491263775905765549</id><published>2008-07-18T17:40:00.002+05:30</published><updated>2008-08-17T18:56:02.964+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programing'/><title type='text'>Robust Web Design - part 2</title><content type='html'>Second part of the post...&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Russian dolls, Onion skins and the purpose of existence&lt;/h4&gt;&lt;br /&gt;All boxes look the same, but are they the same? Suppose I have magic wand that with me, that lets me resize things and 100 boxes and if I need to fit all the boxes into a single box; all I had to do is pick two boxes, change the size of one to accommodate other, easily said. What about html mark-up? Well think of a trying to fit a coffin into a food container, sounds funny! The odd feeling is because of the fact that we try to relate containers with content. They have a purpose. Do we know the purpose of html containers?&lt;br /&gt;&lt;br /&gt;&lt;h5&gt;Valid mark-up&lt;/h5&gt;&lt;br /&gt;God, created heaven and earth, and W3C dictates web standards. Learning the rational behind standards, helps better appreciation and usage. Two broad level box model types are Block and Inline. There are other finer classifications of course, for example six box models, which are: inline, inline-block, block, table, absolute, and float. W3C also has an html validator application, which notifies us of the violations. Doing early and frequent checks for compliance always helps. Anyone who has stacked up laundry for the weekend knows this.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;A compliance, AA compliance, AAA compliance&lt;/h4&gt;&lt;br /&gt;Inaccessible web sites are politically incorrect, legally liable and may cause potential loss of revenue. Certain technologies are not yet deemed accessible (like flash). Just acknowledging the guidelines while designing the site, makes the developers’ life easier. One can always use this as an excuse for excluding fancy stuff of course! Accessible websites make developers more pragmatic, and avoid gloss. &lt;br /&gt;&lt;br /&gt;&lt;h4&gt;This works perfectly fine on my machine – Unfortunate reality&lt;/h4&gt;&lt;br /&gt;Above is a typical complaint from a software developer – a myth – something to be frowned upon. At least I did use it once in my early life as a college pass out. Most of the time, a bad design decision or a weird environment issue causes this. Unfortunately, when it comes to web design, we have a number of variables that make us acknowledge this statement. Did the developer use CSS expressions, did the developer face this on Mac/Windows, what was the browser, what was the resolution, which version of the software is used …. did the butterfly flapped its’ wings, did Microsoft sneeze. &lt;br /&gt;&lt;br /&gt;&lt;h5&gt;PNG, SVG, Flash&lt;/h5&gt;&lt;br /&gt;Not every browser is the same, ACID2 and ACID3 tests give more insight into this issue. How can we have standard code when we don’t have standard compliant user agents? - a million dollar question. The answer: is the whole reason why the client hired you. PNGs are not supported on IE, try using transparent shadow affects, you will know. So are several other technologies across several other browsers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-1491263775905765549?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/1491263775905765549/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=1491263775905765549' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1491263775905765549'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1491263775905765549'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/07/robust-web-design-part-2.html' title='Robust Web Design - part 2'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-3159865797122485422</id><published>2008-07-18T17:35:00.002+05:30</published><updated>2008-08-17T18:56:02.964+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programing'/><title type='text'>Robust Web Design - part 1</title><content type='html'>For a change I will speak of Dos and not about Don’ts. Who likes a wailing moron anyway?&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;On a mark, get…&lt;/h4&gt;&lt;br /&gt;The first thing to do before we start off into code is to acknowledge and assess ones own competencies. Most often, I see people, who fool themselves into the misconception, that web-design is simple. Well they are not exactly guilty. Most often one can see that HTML is no rocket science. A two day reading of the material is sufficient. Any design can be realized with the knowledge of tables. The challenge is convincing oneself that there are things beyond the obvious, and learning is never obviated (warning: obviate isn’t a synonym of obvious). The litmus test I would use: Ask the developers if they are aware of something called quirks mode.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;The first phrase is DOCTYPE and a great leap for design&lt;/h4&gt;&lt;br /&gt;Neil Armstrong landed on moon, and it was rocket science. Now DOCTYPE doesn’t leave a trail of fire, nor is a achievement telecasted globally. Besides that, DOCTYPE is one part that is capable of setting you on fire and telecast your monumental failure across the group. &lt;br /&gt;The possible DOCTYPE declarations and their effects are well presented in &lt;a href="http://en.wikipedia.org/wiki/Quirks_mode"&gt;Quirks_mode&lt;/a&gt;&lt;br /&gt;My suggestion, use XHTML strict in standards mode. Note that having any comments before DOCTYPE declaration in IE trigger quirks mode. One may occasionally wonder why go to such extremes, the answer is simple: Invest and Profit or Ignore and Pay later. A strict standards adherence guarantees minimal deviation across browsers. ‘Almost strict’ is also desirable though.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Raise and Fall of mark-up – XHTML&lt;/h4&gt;&lt;br /&gt;The most interesting thing about standards is that they promise huge benefits and deliver little. XHTML is one aspect of standards that raises my suspicions. Just to avoid the notoriety of being an eccentric designer, use XHTML. Who knows, somewhere down the line there may come a day. I bet that Michael Faraday never dreamt of the modern marvels of electricity the day he discovered it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-3159865797122485422?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/3159865797122485422/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=3159865797122485422' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3159865797122485422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/3159865797122485422'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/07/robust-web-design-part-1.html' title='Robust Web Design - part 1'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-8374897623970546196</id><published>2008-07-10T19:51:00.006+05:30</published><updated>2008-07-10T21:27:37.101+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='experiences'/><category scheme='http://www.blogger.com/atom/ns#' term='Programing'/><category scheme='http://www.blogger.com/atom/ns#' term='monologues'/><title type='text'>Good practice, bad practice</title><content type='html'>When I was young, I had a nasty habit of biting finger-nails. My parents tried hard to convince me that it was bad, I couldn’t' see what was wrong with that. After all, those are my fingers, aren’t' they? Before I tell you how I quit that habit. I got to tell you, how amused I feel when I think about it. To may amazement, when I get to see people writing crappy code around, I don’t' feel equally amused. Narcissistic SOB, I may be.&lt;br /&gt;&lt;br /&gt;I most amusing part is the climax, where you confront them. You get to hear interesting arguments in defence. Some almost child like ones: &lt;span style="font-weight:bold;"&gt;"But the final affect is the same"&lt;/span&gt; or &lt;span style="font-weight:bold;"&gt;"It works, and what you are telling is not very straight forward"&lt;/span&gt;. Some rather thoughtful ones: &lt;span style="font-weight:bold;"&gt;"It’s already tested"&lt;/span&gt;. Seldom some arrogant ones: &lt;span style="font-weight:bold;"&gt;"Why doesn’t' he/she do it"&lt;/span&gt;. Most of the times, the final result is a compromise. The times one sees beautiful code, one can assume that there is egoistic SOB down under. I like these guys. They write code as if they have discipline imbibed into their cerebral cortex, only to find that they can be as sloppy as your neighbour’s cat.&lt;br /&gt;&lt;br /&gt;Now don’t' get me wrong. I know that people learn from mistakes. Adaptability is a virtue. The SOBs have had their share of misgivings. Remember the scene from movie MATRIX where neo jumps of the building! no one jumps the first time, not even the ONE. Taking shortcuts harms, but shortcuts are supposed to be short. It is like driving through city center. When you are new to the city, don’t' take shortcuts. Keep to the main road. That is the greatest shortcut. People tend to ignore the greatest shortcut of all, do your research, don’t' wait till you see the river, find out where the river is even before you reach. &lt;br /&gt;&lt;br /&gt;A wise man once said that there are no dumb questions. Let me blabber about what I feel about &lt;span style="font-weight:bold;"&gt;"The final affect is the same"&lt;/span&gt;. Well is it, is it really. We are forgetting the fact, that two months down the line, when some miscreant changes requirements or finds a new defect. I wouldn’t' like to waste my energy. Nor would I like my brotherhood of #£$$% (fill your own stream) to suffer. Most seriously, I am willing to spend two days right now than slog late into nights for months, later on. The final affect is on you dear, and you effect the affect.&lt;br /&gt;&lt;br /&gt;For, &lt;span style="font-weight:bold;"&gt;"It works, and what you are telling is not very straight forward"&lt;/span&gt;. You are damn right. So does walking. Why learn cycling or drive a car or take a flight. Knowing things is difficult, but when it can give some real soul satisfaction. Ask any teenager fiddling an engine. &lt;span style="font-weight:bold;"&gt;"It’s already tested"&lt;/span&gt; is the most difficult one to justify. The only excuse I have is that it makes you fall out of habit. For &lt;span style="font-weight:bold;"&gt;"Why doesn’t' he/she do it"&lt;/span&gt;, trust me this isn’t' a flight to Moon, even that was repeated. (Or is it?)&lt;br /&gt;&lt;br /&gt;The only difference between the nutcases who organise their stuff with the rigmarole of a fascist and the rest of the world is the same one between those willing to till the soil, creates a fertile bed and between other gatherers. All we are speaking of is some interest, planning, discipline and investment.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-8374897623970546196?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/8374897623970546196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=8374897623970546196' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/8374897623970546196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/8374897623970546196'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/07/good-practice-bad-practice.html' title='Good practice, bad practice'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-4360700034345368176</id><published>2008-05-08T18:47:00.002+05:30</published><updated>2008-07-10T21:29:39.714+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='experiences'/><category scheme='http://www.blogger.com/atom/ns#' term='monologues'/><title type='text'>When Spring Comes...</title><content type='html'>Lost in the wind, lost in the thought, not alone am I? &lt;br /&gt;Equally lost are the wandering leaves and cold nights;&lt;br /&gt;Oh dear bright flowers that I see around, tell those friends,&lt;br /&gt;That I miss their sight. The bright sunny days have stolen my sleep.&lt;br /&gt;My slumber time dreams are now just a slimmering gleam.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-4360700034345368176?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/4360700034345368176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=4360700034345368176' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4360700034345368176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4360700034345368176'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/05/when-spring-comes.html' title='When Spring Comes...'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-6604949867090677801</id><published>2008-02-22T20:11:00.005+05:30</published><updated>2008-07-10T21:28:58.184+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programing'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><title type='text'>CSS Magic and Mayhem</title><content type='html'>Cascading is wonderful thing. It can be fun, like the old times when you used to play with toy trains. It can change colors and act bitchy too. Most CSS designers take short cuts, infact many swear by googling around. This argumentative attitude doesnt' foster creativeness. I strongly believe that we should google around for ideas, not for doing homework! After reading a couple of books here and there, I began to appreciate the ingenuity of the UI designers and the hurdles they face.(I am not yet into CSS, so please excuse the seclusion).&lt;br /&gt;&lt;br /&gt;CSS, is as a template for styles. Any aspect of software has three major features at a very high level - 1.) Static 2.) Functions 3.) Behaviour. UI is no exception. Static aspect is the aspect which is fixed in a completed application. It is essentially code that executes. Functionality is the purpose for which the code is written. Behaviour speaks about the variations in which the Functionality is achieved. In W3C UI, html takes the static aspect. Being an UI application, we desire to have loads of eye-candy; images, fonts, flash, gradients, sounds etc. This eye candy needs to be consistent across the application. Who would like to have an application in which a page footer with the same content shows up differently in different pages. Behaviour is affected by the ability of the User agents like availability of scripting, browser version etc.&lt;br /&gt;&lt;br /&gt;The CSS best practices include avoiding Classitis, Divitis, spacer-gifs. There are other desirable features that make a developers life simple like; using strict DTDs, overriding browser defaults, using liquid/fluid layouts. &lt;br /&gt;&lt;br /&gt;When it comes to managability, I find two very intriguing factors. &lt;br /&gt;1.) Design themes&lt;br /&gt;2.) Seperate concerns, into reusable classes or css scripts for colors, fonts, layouts&lt;br /&gt;3.) Create themes for the design&lt;br /&gt;4.) Negotiate the exceptionally difficult UI features with the client. An example would be interweaved style usage: " Role: &lt;span style="font-weight:bold;"&gt;Consultant &lt;/span&gt; Organisation &lt;span style="font-style:italic;"&gt;Charing Cross Hospital&lt;/span&gt;&lt;br /&gt;for such instances negotiate for a single uniform style for content and try to move the enhancements to Java script.&lt;br /&gt;&lt;br /&gt;As always, I will try to include a small CSS snippet for toying around.&lt;br /&gt;#########################################################&lt;br /&gt;&lt;h3&gt;Html content&lt;/h3&gt;&lt;br /&gt;&amp;lt!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"&lt;br /&gt;    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;&lt;br /&gt;&lt;br /&gt;&amp;lthtml xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;br /&gt;&amp;lthead&gt;&lt;br /&gt;  &amp;ltmeta name="eGMS.accessibility" scheme="WCAG" content="AA" /&gt;&lt;br /&gt;  &amp;ltmeta http-equiv="Content-type" content=&lt;br /&gt;  "text/html; charset=us-ascii" /&gt;&lt;br /&gt;&lt;br /&gt;  &amp;lttitle&gt;This is Sample 1&amp;lt/title&gt;&lt;br /&gt;  &amp;ltlink rel="stylesheet" type="text/css" href=&lt;br /&gt;  "../css/samplecss.css" /&gt;&lt;br /&gt;  &amp;ltSCRIPT language="JavaScript" SRC="../js/footersetting.js"&gt;&amp;lt/SCRIPT&gt;&lt;br /&gt;&amp;lt/head&gt;&lt;br /&gt;&lt;br /&gt;&amp;ltbody&gt;&lt;br /&gt; &amp;lt!-- information tag is used to differentiate footer from main content --&gt; &lt;br /&gt;  &amp;ltdiv id="information"&gt;&lt;br /&gt;    &amp;ltdiv id="banner"&gt;&lt;br /&gt;      &amp;lth1&gt;Banner is being shown&amp;lt/h1&gt;&lt;br /&gt;    &amp;lt/div&gt;&lt;br /&gt;    &lt;br /&gt;    &amp;lt!-- horizontal navigation --&gt;&lt;br /&gt;    &amp;ltdiv id="horiz_nav"&gt;&lt;br /&gt;      &amp;ltul&gt;&lt;br /&gt;        &amp;ltli&gt;horiz_1&amp;lt/li&gt;&lt;br /&gt;&lt;br /&gt;        &amp;ltli&gt;horiz_2&amp;lt/li&gt;&lt;br /&gt;      &amp;lt/ul&gt;&lt;br /&gt;    &amp;lt/div&gt;&lt;br /&gt;    &lt;br /&gt;    &amp;lt!-- main content wrapper --&gt;&lt;br /&gt;    &amp;ltdiv id="school"&gt;&lt;br /&gt;      &amp;lt!-- main content --&gt;&lt;br /&gt;  &amp;ltdiv id="book"&gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt!-- primary content --&gt;&lt;br /&gt;        &amp;ltdiv id="rhymes"&gt;&lt;br /&gt;          I am a little tea pot, Short and stout, This is my CSS,&lt;br /&gt;          Please take me out!&lt;br /&gt;        &amp;lt/div&gt;&amp;lt!-- secondary content --&gt;&lt;br /&gt;        &amp;ltdiv id="questions"&gt;&lt;br /&gt;          Why did johnny eat sugar? Why did London bridge start&lt;br /&gt;          falling and when is it going to break its fall? When did&lt;br /&gt;          rats learn to repair clocks? Why didnt' jack and jill&lt;br /&gt;          call 999?&lt;br /&gt;    &amp;lt/div&gt;&lt;br /&gt; &amp;lt/div&gt;&lt;br /&gt;&lt;br /&gt; &amp;lt!-- vertical navigation --&gt;&lt;br /&gt;      &amp;ltdiv id="vert_nav"&gt;&lt;br /&gt;        &amp;ltul&gt;&lt;br /&gt;          &amp;ltli&gt;vert_1&amp;lt/li&gt;&lt;br /&gt;&lt;br /&gt;          &amp;ltli&gt;vert_2&amp;lt/li&gt;&lt;br /&gt;        &amp;lt/ul&gt;&lt;br /&gt;      &amp;lt/div&gt;&lt;br /&gt;    &amp;lt/div&gt;&amp;lt!-- main content wrapper ends --&gt;&lt;br /&gt;  &amp;lt/div&gt;&amp;lt!-- information ends --&gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt!-- footer --&gt;&lt;br /&gt;  &amp;ltdiv id="footer"&gt;&lt;br /&gt;    Thats' all folks!!&lt;br /&gt;  &amp;lt/div&gt;&lt;br /&gt;&amp;lt/body&gt;&lt;br /&gt;&amp;lt/html&gt;&lt;br /&gt;##################################################################&lt;br /&gt;&lt;h3&gt; Sample CSS &lt;/h3&gt;&lt;br /&gt;/* undoing browser defaults */&lt;br /&gt;:link,:visited {text-decoration: none;}&lt;br /&gt;&lt;br /&gt;ul,ol {list-style: none;}&lt;br /&gt;h1,h2,h3,h4,h5,h6,pre,code,p {font-size: 1em;}&lt;br /&gt;&lt;br /&gt;ul,ol,dl,li,dt,dd,h1,h2,h3,h4,h5,h6,pre,form,body,html,p,blockquote,fieldset,input {margin: 0; padding: 0;}&lt;br /&gt;&lt;br /&gt;a img,:link img,:visited img {border: none;}&lt;br /&gt;&lt;br /&gt;address {font-style: normal;}&lt;br /&gt;/* undoing completed */&lt;br /&gt;&lt;br /&gt;#banner h2 {&lt;br /&gt; float: left;&lt;br /&gt; clear: both;&lt;br /&gt; color: #006;&lt;br /&gt; width: 100%;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#horiz_nav {&lt;br /&gt; float: left;&lt;br /&gt; clear: both; &lt;br /&gt; width: 100%;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#horiz_nav ul {&lt;br /&gt; background-color: #099;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#horiz_nav ul li {&lt;br /&gt; display: inline;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#school #book {&lt;br /&gt; float: right;&lt;br /&gt; clear: right;&lt;br /&gt; color: #606;&lt;br /&gt; width: 75%;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#school #vert_nav {&lt;br /&gt; float: left;&lt;br /&gt; clear: left;&lt;br /&gt; color: #606;&lt;br /&gt; width: 20%;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#school #book #rhymes{&lt;br /&gt; float: left;&lt;br /&gt; clear: left;&lt;br /&gt; color: #698;&lt;br /&gt; width: 48%;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#school #book #questions{&lt;br /&gt; float: right;&lt;br /&gt; clear: right;&lt;br /&gt; color: #698;&lt;br /&gt; width: 48%;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#footer {&lt;br /&gt; float: left;&lt;br /&gt; width: 100%;&lt;br /&gt; clear: both;&lt;br /&gt; text-align: center;&lt;br /&gt; position: relative;&lt;br /&gt; bottom: 0%;&lt;br /&gt; left: 0%;&lt;br /&gt;}&lt;br /&gt;Above is supposed to work independent of browser being used. Anomalies would be there but changing the defaults is easier in CSS structured in this fashion, If one wants to have a close look at the way the boxing is done use the following&lt;br /&gt;################################################&lt;br /&gt;&lt;h3&gt; Samplecss.css with boxes &lt;/h3&gt;&lt;br /&gt;/* undoing browser defaults */&lt;br /&gt;:link,:visited {text-decoration: none;}&lt;br /&gt;&lt;br /&gt;ul,ol {list-style: none;}&lt;br /&gt;h1,h2,h3,h4,h5,h6,pre,code,p {font-size: 1em;}&lt;br /&gt;&lt;br /&gt;ul,ol,dl,li,dt,dd,h1,h2,h3,h4,h5,h6,pre,form,body,html,p,blockquote,fieldset,input {margin: 0; padding: 0;}&lt;br /&gt;&lt;br /&gt;a img,:link img,:visited img {border: none;}&lt;br /&gt;&lt;br /&gt;address {font-style: normal;}&lt;br /&gt;/* undoing completed */&lt;br /&gt;&lt;br /&gt;#banner h2 {&lt;br /&gt; float: left;&lt;br /&gt; clear: both;&lt;br /&gt; color: #006;&lt;br /&gt; border-style: dotted;&lt;br /&gt; width: 100%;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#horiz_nav {&lt;br /&gt; float: left;&lt;br /&gt; clear: both; &lt;br /&gt; width: 100%;&lt;br /&gt; border-style: solid;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#horiz_nav ul {&lt;br /&gt; background-color: #099;&lt;br /&gt; border-style: solid;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#horiz_nav ul li {&lt;br /&gt; border-style: solid;&lt;br /&gt; display: inline;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#school #book {&lt;br /&gt; float: right;&lt;br /&gt; clear: right;&lt;br /&gt; color: #606;&lt;br /&gt; border-style: dotted dashed; &lt;br /&gt; width: 75%;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#school #vert_nav {&lt;br /&gt; float: left;&lt;br /&gt; clear: left;&lt;br /&gt; color: #606;&lt;br /&gt; border-style: dotted dashed; &lt;br /&gt; width: 20%;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#school #book #rhymes{&lt;br /&gt; float: left;&lt;br /&gt; clear: left;&lt;br /&gt; color: #698;&lt;br /&gt; border-style: dashed;&lt;br /&gt; width: 48%;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#school #book #questions{&lt;br /&gt; float: right;&lt;br /&gt; clear: right;&lt;br /&gt; color: #698;&lt;br /&gt; border-style: dashed;&lt;br /&gt; width: 48%;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#footer {&lt;br /&gt; float: left;&lt;br /&gt; width: 100%;&lt;br /&gt; clear: both;&lt;br /&gt; border-style: solid;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-6604949867090677801?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/6604949867090677801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=6604949867090677801' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6604949867090677801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6604949867090677801'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/02/css-magic-and-mayhem.html' title='CSS Magic and Mayhem'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-205760297508851863</id><published>2008-02-17T19:02:00.002+05:30</published><updated>2008-07-10T21:29:39.715+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='experiences'/><category scheme='http://www.blogger.com/atom/ns#' term='ideas'/><category scheme='http://www.blogger.com/atom/ns#' term='monologues'/><title type='text'>RCP Ideas</title><content type='html'>Enterprise applications are typically not meant for every one. The users targeted are specialized and knowledgable. The application providers can exploit this aspect and deliver optimized systems for this section of users. Rich UI and client side processing  are the exploitable aspects. The problem of connecting client systems to servers is still open. Writing custom socket code or coming up with custom user agents are some solutions. If re-inventing the wheel is not your cup of tea, then the following is for you.&lt;br /&gt;&lt;br /&gt;The idea is to use Http unit to communicate with web-apps. Httpunit is developed with the intention of testing webapps on the lines of junit. The interface functionality is tested here. A brief overview of Http unit before we dwell into the facts.&lt;br /&gt;1. The core of http unit is WebConversation, This is equivalent to the application browser window.&lt;br /&gt;2. The requests sent are WebRequests, these carry parameters with them. In webapps, Form submission is one example of request submission.&lt;br /&gt;3. The responses are sent by WebServer, these are WebResponses&lt;br /&gt;&lt;br /&gt;WebConversation defines a context within which WebRequests and WebResponses are exchanged. These form a conversational state.&lt;br /&gt;&lt;br /&gt;Enough with httpunit, we will look at the possible strategies for RCP UI. &lt;br /&gt;&lt;br /&gt;Well designed webapps are typically layered. Presentation layer is the one which feeds the UI. We can retain a simple html based pres layer, without any client validations and build an RCP presentation model on it.&lt;br /&gt;&lt;br /&gt;Or, We can do away with the Presentation layer and straight away handle web conversations from the RCP code.&lt;br /&gt;&lt;br /&gt;I personally prefer a html layer, It ensures a proper seperation of concerns. Note that this UI need not adhere to the W3C standards. It need not even look visually appealing, (read no complex CSS). No need to bother about client side validations either. (With the advent ot scripting to desktop apps from jdk6, we are seeing new evolutions. We now have new areas like Ajax, flash to add all the gloss).&lt;br /&gt;&lt;br /&gt;This being said the problems of managing versions and providing updates to application clients forces new processes to be setup. One of the major benifits that a system provider would get are related to resource usage. If we design for application models on client end, we can save memory and processig speed on server side. Light weight sessions and complex algorithemic computations can be delegate to client. The server would be a data provider and a access provider.&lt;br /&gt;&lt;br /&gt;How popular RCP is going to be, only time can tell&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-205760297508851863?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/205760297508851863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=205760297508851863' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/205760297508851863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/205760297508851863'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2008/02/rcp-ideas.html' title='RCP Ideas'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-4496385120271062498</id><published>2007-12-22T22:39:00.000+05:30</published><updated>2007-12-22T23:28:33.305+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='experiences'/><title type='text'>Xbox 360</title><content type='html'>I bought a xbox 360, never thought that it should be blogged :) I am doing it anyway. The seventh generation of consoles are absolute number crunchers. If any one has worked on a graphics program like adobe photoshop or gimp, they would understand it. Most computers of yester years were good at things like browsing, drafting documents and playing media files. The graphic programers always went for a extra special offering called apple. Any good rendering involves operations that are cpu hungry and memory hungry. Now a days the chasm is being bridged but the divide still exists.&lt;br /&gt;&lt;br /&gt;Coming back, the xbox sits like a cute little puppy in the drawing room just beneath the TV. It at time looks melancholic as well. All this changes in a spur of a moment, just switch on the power and insert your favourite game (mine being Gears of war). There is no thunder or lightning, apart from the noise made by the cooling unit. The graphics and visual effects at times dazzle me. I often wonder whose idea was the rocking controller. I have a strong feeling that the 3.2 Ghz 6 core machine will stay with me for a long time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-4496385120271062498?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/4496385120271062498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=4496385120271062498' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4496385120271062498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4496385120271062498'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/12/xbox-360.html' title='Xbox 360'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-7402156953235569653</id><published>2007-12-22T21:48:00.000+05:30</published><updated>2007-12-22T22:27:54.630+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Programing'/><title type='text'>Jibx with Netbeans</title><content type='html'>There are times when we face the need to marshall and unmarshall java objects. What better than XML for this! Most programmers can write their own XML parsers and unparsers, why do that when we have a beautiful utility tool. Infact there are several tools. Jibx is one of them, it is offers better performance than many other rivals by using the pull-event mechansim, to top that it is free for use and opensourced. Jibx essentially asks the users to provide a mapping between java objects and xml data. This  mapping is provided by users in form of xml file. Lets call it binding xml. Then the users are asked to compile the the project and compile the bindings. The byte code is modified (another reason for the high performance) during this process.&lt;br /&gt;&lt;br /&gt;A sample code snippet:&lt;br /&gt;##############################&lt;br /&gt;&lt;br /&gt;package ajibx_learning;&lt;br /&gt;&lt;br /&gt;import java.io.File;&lt;br /&gt;import java.io.FileInputStream;&lt;br /&gt;import java.io.FileNotFoundException;&lt;br /&gt;import java.io.FileOutputStream;&lt;br /&gt;import java.util.ResourceBundle;&lt;br /&gt;&lt;br /&gt;import org.jibx.runtime.BindingDirectory;&lt;br /&gt;import org.jibx.runtime.IBindingFactory;&lt;br /&gt;import org.jibx.runtime.IMarshallingContext;&lt;br /&gt;import org.jibx.runtime.IUnmarshallingContext;&lt;br /&gt;import org.jibx.runtime.JiBXException;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class Main {&lt;br /&gt;    /**&lt;br /&gt;     * Unmarshal the sample document from a file, then marshal it back out to&lt;br /&gt;     * another file.&lt;br /&gt;     */&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;        String ajibxProperties = "ajibx_learning.bizProperties";&lt;br /&gt;        String fileInput = "fileOutput";&lt;br /&gt;        String fileOutput = "fileInput";&lt;br /&gt;        String className = "className";&lt;br /&gt;        File fOut = null;&lt;br /&gt;        File fIn = null;&lt;br /&gt;        Object bean = null;&lt;br /&gt;        try {&lt;br /&gt;            &lt;br /&gt;            ResourceBundle rbundle = ResourceBundle.getBundle(ajibxProperties);&lt;br /&gt;            &lt;br /&gt;            fOut = new File(rbundle.getString(fileInput));&lt;br /&gt;            fIn = new File(rbundle.getString(fileOutput));&lt;br /&gt;            Class c = Class.forName(rbundle.getString(className));&lt;br /&gt;            bean = c.newInstance();&lt;br /&gt;        } catch (Exception ex) {&lt;br /&gt;            ex.printStackTrace();&lt;br /&gt;            System.out.print("Exiting ...");&lt;br /&gt;            return;&lt;br /&gt;        } &lt;br /&gt;        System.out.print("Unmarshalling ...");&lt;br /&gt;        // unmarshal customer information from file&lt;br /&gt;        bean = unMarshall(fIn, bean);&lt;br /&gt;        // you can add code here to alter the unmarshalled customer&lt;br /&gt;        System.out.print("marshalling ...");&lt;br /&gt;        // marshal object back out to file (with nice indentation, as UTF-8)&lt;br /&gt;        marshall(bean, fOut);&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    public static Object unMarshall( File fileIn, Object bean){&lt;br /&gt;        boolean status = true;&lt;br /&gt;        try {&lt;br /&gt;            // note that you can use multiple bindings with the same class, in&lt;br /&gt;            //  which case you need to use the getFactory() call that takes the&lt;br /&gt;            //  binding name as the first parameter&lt;br /&gt;            Class beanClass = bean.getClass();&lt;br /&gt;            IBindingFactory bfact = BindingDirectory.getFactory(beanClass);&lt;br /&gt;            // unmarshal customer information from file&lt;br /&gt;            IUnmarshallingContext uctx = bfact.createUnmarshallingContext();&lt;br /&gt;            if(!fileIn.exists()) {&lt;br /&gt;                System.out.println("File doesnt' exist: "+fileIn.getAbsoluteFile());&lt;br /&gt;                return status=false;&lt;br /&gt;            }&lt;br /&gt;            FileInputStream in = new FileInputStream(fileIn);&lt;br /&gt;            bean = uctx.unmarshalDocument(in, null);&lt;br /&gt;            in.close();&lt;br /&gt;        } catch(Exception e){&lt;br /&gt;            status = false;&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        } finally {&lt;br /&gt;            if(status)&lt;br /&gt;                return bean;&lt;br /&gt;            else &lt;br /&gt;                return null;&lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    public static boolean marshall( Object bean, File fileOut){&lt;br /&gt;        boolean status = true;&lt;br /&gt;        try {&lt;br /&gt;            // note that you can use multiple bindings with the same class, in&lt;br /&gt;            //  which case you need to use the getFactory() call that takes the&lt;br /&gt;            //  binding name as the first parameter&lt;br /&gt;            Class beanClass = bean.getClass();&lt;br /&gt;            IBindingFactory bfact = BindingDirectory.getFactory(beanClass);&lt;br /&gt;            // marshal object back out to file (with nice indentation, as UTF-8)&lt;br /&gt;            IMarshallingContext mctx = bfact.createMarshallingContext();&lt;br /&gt;            mctx.setIndent(2);&lt;br /&gt;            if(fileOut.exists()){                &lt;br /&gt;                fileOut.delete();&lt;br /&gt;            }            &lt;br /&gt;            if(fileOut.createNewFile()) {&lt;br /&gt;                System.out.println("Creating file: "+fileOut.getAbsoluteFile());    &lt;br /&gt;            }&lt;br /&gt;            else {&lt;br /&gt;                System.out.println("Failed to create file: "+fileOut.getAbsoluteFile());&lt;br /&gt;                return status=false;&lt;br /&gt;            }&lt;br /&gt;            FileOutputStream out = new FileOutputStream(fileOut);&lt;br /&gt;            mctx.marshalDocument(bean, "UTF-8", null, out);&lt;br /&gt;            out.flush();&lt;br /&gt;            out.close();&lt;br /&gt;        } catch(Exception e) {&lt;br /&gt;            status = false;&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        } finally {&lt;br /&gt;            return status;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;###############################&lt;br /&gt;&lt;br /&gt;I decided to use the following properties file&lt;br /&gt;#bizProperties.properties&lt;br /&gt;# the input file is the source of xml data&lt;br /&gt;fileInput = D:\\temp\\jibx-gen\\Example1.xml&lt;br /&gt;# the outfile is written by the program&lt;br /&gt;fileOutput = D:\\temp\\jibx-gen\\Gen-Example1_2.xml&lt;br /&gt;# the bean which I intended to use&lt;br /&gt;className = beandef.Person&lt;br /&gt;###############################&lt;br /&gt;&lt;br /&gt;I then decided to use the good old 'ant' script to compile this. The issue with ant scripts was that, the code cannt be debugged straight away in IDE. So, I decided to have look at the IDE generated ant script. This itself deserved another posting!!. The expressive power of ant is better illustrated in such examples. The modifications  done to build.xml are given below. Note that I was using Netbeans5.5.1&lt;br /&gt;##############################&lt;br /&gt;&lt;br /&gt;blah blah of netbeans...&lt;br /&gt;Please replace &amp;lt with &lt;&lt;br /&gt;&lt;br /&gt;&amp;lt!-- modified for the sake of Jibx bindings --&gt;&lt;br /&gt;    &amp;ltproperty file="nbproject/buildExample1.properties"/&gt;&lt;br /&gt;    &amp;lt!-- JiBX binding compiler task definition --&gt;&lt;br /&gt;    &lt;br /&gt;    &amp;lttaskdef name="bind" classname="org.jibx.binding.ant.CompileTask" classpath="${file.reference.jibx-bind.jar}"&gt;&amp;lt/taskdef&gt;&lt;br /&gt;    &amp;lt!--&lt;br /&gt;    --&gt;&lt;br /&gt;    &amp;lttarget name="-post-compile"&gt;&lt;br /&gt;            &amp;ltecho message= "${file.reference.jibx-bind.jar}" &gt;                &lt;br /&gt;            &amp;lt/echo&gt;&lt;br /&gt;            &lt;br /&gt;        &amp;lt!-- Run JiBX binding compiler --&gt;&lt;br /&gt;        &amp;ltbind verbose="true" load="true" &gt;&lt;br /&gt;            &amp;ltclasspath path="${run.classpath}"&gt;&amp;lt/classpath&gt;   &lt;br /&gt;            &amp;ltbindingfileset dir="${binding.dir}" includes="${binding.filenamepattern}" &gt;&lt;br /&gt;            &amp;lt/bindingfileset&gt; &lt;br /&gt;        &amp;lt/bind&gt;&lt;br /&gt;        &lt;br /&gt;    &amp;lt/target&gt;&lt;br /&gt;&amp;lt/project&gt;&lt;br /&gt;&amp;lt/quote&gt;&lt;br /&gt;###################################&lt;br /&gt;&lt;br /&gt;The modifications are done to  the "-post-compile" target. The prefix "-" indicates that this target cannot be called directly. This also uses a "buildExample1.properties" file. The binding information is given this file. The bindings are compiled using this information. In case you are perplexed, the actual information for build is given in build-impl.xml. The build.xml is just a wrapper. Some of the tasks are exposed to the user for allowing customisation and in this case "-post-compile" was choosen. &lt;br /&gt;The contents of buildExample1.properties:&lt;br /&gt;##################################&lt;br /&gt;# The directory containing binding files&lt;br /&gt;binding.dir= D:\\temp\\jibx-gen&lt;br /&gt;# for nested files use **/*binding*.xml, for this example we dont' need it&lt;br /&gt;binding.filenamepattern = *binding*.xml&lt;br /&gt;###################################&lt;br /&gt;The complete code for bean and xml used are also given&lt;br /&gt;##############################&lt;br /&gt;package beandef;&lt;br /&gt;&lt;br /&gt;import beandef.Address;&lt;br /&gt;&lt;br /&gt;public class Person {&lt;br /&gt;    private String name;&lt;br /&gt;    private String surname;&lt;br /&gt;    private Address address;&lt;br /&gt;    /** Creates a new instance of Person */&lt;br /&gt;    public Person() {&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;package beandef;&lt;br /&gt;&lt;br /&gt;public class Address {&lt;br /&gt;    &lt;br /&gt;    private String houseno, street1, street2;&lt;br /&gt;    /** Creates a new instance of Address */&lt;br /&gt;    public Address() {&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;}&lt;br /&gt;##################################&lt;br /&gt;A good source for learning jibx is &lt;a href&gt; http://jibx.sourceforge.net/tutorial/binding-tutorial.html&lt;/a&gt;. The above mechanism shows how we can debug projects using netbeans even when there is a need for custom ant tasks.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-7402156953235569653?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/7402156953235569653/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=7402156953235569653' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7402156953235569653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7402156953235569653'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/12/jibx-with-netbeans.html' title='Jibx with Netbeans'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-7364042720208572654</id><published>2007-12-01T23:21:00.000+05:30</published><updated>2007-12-22T22:28:01.168+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programing'/><title type='text'>The 'Stig' factor - Philosophy</title><content type='html'>What is Stig factor?&lt;br /&gt;ZEN&gt;&gt;Isolation but observation. Visibility in Invisibility.&lt;br /&gt;&lt;br /&gt;Why do I need to know this?&lt;br /&gt;ZEN&gt;&gt; Because Top-gear has this. Because this is the ultimate truth (well a step short of if there is one). Because you asked me. And if you think zen doesnt' involve   one thinking of Aston martins, you are wrong. It is always about things like Spider vs. Beetle in the parking lot. I like both of them by the way.&lt;br /&gt;&lt;br /&gt;Master explain this in simple English to us 'not so crazy nuts'&lt;br /&gt;ZEN&gt;&gt; Now that you have asked. In this world all entities are related. Some call it 'Butterfly effect'. This association is responsible for all joys and sorrows. Now wise men and truth seekers, who have realized this truth wanted to let others escape the miseries offered by this cruel life. They came up with an brilliant suggestion. That speaks of: &lt;br /&gt;1. Association to disassociation&lt;br /&gt;2. The hardships in breaking all bonds to keep a single bond.&lt;br /&gt;&lt;br /&gt;Master but I am a simple programmer&lt;br /&gt;ZEN&gt;&gt; Thats what they said when they came to me. They were simple tv program producers. I still remember that as if it were yesterday.&lt;br /&gt;&lt;br /&gt;Master, but who said that&lt;br /&gt;ZEN&gt;&gt; The top-gear chaps of course. They were very concerned about the presenters being more popular than the show. There was a bloke called Gerome clarkson who has nasty prejudice against general motors you know. They wanted some thing which is immune to change. So they brought in Stig. You can realise more about him from &lt;a href&gt;http://en.wikipedia.org/wiki/The_Stig&lt;/a&gt; . You see there was more than one stig but there is only one stig.&lt;br /&gt;&lt;br /&gt;Oh, the zen factor. Things may change but the conception is unique. This what decoupling between modules means&lt;br /&gt;ZEN&gt;&gt; Excellent, now meditate more about decoupling between modules and data bases. One can easily say that data bases are similar to modules with a different avatar. The trick is to store the mapping away from the modules. The modules change but the mapping rarely does. Even if it does you can easily adapt the mapping to the discovered truth&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-7364042720208572654?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/7364042720208572654/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=7364042720208572654' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7364042720208572654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7364042720208572654'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/12/stig-factor-philosophy.html' title='The &apos;Stig&apos; factor - Philosophy'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-359777279030607609</id><published>2007-11-17T15:51:00.000+05:30</published><updated>2007-12-22T22:34:40.876+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='experiences'/><title type='text'>Autumn in Leeds</title><content type='html'>Autumn wind in Yorkshire Leeds, cold chill within causes fluttering leaves,&lt;br /&gt;Stands a tree painting tarmac in orange, awaiting the forgotten spring,&lt;br /&gt;She hopes for new life, and the cost she pays is the misery she paints,&lt;br /&gt;A splendid lass baring robes for her new-born, such scene, is it obscene?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-359777279030607609?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/359777279030607609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=359777279030607609' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/359777279030607609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/359777279030607609'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/11/autumn-in-leeds.html' title='Autumn in Leeds'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-7505172567726797764</id><published>2007-11-08T21:51:00.000+05:30</published><updated>2007-12-22T22:36:40.542+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='ideas'/><title type='text'>Learning languages</title><content type='html'>This article is  an extract from &lt;a&gt;&lt;br /&gt;http://www.fourhourworkweek.com/blog/2007/11/07/how-to-learn-but-not-master-any-language-in-1-hour-plus-a-favor/&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;The content copied for ease of lazy few :) Credits to the guy who wrote it&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;&lt;a href="http://www.fourhourworkweek.com/blog/2007/11/07/how-to-learn-but-not-master-any-language-in-1-hour-plus-a-favor/" rel="bookmark" title="Permanent Link to How to Learn (But Not Master) Any Language in 1 Hour (Plus: A Favor)"&gt;How to Learn (But Not Master) Any Language in 1 Hour (Plus: A Favor)&lt;/a&gt;&lt;/h2&gt;   &lt;span class="post-cat"&gt;&lt;a href="http://www.fourhourworkweek.com/blog/category/filling-the-void/" title="View all posts in Filling the Void" rel="category tag"&gt;Filling the Void&lt;/a&gt;,  &lt;a href="http://www.fourhourworkweek.com/blog/category/language/" title="View all posts in Language" rel="category tag"&gt;Language&lt;/a&gt;&lt;/span&gt;        &lt;p&gt;&lt;img src="http://www.fourhourworkweek.com/blog/wp-content/uploads/2007/11/arabic-script.jpg" alt="arabic-script.jpg" /&gt;&lt;br /&gt;&lt;strong&gt;Deconstructing Arabic in 45 Minutes&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.fourhourworkweek.com/blog/wp-content/uploads/2007/11/deconstructing-russian.jpg" alt="deconstructing-russian.jpg" /&gt;&lt;br /&gt;&lt;strong&gt;Conversational Russian in 60 minutes?&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;This post is by request. How long does it take to learn Chinese or Japanese vs. Spanish or Irish Gaelic? I would argue less than an hour. &lt;/p&gt; &lt;p&gt;Here’s the reasoning…&lt;/p&gt; &lt;p&gt;Before you invest (or waste) hundreds and thousands of hours on a language, you should deconstruct it. During my thesis research at Princeton, which focused on neuroscience and unorthodox acquisition of Japanese by native English speakers, as well as when redesigning curricula for Berlitz, this neglected deconstruction step surfaced as one of the distinguishing habits of the fastest language learners.&lt;/p&gt; &lt;p&gt;So far, I’ve deconstructed Japanese, Mandarin Chinese, Spanish, Italian, Brazilian Portuguese, German, Norwegian, Irish Gaelic, Korean, and perhaps a dozen others. I’m far from perfect in these languages, and I’m terrible at some, but I can converse in quite a few with no problems whatsoever—just ask the MIT students who came up to me last night and spoke in multiple languages.&lt;/p&gt; &lt;p&gt;How is it possible to become conversationally fluent in one of these languages in 2-12 months? It starts with deconstructing them, choosing wisely, and abandoning all but a few of them.&lt;/p&gt; &lt;p&gt;Consider a new language like a new sport.&lt;/p&gt; &lt;p&gt;There are certain physical prerequisites (height is an advantage in basketball), rules (a runner must touch the bases in baseball), and so on that determine if you can become proficient at all, and—if so—how long it will take.&lt;/p&gt; &lt;p&gt;Languages are no different.  What are your tools, and how do they fit with the rules of your target?&lt;/p&gt; &lt;p&gt;If you’re a native Japanese speaker, respectively handicapped with a bit more than 20 phonemes in your language, some languages will seem near impossible. Picking a compatible language with similar sounds and word construction (like Spanish) instead of one with a buffet of new sounds you cannot distinguish (like Chinese) could make the difference between having meaningful conversations in 3 months instead of 3 years.&lt;/p&gt; &lt;p&gt;Let’s look at few of the methods I recently used to deconstructed Russian and Arabic to determine if I could reach fluency within a 3-month target time period. Both were done in an hour or less of conversation with native speakers sitting next to me on airplanes.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Six Lines of Gold&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Here are a few questions that I apply from the outset.  The simple versions come afterwards:&lt;br /&gt;&lt;em&gt;&lt;br /&gt;1. Are there new grammatical structures that will postpone fluency? (look at SOV vs. SVO, as well as noun cases)&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;em&gt;2. Are there new sounds that will double or quadruple time to fluency? (especially vowels)&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;em&gt;3. How similar is it to languages I already understand? What will help and what will interfere? (Will acquisition erase a previous language? Can I borrow structures without fatal interference like Portuguese after Spanish?)&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;em&gt;4. All of which answer: How difficult will it be, and how long would it take to become functionally fluent?&lt;/em&gt;&lt;/p&gt; &lt;p&gt;It doesn’t take much to answer these questions. All you need are a few sentences translated from English into your target language. &lt;/p&gt; &lt;p&gt;Some of my favorites, with reasons, are below:&lt;/p&gt; &lt;p&gt;&lt;strong&gt;The apple is red.&lt;br /&gt;It is John’s apple.&lt;br /&gt;I give John the apple.&lt;br /&gt;We give him the apple.&lt;br /&gt;He gives it to John.&lt;br /&gt;She gives it to him.&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;These six sentences alone expose much of the language, and quite a few potential deal killers. &lt;/p&gt; &lt;p&gt;First, they help me to see if and how verbs are conjugated based on speaker (both according to gender and number). I’m also able to immediately identify an uber-pain in some languages: placement of indirect objects (John), direct objects (the apple), and their respective pronouns (him, it). I would follow these sentences with a few negations (“I don’t give…”) and different tenses to see if these are expressed as separate words (“bu” in Chinese as negation, for example) or verb changes (“-nai” or “-masen” in Japanese), the latter making a language much harder to crack.&lt;/p&gt; &lt;p&gt;Second, I’m looking at the fundamental sentence structure: is it subject-verb-object (SOV) like English and Chinese (“I eat the apple”), is it subject-object-verb (SOV) like Japanese (“I the apple eat”), or something else? If you’re a native English speaker, SOV will be harder than the familiar SVO, but once you pick one up (Korean grammar is almost identical to Japanese, and German has a lot of verb-at-the-end construction), your brain will be formatted for new SOV languages.&lt;/p&gt; &lt;p&gt;Third, the first three sentences expose if the language has much-dreaded noun cases. What are noun cases? In German, for example, “the” isn’t so simple. It might be der, das, die, dem, den and more depending on whether “the apple” is an object, indirect object, possessed by someone else, etc. Headaches galore. Russian is even worse. This is one of the reasons I continue to put it off.&lt;/p&gt; &lt;p&gt;All the above from just 6-10 sentences!  Here are two more:&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;I must give it to him.&lt;br /&gt;I want to give it to her.&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;These two are to see if auxiliary verbs exist, or if the end of the each verb changes. A good short-cut to independent learner status, when you no longer need a teacher to improve, is to learn conjugations for “helping” verbs like “to want,” “to need,” “to have to,” “should,” etc. In Spanish and many others, this allows you to express yourself with “I need/want/must/should” + the infinite of any verb. Learning the variations of a half dozen verbs gives you access to all verbs. This doesn’t help when someone else is speaking, but it does help get the training wheels off self-expression as quickly as possible. &lt;/p&gt; &lt;p&gt;If these auxiliaries are expressed as changes in the verb (often the case with Japanese) instead of separate words (Chinese, for example), you are in for a rough time in the beginning.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Sounds and Scripts&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;I ask my impromptu teacher to write down the translations twice: once in the proper native writing system (also called “script” or “orthography”), and again in English phonetics, or I’ll write down approximations or use IPA. &lt;/p&gt; &lt;p&gt;If possible, I will have them take me through their alphabet, giving me one example word for each consonant and vowel. Look hard for difficult vowels, which will take, in my experience, at least 10 times longer to master than any unfamiliar consonant or combination thereof (”tsu” in Japanese poses few problems, for example). Think Portuguese is just slower Spanish with a few different words? Think again. Spend an hour practicing the “open” vowels of Brazilian Portuguese. I recommend you get some ice for your mouth and throat first.&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.fourhourworkweek.com/blog/wp-content/uploads/2007/11/russian-alphabet.jpg" alt="russian-alphabet.jpg" /&gt;&lt;br /&gt;&lt;strong&gt;The Russian Phonetic Menu, and…&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;img src="http://www.fourhourworkweek.com/blog/wp-content/uploads/2007/11/reading-real-russian.jpg" alt="reading-real-russian.jpg" /&gt;&lt;br /&gt;&lt;strong&gt;Reading Real Cyrillic 20 Minutes Later&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Going through the characters of a language’s writing system is really only practical for languages that have at least one phonetic writing system of 50 or fewer sounds—Spanish, Russian, and Japanese would all be fine. Chinese fails since tones multiply variations of otherwise simple sounds, and it also fails miserably on phonetic systems. If you go after Mandarin, choose the somewhat uncommon &lt;a href="http://en.wikipedia.org/wiki/Gwoyeu_Romatzyh"&gt;GR&lt;/a&gt; over pinyin romanization if at all possible. It’s harder to learn at first, but I’ve never met a pinyin learner with tones even half as accurate as a decent GR user. Long story short, this is because &lt;a href="http://en.wikipedia.org/wiki/Gwoyeu_Romatzyh"&gt;tones are indicated by spelling in GR&lt;/a&gt;, not by diacritical marks above the syllables.&lt;/p&gt; &lt;p&gt;In all cases, treat language as sport.  &lt;/p&gt; &lt;p&gt;Learn the rules first, determine if it’s worth the investment of time (will you, at best, become mediocre?), then focus on the training. Picking your target is often more important than your method.&lt;/p&gt; &lt;p&gt;[To be continued?]&lt;/p&gt; &lt;p&gt;###&lt;/p&gt; &lt;p&gt;Is this helpful or just too dense? Would you like me to write more about this or other topics? Please let me know in the comments. Here’s &lt;a href="http://myhappyplanet.com/register.php?refid=pNEGLdWo"&gt;something from Harvard Business School&lt;/a&gt; to play with in the meantime…&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;###&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Odds and Ends:&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;Please help me break the Technorati 1000 today!&lt;/strong&gt;&lt;br /&gt;I’m around &lt;a href="http://www.technorati.com/blogs/www.fourhourworkweek.com/blog"&gt;1070 on Technorati’s rankings&lt;/a&gt;, and it’s killing me. Can those of you with blogs PULEEEEASE register your blogs with Technorati and find something interesting to link to on this 4HWW blog? It would really be a milestone for me and I’m so close! Just breaking 1000 would be enough. If you can find something to link to in the most popular posts or elsewhere, please do whatever you can in the next 24-36 hours! Thanks so much :)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-7505172567726797764?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/7505172567726797764/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=7505172567726797764' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7505172567726797764'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/7505172567726797764'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/11/learning-languages.html' title='Learning languages'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-9035002570827129363</id><published>2007-11-07T22:28:00.000+05:30</published><updated>2007-12-22T22:35:07.507+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='movies'/><title type='text'>Ratatouille - Any one can cook!</title><content type='html'>&lt;o:p&gt;&lt;/o:p&gt;Movies have always been an amusing ways of selling dreams. I have recently seen a magic lantern titled ratatouille. It is far from the Oscars, (probably will get one) definitely doesn’t' strain your tear glands nor stain your hankies. Ratatouille is a fascinating way of reminding ourselves the age old art of story telling. Think of the Red-Indian rituals, Neanderthal cave paintings and even beyond to the point where early humanoids were amusing themselves with the primitive usage of oral communication. Pixar and Disney have mastered this art. The art of story telling is no longer a ritual, I feel sorry for that. It lives thanks to corporate exploitation of childish dreams. Who said capitalism is evil :)&lt;br /&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;The story is about a rodent hero. The one who resembles more like R2D2 than Keanu reaves. The plot is simple. The hero fulfils his dream!. The dream of savouring food in Gusteaus, a french restaurant. The way the story unfolds brings some childhood memories out. Running around kitchen, doing a shelock holmes with the whole and sole intention of finding the hidden delicacies. Aah, good times weren’t' they.&lt;br /&gt;&lt;br /&gt;The more reminiscent words I liked were those of the antagonist Anton Ego voiced by Peter O'tole. Ego relives Gusteau’s words 'Any one can cook'. He rephrases the finer nuance and articulately gives out his criticism during at the climax. Anton declares onerous in a tone that undermines Zen masters and Yoda; that a cook can come from any where and not the superficial interpretation given to the words.&lt;br /&gt;&lt;br /&gt;The art of oration put together with some fantastic graphics is something one shouldn’t' miss. This is one fantastic package put forth for audience of all ages.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-9035002570827129363?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/9035002570827129363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=9035002570827129363' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/9035002570827129363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/9035002570827129363'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/11/ratatouille-any-one-can-cook.html' title='Ratatouille - Any one can cook!'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-8588415450949147214</id><published>2007-10-30T18:46:00.000+05:30</published><updated>2007-10-30T19:00:06.333+05:30</updated><title type='text'>Creative thinkers and Day dreamers</title><content type='html'>Creative thinking or out of box thinking is normally encouraged in technical and artisitc streams, but discouraged in managerial discipline. &lt;a&gt; http://en.wikipedia.org/wiki/Peter_Principle&lt;/a&gt; has a good explanation of this. Creative thinking helps individuals and organisations. People raise the bar even when the results end in a catastrophy. The gains at times may be paltry but the learning is invalueable. Coupled with  some pedagogic skills such a learning becomes an asset in times to come. Unfortunately, creative thinking cannot be imbibed. It is inherently psychlogical. The inquisitive nature seen in children when groomed well forms the foundation for this.&lt;br /&gt;&lt;br /&gt;So the next time a child asks why he doesnt' have a moustache or where babies come from. Try to be creative enough to answer.  Afterall child is the father of man.&lt;br /&gt;&lt;br /&gt;Try googling for Gordian Knot, Egg of Columbus for more insights. The structure of Benzene as proposed by kekulle is another outstanding example.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-8588415450949147214?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/8588415450949147214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=8588415450949147214' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/8588415450949147214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/8588415450949147214'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/10/creative-thinkers-and-day-dreamers.html' title='Creative thinkers and Day dreamers'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-1644692891326168669</id><published>2007-10-23T16:16:00.000+05:30</published><updated>2007-12-22T22:36:07.847+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Programing'/><title type='text'>'Memory'able Dilema</title><content type='html'>Dear God, Father of all electronic, electrical, magnetic, optical, semiconductor appliances. Conserver of all software applications built around boolean and binary representation. Help me out of dilema.&lt;br /&gt;&lt;br /&gt;Should I opt for an 4 Gb flash drive or a 160 Gb passport hdd or a 500 Gb hdd. Give me the wisdom and guidance.&lt;br /&gt;&lt;br /&gt;P.s: At the same time have a look at the Canon S5IS  and Sony DSC-H9, so that you can let me make a decison.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-1644692891326168669?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/1644692891326168669/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=1644692891326168669' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1644692891326168669'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1644692891326168669'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/10/memoryable-dilema.html' title='&apos;Memory&apos;able Dilema'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-8982246114559268266</id><published>2007-10-23T15:53:00.000+05:30</published><updated>2007-12-22T22:36:07.848+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Programing'/><title type='text'>Static imports</title><content type='html'>&lt;p class="MsoNormal"&gt;Himanshu was speaking of static imports in Jdk 5. Not surprisingly, I had something to learn over here too.  Jdk 5 has come up with a feature for importing static variables; the fact that the same is applicable to methods and object references was news for me. I never thought of it before. What are the implications? Well like every feature and tool this adds a new destructive angle to the object oriented paradigm. It is better not to teach static imports to beginners. (Hey this is my blog.. don’t' contest).&lt;br /&gt;&lt;br /&gt;With access specifiers of type '&lt;b&gt;public final static&lt;/b&gt;' there is no problem at all. Essentially making imported entities read only. But if we have a &lt;b&gt;static&lt;/b&gt; object reference or method, the object oriented ness is lost. The static methods themselves are stateless.  The seemingly non-object oriented way of accessing methods and references is what concerns me. The static methods themselves are stateless. We have discussed their usage in a earlier blog. The static references and methods are more of a concern to me.&lt;br /&gt;&lt;br /&gt;These are most often seen in large scale programming applications. To start of 'Singleton' pattern is one of the most popular patterns built around &lt;b&gt;static reference&lt;/b&gt; concept. 'Factory' pattern is another example of using static methods. The fact that &lt;/p&gt;  &lt;p class="MsoNormal"&gt;, some crazy guy wants to increase performance sends jitters.(by changing the access specifier to public, use static imports and invoke the functionality, and thus save a 'precious' method call). Do we break the paradigm for the sake of small performance gains?&lt;br /&gt;&lt;br /&gt;All said, this adds more emphasis on code reviews and another aspect to the taken care of when carrying out code reviews.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-8982246114559268266?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/8982246114559268266/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=8982246114559268266' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/8982246114559268266'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/8982246114559268266'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/10/static-imports.html' title='Static imports'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-1233901356429482865</id><published>2007-09-02T01:05:00.000+05:30</published><updated>2007-12-22T22:35:49.515+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='experiences'/><title type='text'>In Leeds</title><content type='html'>I have reached Leeds on 2nd August. Exactly 29 days passed by the time of writing this post. Leeds falls into the Midlands, precisely West-yorkshire. English weather, even in August carries a chill around, probably reminding the people around that summer is about to end.&lt;br /&gt;&lt;br /&gt;You cannt' resist but observe the spacious dwellings and well organised parking arrangements, (especially coming from Indian cities, quite a contrast). UK is quite a place. The food, football, folks every thing and every one you come across carry a distinctly familiar undercurrent.  The tallest building in Leeds is the 32 storied bridge waters buildling. It is close to the city center - a 15 min walk.&lt;br /&gt;&lt;br /&gt;The city center is a lively place. The universities, shopping centers, Train station, bus stand all make the experience satiating. I didnt' get a chance to go around the city all by myself, but looking forth to do so. Will add more details in later posts.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-1233901356429482865?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/1233901356429482865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=1233901356429482865' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1233901356429482865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1233901356429482865'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/09/in-leeds.html' title='In Leeds'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-8266686998205163659</id><published>2007-07-05T13:15:00.000+05:30</published><updated>2007-12-22T22:36:07.848+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Programing'/><title type='text'>ANT TAUNTS</title><content type='html'>Another Neat Tool is what they say. What’s in the name? Shakespeare should have known better. ANT is a typical tool which comes into minds of java developers when they are supposed to package their goodies. ANT for newcomers is a utility to package, build and deploy user written software. In some sense, it is software written to manage software.&lt;br /&gt;Any reasonably high-level programming language needs a compiler/interpreter. I wont' go into details of compilers/interpreters now. Rather, the focus is on ANT. Some most frequent tasks a programmer needs to do are clean up, rebuild, debug, run, test and deploy the code. The compilers/interpreters provide support for some of these tasks. Some of the tasks are dependent on the operational environment, for e.g. "rm" is used to remove files on unix where as it is "del" on windows. Let us call these "Developers utility tasks" or DUTs.&lt;br /&gt;Writing a script to achieve these tasks is one way of solving this problem. ANT takes this approach further. ANT can be treated as a domain specific language intended todo these DUTs. Usage of ANT, for the most part, is declarative in nature. Essentially you dont' assign values to variables but state the task you want to achieve. It is kind of saying. "ANT, I want to clean up the mess" or "ANT, Can you compile these sources".&lt;br /&gt;In an IDE driven era, most developers are not conversant with ANT. Those who do, don’t' make noise about it. I feel that, knowing how to write a good ANT script is a must for IDE independent development. Let us see a sample ANT example.&lt;br /&gt;There are essentially three areas when it comes to using ANT.1. Having a clear idea of the directory structure. This is simple for most projects. The complex cases involve code level dependencies across projects. Things can be simplified by assuming presence of referred jar files rather than referred source folders.  2. Identifying and Understanding dependencies among tasks which we wish to have. 3. Writing an ANT file and populating the properties file. Properties file is a mechanism that changes a coding problem into a more manageable configuration problem. This simplifies maintenance.A sample directory structure would look like this• Project folder\ant\ • Project folder\lib\ • Project folder\src\ • Project folder\build\ • Project folder\dist\The "ant" folder is supposed to hold ant scripts. The "src" folder is self-explanatory. The "lib" folder is supposed to hold the jars on which the source files have dependency.The "build" folder contains the resultant files after compilation for e.g. ".class" files. The "dist" folder contains the packaged and ready to use bundles or jar files. "build" and "dist" can be generated by ANT and we do so in our exampleSample build.xml, copy it into your favorite editor and reformat it.##################################################&lt;quote&gt; &lt; &lt;/quote&gt;?xml version="1.0" encoding="UTF-8"?&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;project name="SomeProject" default="all" basedir=".."&lt;quote&gt; &gt; &lt;/quote&gt;&lt;br /&gt;&lt;quote&gt; &lt; &lt;/quote&gt;property file="ant\build.properties"/&lt;quote&gt; &gt; &lt;/quote&gt;&lt;br /&gt;&lt;quote&gt; &lt; &lt;/quote&gt;path id="classpath"&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;fileset dir="${lib.dir}"/&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/path&lt;quote&gt; &gt; &lt;/quote&gt;&lt;br /&gt;&lt;quote&gt; &lt; &lt;/quote&gt;target name="preconditons" &lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;echo&lt;quote&gt; &gt; &lt;/quote&gt;Displaying properties...&lt;quote&gt; &lt; &lt;/quote&gt;/echo&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;echo&lt;quote&gt; &gt; &lt;/quote&gt;${jar.name}&lt;quote&gt; &lt; &lt;/quote&gt;/echo&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;echo&lt;quote&gt; &gt; &lt;/quote&gt;${basedir}&lt;quote&gt; &lt; &lt;/quote&gt;/echo&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;echo&lt;quote&gt; &gt; &lt;/quote&gt;------------------------------&lt;quote&gt; &lt; &lt;/quote&gt;/echo&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/target&lt;quote&gt; &gt; &lt;/quote&gt;&lt;br /&gt;&lt;quote&gt; &lt; &lt;/quote&gt;target name="init" depends="preconditons"&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;echo&lt;quote&gt; &gt; &lt;/quote&gt;Intializing build process...&lt;quote&gt; &lt; &lt;/quote&gt;/echo&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;mkdir dir="${build.dir}" &lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/mkdir&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;mkdir dir="${dist.dir}" &lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/mkdir&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/target&lt;quote&gt; &gt; &lt;/quote&gt;&lt;br /&gt;&lt;quote&gt; &lt; &lt;/quote&gt;target name="clean"&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;echo&lt;quote&gt; &gt; &lt;/quote&gt;Cleaning the ${build.dir}...&lt;quote&gt; &lt; &lt;/quote&gt;/echo&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;delete dir="${build.dir}"/&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;delete dir="${dist.dir}"/&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/target&lt;quote&gt; &gt; &lt;/quote&gt;&lt;br /&gt;&lt;quote&gt; &lt; &lt;/quote&gt;target name="compile" depends="init"&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;javac srcdir="${src.dir}"destdir="${build.dir}"compiler="${build.compiler}" source="${source.version}"fork="true" executable="${jdk.path}"&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;classpath refid="classpath"/&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/javac&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/target&lt;quote&gt; &gt; &lt;/quote&gt;&lt;br /&gt;&lt;quote&gt; &lt; &lt;/quote&gt;target name="jar" depends="compile"&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;jar destfile="${dist.dir}/${jar.name}" basedir="${build.dir}"&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;manifest&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;attribute name="Main-Class" value="${mainclass.name}"/&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;attribute name="Class-Path" value="${manifest.classpath}"/&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/manifest&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/jar&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/target&lt;quote&gt; &gt; &lt;/quote&gt;&lt;br /&gt;&lt;quote&gt; &lt; &lt;/quote&gt;target name="run" depends="jar"&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;java jar="${dist.dir}/${jar.name}" fork="true"&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/java&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/target&lt;quote&gt; &gt; &lt;/quote&gt;&lt;br /&gt;&lt;quote&gt; &lt; &lt;/quote&gt;target name="clean-build" depends="clean,compile"&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/target&lt;quote&gt; &gt; &lt;/quote&gt;&lt;br /&gt;&lt;quote&gt; &lt; &lt;/quote&gt;target name="dist" depends="jar"&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;copy todir="${dist.dir}"&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;fileset dir="${lib.dir}"&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/fileset&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/copy&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/target&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;target name="all" depends="clean,dist,run"&lt;quote&gt; &gt; &lt;/quote&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/target&lt;quote&gt; &gt; &lt;/quote&gt;&lt;br /&gt;&lt;quote&gt; &lt; &lt;/quote&gt;/project&lt;quote&gt; &gt; &lt;/quote&gt;##################################################The sample properties file, please reformat the same. Remember to escape spaces using "\"################################################### Properties file jar.name=RunThisClient.jar mainclass.name=client.Main manifest.classpath=Common.jar # Taken care by the project directory structure under base dirbase.dir=.. src.dir=src lib.dir=lib build.dir=build dist.dir=dist # Compiler related informationjdk.path=C:\\Program\ Files\\Java\\jdk1.5.0_10\\bin\\javac build.compiler=javac1.5 source.version=1.5###################################################Try using this as a template and you will see that ANT really doesn’t taunt&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-8266686998205163659?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/8266686998205163659/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=8266686998205163659' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/8266686998205163659'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/8266686998205163659'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/07/ant-taunts.html' title='ANT TAUNTS'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-5712241747240109947</id><published>2007-05-27T09:41:00.000+05:30</published><updated>2007-05-27T09:45:43.218+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Politics'/><title type='text'>Indian politricks</title><content type='html'>INDIA: a land of many faces, facets, facts and fantasies. Indian ness is something very mythical. Is it lack of individualism or servitude to collectivism? The very nature of being related to India raises questions in my mind. India is not a perfect nation, No nation in the world is.&lt;br /&gt;&lt;br /&gt;Indian politics are one (ugly) aspect that can give an understanding of how the nation thrives. Now whenever a government changes/ about to change. We see the following patterns. The time lines are drawn for upcoming elections. There is an incumbent govt. and some opposition parties. This is extreme simplification; we are ignoring internal boardroom disagreements &amp;amp; other issues. So the incumbent govt. starts its' campaign with bombastic antiques. They rope in movie stars, popular personas, and offer soaps. Why do they do that? Are they so scared? Scared of loosing power? Now this also involves buying advt. slots on prime time.&lt;br /&gt;&lt;br /&gt;Here there is some sort of moderation provided by constitution in terms of Election Commission. These guys are the real heroes of democracy. They literally act like old school headmasters with a rod in their hand. They are the ones who resort sanity to the other wise completely one-sided bout.&lt;br /&gt;&lt;br /&gt;What happens at the end of the day? Mostly the underrated opposition wins! Reason: The people know better. Now the party that wins resorts to some changes. They start appointing buerocrates who have their favor, in niche positions. The merit and past achievements are ignored. They also resort to reversing decisions made by last govt.&lt;br /&gt;&lt;br /&gt;This may not sound ugly. But the next aspect is really ugly. The issues highlighted during campaign to power are brought into limelight. These include earlier govts. policies that were strongly criticized too. Now after a months time. These are put on backburner. One would find no difference in the attitude towards public after a year or so. The headlines also sound familiar only the names and pictures keep changing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-5712241747240109947?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/5712241747240109947/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=5712241747240109947' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/5712241747240109947'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/5712241747240109947'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/05/india-land-of-many-faces-facets-facts.html' title='Indian politricks'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-4274406437850964544</id><published>2007-05-23T20:12:00.000+05:30</published><updated>2007-06-22T20:26:02.536+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Programing'/><title type='text'>Paving Path to ClassPath and Packaging</title><content type='html'>Last fortnight vineela posed a question. Sounded silly in the first go but later found it to be not so silly. She was trying to compile java files from command prompt. Guess what happened. A disaster! Now she is not a run of the mill kind. Only issue was that she was born and brought up in the world of user-friendly IDEs. She never worked with the age old tools "javac" and java. Why should she? When was the last time I used javac? Let me guess, it is nearly four years.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There were three problems she was facing, packing the sources, compiling and running. The next step of packing the sources into directories sounds easy. What about classes? As per the practice, they also need to mimic the file structure. We need to duplicate the directory structure. What about running the app? Run it from the top-level package. Wait... Wait... why are we hurrying? Take a break and breath-in... &amp; out... repeat it 3 times (use for loop!!)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Some references before we start.&lt;br /&gt;&lt;br /&gt;http://java.sun.com/docs/books/tutorial/java/package/QandE/packages-answers.html http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html &lt;a href="http://www.cs.wisc.edu/~hasti/cs368/JavaTutorial/NOTES/Packages.html"&gt;http://www.cs.wisc.edu/~hasti/cs368/JavaTutorial/NOTES/Packages.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Simple Example:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Assuming we know how packages are formed we shall go ahead.&lt;br /&gt;&lt;br /&gt;Have a directory called C:\Workarea. Now create three folders called "src", "classes". Under "src" create your package structure.&lt;br /&gt;&lt;br /&gt;My source files are: myblog.master.Lord.java, myblog.servant.Gini.java.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There is a correlation between and packages and directory structure.&lt;br /&gt;&lt;br /&gt;Under C:\Workarea\src create 3 directories&lt;br /&gt;&lt;br /&gt;1.) myblog, 2.) mblog\master, 3.)myblog\servant.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Create the same structure under C:\Workarea\classes. We need to copy java sources to src directory location.&lt;br /&gt;&lt;br /&gt;Now copy Lord.java to master and Gini.java to the servant directories. Now come to top directory i.e. C:\Workarea.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Under windows run these commands "dir /s /b *.java &gt; a.txt" and then "javac -sourcepath src -classpath . -d classes  @a.txt"&lt;br /&gt;&lt;br /&gt;javac essentially takes parameters describing the source location, classpath info and destination where classes are to be saved. @a.txt is the file that contains the locations of .java source files&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Bingo...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To run the app from C:\Workarea call "java mainclass"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-4274406437850964544?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/4274406437850964544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=4274406437850964544' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4274406437850964544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4274406437850964544'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/05/paving-path-to-classpath-and-packaging.html' title='Paving Path to ClassPath and Packaging'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-8366316270176087989</id><published>2007-03-20T19:38:00.000+05:30</published><updated>2007-12-22T22:37:30.484+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='monologues'/><title type='text'>vaio why?</title><content type='html'>Sumit left for Japan last week. He isnt' quite completely settled, but he is not a new customer. Hes been to Japan before too. Yesterday, he mailed ashish &amp; me asking for an opinion about laptop purchase. He has already made up his mind and is giving a serious thought towards VAIO. Apple is off the radar, DELL is still within proximity range. His requirements are quite amusing. Till date I have seen guys boasting about their CPU muscle power! and enormity of memory space. This is the first time I have seen a techie someone go after really after a stylish glam doll. Ever heard of Armanis and RollsRoyce among computers, VAIO quite in the same league. VAIO has an interesting logo too. A cosine wave followed by 1 &amp;amp; 0 (binary notation). What does that mean? Pretty rudimentary isnt' it? Do most owners understand the significance of the symbol or is it... AAh I must be day dreaming.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-8366316270176087989?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/8366316270176087989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=8366316270176087989' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/8366316270176087989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/8366316270176087989'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/03/vaio-why.html' title='vaio why?'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-1627930821894300710</id><published>2007-03-12T22:27:00.000+05:30</published><updated>2007-12-22T22:37:57.282+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='monologues'/><title type='text'>Festival of colors</title><content type='html'>First things first, I am blogging this albeit late. Holi, in INDIA is also called as festival of colors. It falls in the early spring season. The colors are vibrant, so is the mood. Boys and girls have a go at each other with colors. It commemorates the ancient epic of Holica, sister of Hiranyakasipa who had a boon of being untouched by fire, being killed by Lord Vishnu when she intends to hurt his disciple Prahlad.&lt;br /&gt;&lt;br /&gt;Children make merry throwing water balloons and spraying colors at every one. This festival is also memorialized in Raasa Leela, where Lord Krishna celebrates Holi. This year we had a gr8 time. First I was dragged into muddy pool then had colors hurled at me. Then had a chance to repeat the same unto others and finally in the afternoon went to a rain dance and danced for a long time. The colors was completely washed away by the end of the evening and I wasn’t’ sorry for that.&lt;br /&gt;&lt;br /&gt;This is one day that stays long in memory&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-1627930821894300710?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/1627930821894300710/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=1627930821894300710' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1627930821894300710'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/1627930821894300710'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/03/festival-of-colors.html' title='Festival of colors'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-4439692078443543969</id><published>2007-03-12T22:17:00.000+05:30</published><updated>2007-12-22T22:37:57.283+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='monologues'/><title type='text'>Yahoo! sounds</title><content type='html'>Last week I checked web for voice offerings. I was looking for cheap and reliable voice based offering. Guess what! I found that Yahoo has the best offering, I can call USA for just 1 cent per min. I had to pay 10$ for this and I have got atleast 1000min of talk time. Luckily I have a good net connection and I brag about the same :)&lt;br /&gt;&lt;br /&gt;Skype comes close but at 2 cents per min they made my decision easier. You all know where my 2 cents went, don't' you.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-4439692078443543969?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/4439692078443543969/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=4439692078443543969' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4439692078443543969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/4439692078443543969'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/03/yahoo-sounds.html' title='Yahoo! sounds'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-6862218390093700017</id><published>2007-03-05T16:34:00.000+05:30</published><updated>2007-03-05T21:23:24.206+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Programing'/><title type='text'>The static thing</title><content type='html'>The way we think reflects what we want to achieve. Humans are inherently comfortable thinking in terms of objects. It is rather strange that I was taught structural programming than an object oriented one, earlier in my academics. I am not going to speak in detail about OOPS, but concentrate on one aspect of the OOP Languages. Usage of "static".&lt;br /&gt;&lt;br /&gt;As a norm, object-orientation avoids unnecessary "static" declarations, any entity carrying a "static" tag needs scrutiny and the relevance of static-ness needs to be questioned. This doesn’t' mean that static needs to be strictly avoided. It should be used as per the requirement.&lt;br /&gt;&lt;br /&gt; Question : Let us think of a MVC style program where model and view are seperated. The hierarchy of model is "GenericModel", "SpecificModel" which extends "GenericModel". For simplicity let us alias them as GM and SM. GM and SM also have attributes defined within them. Not very different from other classes you may say. Now here is the catch, What if those attributes are "static" and are to be inherited. Design an object oriented specification for the above. On the face of it, the problem is obscure. So let me elaborate.&lt;br /&gt;Static nature : A brief intro on static nature. Static entities are tied up to class definition rather than objects’. So static entries are accessed using class context, rather than object context. In such a case the concept of Runtime polymorphism is irrelevant and hence for static entries, the super class definitions and references take precedence over derived class ones, i.e. if GM has attr ‘x’ and SM also has another attr’ ‘x of the same type;&lt;br /&gt;GM o1 = new GM();&lt;br /&gt;GM o2 = new SM();&lt;br /&gt;Print(o1.x);&lt;br /&gt;Print(o2.x); // value printed here is same as that in above line.&lt;br /&gt;&lt;br /&gt;You might have already observed the oddness. Most design patterns essentially rely on the fact that interfaces are available (abstraction) and use runtime polymorphism to do the trick. The situation here is different; the super class reference determines the value one gets.&lt;br /&gt;&lt;br /&gt;Problem version1: We had two classes called "ModelElement" and "ObjectModel", the later extending the former. “ModelElement” class was contributing an attribute called "Name" and ”ObjectModel” was contributing an attribute called "Classifier". Now we have a GUI for the properties represented by an element. All instances of the “ModelElement” are supposed to have a view like “Name :: ”, and all entities represented by “ObjectModel” are supposed to have a view similar to above and in addition contribute its own “Classifier :: ”. Clearly “Name” and “Classifier” can be logically concluded to be static.&lt;br /&gt;&lt;br /&gt;Now the complete version: We have number of attributes to be contributed rather than one per class. So we use vectors for holding all attributes in the vector and return it.&lt;br /&gt;&lt;br /&gt;Solution 1: Not a solution, but for discussion. As this is one possibility we run into. Make the vector in super class Model protected static. This will fail for all the cases where derived class is instantiated before super class. The vector gets filled with attributes of both derived a super and when we later want attributes specific to super class it fails to do so.&lt;br /&gt;&lt;br /&gt;Solution 2: Create a static vector in every derived class. Also, create a non static method to return this vector in every derived class. Use super. invocation to call super class method. The polymorphic behavior calls the hierarchy of classes and returns a vector of appropriate entities.Problem with this approach: Imagine a huge hierarchy, if some class in the hierarchy doesn’t’ override this method properly with super invocation; the returned values may be drastically different.&lt;br /&gt;&lt;br /&gt;Solution 3: Use singletons to represent objects. Now inheritance among singletons is another over head. Think of the possible cases. Singleton entities may themselves be part of some other hierarchy and what about issues with Multiple Inheritance in singletons?&lt;br /&gt;&lt;br /&gt;Solution 4: Using reflection, identify the static entities defined in the class hierarchy and return them to the user. Problem is that this approach is possible only in languages with support for reflection. This involves certain amount of hard coding of method/attribute names.&lt;br /&gt;&lt;br /&gt;Clearly no solution described above sufficiently addresses the current concerns, If you have a cleaner solution to handle above, please feel free to mail me.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-6862218390093700017?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/6862218390093700017/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=6862218390093700017' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6862218390093700017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/6862218390093700017'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/03/static-thing.html' title='The static thing'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996157773659370402.post-5489896732049677175</id><published>2007-03-05T16:12:00.000+05:30</published><updated>2007-03-05T16:22:38.813+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='My First Post'/><title type='text'>My First Post</title><content type='html'>It is believed that Voltaire once said, "I may not agree with what you say, but I'd fight for your right to say - what you want to say".&lt;br /&gt;&lt;br /&gt;I never thought I’d’ve a blog of mine before. In a very voltairish way, I used to enjoy reading  blogs of near and dear. But, why a blog? Probably its my urge to pen my thoughts, or probably to have something to be nostalgic later on... There may be zillions of reasons, as many as the value of Avagadros' number. For me what matters most is my ability to recap my thought currents, the questions and more importantly the intriguing aspect of human psyche to keep itself intrigued.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996157773659370402-5489896732049677175?l=questzen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://questzen.blogspot.com/feeds/5489896732049677175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8996157773659370402&amp;postID=5489896732049677175' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/5489896732049677175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996157773659370402/posts/default/5489896732049677175'/><link rel='alternate' type='text/html' href='http://questzen.blogspot.com/2007/03/my-first-post.html' title='My First Post'/><author><name>Swaroop</name><uri>http://www.blogger.com/profile/06654032716605354197</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
