Monday, April 23, 2012

"wget" gets blocked Java

Recently I faced an interesting problem. I wanted to crawl some pages from the internet and chose wget as the weapon. But, as I am a lover of Java, I wanted to call it from Java. Though I regretted a lot last hours  not following my initial plan to call it through Perl (or theoretically any scripting language) but now happy finding a hack.

Why regret? It hangs!! Just after downloading a couple of pages it sleeps to never come back alive. Well, digging out revealed, it completely occupied the stdout and the process is stuck. That means you need to flush the stdout to move forward. This can be handled by either stopping the buffering or continuously flushing the buffer!

So better would be to silent wget before it "silent"s your process. Adding the options -nv and -q, no verbose and quiet respectively, make the wget silent and your process does not get blocked.

So  at the end of the day you choose to call wget from Java, dont worry but mind to add the options -q and  -nv in your command!

Wednesday, April 11, 2012

Bag of 'Bugs'

A couple of days before, I met a coder. We started talking casually about the things and I noticed that he was carrying a small diary. Usually I am very bad at noticing unless something is really conspicuous, just in case my girlfriend is reading this. In the conversation I realised, that was the log of errors and the 'hack' he had come across so far in the life of coding. This reminded me my undergrad days when the easiest measure for geek quotient was the number of bugs one can spontaneously reciprocate. People are also used to search the error messages a lot on the web to seek the solution which I can notice from the "query suggestions" in the search engines. Okay let me say something about how the "query suggestions" work. Basically the search engines keep the track of all the queries fired and accumulate the frequencies and some advanced statistics on that. Based on these statistics, the probability of the most likely query for your already typed word/s or characters is calculated and presented in the decreasing order of probability/score as the suggestions. Mostly the query suggestions come from the previous queries and the top suggestion is the most frequent one and so on. Sometimes, these suggestions become really funny, for the fun type "nobody uses" in Google and see what are the suggestions!

Okay coming back to the original point, I think at the end of the day the knowledge is how many bugs you can solve. Here, the scope of the term "bug" is quite large. I see a strong analogy to this in the life. We call somebody 'veteran', why? Because s/he possesses a long experience of the field and intuitively can handle/hack most of the situations arise in that domain. That knowledge comes from an experience and ends up in some physical or virtual diaries somewhere which I refer as a 'bag of bugs'.

Sunday, February 5, 2012

How you want to be treated?

The first point that arrives in picture when you take any service which can be from simple dining out to a long international trip : "How would I be treated?". More than five years ago, I remember when I underwent a summer training of customer dealing, I was taught "Remember! You are the face of the company. You portray the image of the company to the customer. So think of your actions and words." This is so true. Each good and bad experience with the companies around reminds me the same lines. I try to see the same point from the both perspective an employee and a customer.

The rule of the world is very interesting: the customer is an employee somewhere and deals with fellow customers directly or indirectly. This makes the situation very easy to understand. For example, we all know that how the bureaucracy sucks sometimes, but only one person sitting on the other side of the table has the power to turn our experience upside down or otherwise. If that person "treats the people as he wants to be treated" the world of bureaucracy will be much simpler. Unfortunately, this is somewhat related to corruption but I do not want to talk about it at the moment. On the contrary, the inverse is also true that "I am treated very badly and the same will now be reflected in my services!" :) So these are directly related nodes of the chain "the customer and the employee".

I hope to see the chain in proper direction and would end with related lines: "Treat the people around the same way you want to be treated!"

Saturday, November 19, 2011

Do you have 'Frames'?

Yesternight I was watching Vinod Dua Live on NDTV, well its my one of the favourites and I feel bad when I miss it. He has the vision and is outspoken though he does his research before making any point. Basically an ideal piece of impressive and effective journalism. He speaks only for 15 minutes and it feels like he has conveyed something that some ordinary person will take whole day to convey.

This is just a recent show video for your reference (Click on the image):



Personally I don't want to be judgemental about his reports nor am here to increase his fan following because it is none of my business though I am a big fan of the show.

