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