Author Archives: anupjani

An average IT professional with some spiritual inclination.

Attached yet detached

Enquirer:

(Being spiritually so much inclined), How can one stay attached to the world?

After knowing that everything is Maya (an illusion that is neither real nor unreal thus, pointless), how do we keep up with everything around in our life? How do you stay put? What was effortless before; has turned so much awkward now, that you start asking yourself questions like: How do you plan? Why to plan? What motivation to use in the end to even carry out small daily routines? When everything is pointless, what should I work so hard for? We all know that even after turning into a Monk, the work doesn’t stop. So, how do you stay attached yet detached?

Answer:

By being Lotus – That grows & stays in the mud yet unadulterated as the muddy water droplets merely slip away from over its surface.

Enquirer:

How to put this theory into practice in real life?

 Answer:

Being Lotus is nothing else but to witness everything around you with no desire of your own. For example, you are attached (to some movie in a cinema hall) yet remain detached (not being inside the movie), only as the one who witnesses everything. We neither actually go & make changes in the story of that movie, do we? Nor do we get affected.

Enquirer:

But, won’t just watching around will make you wandering around leaving you directionless in life?

Answer:

You need not worry about the direction. Once settled within, you become the direction for everything & everybody around you. Things will come to you.

Enquirer:

But how can you achieve great heights with no desire?

Answer:

We have been nurturing a self proclaimed delusional notion since childhood that having a great desire (ambition) in mind is indispensable to achieve something remarkable in life. It’s not the desire that gets you there. Walking towards it gets you there. With this fresh attitude, you become free from a “feeling of compulsion to have any desire”. You will achieve great heights just by performing your duties in your best ways. No need to feel guilty about not having any ambition or desire.

Enquirer:

But, with no purpose, no motivation, how do we do our best?

Answer:

Our purpose is not to work for happiness. Happiness is resident in us already. Our purpose is to become free from the process where we mortgage our happiness to the outside situation. For e.g. When you yourself decide not to stay happy unless & until you have become something or achieved something. The sense of incompleteness within makes you do this. The Ego (nothing but a false self that occurs every time you try to seek your identity in your mind) does not allow you to feel complete. Because, despite no base in present, the Ego clings to the past (holding the identity) & future (promising the salvation) in order to sustain. The idea of promise of salvation fuels the thought of incompleteness making you lose your true Self that dwells in the present moment. Being with your true self, keeps you in the present moment which is devoid of pains & worries. Isn’t the peak performance done while at peace? Do you really need to worry about desire, ambition, purpose, happiness, direction & attachment now?

Advertisements

How to see God.

It is said; “The misery is an opportunity to go closer to God”. This is how it generally works.

यं  विषयमपि लषित्वा धावति बाह्येंद्रिय द्वारा । 

तस्या प्राप्तौ खिद्यति तथा स्वं  गतं  किंचित् ॥६९॥ [प्रबोध सुधाकर (श्रीमद आदि शंकराचार्यकृत)]

Whatever subjects after which our mind rushes riding on our senses, but when not achieved, the mind then develops distaste for those subjects & then somewhat turns inward towards the Self. [Prabodh Sudhakar, By Shrimad Shankaracharya]

Misery; like a kick, shakes you up from a sleep! Such repeated wake-up calls discover the vagueness of this world. Since vagueness doesn’t have much scope to offer for attachment, the detachment is established. Continued distaste causing lack of bonds don’t allow mental constructs to grow taller than ground level. (No cementing glue!) This is how the maintenance of detachment (seemingly, the first & foremost criteria to get close to God.) continues.

Continue reading

Significance of Certifications

I was once asked a question upfront by an HR manager looking at my qualification & an array of certifications done, in an interview for a job role in a respectable company: “Why Certifications?” Of course I didn’t have enough time & thoughts at that moment to answer in an elaborated manner nevertheless, “I managed” & that was then.

Ever wondered the difference between “a human-kite” & an “air-plane”? These human-kites do not have own engines for takeoff & require external support system / a little running & jumping from the peak. Once took-off, it glides smoothly with help of air / wind. Some people believe just taking off in the air (entering the market) is enough & the market-wind (experience) will make him glide. True. But this is not what you want. You want higher pay scale, higher positions & that too quicker. Kite has limitations. It can fly you only with limited speed at a very limited height. And when wind turns unfavorable or low, your flight is compromised. Their career & life is hampered to greater extent because their flight is dependent totally on the wind only. They do not have any other driving force of their own. They often blame on the market & give excuses of recession for their jobless situation. It is not the case with air-planes because they’ve got their own independent engines to boost their speed. They reach to the altitude where human-kites are outclassed in every way.

You see –

