Saturday, March 10, 2012

opensource, java app metrics, graphite

The beauty of opensource software is in the opportunity to learn and improve the craft hands-on. github.com understands and enables this aspect wonderfully.

I was admiring graphite http://graphite.wikidot.com/ for its elegance over RRD tool chain. Sometime later; I found this nice library to capture metrics in java apps https://github.com/codahale/metrics.

How nice if these two beautiful pieces of software talk to each other is a natural thought. Its one of those moments where; You have an idea and cannot see it not happening now!!

That idea became this pull request @ https://github.com/codahale/metrics/pull/16 and within a day, Codahale responded by merging it into his branch.

Awesome, thank you! I'll repackage this slightly, but much appreciated.

Opensource doesn't spring out into a beautiful tree in one day @ one place. Small contributions over time amalgamate into this massive Juggernaut...that distills human knowledge from all across the globe.

Tuesday, December 27, 2011

maven plugin to get localip

During a dev build, its useful to have resource filters that can create config files using localip of the machine on which build/deployment is happening. (Eg: serving media files from dev machine to a remote browser)

I searched all around for a way to fetch localip of the machine into maven build. But, found nothing working/ready to use. So, Here is an effort to fix the gap in dev tools: A maven plugin that sets localIP as a property. It can be attached to initialize phase of the build.

The code is opensourced on gihub: https://github.com/tmahesh/maven-getlocalip-plugin with usage/install instructions

Saturday, February 05, 2011

How fast is my site? : Integrating boomerang with google analytics

Site speed matters. Period!!

Here is a statistic to drive home this point: For a 100ms(millisecond) delay in pageload of Amazon, sales decreased by 1%

Through this post, I want to share an approach to figuring out: How fast is my site?

Step1:
Install YSlow/Pagespeed : Two wonderful tools to find what is happening behind the scenes to render a web page, how fast is it on your computer.

But, the problem is... The data we can get from these tools is limited/biased.
How can we collect data of every consumer visiting your site?

Step2:
Boomerang is a beautiful tool from the Yahoo! Stable (YDN). It measures how much time a page takes to load for every visitor of your site (well, almost...)

But, the problem is... We have to write a lot of scripts to parse the webserver logs and analyze this data.
How can we be lazy/smart to analyze this data?

Step3:
Integrate google analytics (event tracking api) with boomerang using this code snippet:
https://gist.github.com/833066
The piece of code above will create a report of the page load time of different pages in your analytics account (goto: Content->Event Tracking)



The last column will tell you the average page load time.

Each line/variable of the code has been thought through and tuned to get the reporting right. Hope you will find the code/ideas useful.

Now, Lets make web faster...

Wednesday, January 14, 2009

Black Swan: Impact of the highly improbable

Project two of toastmaster's speech

---------
For centuries together, Europeans were totally convinced "All Swans are white" Until the dutch explorers in 1697 discovered Australia and they spotted a Black Swan. One single event shattered the beliefs held for centuries.

Fellow toastmasters and my dear guests, Today, I'll summarize the ideas presented in the book "Black Swan: The impact of highly improbable" by a famous author Nassim Nicholas Taleb

Lets take another dramatic example to understand Black Swan event:
I assume you all know about the bird Turkey. Its bigger than a Hen. Its fed a variety of grains everyday by the friendly human race. With every feeding, the Turkey firms up its belief, the friendly human race is looking after its best interests. Until one Wednesday afternoon before the Thanksgiving, it incurs a revision of belief. Any guess? Yeah..its slaughtered, cooked and served as Dinner!!

I'm sure we can find a few Black Swan events from our own experiences: Stock market crashes, 9/11, Tsunami, Recent Satyam fiasco...

There is a common thread that runs through these Black Swan events:
1. Highly unpredictable
2. Huge impact
3. Human nature to attach a reason and explain them after they have happened

The First two characteristics are easy to grasp. Let me focus on the third one.

The future history books will say. Oh! SubPrime crisis lead to the Crash. India did not install earth quake sensors in the ocean bad or else Tsunami wouldn't have caused big damage. If all planes had bullet proof cockpits and sealed, terrorists wouldn't have flew into Twin Towers and collapsed them. If SEBI was more cautious, Satyam fiasco wouldn't have happened.

Let me describe a scientific experiment to show how human brain constructs these theories after the fact. Our brain is separated into two hemispheres: Left brain and Right brain with a few connections between the two. Split brain patients has no connections.

Ask the right brain of the split brain patient to lift his finger and then ask the left brain "Why did you lift the finger?" He'll shoot back...Oh! I saw a beautiful flower on the wall or Oh! there was a lizard crawling on the roof. If you do the same to left brain and ask the right brain...He'll say "I don't know"

Strange ways our brain got wired for evolutionary reasons. Be aware of it. Resist the temptation to explain away things as natural and predictable because this has happened or that has happened. We are being tricked by our circuits in the brain. Be aware of them.

So Dear Friends, the Black Swans are a realty. Ignore the experts who theorize and attach reasons after the fact and keep in check the arrogance of humans to attach precise reasons to events and think.... We know more than what we actually know.

Over to you Toastmaster

Thursday, December 18, 2008

My GrandMom's place

My Grand Mother's place in Nutakki

The way a house should be-- Clouds provide you the shade, the moon works as your calendar, twinkling stars put you to sleep and time stops for you...

