Wednesday, June 8, 2011

How to close an open port in unix/linux environments

In many cases it is not uncommon to see exception like "java.net.BindException: Address already in use" when running programs. Sometimes this exception occurs even after the program that was using the particular address/port has been terminated. That is mostly due to improperly terminated application. Here the port is still assigned to the process of the particular program. How can we release the port and let the new program use that specific port, without throwing address already in use exceptions.

First let's find the process attached to the program running on the particular port.
pradeeban@pradeeban:~/LB/wso2lb-1.0.0/bin$ lsof | grep 8243
notificat  1802  pradeeban  txt       REG                8,4     53296   13638243 /usr/lib/gnome-panel/notification-area-applet
firefox-b  1821  pradeeban   52u     IPv4             896036       0t0        TCP pradeeban.local:43306->pradeeban.local:8243 (ESTABLISHED)
java      10500  pradeeban  113u     IPv6             867578       0t0        TCP pradeeban.local:8243->pradeeban.local:45898 (CLOSE_WAIT)
java      10500  pradeeban  300u     IPv6             867966       0t0        TCP pradeeban.local:8243->pradeeban.local:46006 (CLOSE_WAIT)
java      10500  pradeeban  471u     IPv6             858667       0t0        TCP *:8243 (LISTEN)
Here, lsof lists open files. From the above command, we notice that a process having the pid of 10500 is listening on the port 8243.

If you know the name of the running application process or part of it, you can use
ps -xa | grep
instead, to get the pid.

Now we can easily release the port 8243 by killing the relevant process (process of pid 10500).
pradeeban@pradeeban:~/LB/wso2lb-1.0.0/bin$ kill 10500

Saturday, April 30, 2011

[Facebook] Identifying the profile from the shared image link

Image 1 - Below an image in Facebook
It is always possible to get the source address from the images shared over facebook and use it elsewhere over the web, as an image content by giving the link.

Getting the link from the "Download" option:
https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-snc4/35861_409992913465_705563465_4274416_6899149_n.jpg?dl=1

Use the image link (https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-snc4/35861_409992913465_705563465_4274416_6899149_n.jpg) as an image source.

Regardless of your privacy settings, once the link is exposed, anyone over the Internet can access the image directly and download it!
One of my friends asked, how to get the Facebook profile of the original owner from the facebook image shared over a website.

So here comes the way.
  • We get the source location of the shared image.
    https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-snc4/35861_409992913465_705563465_4274416_6899149_n.jpg
  • Image URL is in the form of https://...../35861_409992913465_705563465_4274416_6899149_n.jpg
  • Take the 3rd block of the numeric value from the right.
  • In this case, it is 705563465.
  • https://...../xxx_xxx_705563465_xxx_xxx_n.jpg
  • So 705563465 will be the facebook profile id of the original owner of the image.
  • Image 2 - An Image from facebook
  • Now by appending the profile id to https://www.facebook.com/profile.php?id= you can view the profile. So in this case, it is https://www.facebook.com/profile.php?id=705563465
