Life without Apache : Meritocracy in Action.

I am obsessed with Apache. Yes! I am and I am proud that I am!

I was just wondering how life would be WITHOUT Apache!

  • We would still be doing ASP. Many of us would have gone into ASPX and C#

  • CGI and PHP wouldn’t have come out..

  • Total no. of websites in the world would be less. I don’t know how much % but yes, it would surely be less.

  • There would all be Windows Hosting Services everywhere and the prices would be higher and higher…

  • Who can forget the popular Tomcat. Java wasn’t open source before, other app servers were not that comfortable interms of price, simplicity and ease of use. Every newbie in JSP/Servlet starts with Tomcat. People crib that Tomcat doesn’t have EJB, who needs EJB these days?

  • No Java projects would compile using Make, so Ant came it. Imagine how difficult life would be without ANT scripts.

  • MVC the most popular design pattern: Struts is the name you think of. If it weren’t there, you’d still be writing your own servlets and JSP and controller logic.

  • Almost 80-90% of GOOD Java EE developers would use Apache Commons. I mean who doesn’t use it?

  • Logging your application for debug and support, What would you do without Apache Logging Sevices

  • Forget all programming, there is still no comparision with Xerces for XML. I challenge.

  • Make your code as Webservice? No words about Axis, yet again apache product!

  • You want a middleware java messaging framework for your JMS? Use ActiveMQ

  • Object relation model: Try iBatis, you wont leave it again.


All in all, If there was no Apache, Life wouldn’t have stopped but would have been SO SO damn difficult. My many many thanks to Apache…

Some Javascript Tips

I have been doing a lot of JavaScript these days. Each day I learn newer things and each day I am starting to like it more and more.

I am going to compile a few queries where I broke my head.

Q) If I do window.open(‘anotherPage.html’), How can I change the DOM of the parent window.
This problem arrived when I was trying to add more rows to a table from another window itself.
Problem: Firefox allows it. But IE doesn’t allow.
Solution: Use cloneNode() for FF. For IE , create the row again by attachRow()
Now for each cell, loop through it and do insertCells() and then copy the innerHTML to it.
All this is done in a simple loop through the table.

Q I have 3 frames on a page, I want to submit requests to page 2 and 3 at the same time
Do: document.forms[2].functionName();
yes, its as easy as this…
in your functionName(), you can add code to submit the form.submit();

Q Recursive Ajax calls.
Problem: To keep refreshing content of a page through Ajax.
One might typically use setInterval() but what if setInterval fires while a request from your ajax is coming back?
Solution: Use a global variable called “lock”. Everytime you make a request set this lock, the call back function should release the lock.
When setInterval fires your ajax request function it should exit if its locked.

Q. getElementById(‘idname’). Don’t use it too often, Try to traverse though the DOM by your code.

Q. Always give IDs to your form. Someday you’ll find that this is very useful. You can submit a form from anywhere if you do this by getting the refrence of the form and then yourform.submit()

Q. Try to avoid excess IDs, This will occupy more browser memory interms of DOM parsing.
For example, If you have a table, don’t give ID to each row. instead give the id to the table and then traverse the table.

Q. Do overuse Ajax and submit multiple requests simultaneously. Browser might allow this, but your database will not. Specially when you’re doing connection pooling. In connection pooling , you have the same connection object and multiple execution of sql queries on the same object from different clients will result in failed transactions.

Q. attaching events is a good idea , but beware, IE and FF behaves differently. The API is completely different.

Q. Always use a common Javascript Browser detection Module. Make the detected browser global and then customize your scripts that way.

Q. Often while debugging we use alert(“debug msg here..”); and waste time in commenting and uncommenting it. Instead use a global variable called “debug=true”. And use if (debug) alert(“”);
You wont have to comment or uncomment it all the time.

Q. There are some good Javascript debuggers. Use them. The simplest one is FF error console. But what about IE? Yes, now you can use FF error console to debug IE related Errors too.. Install the FF IE tab plugin and have fun.

Q. Another great FF extension is Firebug. MUST MUST have for all you JS guys….

TIBCO GI (General Interface) : A boon for Open Source RIA

Tibco GI is OPEN SOURCE.
Tibco GI is cool.
Tibco GI is fascinating.
I like TIBCO GI