Writing certification exams is the self initiated process where you proactively put yourself to the test. Testing your limits tells you where you stand. In other words; if you fail, you lose nothing but many wrong self generated impressions & ideas you unfortunately once had about yourself & that makes you much, MUCH lighter. Isn’t that a good thing? On the other hand, if you pass, you excel & already reap following benefits.

  1. Proves that you are familiar with underlined technologies.
  2. Your pro-activeness is demonstrated here.
  3. (Gives a reason to your employer to be at rest assured that) you are not money minded.
  4. Shows that you’re career-oriented after all.
  5. Because of this disciplinary course of certification exam, you systematically gather greater, deeper, wider & better knowledge in a very small time which otherwise was not your cup of tea.
  6. Grooms you. Shapes you up. Excessive fat / rust is chiseled away.
  7. You are ready to face new challenges.
  8. You stand out from the crowd.
  9. Certification brings you a unique joy of success that boosts your confidence level.
  10. This sense of achievement stays with you for a life time.
  11. Trust of interviewer / employer is earned very easily.
  12. People respect you & your achievements. And that gives you deep satisfaction that can’t be acquired from elsewhere.
  13. Adds a feather in your cap. Curriculum Vitae gains extra weight.
  14. Saves you from hassle of speaking too much convincing about your abilities to people as your actions speak louder enough.
  15. You get a USP (unique selling point) for yourself so that your chances of being selected for the interview increases.
  16. Doors of many possibilities & opportunities for better future prospects open up instantly.
  17. Provides you motivation to do next certification in jobless situation & this gives the meaningful sense of continuity to your career & most importantly it prevents you from sinking into depression.
  18. Preserves that innocence of long lasting studentship in you which makes your personality radiant.
  19. Others get inspired by you.

How about it? Isn’t that good too?

 

Suppose you are the interviewer, given exactly 2 matching profiles lying on your table. One is of Mr. You1 & another of Mr. You2. The only difference is Mr. You2 is certified in relevant field whereas Mr. You1 is not. Given a choice to you as a recruiter, would you honestly not prefer to select Mr. You2 for a required job role for your company? Wouldn’t you want to upgrade yourself from Mr. You1 to Mr. You2 so that you reap all above benefits & much more?

Sadly, some people refrain from doing certifications because of various reasons:

  1. They fear failure & want guarantee to pass
  2. They don’t realise the importance of certification because they haven’t tasted that success yet
  3. They are lazy & are hardly self motivated. Status quo is their comfort zone.
  4. They’re unaware of a fact that every quarter new certified professionals are being churned out from institutes that soon will replace them.
  5. They do not want to spend money & they think they will save some.
  6. They want company to sponsor them & are foolishly willing to wait for infinite time
  7. They think having gained experience is enough & writing a certification exam is pointless
  8. They believe certification is only meant for inexperienced candidates to penetrate the market in the beginning. Once you’re experienced, you do not require it.

I say:

If you’re already experienced & feeling that confident then why is that certification not in your bag? Why not prove your confidence to you & others by earning that certification!

Don’t you want to stay ahead or else newly inexperienced but certified professional will take up your place at lower wages? You are not the only quick learner. If company can get work done from inexperienced but certified candidate with minimum training & that too offering lower wage, why would the company keep you? But if you are certified & experienced, the company might prefer keeping you. IT industry is the knowledge industry. Gone are the days when employee stuck with a company for a long time that made difficult for him to be replaced. It is not the scenario these days. In today’s time, people jump for better prospects. They learn, earn & run. So, when you are selected, consider that you have replaced someone, and one day same will happen to you too.

It’s not about money!!! Leave the thinking of money part to your employer who is a businessman. I’m sure he’s “somehow” better than you. That’s why he’s in position to hire you & not otherwise. You just think about your career. Mind it. It’s about your career. Doing injustice to your career baby will backfire in the coming time by when it is too late. After all, career says: “More you give, more you get back”. Nurture it, give fertilizer, water, care & invest in your career that will yield sweet fruits in the times to come.

Wake up! Make up mind for certification. Go get it! Carve the Mantra of “Student for a life time” in your heart. Ask every year; what certification exam am I going to write this year?

By the way, I was selected in that interview & that company gave me an ample of good opportunities including a short trip to USA. It also gave me a lot of company sponsored training in relevant areas. I enjoyed every single day of my work in that company & I still cherish my golden moments till date.

 

What do you think reader? Are you with me? Comments welcome.

Employee – Good, Bad & Ugly

Employee Characteristics Good Bad & Ugly
COMPETENCY
 1 Excellent (written & verbal) communication. Poor communication.
ORIENTATION
 2 Technologically inclined. Money oriented.
 3 Equipped with knowledge, skills & talents. Equipped with company politics, small evil techniques & unnecessary contingencies.
ATTITUDE
 4 Down to Earth.  Egotist
 5 Go-Getter, Do it now, Do Gooder, Burn midnight oil, Run that extra mile. It’s not my job, pay me & I’ll do it, Not coming on week-ends
 6 Takes the ownership of the problem statement / task assigned. Avoids owning the problem
 7 Takes up responsibility for failures. Blames others for failures.
 8 Runs away from appreciations. Is appreciation hungry.
APPROACH
 9 Is initiative taking & proactive. Refrains from initiations & avoids being proactive.
 10 Always willing to give something extra to the company free of cost. Always willing to charge company for anything (time / effort) given extra.
MENTALITY
 11 Considers himself as imperfect individual no matter how grown up. Feels himself as perfect & looks at self as flawless (or with very few flaws) individual.
 12 Feels guilty wasting his & company’s time while at work. Doesn’t value own time as well as company’s time.
 13 Feels proud for his company. Often curses his company.
 14 He feels sorry to leave his company. He feels sorry being an employee of the company.
 15 Doesn’t want to know anything about company politics. Often interested in some or other company politics.
