Friday, September 25, 2009

cygwin|fortune

One of the many fun things in cygwin is the tool called fortune. As per the man page, it returns a random quote or anecdote. I do not wish to take any credit away from the tool, but just share a few here:
But since I knew now that I could hope for nothing of greater value than frivolous pleasures, what point was there in denying myself of them?
-- M. Proust

Psychiatry enables us to correct our faults by confessing our parents' shortcomings.
-- Laurence J. Peter, "Peter's Principles"

The Briggs-Chase Law of Program Development:
To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.

The sweat of hard work is not to be displayed. It is much more graceful to appear favored by the gods.
--Maxine Hong Kingston,
The Woman Warrior: Memoirs of a Girlhood among Ghosts

Leadership is nature's way of removing morons from the productive flow.
--Dogbert Dilbert strip of February 5, 1995

Thursday, September 17, 2009

Daily Rant - "Meditation Time"

Recipe: You need the following items:
1 Apple iPod
2 Custom playlists - "Creed" & "Tool" - For best results the following songs could be played in this order Tool: "Forty Six & 2", "Schism", "Rosetta Stoned", Creed: "Hide", "My Sacrifice".
1 BMW M3 6MT or equivalent(right!)

Preparation:
In a city, on some fast roads, preheat the S54 Engine by driving under 3000 rpm so the engine oil & the transmission oil is warmed up. At the same time start the music system, and crank the volume just enough to drown all other noise, while you still have some conscientiousness of where you are. Once the temperature is right, and the driver adrenaline level high enough - hyper alert mode for road safety and protection from toads on the road, safely and quickly move to the free lanes, never exceeding the speed limits (SL:40) more than 5 mph. Bring the speeds up to just about +10 mph. Then merge on the fast roads (SL:55) at 60 mph.

Let the music, speed and this high alert mode take over and then by the time you have finished listening "Rosetta Stoned" you have achieved nirvana. Listening to Tool can help me drown all the rubbish from the mind and following my instincts driving an M3 is more peaceful than anything else, so far.

Note: Driving safely on the road means more than just driving at or under the speed limit. Its being aware of your surroundings and being courteous to other people on the road. The high alert mode with the head spinning like a top to cover 360 deg. view makes this possible. Not to mention the ever so responsive and perfect M3. A lethargic Toyota corolla is more dangerous on the road than the nimble M3.

Wednesday, September 16, 2009

Daily Rant - "Nice Day"

"Matrix" by far is my most favorite movie, since it's references come up so often, on a daily basis. It seems nature is indeed programmed and it obeys the rules so diligently. Today, it was an amazing drive to office.. 64F, nice cool breeze, warm sunlight and gorgeous clouds. It was just perfect ... as though there was some program making all the pieces work so beautifully.

The All & Powerful Media & are we Immune?

Journalism has a new meaning... or was it the vague impression born out the better qualities displayed by journalists from the yore, that is helplessly clashing with these modern tasteful times. There is too much oxymoron in this sentence. Perhaps due to the confusion created by what is happening in the media.

Two celebrities Michael Jackson & Patrick Swayze died recently, and apparently there is a rejoice in the media. A frenzy of shows have poured over, recounting the last days and then the glory days. When Michael was alive the media called him "Whacko-Jacko" and now in his death, he is remembered as the "King of pop". Swayze perhaps did not have too much weirdness in his personal life to have been forgotten, until he came out with his fight against pancreatic cancer. Why is the media controlling the life of these great artists of our life time? The media seems to be in complete control of our emotions.

While I am writing this, a warning light is blinking in my head - Hypocrite? I am using the media to fight the media. The sole purpose of the blog is to expose this lack of justice to the people like Michael and Swayze. What kind of memories did Michael take with him when he died? Swayze gave us all an example of dignity and courage in his passing. I just feel we all need to offer this gratitude to these folks while they are alive than using them to sell news.

As per Merriam-Webster "Journalism" is
"2 a : writing designed for publication in a newspaper or magazine b : writing characterized by a direct presentation of facts or description of events without an attempt at interpretation c : writing designed to appeal to current popular taste or public interest";

I take offense to the meaning in "c". "Appeal to the popular taste"!! I'm certain that this is not at the expense of "b" .."presentation of facts or description of events without an attempt at interpretation".

There was much more honor in reporting and being civilized, or so I want to believe. Now it seems we are living like beasts, saved by all the fine prints in the legal documents. Recently Kayne West decided to exercise the first amendment, insulting a fellow musician Taylor Swift. After which he apologized profusely on Jay Leno's show. Serena Williams must have scared the living day lights out of the lines-woman at the US Open, and then "almost" apologized.

