Sunday, June 19, 2011

Setting up Stratos locally in your laptop

Now you can check out the trunk code of Carbon from the repository, build, and configure WSO2 Stratos in a few steps.
Check out https://svn.wso2.org/repos/wso2/trunk/carbon
mvn clean install from carbon directory

Set up the following in ~/.bashrc (change the values accordingly for the email addresses, carbon directory, the transport sender, and the other information given below.)
# Stratos setup constants
export stratos_local_ip="10.100.0.15"

export CARBON_DIR="/home/pradeeban/trunk/stratos/carbon"
export STRATOS_DIR=$CARBON_DIR/stratos_home
export STRATOS_VERSION=1.1.0-SNAPSHOT
export SSO_ENABLED=true
export CREATE_DB=true
export STRATOS_MAIL_TRANSPORT=' ********.***.***25 false false cloud-noreply@wso2.com '
export NOTIFICATION_EMAIL=pradeeban@wso2.com

If you are going to use the stratos binaries, you can use the downloaded packs, usually available from the builders online (find it here, for the Stratos-1.5.1 binaries), as of the trunk or development branch version or from the wso2.org download area, for a released version.

Place the downloaded zips in to a location and also define that location in bashrc profile.
export PACKS_DIR="/home/pradeeban/Downloads"

Now you may run the set up script as above.

Running Stratos Set up script - carbon/build/stratos-setup.pl
./stratos-setup.pl

Add the following lines to your /etc/hosts file

127.0.0.1 cloud-test.wso2.com
127.0.0.1 identity.cloud-test.wso2.com
127.0.0.1 governance.cloud-test.wso2.com
127.0.0.1 appserver.cloud-test.wso2.com
127.0.0.1 bam.cloud-test.wso2.com
127.0.0.1 dss.cloud-test.wso2.com
127.0.0.1 bps.cloud-test.wso2.com
127.0.0.1 brs.cloud-test.wso2.com
127.0.0.1 cep.cloud-test.wso2.com
127.0.0.1 esb.cloud-test.wso2.com
127.0.0.1 gadget.cloud-test.wso2.com
127.0.0.1 mb.cloud-test.wso2.com
127.0.0.1 mashup.cloud-test.wso2.com


Start all the Stratos services
from $stratos_home
sh stratos.sh start all

Stop all the Stratos services
form $stratos_home
sh stratos.sh stop all

Also you can start and stop the services individually or as a chosen subset of all the available services.

Here by pointing the browser to cloud-test.wso2.com, you can access Stratos Manager. Pls note that in the configuration we have enabled SSO. You can also set up the Stratos services with SSO disabled instead, by setting export SSO_ENABLED=false, above in .bashrc profile. 

Since we have enabled SSO as above, once you have logged in to one of the services, you can just click and enter the other services without logging into each of the other services separately. Here identity.cloud-test.wso2.com is the url for WSO2 Identity Server as a Service, and governance.cloud-test.wso2.com is WSO2 Governance Registry as a Service, and the other urls as given above lists the respective services.



Await the official Stratos-1.5 release soon!

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!