PHILOSOPHY
 16 Says: More replace-able you are, more promotable you are. Says: Less replace-able you are, more important you are.
 17 Job is more of a “Career to build on”. Job is more of a “Bread earner & Future securer”.
 18 Shells out money from his own pocket for doing external certifications & trainings. Expects company to sponsor him for doing his certifications & trainings.
 19 Offers commitment. Demands guarantee.
 20 Salary is secondary to learning, skills & technical upgradations for him. Salary is primary to learning, skills & technical upgradations for him.
BELIEFS
 21 Believes in improving self all the time. Expects company to change according to him.
 22 Believes in bringing profit to the company N times more than what he gets as salary, & works accordingly & expects nothing in return. Hardly does extra work. And immediately expects promotion salary-wise / designation-wise for every extra work done.
PERCEPTION
 23 Clear vision matching & well aligned with company’s goals. Vision often clouded with doubts, suspicions & fears.
 24 Looks at seniors respectfully as mentors & treats likewise. Treats seniors respectfully as mentors & but looks otherwise.
 25 Compares his own performance with other peek performers within the company. Compares his own salary with that of highly paid colleagues.
 26 Is Other-centric Is Self-Centric
 27 Eyes focused on excellence. Eyes focused on perks, promotion & salary hikes.
 28 Always sees opportunity in every problem. Always sees problems in every opportunity.
 29 Looks at HR department as a friend. Looks at HR department as an enemy.
BEHAVIOR
 30  Creator. Complainer.
 31 Grows with the company. Retards company’s progress or causes hick-ups.
 32 Avoids Email wars. Always ready for any kind of Email war.
 33 Open & friendly. Gets along. Secretive, reserved & unfriendly.
 34 Generously imparts knowledge by training people within the company. Avoids giving training. On contrary, expects company to train him.
 35  Upgrades. Doesn’t upgrade / Downgrades.
 36 Hyper active when on bench period. Bench period means hibernation for him.
 37 Rocks the boat in the middle of the sea. Looks for new challenges. Status Quo is his comfort zone. And always seeks comforts.
 38 Judges own performance. Judges the company, the boss & HR.
 39 Accepts & adapts to the company culture immediately. Hardly adapts to & accepts the company culture.
 40 Leaves the decision of his promotion to boss / HR department totally. Expects promotions from HR / Boss frequently.
NATURE
 41 Not scared to talk his heart out to his seniors. Scared & suspicious about talking what’s on his mind.
 42 Is introvert yet uplifting. Is introvert but downfalling.
 43 Cheerful & innocent almost all the time. Often suspicious & dull most of the time.
 44 Feels guilty if delivered less. Tries to make boss / company feel guilty if his efforts are not appreciated.
 45 Maintains professional integrity to his best. Doesn’t care about professional integrity.
 46 Company feels sorry to leave him. Company always looks for a chance to kick him out (of course, in a polite & professional way).
 47 Entrepreneur by nature demonstrating his creativity. Slave / laborer by nature waiting to be directed by someone else.
PERSONALITY
 48 Liked by all. Dis-liked by good employees.
 49 All this goodness reflects like a perfume in his personality & profile. All this badness & ugliness smells fishey from his personality against the nice profile portrayed in resume. (This is the reason why interviewers want to see candidate in person, to avoid mis-judgement).
 50 People (Boss, team, colleagues, seniors & subordinates) find him easily approachable & are happy to meet him every time. People feel like avoiding to approach him unless utmost necessary. And they often regret their meeting with him.

Corruption & Lokpal Bill – India

How Corruption works

• Corruption is Top-Down Phenomenon

• Corporate corruption always operates through public officials.

• Monster corporations are growth hungry & political parties are power hungry.

• Elections campaigns get big black money from such monster corporations. In return, the monster corporations dictate govt. policies in their favor.

• With favorable conditions, monster corporations have more financial & other resources (oil, gas, energy, etc…) than 80% of people.

• Economy gets driven by their selfish means. Prices rise, rich become richer & poor become poorer.

• This is how corporations rule and political officials become their agents

• As a result common people suffer due to lack of adequate resources and overall growth of the country is retarded.

• Moreover, corruption thrives even at bottom level because officers who should stop corruption are also corrupt. No one to watch them.

What makes the people of the country handicap?

• CVC (Central Vigilance Commission) is independent but has no power to prosecute.

• CBI (Central Bureau of Investigation) has power but was not independent (had to wait for central govt.’s permission for prosecution) only until UPA govt. made it independent just pre-lok-sabhaa elecetions 2014.

Where is the missing link?

• Need an independent powerful body to remove corruption by investigating and prosecuting govt. officials impartially.

• Lokpal has only been advisory to govt. without any powers to investigate & prosecute govt. officials.

• 8 attempts (1968, 1971, 1977, 1985, 1989, 1996, 1998 & 2001) have been failed to in past 42 years for making Lokpal more powerful enough to be able to prosecute corrupt officials impartially.

The trigger point

• Global Financial Integrity (a NGO) pegged outflow of illegal money from India.