I thought saying "I'm sorry" meant feeling "ashamed". These days spouting these hollow apologies made infamous in the media is a sign of character. Just because you have these handy-dandy apologies lying around does not give you the right to be a jack-ass to begin with. There is a cost to character and it has nothing to do with having a PR.

We all need to understand this responsibility towards other people and ourselves. Even if the media makes a "wrong" look like "conditionally right" we all know the truth in our hearts. Following this conscientiousness may not be the fashion this season, but it has to be over our lifetime, if at all we wish to remain civilized.

Monday, September 14, 2009

Daily Rant - "The world is my oyster"

I thought I should just start this blog entry, to note some of the observations on a day to day basis. I must request your indulgence only at the cost of the accepting the long standing disclaimer, that this blog is just IMHO.
Ever heard the phrase "The world is my oyster". Today I experienced a different one - "The world is my ashtray". Nothing funny, just some minivan driver exercising his/her right, while I'm driving with all the windows down, breathing in the fresh air.

Monday, July 13, 2009

Xmarks - Syncing w. Firefox 3.5

Recently, I upgraded my favorite browser to 3.5. However, Xmarks, formerly known as Foxmarks stopped working. It's a Firefox extension that stores a copy of your bookmarks & allows you to sync bookmarks on other computers using Firefox. It's pretty neat! I was getting "Error 3" whenever I tried to sync. Xmarks help was suggesting that the FF user profile was corrupt. I was too lazy to create a new profile.
I seem to have a quick fix for this issue; as follows:
1. Delete all the bookmarks on the client computer. (It may be advisable to backup your bookmarks before doing this, although Xmarks would already have a recent backup.)
2. Restart FF.
3. Go to Xmarks > Settings > Advanced & Hit Download. This will overwrite the local computers FF bookmarks.

These steps solved the problem for me.

Saturday, May 16, 2009

Monopoly - US Economy 2009

Disclaimer: I am far from being even the novice in Economics & hence all the statements made on this blog entry are completely personal. The entry is merely a feeble attempt to verbalize the non-sense we all are reading & watching about in the news these days - Yr. 2009. I humbly seek your indulgence & pls. take this entry with a pinch or pint of salt.
Recently, I had an interesting chat with my friend Arun. He was was talking about how Rats camera went down. Here is the chat I had with my friend:

(10:42:49 AM) Arun:Rats cam closed,they owe canon and nikon 40 million $ and the store is shutdown
(10:43:28 AM) Ajay: wow! hence the ridiculous prices :D
(10:44:39 AM) Arun: canon lost almost about 25 million, nikon and others lost the rest, they went to bankrupt
(10:46:27 AM) Ajay: all these business models seem driven by only thing.. wishful thinking.. the demand will always grow, the consumers will always pay.. the market will always have a lot credit!!!
(10:48:52 AM) Ajay: just look at all these companies growing growing..growing.. globing globing globing.. under the assumption that monopolizing the market is the only way to b successful
(10:49:12 AM) Ajay: now they r all obese tearing at the seams and wondering why people r not buying
(10:50:02 AM) Ajay: the rate at which the stores/supply grew was never backed up by the purchasing power/jobs/income..
(10:50:11 AM) Arun: more over i don't understand one thing. they borrow money to buy merchandise then they sell them and then don't they return money back to the investors
(10:50:16 AM) Ajay: how can u assume demand?
(10:50:35 AM) Ajay: thats credit
(10:50:42 AM) Arun: i am talking about past 10-20 years they made money; spreading themselves too thin, where did all that money go

The main theme of this post begins here...

(10:51:13 AM) Ajay: yeah.. but its like the way i played monopoly
(10:52:18 AM) Ajay: i borrowed like anything.. bought all the places and put expensive buildings on them... now every time the player landed there.. i got a huge sum of money.. nobody could play w/ me.. and even the computer gave up..
(10:52:42 AM) Ajay: in real life.. people can stop going around.. and then the owner ends up owing a lot of money
(10:53:18 AM) Ajay: that dumb monopoly version makes the assumption that players continue to play and the game is over if they all quit
(10:53:40 AM) Ajay: not the later part, that now I owe a ton of money w/o any players and i must play until i pay off
(10:53:57 AM) Ajay: all these folks.. or the deluded capitalist play this stupid monopoly, the real one.. is the yr 2008-09 outcome
(10:54:33 AM) Ajay: i think the analogy is impeccable
(10:55:02 AM) Arun: you are brilliant
(10:55:15 AM) Ajay: :)

(10:56:36 AM) Ajay: its weird that businessmen make this mistake.
(10:57:45 AM) Ajay: there is a simple understanding.. how big can u grow? What is determining ur growth?
(10:58:01 AM) Ajay: I guess now we might appreciate why Apple likes its profitability than % market share .. Apple has a ton of money and less headache!
(11:10:37 AM) Arun: makes sense
(11:10:55 AM) Ajay: just imagine.. to the least, by cutting some cost Apple can boost the sales
(11:11:18 AM) Ajay: now imagine they launch new ipods, iphone.. diff. colors, diff features.. they can further invest in adds for more mac sales, these opportunities r still viable and they don't have to sweat it yet
(11:12:23 AM) Ajay: M$ on the other hand ...

