A Good Car+ Good smooth long Road+ Good Scenic View+ Some Good Quality Music= Life
Author Archives: admin
Struts in Seven Minutes!
Ok! The title of the post is because that sounded kool.. but still it could not get easier than this – http://www.allapplabs.com/struts/struts_example.htm
Hidden Firefox feature?
I have been using the FF browser for like last 5 years, but this is the first time I observed this feature, that too accidentally. If you double click on the empty space on the bar next to your browser tabs, a new tab opens up.
There is no indication anywhere that a double click will open up a new blank tab. That is one kool thing I found in IE browser, that small box next to your last browser tab, which very clearly tells you “click me! I will open up a new tab”.
I guess that is what we call usability.
AJAX: is it Asynchronous JavaScript and XML?
Recently one of friends asked me how to learn AJAX? Is it all about JavaScript and XML and sending asynchronous data? Though the term AJAX stand for Asynchronous JavaScript and XML. That means the term talks about how to asynchronously retrieve data from server using JavaScript and XML, but actually, AJAX goes much beyond that. It is more about providing a rich experience to users. A rich user experience can be simply stated as a ‘desktop application like feel’; now, desktop applications can have the luxury of heavy weight rich User Interfaces and with AJAX the same is possible for web applications, which so far could afford only a basic UI. With AJAX, the need for reloading the UI again and again with every request is gone; we will understand this more in rest of the document.
AJAX in itself is not a language or a framework. It is a technique. It basically uses XMLHTTPRequest Object to fetch the data from server without reloading the page. Additional AJAX supporters are CSS, DOM, DHTML and XSL.
Another keyword you will observe is Asynchronous. Asynchronous communication in general terms means that a browser does not wait for a reply from server once a request is sent. Hence, it does not stop user from interacting with the page while the information is being fetched from server. The data is retrieved as a back ground process and the web page does not get refreshed, the data is displayed dynamically at runtime giving the web application a feel of desktop application and hence improves user experience.
You might question if AJAX is more than just JavaScript and XML, why is it called AJAX? This is what Jesse James Garrett, the man who coined the term AJAX has to say about it “I needed something shorter than ‘Asynchronous JavaScript + CSS + DOM + XMLHttpRequest’ to use when discussing this approach with clients.” hence the term AJAX
Twenty 20 world cup: The game is on!
Just a couple of days and you can already feel the sensation. West indies beating mighty Australians, Netherlands upsetting England, Scotland giving a target of 90 in 7 over, which was achieved by New Zealand in 6 over scored at a run rate of 15, things are really happening in England.
This really is anybody’s game. You just need a couple of good overs or just one batman gets going and the game is yours. It is different from other versions of cricket. Unlike 50 over game, where maybe first 15 and last 10 overs are the most important, here you only get 20 overs. That means each and ever over counts, or should I say every ball counts. One sloppy shot, one dropped catch, one loose ball; everything is capable of making “the difference”. The rule is simple, go there, and hit it hard, as hard as you can.
Whoever wins, next 15 days would be full of excitement.
keep a track: http://www.cricinfo.com/wt202009/engine/series/335113.html
Difference between visibility hidden vs display none
I spent almost an entire day on this, so wanted to share the information in case it might be helpful for others. We at times need to remove a DOM object (textbox/ label/ dropdown etc) from the UI. For which we use two things object.style.visibility=”hidden” and object.style.display=”none”. Though both of them can remove the object from UI, yet there is a significant difference between these two approaches. Whereas visibility hidden will “hide” the object, it will still leave the object on the UI (in hidden format). On the other hand display=”none” will completely remove the object from UI.
The differentiation is more important in a case, where the css being used here does not specify the x and y coordinates for DOM objects, it instead places one object after another. So the trick here is, if I make an object invisible by hiding it (visibility=”hidden”), it will still occupy that one space in the flow, and a blank cell will appear on the screen. Whereas if display is none, then the next object will take place of this object and hence no empty spaces are shown on the screen.
So both the approaches can be used as per ones requirement
Association vs Aggregation
Short and Simple explanation- http://ootips.org/uml-hasa.html
Election results and spicy media
Country’s election results are out today, and obviously all news channels were full of reports on the same. Every other news channel coming up with its own breaking news every second minute. “Sabse pehle humare channel par”.. you know that stuff
And ofcourse they would add some spice on their own. The most funny and amusing stuff was the songs they came up with for different politicians. For BJP leader Advani one channel played, “Chan se toote koi sapna, jag soona soona lage”, for Rahul Gandhi we had songs like “main hoon yuvraaj” and “yaha ke hum hai raajkumar”, and ofcourse for Manmohan Singh we had “singh is king”. These news channels do have a sense of humor.
But amidst all this drama, one important thing that came out was victory of democracy. Predictions of all the channels for a hung assembly were proved wrong (well almost), and the country is hopefully heading towards a stable government.
The IT Park Joke
I work for an MNC in Rajiv Gandhi Chandigarh IT Park. And this is a true incident. On a weekend a couple of months back, I was coming to office to catch up with some work. Now as I was nearing the office, there were 4-5 ladies standing, most probably from some nearby rural area, along with kids. As I reached near, one of them asked
Lady (looked like their leader): “Bhai Jee! Ye IT Park kaha hai” (Bro! Where is this IT park)
Me (as matter of factly) :”Yahi hai IT Park” (This is IT Park)
She ( a bit surprised): “Lekin Park kaha hai yaha?” (but then where is the park?)
Now it was my turn to be surprised: “Park nahi hai. Ye jo buildings dikh rahi hain, isi area ko IT park kehte hai” (There is no park as such. You see all these buildings around you. This whole area is called IT Park)
Another lady to the first one (a bit angry) “yeh hai tumhara IT Park. Tum hi layi thi na IT Park Dikhane. Lo Dekh lo ye buildings” (So this is your IT Park. You brought us here to visit the park. Now see all these buildings)
It took me a few seconds to realize that these ladies must have heard the name IT park somewhere and thought that this is some kind of public amusement park or something. so they along with their kids came to have some good time over the weekend.
Redundancy Vs. Reuse
We faced a typical software engineer problem recently, that should we have multiple copies of similar code? Obvious answer is “NO”
But Lets say, you are dealing with multi hundred thousand lines of code. There is a pressure of deadline. You know that there are already some module which is providing the similar solution as you want, and just adding one if else, and making some tweaking in that code will save you from writing hundreds of lines of code. Isn’t it tempting to do that.
Ideally, we would like to get that code which is common in both cases to some common util area, where both modules can use it. Moreover, future coders will get help if they face the similar situation. But again, that is ideal solution. Here we are talking about deadlines. We don’t have time to do this activity creation of this common util stuff is a task in itself.
Second best, which I would recommend, is to copy the code to your module and use. Concern- we have two copies of same code. hundreds of lines of code which is duplicated. I would argue, better duplicate then undauntedly dependent. Why to make two mutually exclusive units dependent. What if I want to delete one module completely tomorrow, how and “why” to think that some file somewhere might be used by some other module.
What say?