• $500 billion – $1400 billion trailed in Swiss banks. All Indian black money.

• Finance Minister Pranab Mukherjee’s steps inadequate to combat this menace.

• Govt. has the necessary information & tools at its disposal to trace & prosecute the offenders. E.g. Swiss banks can provide details if Tax authority registers formal cases against offenders.

• But if names disclosed, entire UPA govt. would fall. There is lack of political will.

Enter Anna Hazare (Former Indian Army Havildar & activist of civil society).

• Anna: “Govt. (merely the trustee of people to safeguard public money) is failing its duty to people (masters in democracy).

• Anna writes letter to PM (Manmohan Singh) with intention of “fast unto death” if govt. didn’t accept his demand by April 5.

• Demand = “Include civil society members in the drafting of Lokpal Bill so as to allow to investigate & prosecute corrupt public servants impartially”.

• Anna’s declaration largely gets immediate acceptance in public (frustrated by corruption menace).

• Public turns angry as Govt. hesitates. People react on Media and the Internet.

• PM Manmohan Singh appealed to Hazare to call off his fast and engage in a discussion with subcommittee to frame the lokpal bill.

• Kapil Sibbal (Union Human Resource Development Minister) opposed and indicated that “outsiders” can’t draft legislation as it would be compromising parliaments’ sovereignty.

• Hazare: “If Govt. alone drafts the Bill, it will be Autocracy, not democracy”. And questioned govt.’s wisdom in calling civil society representatives like him as an “outsider”.

• SERVANTS CAN’T CALL MASTER AN OUTSIDER. IF SERVANTS DIDN’T WORK RIGHT, IT IS DUTY OF MASTER TO TEACH HIM THE RIGHT LESSON.

• 7th April, Govt. in Jittery, with concerns of Hazare’s deteriorating health.

• Number of Hazare’s Co-fasters rose to nearly 500.

• 8th April, Govt. agrees to accept all demands of Hazare. But Hazare waits till 9th April so that Govt. would have enough time to bring out gazette notification.

• Hazare breaks his fast but warns that he would do same again if Jan Lokpal Bill isn’t enacted by 15th August (symbolic deadline of 2nd freedom).

• But merely the Bill is not enough. Policies too should change accordingly.

• Therefore, next agenda is to push for decentralization. This will lead to participatory decision-making in Govt. policies to stop favoring monster corporations.

• Theoretically, Lokpal will have full potential to curb every corruption however it is believed it would wipe out 80% of corruption in the country.

• Visit http://en.wikipedia.org/wiki/Jan_Lokpal_Bill to know more (key features) about Lokpal Bill

    References:

1. FRONTLINE (www.frontline.in), May 6, 2011
2. http://en.wikipedia.org/wiki/Jan_Lokpal_Bill

Diving deeply into NOW

DEFINITION OF A BUSINESS OBJECT.

WHAT IS A BUSINESS OBJECT (BO)?

Having both state & behavior is an important criterion for a class to be considered as business object.

It may represent a person, place, thing or concept from business domain.

It should be re-usable.

Generally business objects are classified into:
Entity BO: Nouns from business.
Process BO: Work flow or business process.
Event BO: Causes / caused by action in system. Represents an event.

BOs provide common terminology & ideas that can be shared across organization by technical & non-technical people alike.

They are very intuitive & should make sense to entire organization.

Have ability to evolve with organizational changes through modification / specialization.

BOs should have well defined interfaces so as to hide low-level implementation.

Should have clear & cohesive set of functionality.

References:
Programming Jakarta Struts
By – Chuck Cavaness
O’reilly

Anup Jani
(Bsc, MCP, GNIIT, SCJP, SCWCD, IBM OOAD/UML JCert.)
My profile: www.linkedin.com/in/anupjani
My Blog: www.anupjani.wordpress.com

SIMPLE XML/XSD/XSLT EXAMPLE FOR BEGINNER THAT WORKS!!!

CSS is Style Sheet for HTML
HTML uses predefined tags, and the meaning of each tag is well understood.
The <table> tag in HTML defines a table – and a browser knows how to display it.
Adding styles to HTML elements are simple.
Telling a browser to display an element in a special font or color, is easy with CSS.

XSL is Style Sheet for XML
On the other other hand,
XML does not use predefined tags (we can use any tag-names we like), and therefore the meaning of each tag is not well understood.
A <table> tag could mean an HTML table, a piece of furniture, or something else – and a browser does not know how to display it.

XSL describes how the XML document should be displayed!

You will need:
A good XML editor (even a notepad can do). I used XML Copy Editor 1.2.0.2
A browser. (I used Mozilla Fire Fox 3.0.8).

Create c:\country.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<?xml-stylesheet type=”text/xsl” href=”country.xsl”?>
<country xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xsi:noNamespaceSchemaLocation=”country.xsd”>