Okay coming back to the title: 'Frames' a concept I was taught by somebody in the school that "If you don't want/like something then just put a denial frame in your mind and then you will realize, that thing is no longer a problem for you. Basically your mind learns to ignore that thing very easily."

We have lots and lots of frames in our mind. I don't want to enlist them because they also include some of the social stigmas. Now, why I introduced Mr. Dua's show? Whenever I watch his show and listen to his sharp comments, I feel he tries to break the frames in the minds of India - the frames which are very bad but we are not ready to break them. He tries to make the point and if a citizen tries to incorporate some of them to which she herself agrees, significant improvement would be visible in the society. Basically I don't like to give any advice but I am extremely sorry to say this piece of advice here as I couldn't help it. I think those frames are so strong in our minds that even such strong opinion and sharp journalism is weak to break them.

"Isi Umeed me ki hamara aanewala kal aaj se behtar ho" I sign out!

Sunday, October 16, 2011

Dust is settling down in Spain!

The whole experience of coming over abroad and settle here was beautiful and very emotional. The experience can be seen in three different phases. I try to see an analogy between the situation with the sequence of the events when you first time go for a sky diving. The phase one, is the pre-processing step: It is the time until the day of the flight. I would call that part 'Excitement'. I was so happy and excited to come over and start my work because I was taking a very well deserved vacation of 3-4 weeks after finishing some tight deadlines like: Master's Thesis, Google Summer of Codes, PAN-2011 track participation etc. In the excitement you generally don't think the topic which in this case is to "go abroad", in more depth and knowingly you don't let any negative thought come about your adventure because you are just excited. You want to experience it and also you have to stand by your decision. It is same, when you have decided to go for sky diving and you enjoy your decision, thinking that what a great time you are going to have. Then comes the day of flight. On that day the situation seems real and apparently more real on the airport when you see your family bidding you the final goodbye. Remember, you are still in the excitement phase. As soon as you land, you find somebody to pick you up and you chit-chat for a while and then you go to the house. Rarely you find that you have reached the destination and your luggage has not! Yeah, exactly that happened to me and I was told that my luggage will not be available for two more days because on Tuesday Turkish Airlines does not have any flight to Valencia from Istanbul. Murphy's Law. Then you go to home and sleep tight because you are so tired of the journey and Jet-Lag. The very next day starts the phase called 'Nervousness'. You feel nervous because you are in a completely different environment. You see different people around, sometimes it happens they don't speak your language and even worse that they don't understand your language. Somehow the day is spent and gradually you see your over-ambition for the trip. As soon as you reach home back, you are all alone and you don't have internet and a phone to connect to your world. Now what you have is, a photo of your family and some letters from your girlfriend or wife. That's it, this is the night you are going to cry and repent the decision of coming over. All the negative thoughts which were forced underneath will come out. You somehow take hold of yourself and go asleep. This is the moment which is very crucial for one's stay abroad. It feels the same as when, you are in the airplane for sky diving and your other three friends have already dived and now its your turn. You have to deal with that crucial moment and yes it is crucial because you have always a choice of not to dive! I have seen many people returning to the home country in merely some weeks or a couple of months saying it was very bad there and they didn't like it at all. At that time I used to think why would someone do that. Now I realise, it comes under the phase of 'Nervousness'. Actually in the days of phase 2, if someone doesn't think much about going back and try to see the good things around, it would really help. I started crawling over all the plans I had made before coming over and was searching the reasons which really made me excited to come over. I suddenly noticed, doing that makes me comfortable and I liked that feeling. I notice the improvement in the mental comfort day by day and week on week. Now I really like it here. The dust has settled! Now I realise that I have time for all those things which I wanted to do like walking, cooking, spending lot of time on the research problem I am dealing with and much more. Yes I cook my dinner and weekends' lunch as well most of the times. You can see some of the photos here.



Now starts the third phase called 'Thrill'. The moment you dive, in some time you start enjoying your adventure and you are thrilled! Exactly same is the feeling when you convince yourself that I like it here. In this whole process of settlement, I rejoiced my confidence in self and it is an earned confidence and not the granted one because you see how beautifully you have tackled the situation. This experience is great and has taught me a lot for life!