/home/jasdeep

Ramblings about self, surroundings and technology

Posts Tagged ‘google

Joys of Python and APIs

with one comment

At my present job , Most of the time, I have to do changes in the legacy Java code to improve performance.

But this time i was asked to tell the extent of performance improvement due to my changes . I tried to use some Java Profiler , I tried Eclipse TPTP and HPROF but due to complacency of the legacy application. I was not able to profile my changes.

So i decided to keep it simple . Log the timestamps and analyze the result. But the log generated by this was unable to show any subsequent improvement in performance as I had to log time in Milliseconds ( System.nanoTime () could not be used for Java 1.4) .

For better time precesion i googled and found this timer library by Vladimir Roubstov.I tweaked it for my code and got the comprehesive log output.

Now to analyze the log, I wrote a python script that reads two log files and generates the time improvements in aggregation and for each run. This was the most exciting part.

for i in imap(lambda x,y:(x, y, x-y), [float(b) for b in new_list],[float(a) for a in old_list]):
              print '%f - %f = %f' % i

I wrote it in no time , Python Rocks . Then I decided to go one step further. What about plotting it on a graph. Straight away Google Chart API came to my mind and there is python wrapper to this.
So I wrote this small function to produce graph for these logs.

def draw_chart():
    from pygooglechart import Axis,SimpleLineChart
    chart = SimpleLineChart(600,200,
                        x_range=(0.000, 0.999), y_range=(0.000, 0.999))
    chart.set_colours(['ff0000', '0000ff'])
    chart.set_legend(['New','Old'])
    chart.add_data([float(a) for a in old_list])
    chart.add_data([float(b) for b in new_list])
    chart.set_axis_range(Axis.LEFT, 0.000, 0.999)
    chart.set_axis_range(Axis.BOTTOM, 1, 100)
    chart.download('D:\\my_data.png')

This is the graph generated for my data :

The Generated Graph

The graph does not show much improvement though , but the post was about joys of python and APIs :)

P.S. : There are Java backports for using 1.5 > features like System.nanoTime().

Written by Jasdeep

June 12, 2008 at 1:50 pm

Posted in Java, Open Source, Python, Script

Tagged with , , , ,

My New Year Resolutions – 2008

with 9 comments

Its dawn of the new year. Every things seems fresh, though its just a psychological feeling.The past is past, everybody make plans for the future, and I have some too.I scribbled some lines in Punjabi on new year eve.Here is English translation :

"have dreams in the eyes,
and passion to live the dreams..
have tides of wishes,
and courage to achieve those.. "

Punjabi Source Here

So my new year resolutions will be a progress in living my dreams .

Professional/ Academic :

Personal :

  • Learn Urdu langauge/script , to be efficient in reading and translating Pakistani Punjabi /Shahmukhi.
  • Have personnel web space and host/migrate my blogs there.
  • Will make cycling/exercising a habit.
  • Will start writing a diary
  • Will look for a girl friend… :)

Books To Read:

My Predictions :

  • Open Source is going to rule that is for sure . Linux (especially ubuntu) will give the fight to windows in desktop war.
    I am excited about KDE4 release.
  • Google will be drifting from ” Don’t Be Evil ” policy .
  • A Multipolar world order as US hegemony gets counter balanced by Russia, Iran and Venezuela trio.

Hmmm. It has become quite a long list . Hope I make all of these . I will appreciate if anybody has similar/anti thoughts on this, please do drop me a comment..

Written by Jasdeep

January 3, 2008 at 11:46 am

Alvida 2007

with one comment

2007 has come to an end … Here is my analysis of my surroundings and things i am interested in . Here are the happenings :

Globally

  • Open Source has arrived , It was more vibrant this year. Sun Micro systems open sourced its premier programming language Java , its operating system Solaris , even its processor chip ultraspark ( a first).
  • Ubuntu captured the buzz in the Linux word and has become the alternative to windows along with opensuse . Its Linux era now as Windows Vista failed to create any impact . Go Linux Go. KDE4 is going to launch in January next year. Which is going to be another feather in the cap as its looks will be rock the Vista look and feel. Go Linux Go
  • Google joined hands with various telecom companies and formed open handset alliance which announced its mobile SDK andriod in November this year. Google joined hands with IBM-Sun camp for ODF as document standred to challenge Microsoft’s OpenXML. Although being involved in open source ventures , Google is said to be drifting from its “Don’t be Evil” policy.
  • The world is fastly moving to multipolar world as US hegemony is weakened by various elements like weakning of Dollar diplomacy, President Bush’s wrong stance on Iraq war. The countries like Russia,Iran ( in Asia ), Venezuela, Cuba (in Latin America) have risen as poles of new word order. Venezuelan President Hugo Chavez is the greatest challenger of the US hegemony in his region . With his oil diplomacy and pro people policies he has won support of earlier US allies in Latin America.

Personally

The year was a great learning experience in many aspects of life , professionally and personally :

Written by Jasdeep

December 18, 2007 at 10:41 am