<countryName>Australia</countryName>
<capital>Canberra</capital>
<nationalLanguage>English</nationalLanguage>
<population>21000000</population>
<currency>Australian Dollar</currency>
<nationalIdentities>
<nationalAnthem>Advance Australia Fair</nationalAnthem>
<nationalDay>Australia Day (26 January)</nationalDay>
<nationalColour>Green and Gold</nationalColour>
<nationalGemstone>Opal</nationalGemstone>
<nationalFlower>Wattle (Acacia pycnantha)</nationalFlower>
</nationalIdentities>
<publicHolidays>
<newYearDay>1 January</newYearDay>
<australiaDay>26 January</australiaDay>
<anzacDay>25 April</anzacDay>
<christmasDay>25 December</christmasDay>
<boxingDay>26 December</boxingDay>
<laborDay>Variable Date</laborDay>
<easter>Variable Date</easter>
<queenBirthDay>21 April (Variable Date)</queenBirthDay>
</publicHolidays>
<states>
<stateName>NSW – New South Wales</stateName>
<stateName>VIC – Victoria</stateName>
<stateName>QLD – Queensland</stateName>
<stateName>SA – South Australia</stateName>
<stateName>WA – Western Australia</stateName>
<stateName>TAS – Tasmania</stateName>
</states>
<territories>
<territoryName>ACT – Australian Capital Territory</territoryName>
<territoryName>NT – Northern Territory</territoryName>
</territories>
</country>

Create c:\country.xsd
<?xml version=”1.0″ encoding=”UTF-8″?>
<xs:schema xmlns:xs=”http://www.w3.org/2001/XMLSchema”&gt;

<xs:element name=”country”>
<xs:complexType>
<xs:sequence>
<xs:element name=”countryName” type=”xs:string”/>
<xs:element name=”capital” type=”xs:string”/>
<xs:element name=”nationalLanguage” type=”xs:string”/>
<xs:element name=”population” type=”xs:double”/>
<xs:element name=”currency” type=”xs:string”/>
<xs:element name=”nationalIdentities”>
<xs:complexType>
<xs:sequence>
<xs:element name=”nationalAnthem” type=”xs:string”/>
<xs:element name=”nationalDay” type=”xs:string”/>
<xs:element name=”nationalColour” type=”xs:string”/>
<xs:element name=”nationalGemstone” type=”xs:string”/>
<xs:element name=”nationalFlower” type=”xs:string”/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name=”publicHolidays”>
<xs:complexType>
<xs:sequence>
<xs:element name=”newYearDay” maxOccurs=”1″ type=”xs:string”/>
<xs:element name=”australiaDay” maxOccurs=”1″ type=”xs:string”/>
<xs:element name=”anzacDay” maxOccurs=”1″ type=”xs:string”/>
<xs:element name=”christmasDay” maxOccurs=”1″ type=”xs:string”/>
<xs:element name=”boxingDay” maxOccurs=”1″ type=”xs:string”/>
<xs:element name=”laborDay” maxOccurs=”1″ type=”xs:string”/>
<xs:element name=”easter” maxOccurs=”1″ type=”xs:string”/>
<xs:element name=”queenBirthDay” maxOccurs=”1″ type=”xs:string”/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name=”states”>
<xs:complexType>
<xs:sequence>
<xs:element name=”stateName” type=”xs:string” minOccurs=”1″ maxOccurs=”unbounded”/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name=”territories”>
<xs:complexType>
<xs:sequence>
<xs:element name=”territoryName” maxOccurs=”unbounded”/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

</xs:schema>

Create c:\country.xsl
<?xml version=”1.0″ encoding=”UTF-8″?>
<xsl:stylesheet xmlns:xsl=”http://www.w3.org/1999/XSL/Transform&#8221; version=”1.0″>
<xsl:template match=”/”>
<html>
<body>
<xsl:for-each select=”country”>
<xsl:value-of select=”countryName”/><br/>
<xsl:value-of select=”capital”/><br/>
<xsl:value-of select=”nationalLanguage”/><br/>
<xsl:value-of select=”population”/><br/>
<xsl:value-of select=”currency”/><br/>
<xsl:for-each select=”nationalIdentities”>
<xsl:value-of select=”nationalAnthem”/><br/>
<xsl:value-of select=”nationalDay”/><br/>
<xsl:value-of select=”nationalColour”/><br/>
<xsl:value-of select=”nationalGemstone”/><br/>
<xsl:value-of select=”nationalFlower”/><br/>
</xsl:for-each>
<xsl:for-each select=”publicHolidays”>
<xsl:value-of select=”newYearDay”/><br/>
<xsl:value-of select=”australiaDay”/><br/>
<xsl:value-of select=”anzacDay”/><br/>
<xsl:value-of select=”christmasDay”/><br/>
<xsl:value-of select=”boxingDay”/><br/>
<xsl:value-of select=”laborDay”/><br/>
<xsl:value-of select=”easter”/><br/>
<xsl:value-of select=”queenBirthDay”/><br/>
</xsl:for-each>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Execute the program
Just open the country.xml in your browser.

Moreover
Above is a very simple output.
You can further beautify your output by modifying your country.xsl
Just create another c:\beautifiedcountry.xsl
And replace the name from “country.xsl” to “beautifiedcountry.xsl” in your country.xml
And open the XML to see the difference.