(11:18:25 AM)
Ajay: companies like Rats ... r stupid
(11:20:02 AM)
Ajay: "According to the bankruptcy filing, the company's profits in film processing were hurt by the shift to digital photography." [r]
(11:20:25 AM) Ajay: *hurt by the shift to digital photography* that explains a lot why Rats went down.
(11:20:49 AM) Arun: the shift happened 5 years ago
(11:21:03 AM) Ajay: and these guys were in business since 1918 .. but they had no idea how the industry will evolve??
(11:21:38 AM) Ajay: no connections w/ canon or nikon to realize what will happen??
(11:22:10 AM) Ajay: i think Chapter 11 is like "Here's ur sign!!"
(11:22:44 AM) Ajay: but i seem to go back to the obesity crisis and these companies
(11:23:12 AM) Ajay: don't call me fat.. i need special provisions.. u cannot discriminate.. all the plain BS
(11:23:35 AM) Ajay: if u r fat.. u r fat.. deal w/ it!! if u r making losses.. then deal w/ it!!
(11:23:55 AM) Ajay: close down shops... 800 of them, make it 400
(11:24:18 AM) Ajay: adds, new bigger places w/ lot of hands on training, invite great photographers for review
(11:24:48 AM) Ajay: 1/1 meetings between Experts & Amateurs, reduce the stupid workforce and inventory
(11:25:11 AM) Arun: also they have to offer something additional to compete with online stores
(11:25:12 AM) Ajay: 1/2 the stuff is made from china and completely useless
(11:25:21 AM) Ajay: precisely!!!competitive prices, offer training, consultation, open discussion
(11:25:57 AM) Arun: event contests
(11:25:59 AM) Ajay: make a community out of the photographers
(11:26:02 AM) Ajay: yep
(11:29:36 AM) Ajay: "Forget about learning anything, u can buy everything!!" - US motto of this decade??

(11:30:25 AM)
Ajay: its like the early industry founders believed in Legos, the only game they ever played
(11:31:16 AM) Ajay: same blocks, same colors, mass produced - everything everywhere!!! food, services, language, vehicles, furniture, name it!!
(11:32:03 AM) Arun: things will break down and i think we will see a lot of smaller stores soon
(11:33:00 AM) Ajay: It might be a bit to outrageous to hope that this economic crash could bring about a cultural revolution
(11:33:18 AM) Ajay: bb

r: Sorry I don;t have the reference to this article.

Saturday, May 9, 2009

HelloWorld - Ajax, Struts

This is a simple HelloWorld example for Ajax & Struts. In this example, I have a rudimentary Ajax call to the server side Struts Action class.

JavaScript:

<SCRIPT language="javascript">
var xmlHttp;
function greet(name) {
xmlHttp = GetXmlHttpObject();
if (xmlHttp == null) {
alert("Critical Browser Error: Pls. close the browser & try again!");
return false;
}
// struts action call
var url = "sayHello.do";
url = url + "?name=" + name.value;
url = url + "&sid=" + Math.random();
xmlHttp.onreadystatechange = stateChanged;
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}

function stateChanged() {

if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
var strutsResp = xmlHttp.responseText;
document.getElementById("strutsResp").innerHTML = strutsResp;
} else {
alert("Critical Browser Error: Pls. close the browser & try again!");
}
}
}

