Filed under Uncategorized on February 10 | 0 comments
I had heard about functional programming and I was curious about understanding a bit more than just a few “features” of it. This article explains some basic concepts and I was surprised to learn that the functional programming concept can be applied in common programming language.
http://www.geeksaresexy.net/2009/02/06/an-introduction-to-functional-programming/
Filed under code on February 9 | 0 comments
When looking at java garbage collection logs you only get logs with a time stamp in seconds from the start of the JVM. After a few days of running the JVM it is difficult to remember when it started and when is the event your are looking at from. I was looking for a quick way to calculate the time. Python has some nice facilities built-in to help with that task. Here is what I do from the command line to figure out the last time it was started:
[bash]$ python
>>> from datetime import datetime
>>> from datetime import timedelta
>>> datetime(2009,2,9,10,48) – timedelta(seconds=159565)
datetime.datetime(2009, 2, 7, 14, 28, 35)
The datetime object is initialized with the date I want. In this case it was February 9, 2009 at 10:48. The timedelta object is initialized with a number of seconds but it could be days or min.
Very quick and convenient.