Print to console without using semi colon
One of my friend asked : “How can one write to console without using semi colon in Java ?”.
I tried many work-arounds . Even Googling did net help much .
I thought i should raise an exception some how thats it some thing will be written on the console. Naa , its did not work well.
Then a stupid workaround was to enable the verbose argument , thats it every class loaded in the JVM is traces on console.
The some how i tried real tricks to print my name on console ,
This is what i got,
public class Test {
public static void main(String a[]){
if ( System.out.append("jasdeep") instanceof Object ){
}
}
}
You might be wondering , why i did not use System.out.println() . Because it does not return anything , So it can not be compared in if block.
Ada Lovelace Day – Leah Culver
Though internet spreads the word at lightening speed, but i came to know about Ada Lovelace Day 3 days late. Pardon my ignorance.
To quote from website http://findingada.com/
Ada Lovelace Day is an international day of blogging to draw attention to women excelling in technology
Who was Ada ?
Ada Lovelace wrote the world’s first computer programmes for the Analytical Engine, a general-purpose machine that Charles Babbage had invented.
The computer language Ada, created by the U.S. Defense Department, was named after Lovelace
The name that promptly came to my mind of woman in technology i admire is :
She was founder and lead developer of Pownce (a twitter clone), She has contributed to OAuth and many more open source projects and another important thing she writes code in python
.
Nowdays she works with SixApart.
Its not too late to celebrate i think, spread the word and tell the world about women you admire in technology.
Daily Links 12/01/09
- Why Sat Nav(s) are not for Indian customers : Intersting article and conversation on viability of GPS devices in India
- What type of feminist are you? : An argumentative conversation on noida rape case and incidents like this
- Quillpad has improved its multilingual editor .
- tweet : #punjabi word for the day : high spirits = chardi kala = ਚੜਦੀ ਕਲਾ
Silence of the Poor
Most countries in modern history have built their wealth on the foundations of the oppression of powerless people. India is taking giant economic strides within a functioning democracy. We still have the time to resolve that we will not build our prosperity on the sufferings of ordinary people.
This quote is concluding remark of HT Editorial written by Harsh Mander (Convener , NGO Aman Biradari )
Its blog action day today and there is call to change the conversation to Poverty. So bloggers around the world today has put there views together for 88 ways to do something about poverty right now.
Some interesting views are :
- Stop buying junk to make yourself look pretty and donate it to homeless people and hungry people
- Stop being lazy. Find a way to do your job better so that you can save an hour a day, or be that much more productive
- Give comfort to the poor
- Support charity organization in your country. Reducing poverty may start in your nearest region.
- Donate your time and expertise to teach a class to those trying to find a new way to earn a living
- Fund educational programs for women
We can work in way to change ourselves first , Change the way we perceive the poor, the way we deal with them.
The article i have quoted throws light on the way Indian poor has been marginalized by the state – industrial nexus, which can result in a disaster for both. Its evident that Indian poor has not asked for its share from the new “Shining India”, they have sacrificed there labor,their lives and land willingly or unwillingly in a hope of better future. They have not got any thing out of it.
Its our responsibility to make them feel the part of rising India not . If we fail to do so , We can see results in near future , the Maoist insurgency is one such problem, that is called biggest threat to Internal security , rather than providing socio economic upliftment to the people of that area. We may face similar problems rising in more parts of India.
So its time to act and do our bit because little does matter.
I am making a donation to http://www.amanbiradari.org/ and will look for helping the cause by becoming a volunteer. You can do the same by doing your preferred mode of participation.
Its Arun, who made me aware of blog action day on delhi barcamp, Thanks dude.
Arun’s Presentation on blog action day
Attention Guys , Kwippy here !
May be this shirt quote is witty enough, Some one will finally love me
The origin of above quote is xkcd . Its human instinct to seek attention. Its deep rooted in our genes. The T-shirt quotes are one example. Same goes for the IM status. The IM is yet another communication tool that has become part of our lives. Now we do set our IM statuses according to our mood or just for fun. So that friends around us might read our status message.
What about having an aggregation of all the status messages you ever set. Kwippy is here for that.
Just add Kwippy as buddy in your gtalk or yahoo messenger and get going with the storing the status messages from your IM messenger to your Kwippy account at web.
There are lot of features that Kwippy provides:
- comment on the status messages.
- share posts,links as instant messages.
- have threaded discussions on a post
- make more friends on the webosphere.
To dig more deep into Kwippy, its different that twitter, pownce and other microblog services in away,I quote the official kwippy blog for this:
In kwippy, the whole focus is on the Instant Messenger. The friends list on the instant messenger is the most intimate friends list you can find, of all social networks. It gives the people in the list immediate access to your attention. People share their joys (i got a raise), sorrows (i flunked my english papers), their favorite links, and thousand other things through their status messages. And all these people also have a list of their closest friends on their list. And like in the real world when a real friend introduces you to another person, the chances that you hit it off are greater. There’s this trust thing which is automatic.
Moreover Kwippy is built on coolest technologies like python, django, jQuery, Nginx and memcached. They have loosely coupled the system into services, Their blog post about its architecture speaks a lot about its quality of service and proclaims its bound to scale well.
I was following the twitter downtime discussions, some one was talking about Why twitter was built as a CMS why not as is messaging service ?.
I feel the same for Kwippy , Can they integrate concepts of messaging system to the kwippy architecture?
I have affinity for Kwippy because its Made in India , I have personally met the Kwippy CEO/co-founder. The startup culture is not as happening and vibrant in India, Its on the brink of becoming a great startup environment, So Kwippy is yet another Indian startup that might become an cult/role model figure for startuppers.
Come on Kwippy dikha do !
Chandigarh Bloggers haz a meet up !
I got a direct message on twitter from Shankar Bakshi about Chandigarh bloggers meet on Sunday. I was in huge excitement straightaway, I said yes, yes like i had found some lost treasure.
So I was the first guy to reach the venue,then came Shankar the self confessed dot com guru and the other guys behind this meet up. We introduced each other briefly, the meetup was brain child of Gaurav, who is studying at NIT Warangal.This guy was working on an idea to setup a blogging media company and a blog magazine in print was on the cards.There was Rajesh, who wants to spread thoughts on social issues like female foeticide.There was teen blogger Saurav around after that, He is 18.
The rain was pouring outside and the bloggers started to pour in too.Then came the girls to add charm into the evening. Preeti and Sukhbir were two SEO consultants/managers, who were working for a city based SEO/Software organization , the maintain companies blog. Preeti has a blog on SMS poetry. A guy with specs came to me and asked, where is the blogger meet. This was Abhinav Sood born to a doctor couple, he was kept away from computers as much as they can, but the geek in him, won and he chose to be an engineer rather then a doctor. He is a successful blogger, means he makes money from it. He was really enthusiatic about meet and asked really nice questions to all others.
Then came Mohit Aneja, with his lovely wife Reet Aneja . He works with dell, and is really great designer and supportive guy. He had a story to share that he was top contributor to Yahoo answers and his account was blocked by Yahoo without warning as he un-intetionally posted link for a torrent site. So he started http://mohitaneja.com/ to share best practices as a slap to yahoo’s face.
The meet bacame vibrant with open discussion / introductions, Shanker shared his thoughts on how to make money with blogging and SEO, Gaurav on Indiblogger and future blogger events , Mohit on future meets and contributing sharing and working with each other. Two guys Sameer and Abhishek arrived in between. These guys have just bootstarpped a startup named vantagewebtech on Internet Marketing. They have worked for local SEO companies.Abhishek is a dog lover and wants to dig deep into blogging about dogs.
The discussion was enthralling , the coffee and snacks had arrived. Weather outside was awesome. I too was asked to speak about myself. I talked about my village background and how I started the Punjabi Poetry blog parchanve. Then about the tech blog and my tech ventures. I was emotionally charged up and was asked to recite any poem for the mehfil. So I recited Avtar Singh Paash.
ਕਿਰਤ ਦੀ ਲੁੱਟ, ਸਭ ਤੋਂ ਖਤਰਨਾਕ ਨਹੀਂ ਹੁੰਦੀ
ਪੁਲਿਸ ਦੀ ਕੁੱਟ, ਸਭ ਤੋਂ ਖਤਰਨਾਕ ਨਹੀਂ ਹੁੰਦੀਸਭ ਤੋਂ ਖਤਰਨਾਕ ਹੁੰਦਾ ਹੈ
ਸਾਡੇ ਸੁਪਿਨਆਂ ਦਾ ਮਰ ਜਾਣਾMost treacherous is not the robbery
of hard earned wagesMost horrible is not the torture by the police
Most dangerous is the death of our dreams
The discussion moved on with this, a journalist Ravi arrived for reporting blooger meet for newspaper Hindustan. We decided about the things to do for next meetup. The reastaurent bill was paid by Shankar Bakshi , Thanks dude. Looking for the next meetup, See you there.
I am a World Record Holder :)
Firefox achieved the world record for most number of downloads in a day. I was a downloader too. So i got this certificate From Mozilla. I am part of a world record for a browser that changed the world of browsing,challenged the market hegemenoy of Internet Explorer and created an ecosystem of applications around firefox with its addons and open source code.
If you are still using Internet Explorer, Don’t click the blue e now. Download cool new Firefox 3 and be a part of a revolution, you will feel the difference.
Joys of Python and APIs
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 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().