function GetXmlHttpObject() {
var xmlHttp = null;
try {
xmlHttp = new XMLHttpRequest();
} catch (e) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
</SCRIPT>


HTML Form:

<form><!-- onchange='greet(this);'-->
<p><LABEL for="name">Name: <input type="text" name="name"
size="10" id="name" onchange='greet(this);'/></LABEL>
<input type="button" id="ok" value="OK"/>
</p>
</form>


Struts Config:

<!--Note: the response is fully cooked - no mapping required! -->
<action-mappings>
<action path="/sayHello" type="com.aj.helloajax.actions.SayHelloAction">
</action>
</action-mappings>


Struts Action Class:

public class SayHelloAction extends Action {

public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {

String name = (String)request.getParameter("name");
response.setContentType("text/html");
PrintWriter out = response.getWriter();

out.print("<h2>Hello "+name+" !!</h2>");
out.flush();
response.flushBuffer();
//Note: the response is fully cooked - no mapping required!
return null;
}
}

Thursday, April 30, 2009

Expand Collapse - Client Side using style.visibility

This is the simplest version of implementing Expand/Collapse of table rows using Javascript.
Clicking + expands the table & - collapses the table rows to the header.




Its important to note that even the selections are preserved, between expand and collapse; clearly since only the display property is altered.
I am enclosing the bare bone version of the code here. I have used some CSS to make the tables above look presentable.
Refer http://w3schools.com/css/ for more details

<br /><script language="javascript"><br />var disp = true;<br />function toggleDisplay(){<br /> if(disp){<br />  disp = false;<br />  document.getElementById("state").innerHTML="-";<br />  document.getElementById("table").style.<br />visibility="collapse";<br /> }else{<br />  disp = true;<br />  document.getElementById("state").innerHTML="+";<br />  document.getElementById("table").style.<br />visibility="visible";<br /> }<br />}<br /></script><br /></pre><br /><pre class="brush: html; wrap-lines: true"><br /><br /><body><br /> <table cellpadding="0" cellspacing="1"><br /> <thead><br />  <tr><td><a href='javascript:toggleDisplay()'><div id="state">-</div></a></td><td>Names</td></tr><br /> </thead><br /> <tbody id="table"><br />  <tr><td><input type="checkbox" name="name1"/></td><td>Ajay1</td></tr><br />  <tr><td><input type="checkbox" name="name2"/></td><td>Ajay2</td></tr><br />  <tr><td><input type="checkbox" name="name3"/></td><td>Ajay3</td></tr><br /> </tbody><br /> </table><br />

Sunday, March 8, 2009

Definitions of Success

Gary Davis, president of Davis and Associates Inc. construction: "Career success is measuring your effectiveness against the goals and objectives you've set, and then constantly re-evaluating your skills vs. their demand and your response to the challenges before you. If this 'self-check' is done regularly and realistically, your career success will be ultimately determined by the professional legacy you leave and those who've benefited from your life's work. [r]

I find this definition the most perfect one to capture an idea of success. If it were so that success was a single goal or single achivement then it would have been much easier to attain. But sucess is not an achievement but an ability - both physical & mental. It takes a lot of perserverance to apply the skill & then improve on it.

r: I am afraid I don't have a reference for this.

Friday, February 13, 2009

Allegged Confessions of a Senator/CEO

The only thing I have to say about the current economy is .. as follows.. one Senator or CEO.. saying..

..Hmm...

I did cause this, but in America we believe in the teachings of Gordon Gekko .. "Greed is good!" Why else "Wall Street" the movie, is a recommended must see in Business Schools. I thought I was the only one with this novel idea of making a lot of money and never expected that all my colleagues had the same one.

So what if I overindulged in greed, there is nothing illegal about it. And you say its unethical, hey I chose to be a capitalist - if I don't capitalize on opportunities, somebody else would. I was only digging graves, I never expected people will jump into it. It was their greed, that caused them to desire a lifestyle they could never afford. If I just brainwashed them by constant adds as to what they are missing in their lives and provide them money to acquire it, I'm only being generous.

I am pursuing "My" American dream, if it so happens to be a public nightmare that "your" grand children may suffer, its not my problem. If it was not for all my colleagues doing the exact same thing at the same time, I would have been super rich and the rest super jealous. But now it is affecting the entire economy and all my clandestine affairs are public.

Look its even on this stupid blog!

There is a reason why a Senator may also have this burden on his conscientious.

"Behind every successful businessman there is a more successful politician. "

* As usual the IMHO disclaimer applies!

Saturday, January 17, 2009

Samurai Jack - The best imagination!

It is no surprise that I bumped into this animation. Mix Animation, swords, fantasy world & I am there. Its not to say I like all kinds of cartoons,...I am not that kind of a cartoon. I had seen Samurai Jack few times and knew that the style is quite different from most. It looks too simple to me - official terms are "highly detailed, outline-free, masking-based animation". I seem to contradict when I say simple. However, there is plenty of detail, colors, & amazingly creative imagination.

I think Samurai Jack is the best animation. It would be more appropriate to say that the creator has the best imagination I have ever seen. I am not trying to compare this simple yet brilliant animation to the likes of Final Fantasy or Ghost in the Shell, but the creativity is out of the world, metaphorically & literally. Where most of the animators (graphic artists) try to bring the animation as close to the reality, Samurai Jack goes full blast into making taking the audience into a wonderful fantasy. The variety is so enormous that it just blows my mind. How can a person have such an innocent & vivid imagination? The stories are thought provoking & each one is quite unique in characters & places.
After such an impression, I decided to find some more information about this animation & reached Wikipedia. It turns out it has won Emmy award, 4 times. And surprisingly its an American animation created by Genndy Tartakovsky & that he lived in Chicago [1].
--
[1] http://en.wikipedia.org/wiki/Genndy_Tartakovsky