Tibco GI (General Interface) is a small little tool for building RIA.
The most amazing part of TIBCO GI is that it provides a fine IDE. And the IDE itself is built on the same framework. You don’t need any installer to run the IDE except a standard browser. And yes, ANY browser. I have tested with IE and Firefox and it runs smooth!
I have used Flash, I have used Ajax, I have used Flex, I have used Laszlo.. I like them all but I like this GI a lot! I always say : Rich User Interface = Rich User Experience! And TIBCO GI is quite satisfactory in that.

I would like to mention some cool things you can do with TIBCO GI:

– Integrate it with all major J2EE Frameworks: Struts 1.1, 2.0, Spring etc etc….
Links for some tutorials:
http://ajaxian.com/archives/ajax-crud-with-struts-2-and-tibco-gi
http://www.adtmag.com/blogs/blog.aspx?a=19387

– Javascript based: Runs on browser, no other downloads required.

– One page application: Just like flex, Single Page Application.

– Drag and Drop IDE: Just like flex builder, Drag and Drop Components and do lots of stuff with them. What’s more, remember the old days with VB6, It provides an IDE just like VB!

– Javascript: Organize all your business logic in Javascript. Add javascript functions and just call them from component’s events. Yes, the components have events and they can call other javascript functions or directly write code into that.

– Java Like API: If you download and goto the help section, You’ll see all the API’s are well structured Java Classes. Very well documented.

– COOL TOOLS: I must say some really really cool tools: Everyone knows how difficult it is to debug javascript(Until firefox came out with an Error Console) . TIBCO GI provides a small window where you can paste your JavaScript code and it can run it for you! No need to write functions! I use this for checking some external JavaScripts too!

– Error console. Before you actually deploy your application, the IDE checks all the javascript errors for you and lists them out.

– Another cool tool: XML Mapping. TIBCO GI has thought for Web 3.0. When websites become webservices. Expose all your business logic on webservice and call them by a WSDL. You can drag and drop your components to say what’s gonna be your input and what’s gonna be your output. You really gotta try this!!!

– Integrates quite well with All other TiBCO Products like TIbco Businessworks, Iprocess etc.

– Charting: Add in components provide a bundled set of charting tools. You will really like it if you’re into charting. It can give tough competition to FLEX Charting!

– The TibCO framework size is just around 350 KB. Bye bye dial up users. Web 2.0 is not for you!

– Lastly, TIBCO is open souce. I love open source. I have been into open source for quite sometime and something like this is really a boon for RIA World.

A challenge to non-vegetarian, if they can contradict the answer

I’m a strict vegetarian as a result, I’m always taunted. I always felt embarrassed. I always used to think that why in our religion we are asked to have vegetarian diet and not the non-vegetarian diet. As all the non- vegetarians used to tell the various benefits of non-vegetarian food. I used to feel that there should be some very strong reason that why vegetarian food is preferred. Something which can make all other reasons appears trivial. I always used to search for that reason.

But, after surfing a lot of internet I have finally got a possible answer. The very reason of why we eat food is the answer to this question i.e. the survival of the human being on this earth.
How?

I have found on many websites which says that eating meat causes increase in the global warming. Probably all the readers must be knowing that if the temperature of our earth increase by few more degrees then our planet will become like any other planet. Then, probably the aliens (if they exist) from other planets will come and search for evidence of life as we search for evidence of life on mars and moon.

All this happens because of the concept which I had read in my ninth-tenth standard. I won’t go in science of the concept. But, in the laymen terms I will say that from a plant to animal and from animal to animal only 1% of the total energy is transferred.
For example:

If we need 3000 calories per day and from each plant only 1000 calories is obtained. Then we need to eat only three plants.

But suppose if we eat beef rather than plants which can give say 3000 calories. Then most of you will think that the beef is a better option. But, I would like to say that for accumulating those 3000 calories we would have to feed cow at least 300 plants which means that we need more space and energy to feed one person.

Now greater the energy used, then greater will be the demand for energy and greater will be the burden on our natural fuel resources and hence greater would be the production of the greenhouse gases.

So, with greater consumption of meat, there would be more and more increase in greenhouse gases which will make the global warming condition worse.

Now, I think you all can conclude that by maintaining a vegetarian diet we are actually saving ourselves.

However, probably one may point out that what about the various diseases at which we all are at risk if eating of non-vegetarian food is stopped. To this point, I would like to say that many people in India are vegetarian and all those who take a balanced vegetarian diet with regular exercise always live a healthy life.