\yay/ You have found the person behind that face! :P
    Apologies if this post sounds silly and obvious. Thought it may be useful for some others as well.

    P.S: The images and the facebook profile used in this post are mine, and neither copyright nor privacy is infringed by this post.

    Thursday, April 28, 2011

    Google Summer of Code 2011 and AbiWord

    Being a mentor for Google Summer of Code is yet another interesting experience like being a student. It was a nice memory going through all the 23 excellent proposals for AbiWord and reviewing them as a mentor, during the night at our annual trip at Kandalama. This year, AbiWord has got more smarter applications. GSoC deduplication meeting was something remarkable, where the organization admins (or a representative/mentor from the organizations) resolve the duplicate students issue in the presence of the Google Summer of Code admins over #gsoc at irc.freenode.org. Many students were also seen in the irc meeting to check whether they have been accepted for multiple organizations, and in that case, where are they going to work for their summer. Selected students were announced by Google on 1900UTC, 25th of April, a few days after the dedup meeting.

    The list of accepted students, along with their project proposals as well as their mentors are given below.
    Fabiano Fidencio - "Get our Mac Port up to speed" - Mentored by Marc Maurer
    Volodymyr Rudyj - "Implement an ePub filter" - Mentored by Xun Sun
    Chen Xiajian - "Implement Hyphenation" - Mentored by Kathiravelu Pradeeban
    Aseem Sharma - "Port AbiWord to Gtk-3.0" - Mentored by Jean Bréfort
    Andrei Sfrenț - "Reduce flickering" - Mentored by Martin Sevior

    An important factor to notice is that, since 2006, AbiWord has successfully been participated in all the Google Summer of Codes (2006, 2007, 2008, 2009, 2010, and 2011). Hence this becomes the 6th consecutive year for AbiWord to participate in Google Summer of Code! I wish the 5 students who got selected a great summer of code with AbiWord, and I hope they will continue to be a long term contributors even after their summer. At the same time, I should also note that, we had to miss a few nice students as we have only 5 slots. Hope they will still continue with their development on AbiWord.

    Saturday, April 23, 2011

    how to ignore someone you love

    Lately many stupid* people have started to click unknown links over the facebook. Finally they ended up ..
    1) Liking very ugly videos and sharing them over their newsfeed to their friends. - Actually those are not videos. They are applications that pose like videos. Once you click the link hoping to have some fun with that *video* clip, everyone will know that you have tried to watch that creepy thing. If you want to have a look at a video clip, use Youtube [Youtube and Facebook - both have a censor policy]. Don't click random links over the facebook. Your online identity matters.

    2) Worse - Once you click the spam link, it will spam your innocent friends. If they too are stupid, they will click the link too, eventually spamming everyone over the facebook.

    Currently, the hottest spam is, {someone} invited you to the event "How to see who viewed your profile!!". So it comes in the format of the event. All who clicks the link in the event will get affected, and spam their friends by inviting their friends to that spamming event without knowing they are doing so.
    Pls pls plsssssss stop these stupid invitations.. If I ever visit your profile, I never forget to leave at least one comment or a like.. so don't send me invitations to "How to see who viewed your profile!!" - So far 71 invitations.. :'( I don't care who viewed my profile.. :'(
     Apart from everyone preaching about these spam, still people are being stupid and are clicking those stupid links and spamming others.


    I never remove the fakes, ignorant people or the rude people from my friend list, once they got into my friends list in facebook. The rationale is, the real world too is full of fake people as well as the rude people. So I don't want to fake a nicer world in my facebook by removing them. Thus my facebook profile is more natural.

    Finally I decided to temporarily ban everyone from inviting me to any event. But I couldn't figure out how to do that. So I tried to get some help from Google. I started typing, *how to ign* to get some idea on how to ignore the facebook event invitations. 

    Have a look at the Google's suggestions -- *how to ignore someone you love*. Seems people are actively finding ways to ignore someone whom they love! World is so weird!

    Saturday, April 16, 2011

    Winning the customers' hearts and more ..

    Last year I tweeted once on LOFT's effective and proactive response to the customer feedback over the Internet. Let me summarize the LOFT story for the completeness. LOFT specialize in clothes for women, through their stores and through their online marketing. 

    Customer-Oriented Marketing
    They had announced a new jeans, and posted photos of a few models wearing their new jeans model over their facebook fan page. But users were not much satisfied, and their comments were mostly negative pointing out the fact that the new models of the jeans will not suit the public, except for the *models*. As a response, LOFT asked its team members to appear in the new model of the jeans, and posted their own team members wearing the jeans as a facebook album. This immediate response grabbed the attention of many customers, and it gave a tremendous amount of customer trust and recognition for the particular jeans model. Feel free to go through their fan page or twitter page if you want to know more about this famous story.

    Young and Energetic Teafe
    This time, I have a similar customer satisfaction related experience, and fascinatingly it is from a very young mini-cafe (exactly 3 months old when we visited them - 27th of March, 2011). We were on a short trip to India to attend a conference, and had to stay at Indiranagar, Bangalore for a day. So during the morning walk, we noticed a small cafe on the road side of 100 ft road.

    Creative and Unique
    First thing which grabbed my attention was the name "Chaipatty 'Teafe'".They mention they are dedicated to tea cafe (and hence the name Teafe). The seats were showing the Indian tradition. The cafe -- oops, sorry -- teafe, was also full of fancy items and brands making it possible to have a mini shopping while sipping the tea or a milk shake.

    Friendly and Proactive
    The teafe members were really friendly. They are interested in getting the customer feedback too. One more interesting thing was their Facebook page. I did notice that they have written down their facebook page address on a white board at teafe, but I didn't expect the page to be such professional, with proper photos those will speak vigorously than any advertising media. Just do a google search 'Teafe', and you will get the Teafe's facebook page as the first hit. One thing they missed was the domain - teafe.com is not theirs.

    Win-Win and Customer Loyalty
    Pay a visit to the Teafe's facebook page, and you will realize it yourself. I have visited it only once. So please feel free to correct me if I have mistaken any facts here. Earning a loyal customer is a win-win for an organization. I am pretty sure Teafe plays the correct game in this. I hope to visit Teafe once more, if I get a chance to visit Bangalore again. I would also recommend anyone at Bangalore to have a visit too. :)