A house where you can:
-grow a few vegetables in the backyard
-domesticate a buffalo & play with its cute calf
-pump out fresh water with a hand-pump
-crawl a creeper all over the roof
-use few resources and Do beautiful things...

A few years back, before it was rebuilt, there wasn't this much concrete and stone. A big black buffalo and its cute-calf were in the backyard. I lived with my grand mom and Great grand mom. Two wonderful women, who cared only for things that made me happy. I played all day, every day :)

Friday, November 28, 2008

About Me: Transcript of my toastmasters speech

Here is a Transcript of my icebreaker speech at ToastMasters Club:
----

Who is Mahesh? What is his story of Life?

Fellow Toast Masters and Dear Guests. I'll try to run-thru 26 years of my story in 6-7 minutes...

I was born in Macherla, a small town in Andhra Pradesh. Its on the bank of river Krishna near the Nagarjuna Sagar Dam, the longest man-made earth dam on the planet.

My Dad, Siva Reddy worked at KCP. The company's colony pretty much defined the town. People respected him for his hard work and asked him for advise because he was very straight forward and called spade a spade. My Mom, Vijaya was housewife. She truly believes in "Athidhi mahadevobhava", Treat the guest in your home as God. The whole colony loved her. People booked slots with her for cooking advise. She was a famous chef of the town!! Add to all this: I was the only small kid in that tightly knight community. So I was the toy for everyone and they liked to play with me. I was never constrained by the four walls, the whole colony was a playground, i had clothes in every house, slept anywhere i wished to. Life was beautiful.

When i was 4-5, my grandmother took me with her to the Village, I live with my grandmother and great grand mother- my mom's mom's mom. Two beautiful women, and all they cared for was for me to be happy. I played all day, everyday. It doesn't get any better. I ran bare foot on stony roads, chased butterflies, climbed trees, played in mud..There are no rules, thats the way of village life. It was glorious and Life was exotic.

Reality struck my mom after an year and she put me up in a school. I studied in a govt school, KV. The fees was 15/- per year, the cost of one Masala-Dosa now? Enjoyed lots of free time and games periods, I don't remember doing any homework. Everybody has a nickname in school. I was called the doubt master. I was too curious. Some teaches were happy to answer questions, some got irritated. But, i didn't care. I asked them anyway :-) Everything fascinates me. I carefully watched the workers digging the earth to lay telephone cables, work at house construction, Bus driver replacing the punctured tyre. I watched them in fascination and they watched me in fascination :-) I picked up everything, i found on the road..bolts, empty cigarette packs, stones, used rubber bands..u name it. Fight with my kid brother over small things... Life was fun.

Time passed by and i joined college. I was in a big fix, should i focus on EAMCET, the local engr college exams or prepare for IIT-JEE? Parents and neighbors advised to focus on EAMCET instead of putting foot in two boats. They had a point, but IIT was a romantic goal and I didn't know what to do. So, i tossed a coin :) Heads showed up and i wrote JEE. Thanks to good friends, i cleared it and joined IIT Kanpur. I was in the linux geek group and we loved to hate Microsoft for no reason. Contested in Elections and became hostel president and learnt a bit about real-life. Life passed by like a dream.

After IIT, joined Y! labs and worked on some problems related to Artificial Intelligence. After 3 years, I gave up the job to chase dreams. I am now doing a start up and I'll keep you folks updated on it...


So, here i'm... Celebrating Life and Hoping to make a difference. Over to you ToastMaster.
---------------

PS: This is a speech delivered to an audience..so apply a reality filter to it :) Everyone has their ups and downs. We remember the good things in all its finest detail..and forget stuff that is not so pleasant. Thats Life!!


A few interesting tidbits: Was dangerously close to a charged up one-horned rhino that came out of nowhere in a Safari@Kaziranga, A passenger in a supposedly hijacked plane, Stood on the edge of GrandCanyon, Do 50 pushups, Manage a bullock cart, Spray pesticides in a field, Was lost in the crowd of Kumbh-Mela, Did a Bungee jump, Been to Venice, Florence, Pisa, Rome, Vienna, The Alps, California, Bangkok, LasVegas and a lot of other interesting places in India. Wish to drive a 20wheel truck on the freeway and honk madly(like the one in Terminator)

Friday, November 14, 2008

On staying healthy...

Eat food thrice a day, Exercise for 30minutes, Keep an eye on how ur clothes fit.

How simple is that!! But, no...we are suckers of complexity. We measure the number of calories in cereal, ask if its sugar-less sugar in the coffee, look for vitamins on the label of chips packet, wonder if its good-cholesterol or bad-cholestrol -- Essentially, comfort ourselves in the complexity and refuse to follow simple things; Eat Food, Exercise a bit. If ur trousers is getting tighter, u are eating more than what you need.

Here is a simple rule for choosing food: Don't eat stuff that is/can be artificially preserved. The food has to rot if left in the open. Otherwise its not the food humans have evolved to digest easily. Even bacteria doesn't grow on that food!! Don't buy stuff your grandmother won't understand :-)

Think about it, We have evolved over millions of years. But, things changed so fast in the last 200 years. Even the all agile human mind is struggling to keep up with the pace of external world. Don't push your body too hard to change. Science doesn't have enough answers, yet. Give your body some time to adapt to our abuses and stay healthy.