Copy this c:\beautifiedcountry.xsl
<?xml version=”1.0″ encoding=”UTF-8″?>
<xsl:stylesheet xmlns:xsl=”http://www.w3.org/1999/XSL/Transform&#8221; version=”1.0″>
<xsl:template match=”/”>
<html>
<body>
<table border=”2″ bgcolor=”lightgray”>
<tr><u><b>GENERAL INFORMATION</b></u></tr>
<tr>
<xsl:for-each select=”country”>
<tr>
<table border=”1″ bgcolor=”lightblue”>
<tr><td>Country Name</td><td><xsl:value-of select=”countryName”/></td></tr>
<tr><td>Capital</td><td><xsl:value-of select=”capital”/></td></tr>
<tr><td>National Language</td><td><xsl:value-of select=”nationalLanguage”/></td></tr>
<tr><td>Population</td><td><xsl:value-of select=”population”/></td></tr>
<tr><td>Currency</td><td><xsl:value-of select=”currency”/></td></tr>
</table>
</tr>
<tr><br></br></tr>
<tr><u><b>NATIONAL IDENTITIES</b></u></tr>
<tr>
<xsl:for-each select=”nationalIdentities”>
<table border=”1″ bgcolor=”lightyellow”>
<tr>
<td>National Anthem</td><td><xsl:value-of select=”nationalAnthem”/></td>
</tr>
<tr>
<td>National Day</td><td><xsl:value-of select=”nationalDay”/></td>
</tr>
<tr>
<td>National Colour</td><td><xsl:value-of select=”nationalColour”/></td>
</tr>
<tr>
<td>National Gem Stone</td><td><xsl:value-of select=”nationalGemstone”/></td>
</tr>
<tr>
<td>National Flower</td><td><xsl:value-of select=”nationalFlower”/></td>
</tr>
</table>
</xsl:for-each>
</tr>
<tr><br></br></tr>
<tr><u><b>PUBLIC HOLIDAYS</b></u></tr>
<tr>
<xsl:for-each select=”publicHolidays”>
<table border=”1″ bgcolor=”LightGreen”>
<tr>
<td>New Year’s Day</td><td><xsl:value-of select=”newYearDay”/></td>
</tr>
<tr>
<td>Australia Day</td><td><xsl:value-of select=”australiaDay”/></td>
</tr>
<tr>
<td>ANZAC Day</td><td><xsl:value-of select=”anzacDay”/></td>
</tr>
<tr>
<td>Christmas Day</td><td><xsl:value-of select=”christmasDay”/></td>
</tr>
<tr>
<td>Boxing Day</td><td><xsl:value-of select=”boxingDay”/></td>
</tr>
<tr>
<td>Labor Day</td><td><xsl:value-of select=”laborDay”/></td>
</tr>
<tr>
<td>Easter</td><td><xsl:value-of select=”easter”/></td>
</tr>
<tr>
<td>Queen’s Birthday</td><td><xsl:value-of select=”queenBirthDay”/></td>
</tr>
</table>
</xsl:for-each>
</tr>
</xsl:for-each>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Recommended Reference:
http://www.w3schools.com/xsl/xsl_languages.asp

Anup Jani
(Bsc, MCP, GNIIT, SCJP, SCWCD, IBM OOAD/UML JCert.)
My profile: http://www.linkedin.com/in/anupjani
My Blog: http://www.anupjani.wordpress.com

SIMPLE JUNIT EXAMPLE FOR BEGINNER THAT WORKS!!!

This Hello World program demonstrates basic features of JUnit.

