Monday, December 25, 2006

:)

The last blog told u about my repeated failed attempts to try and publis my blog about ANTs. Google docs came to my rescue and here i am publishing my document online Visit http://docs.google.com/View?docid=ddztwnpf_0fzwb69 to access the document. havent yet figured out how to publish a blog directly using the docs but will do it soon.

:(

Had written a blog offline to expalin the working of ANT. Since i had added a few examples which used XML formatting, the data is not shown correctly when i use it here. the browser messes up the XML completely inspite of me replacing '<' and '>'. The blog still resides on my machine unpublished. If someone could tell me the way out i would be grateful :)

Thursday, November 30, 2006

Once upon a time I had studied RMI. Had implemented it too for my project purpose, but as is the case with many of our academic projects there was no proper design approach for using RMI. This time its not going to be so. I need to go through the entire concept theoretically as well as practically which would be my task over the weekend. Would write about it soon….

Tuesday, November 21, 2006

Java and runtime identification

Because of the age old problem associated with xml-code and browser interpreatation of it this blog has been moved to a Google Document that can be accessed here.

Thursday, November 09, 2006

Some SCJP tips

Some SCJP oriented Java tips - 1) U can never make a non-static reference from a static reference. So check for non static calls from main() 2) You can have a method name with the same name as that of the class and returns a value. Its perfectly acceptable. Its just that they would obviously not be the constructors. Take care for such methods 3) widening conversions are always acceptable. narrowing are never acceptable, hence, all narrowing conversions require an explicit cast. Short hand assignment operators make this by default. e.g. int i = 10; short s = i; //compiletime error int k = 10; short s; s+= k ; //acceptable because this short hand conversion actually is s = (byte) (s+i) short s = 10; //perfectly legal as integer literals withing byte range can be directly assigned 4)Garbage collection can never ever be forced . You can request it thru’ System.gc() or Runtime.getRuntime.gc(). 5) The garbage collector is a low priority daemon thread that’s platform dependent. In fact Threads & Garbage collection are the only 2 things in Java that are platform dependent. 6) For method Overloading you need to consider only the method name and parameter types. For over-riding you need to consider method name, parameters, return type and exception list. e.g. class Q7 { public int hello(){return 4;} } public class Question7 extends Q7 { public long hello(){return 5;} //compile time error for above ‘coz return type diff public long hello(String s){return 5;} //Perfectly legal ‘coz this becomes Overloading and not over riding } 7) Throwing a Runtime Exception and/or Error is equivalent to not throwing an exception because RuntimeException and Error (and their sub classes) are unchecked exceptions. 8) legal identifiers in Java are of the form [$/[A-Z]/[a-z]/_]{ $/[A-Z]/[a-z]/_/[0-9]}* 9) String String = “String” //legal You could always use a class name, method name as legal identifiers. I never knew the compiler was so smart ;) 10) switch(a) ;// a is byte/short/char/int and nothing else 11)The bitwise operators & and | are not short circuited ever. so the two operands are always evaluated as against && and || where the second operand may/not be evaluated 12)For positive value >> and >>> yields the same result U better learn the shift operators in and out. There’s much more to it which being an application developer I missed. That’s it folks. I could go on and on if I keep writing but these were the first few and important ones that I learnt myself and hence thought of sharing. I promise to cover things section wise in one of my soon to arrive blogs ;) One of my friends too has shared some handy tips which you would like to go thru’. Click here It feels good when you work hard and ur efforts pay off but it feels better when you realize you have gained more knowledge because you just were eager to learn more(this time no university bothered me with deadlines for my exam).....Cheers

Friday, October 13, 2006

Learning (-) the way of life

I sometimes wonder what is it about criticism that scares us all. Why do we feel scared to say something just for the fear of being ridiculed? Wasn’t the person who kept on pestering the teacher with questions considered a snob during school days? As the school days pass and you enter the so called matured forms of schooling, the snob is replaced by the words - highly inquisitive’. I remember reading a friend’s blog where he mentioned that the basic problem that’s hindering the growth of mankind is ‘Failure to accept responsibility’. Somehow I connected to the statement immediately. People are scared to accept responsibility and that is what is leading to ever deteriorating standards of living. I have myself never escaped this situation, but when I realized that standing up for what you did/thought, is half the battle won, I changed my approach. Never be scared of critics, for they only help you make yourself better. Their criticism should be seen as an opportunity to help your individual growth. At the same time remember never to become the critic and take up the role of demoralizing the inquisitive lot. You may ask them to hunt for answers to their queries but never ever ridicule a question. Remember there are never stupid questions only stupid people. In the IT world you will often come across Gurus – as the intimidated call them. You will have a Java guru who can solve your EJB, servlet problems in a second or a UNIX guru who can fix up your UNIX based system in a jiffy. I have myself met many of them but I refuse to call them gurus for the simple reason that these brilliant people are learners all their life and that is what makes them better than the others. I am sure if probed deeper, all of them would confide their scare of criticism which they overcame when they decided to better themselves. So the next time you are scared to open your mouth, I suggest you think about your overall growth than the momentary ridicule , the fear would automatically give way to the eagerness of knowing/learning something new. Welcome to the world of learners!!!!

Thursday, September 28, 2006

Thoughts....

Newton once said, ``If others would think as hard as I did, then they would get similar results". If it was awfully humble of him to say so, I think u should re-read it again. That’s what is fascinating about life and computers (that’s not a good analogy, but couldn’t resist it :D). You would get results if u think. In the beginning u may need time but as u learn to think u also learn what to think. And at no point should u cease being ignorant. That was just a self help tip

Monday, September 11, 2006

File creation date and Java

Sometimes u give such weird replies to questions. A friend came to me and asked "Whats the easiest way to find the file creation date in Java" I looked at him and answered "Go check the File class, they will surely have some API". He grinned and said, "If they had, would i have asked you?". Its only then i realized there isnt a default API to get the creation time of a file in Java although u do have an API for file modification time. That got me into the thinking mode and i wrote a small code to get the creation time. All i did was to exec the command prompt and fire dir 'filename' /tc on the 'exec'ed process. The output was captured thru an inputStream and corresponding line tokenized to retrieve the date and time. Not a very neat way BUT it is one way ;) It was a small code but it made me realize - Never assume Java being a HLL does everything for you :P