All you need is:
1. Eclipse
2. JDK1.5
3. junit.jar (Download from http://www.junit.org)

In this program, usage of JUnit is demonstrated in order to test 2 components, namely:
1. Dice.java
2. DiceFactory.java

Test requirement for every new Dice created:
1. Playing a dice every time should get any number between (including) 1 to 6
2. A dice has 6 sides & no two sides should hold the same number.
3. Dice should be unbiased. In an unbiased dice, the sum of 2 opposite side numbers is always 7.
e.g. If back side is 6 then front side has to be 1.

Create Java project in eclipse.
NOTE: Make sure junit.jar is set in your classpath.

Folder structure
C\MyWorkspace\HelloJUnit:
│ .classpath
│ .project

├───bin
│ │ DiceTest.class
│ │
│ └───com
│ ├───mymodel
│ │ Dice.class
│ │
│ └───myservice
│ DiceFactory.class

├───src
│ └───com
│ ├───mymodel
│ │ Dice.java
│ │
│ └───myservice
│ DiceFactory.java

└───test
DiceTest.java

Create Dice.java
package com.mymodel;

import java.util.Random;

/**
* @author Anup
* A dice that has 6 sides, namely:<br>
* top, bottom, left, right, front & back.<br>
*/
public class Dice {

//Dice has six sides, each one carrying a number.
private int topSide = 0;
private int bottomSide = 0;
private int leftSide = 0;
private int rightSide = 0;
private int frontSide = 0;
private int backSide = 0;

/**
* Parameterised constructor.
* @param topSide
* @param bottomSide
* @param leftSide
* @param rightSide
* @param frontSide
* @param backSide
*/
public Dice(int topSide,
int bottomSide,
int leftSide,
int rightSide,
int frontSide,
int backSide) {
this.topSide = topSide;
this.bottomSide = bottomSide;
this.leftSide = leftSide;
this.rightSide = rightSide;
this.frontSide = frontSide;
this.backSide = backSide;
}

/**
* This method plays the dice to get a number.
* @return
*/
public int throwDice() {
return getRandomNumber();
}

public int getTopSide() {
return topSide;
}

public int getBottomSide() {
return bottomSide;
}

public int getLeftSide() {
return leftSide;
}

public int getRightSide() {
return rightSide;
}

public int getFrontSide() {
return frontSide;
}

public int getBackSide() {
return backSide;
}

/**
* Private method to get a random number.
* @return
*/
private int getRandomNumber() {
Random r = new Random();
int n = 0;
while (true) {
n = Math.abs(r.nextInt()) % 7;
if(n <7 && n >0)
return n;
}
}

}
Create DiceFactory.java

package com.myservice;

import com.mymodel.Dice;

/**
* @author Anup
* A factory class that deals with Dice object creation.
*/
public class DiceFactory {

/**
* Creates a dice object.
* @param top
* @param bottom
* @param left
* @param right
* @param front
* @param back
* @return
*/
public Dice getDice(
int top,
int bottom,
int left,
int right,
int front,
int back) {
return new Dice(top, bottom, left, right, front, back);
}

}
Create DiceTest.java
import java.util.HashSet;
import java.util.Set;

import junit.framework.TestCase;

import com.mymodel.Dice;
import com.myservice.DiceFactory;

/**
* @author Anup
* A test case to unit test the Dice Program.
*/
public class DiceTest extends TestCase {

int top = 1;
int bottom = 6;
int left = 4;
int right = 3;
int front = 2;
int back = 5;
DiceFactory diceFactory = null;
Dice dice = null;

//Constructor
public DiceTest(String testMethodName) {
super(testMethodName);
}

//Initialise
public void setUp() {
diceFactory = new DiceFactory();
}

//Dice should not be null.
public void testGetDice() {
dice = diceFactory.getDice(top, bottom, left, right, front, back);
assertNotNull(dice);
System.out.println(“Dice created.”);
this.dice = dice;
}

//When dice thrown, should get any number between (including) 1 to 6
public void testThrowDice() {
dice = diceFactory.getDice(top, bottom, left, right, front, back);
int n = dice.throwDice();
assertTrue(n<7 && n>0);
System.out.println(“Dice number is between (including)1 & 6 = ” + n);
}

//Making sure NO two sides are same.
public void testUniquenessOfSides() {
dice = diceFactory.getDice(top, bottom, left, right, front, back);
Set set = new HashSet();//Set holds unique values.
String args[] = {
dice.getTopSide()+””,
dice.getBottomSide()+””,
dice.getLeftSide()+””,
dice.getRightSide()+””,
dice.getFrontSide()+””,
dice.getBackSide()+””
};
for(String i : args) {
assertTrue(set.add(i));
}
System.out.println(“No duplicates detected!”);
}

//Dice should be unbiased.
//In an unbiased dice, the sum of 2 opposite side numbers is always 7.
//e.g. If back side is 6 then front side has to be 1.
public void testUnbiased() {
dice = diceFactory.getDice(top, bottom, left, right, front, back);
assertEquals(dice.getFrontSide() + dice.getBackSide(), 7);
assertEquals(dice.getLeftSide() + dice.getRightSide(), 7);
assertEquals(dice.getTopSide() + dice.getBottomSide(), 7);
System.out.println(“Dice is unbiased.”);
}

//De-initialise
public void tearDown() {
diceFactory = null;
dice = null;
System.out.println(“Tear down <<<<“);
}

}

Execute the program
Wen you are done building project, right click on project.
Project –> Run As –> JUnitTest
There is no main method here.
That’s the whole idea. We have JUnit test methods instead.

Anup Jani
(Bsc, MCP, GNIIT, SCJP, SCWCD, IBM OOAD/UML JCert.)
My profile: http://www.linkedin.com/in/anupjani
My Blog: http://www.anupjani.wordpress.com

Understanding of Matrix

If you have read Indian holy Gita, you will find many similarities. In fact, Matrix is Modern way to convey the message of essence sung by God Himself in Shri Gita. Leo Tolstoy (one of the greatest Novelist of all times) danced with Gita on his head repenting why the heck did he not come across this great scripture before.

This SCI-FI movie that talks about AI (Artificial Intelligence) taking over humans in far future, is the beautiful code that could be understood only in its metaphorical terms with a broader perspective.  Put aside your urge for inclination towards all dramatic stunts & special effects for a moment & try to think out of the box. Let’s first assume these metaphors to see if it makes some sense.

Metaphors

Architect: You who constantly try to achieve perfection.

Matrix: Your Mind which has projection that is full of illusions where nothing is real.

AI: Your intellect. Agents represent the AI in matrix.

Humans: Your Heart (not in literal sense) which is full of emotions & qualities such as devotion, love, faith, belief & sacrifice that are beyond the logic & that even AI (who things of himself as superior) lacks. That’s the reason why Architect can’t see past the choices he makes. And that’s why the need to see beyond.

Frustrated by failures, Architect develops a vision (Oracle) that appreciates human qualities & hence sees beyond in order to achieve perfection.

Zion: Human body (collection of life).

Neo: Your Self. Whoever cares about the truth becomes the chosen one. Rest of all are just some or the other than Neo. Only chosen one seeks the answer.

The One: The Consciousness. Self eventually realizes it.

Smith: Your self: The Ego (mirror of the Self). He wants to get out of Matrix. Smith itself is a construct of Matrix & how can he be free from it? But he dislikes this compulsion. This clearly tells that he is ignorant. Being ignorant he’s directionless & therefore always malfunctions. He must disappear.

Ignorance: The real anomaly that is inherent into the Matrix program (Mind) which needs to be corrected.

Both (Neo & Smith) want to be free. That is the connection that drives them. But there is a difference. Because of Smith’s definition of freedom being different from that of Neo, Smith wants to be free from any kind of Compulsion. On the other hand, Neo doesn’t care about that. He wants freedom from the question that drives him crazy. He believes that only by finding the answer he can be free.

What question?
What is truth? It’s the question. Neo is restless & seeks the only thing throughout.

Another difference between Neo & Smith: Neo is guided by Oracle’s advice. As if Self guided by the Vision. Smith on the other hand, tries to forcefully steal the Vision (eyes of oracle).

Another difference: Smith is not ready to give himself up even though he wishes to see beyond. Neo, in the end is prepared to even give himself up.

Fear is another thing that makes them distinct. Neo is not afraid. Smith is afraid. Both seek freedom but only chosen one becomes the worthy of ultimate purpose.

What purpose?
Purpose is to achieve eternal happiness. In the end, Neo achieves Nirvana (the ultimate peace, the real happiness). The golden code that Neo sees is the enlightenment that he attains. He is physically blind but is still able to see. That’s because of his “inner eyes”. Truth is seen only with inner eyes. And that too only when he reaches the level where he is ready to let go of his Love. Love, again a rare highest quality in front of which (for Neo) nothing else matters. Remember Neo told Ramakandra at the train station that he would give up everything for his love?

Earlier versions of Neo hadn’t developed this kind of specific Love. That’s why re-incarnations.

Merovingian: (one of the earlier ones) is kind of characterless departed one. Very powerful yet immoral. The one who perhaps cared for neither Trinity (specific love) nor the people (generic love). And therefore he gets downgraded.

Oracle, while examining Neo in her first meeting, is happy to see that Neo’s in love. And she believes that this love would take him to highest point against all odds, (odds as in the ultimate defence system of machine city). This gives her a hope that he is really worthy of walking on the path. The path, that leads to the truth.

And what is truth?
Truth is the (Pure) Consciousness, THE ONE that is finally realized when calmed down everything else. When wars end between mind, body, heart & intellect so that they start to learn to live in harmony: When Ego is beaten down & disappeared: When highest qualities such as love are also sacrificed & left behind on the quest of truth: When one who has sacrificed anything & everything & yet stands: That is the state of perfection where Neo achieves Nirvana, the ultimate peace, the eternal real happiness. This is the golden code of the One. And this realization is the truth by attaining which Neo (Now the One) attains the real freedom.

Why war?
War between Matrix & Zion is like conflicts between intellect & emotions. The cause is ignorance which was the real anomaly. Except for the consciousness, nothing else is perfect. Neither mind nor body neither intelligence nor heart. As long as ignorance (anomaly) lies in the Mind (Matrix), there is a constant conflict (war) between heart (humans) & intellect (agents). And Ego (the victim of ignorance) is so pervaded (duplicate Smiths) in the mind that it causes the ultimate mental block which is not acceptable to you (Architect). And as you stand helpless, now the real problem is Ego.

Self comes to the rescue. But the deal is first to calm down emotions & intellect. Thank (machine) God for agreeing for “peace” & relying on the Self to solve the matter.

The ultimate fight between the Ego & the Self within the mind (Matrix)
Self (though at times is weak) is not giving up till the time when Ego realizes one truth that “Everything that has beginning has an end.” Even he was constructed in mind & therefore even he has to die. Smith is afraid of death. Self is not because all left of him is Self. This is the time when Neo reckons that Ego is ready to die & he then “chooses” to give up the fight. As he gives up, Smith childishly kills Neo in Matrix. As he kills Neo, this serves the purpose of Smith. And Smith object is no more required therefore deleted as per the Matrix rules.

So you see! Matrix is nothing but about the journey of Self to unite with the pure Consciousness.

When the Matrix Revolutions is ended, a careful viewer must have noticed a chanting of mantra:
“ASATO MAA SAT GAMAYA,
TAMASO MAA JYOTIRGAMAYA,
MRITYOMAA AMRUTAM GAMAYA”.

This shloka is originally from one of the ancient & oldest Indian sacred scripture which means:

Lead me from the asat (unreal) to the sat (real).
Lead me from darkness to light.
Lead me from death to immortality.

(Brhadaranyaka Upanishad – I.iii.28)

Refer to this site for hearing the mantra.

Anup Jani
(Bsc, MCP, GNIIT, SCJP, SCWCD, IBM OOAD/UML JCert.)
My profile: http://www.linkedin.com/in/anupjani
My Blog: http://www.anupjani.wordpress.com