Monday, February 4, 2013

Good Morning Beach Negambo


The fisherman in the picture released all the fishes caught back to the sea. 


It was empty in Sunday morning. But certainly this view deserved more people out here. It brings such calm thoughts.



Sunday, January 15, 2012

Useful commands (Unix/Win)

Thought of creating a a list of commands that are useful in development. Purpose is to reduce googling time i know where exactly what i want that is in my blog.

1.finds all files with last modified date is greater than some date
find . -mtime -1

2. Create a list of files that were modified after a given date.
find . -mtime -2 -exec ls -l {} \;

Wednesday, January 26, 2011

Social Networking makes us less human

The modern form of madness, i.e Social Networking, is taking its way very nicely. People are more into live in a virtual life rather real. Facebook, Twitter, Second Life, BlackBerry, iPhone or what ever the things used to stay connected(so called) in a cyber space with their peers has become a major part of the life(I am not talking about the basic communication protocols that comes with those). The way of living in a real life with a real passions and styles with real expressions is no longer existed in this cyber-reality. Simply it makes you living less in your real life. Less of productivity is another concern. Family relationships can be less connected. You are more vulnerable to feel lonely even your friends count shows thousands in numbers. Those are the real facts behind this .

Its true tha the Social Networking brings us some good. Its a great technology evolution, no doubt. But the problem is the balance that people get it into their life. By means of living the life it does very few good things to us but a big damage in many ways. These facts has been explained well in the book ALONE TOGETHER written by MIT professor Sherry Turkle. She explains that people are become isolated from reality due to such social networking sites because technology is dominating our lives and making us "less human".

Therefore its time to think weather it is really imperative to get this modern-madness into our life and is that the way we really want to live our life with. Honestly for me its more like a waste of time. Its not healthy. If you want to live in a real life, face-to-face, with a great sense of hummer feeling the setting whatever you are in start get rid of Social Networking. Instead go to a gym, fab or bar or do whatever it makes you real socialized. Its really healthy and you may feel you are more living like a human.



Sunday, January 23, 2011

Next generation framework for Java based web applications

Recently I had an opportunity to work on a project developed using JBoss Seam framework.
Seam is next generation web framework that integrates JEE technologies with variety of non standard technologies into a unified, consistent, programing model. Although Seam is not much popular in the co-operate world today It will be the next generation integration framework in Java world. The idea of seam is to glue the two key components of Java EE 5 specification that is JSF 1.2 and EJB3 (JSF is the standard presentation framework for the web tire that provides both a UI component model and a server side event model. EJB3 is the standard programing model for creating secure and scalable business components that access transactional resources. EJB3 also surround JPA that defines a standard persistence model for laying a ORM layer in between application and RDMS).

In conventional JEE programing model it requires lot of ''glue" code (backing bean layer) to combine JSF and EJB layers. Simply Seam eliminates that additional layer and fits JSF and EJB together. As such and with many more programing patterns, Seam has positioned as the next generation integration framework for Java base web applications.

Seam project is an idea of the Hebernate's inventor Gavin King. As for the most software project, Seam also was started to scratch a single developer's itch that of Gavin's. Why? Gavig King was fed up with that developers are not using Hibernate properly with the stateless framework like Spring. So he identified that the missing integration between JSF and EJB in a statefule context is much needed and it would avoid further abuse of Hibernate as a JPA provider. This would allow the persistence context (Hibernate Session or JPA EntityManager) to transcend layers and would permit stateful session beans to respond JSF directly. To achieve this, Seam was came out as a stateful, yet efficient, architecture in to the JEE picture.

Even there are many features that I can write on this blog I would not because there are lot more well written article that describes in and out about Seam well. If you are further interested it is just a matter of searching(Googling).

Wednesday, September 15, 2010

Friday, February 19, 2010

Impelementing audio streaming using RTP in Java

As this post is writing its a frustrating moment. Because no stable fully functional Java API found for streaming real time audio so far.

The first attempt I tried to implement RTP streaming was with JMF. Event JMF is almost a dead project by sun as its still using lot of programers and the mailing list is stil active I decided to use it. But again It was just a failure attempt as its not funtioning well on Linux. And again as it has not update since 2001 its quit rist to continue with it. So I decided to find for some other libraries. Freedom for Meedia in Java(FMJ) is the alternative open source project that provides functionalities to capture, playback, process, and stream media across multiple platforms. But its not that much active and less of documentations and tutorial I stil did not try to write any code with tha. But by the side im keeping it in case to try out.

The xuggle, I thought first the xuggle will do the job. But agian xuggle is supporting live streaming with a flash server called octopus. But who need a central media streaming for VOIP. So bye bye to xuggle.

The next library my attention went is Quick Time For Java(QTJ). God u know what?
Quick time streaming works only on Mac OS (Classic and OS X).

At the begening I did not think implementing audio streaming using RTP in java would be a challage. But now it has become a challage.

Sunday, January 31, 2010

Oracle's Sun Acusition

One of the big news to the IT sector within the last week was the merge of Oracle and Sun, both are major players in the industry from every aspects. As I am much more to Java I am pretty interested about this interesting sudion. There are winners and losers. This would be a good for some while bad for some. Even nothing can be concluded precisely but some predictions still can be made.

With this acquisition, software that are running on Java and the developments using Java would have affected badly. Such a clue comes because Oracle is very good at earning money by selling software with licenses. Java was Open and Free. But lately if oracle decide no more free Java then the problem arises. Probably they would not go such a foolish decision. But they might create many alternative paths in order to get money out from the idea. The idea is that Java can not be given totally free any more. Therefore the license would be required for any Java related works which is bad despite oracles side.

On the one hand this would be affected badly to the R&D works that have been continuously doing by Sun. Concerning the two natures of Sun and Oracle Sun has invested more money on its research works compared to Oracle. Therefore at the bottom line the less of R&D activities means less new releases and technologies to come. The result is the existing development APIs and frameworks will get a longer time to get upgraded to their new versions. In other words the speed of Java technology evolution will get slow compared to its Sun's era.

Another aspect to taken into the discussion due to this merge is the Opensource world as Sun was engaging with large number of opensource projects. Sun was investing more money and giving sponsorships to many opensource developments. Unless Oracle sees the value of this need probably Opensource world would be collapsed. This can been seen from the press conference released by Larry that the main reason to buy Sun is Java. But it is not. The main reason is the hardware business owned by Sun. By the way he would not obviously interested on other java based opensource softwares and API's that has been developing by Sun. Therefore Opensource would fall in quite an unexpected way.

Finally, the deal that worth $7.4 billions would not be a good one for most of Java users and opensource communities. This can be clearly seen by analyzing the behaviors of Sun's and Oracle. Other point is how it can be expected to be much better from the one that was already better. Its quite unnatural. Therefore things would be affected soon and be felt soon. But not for forever as everything got to get adjusted accordingly. Therefore will definitely have a better future.

Wednesday, December 9, 2009

128-bit node id space in p2p systems

DHT based p2p systems are designed based on 128 bit(sometimes more bits) length unique hash value as the node id. There are several ways this can be done and this should be done. It depends on the way that the system need to be performed in message routing. For an example one may need to route messages anonymously to all the nodes in the ring(DHT based nodes are normally organized to a ring of nodes). But another may need to rout a message to some particular node. So there are several scenarios to be considered when deciding which way to use in order generate node ids. Most popular ways of generating node ids are using the peer's IP or its public key. Some system uses randomly generated 128 bit hash as the node id.

However in my research work I wanted to generate a nodeId based on not neither the IP nor the Public key of the node but using some unique key/number given or that can be used to identified the node. For an example the mobile number of a mobile device(phone, PDA, iPhone, etc) which represents a peer in a p2p network. Since I am using Freepastry API this capability is not provided directly. But extending its NodeIdFactory class this can be done easily. Its quite simple. :)

Friday, November 20, 2009

Finally my freepastry nodes are working

In past few weeks I have been working with Freepastry in order to implement a p2p substrate. Freepastry is the java implementation of pastry algorithm based on DHT. But I was very unhappy in this case that the Pastry nodes implemented in different machines were not communicating. More technically bootstrap node is not identified by the lately come nodes and hence the nodes are not organizing into a ring. But while running on same JVM it works well. Btw finally I could able to make it worked. i.e nodes are now joining to pastry ring and communicating residing even in different machines also.
Initially It was not working because of that I had forget to implement one code line that perform the call to register() method of endpoint reference object.

Not only that. There are some other points also that I found and which was not mentioned in freepastry tutorial.
1) For the Bootstrap node bootAdress(InetAdrress) should be the real Ip( or the domain name also could be worked but I didn't check ) of the machine and the boot port and bind port should be equal.
e.g
int bindport = Integer.parseInt(args[0]);
InetAdress bootaddr = InetAddress.getByName(args[1]);
int bootport = Integer.parseInt(args[2]);
..............
............
node.boot(bootaddress);

Note that here if you start new node as the bootstrap(parent) node then you should pass local IP or domain name of local maching as as the bootaddr and same port number for both bindport and bootport.
So if the ip of the local machin is 192.168.1.100 then your command line arguments should be like
$java [-options] class 9001 192.168.1.100 9001

2) In FreePastry Application class (in this example MyApp) where we normally initiate the reference for Endpoint, dont forget to call register() method.


import rice.p2p.commonapi.Application;
import rice.p2p.commonapi.Endpoint;
import rice.p2p.commonapi.Id;
import rice.p2p.commonapi.Message;
import rice.p2p.commonapi.Node;
import rice.p2p.commonapi.NodeHandle;
import rice.p2p.commonapi.RouteMessage;


public class MyApp implements Application {

protected Endpoint endpoint;

public MyyApp(Node node) {

this.endpoint = node.buildEndpoint(this, "myinstance");

this.endpoint.register();
}

//some codes go here
................
..................
}

Therefore the Warning is...
If somebody wish to implement freepastry and forget to call this register() method your other pastry nodes who are waiting to receive messages from the first node wont receive pastry messages.

Monday, November 16, 2009

Changing default java setting on ubuntu

By default ubuntu comes with default GCJ flavor of Java which sometimes gives trouble when working in console to compile and run java programs. I recently faced to this problem. So here I thought to write how to change the default java setting on ubuntu.

Nothing much. we only need to change two things in advance that is java and javac command.

To choose Java
Just installing new Java flavours does not change the default Java pointed to by /usr/bin/java. You must explicitly set this:

$ sudo update-java-alternatives -l to see the current configuration and possibilities.

$sudo update-java-alternatives -s XXXX to set the XXX java version as default. For Sun Java 6 this would be sudo update-java-alternatives -s java-6-sun

Run java -version to ensure that the correct version is being called.

Alternative way

$sudo update-alternatives --config java

Although the above changes are done the system may still refer to old 'javac' setting.

To choose javac

To check which javac is fired when type javac -version use

$which javac

/usr/bin/javac

To check this javac is a real program or a symlink
$
ls -al /usr/bin/javac
lrwxrwxrwx 1 root root 23 2009-07-29 19:42 /usr/bin/javac -> /etc/alternatives/javac

It is a symlink. follow the same command again.
$ls -al
/etc/alternatives/javac

lrwxrwxrwx 1 root root 42 2009-11-16 14:59 /etc/alternatives/javac -> /usr/lib/jvm/java-gcj/bin/javac

So probably the /etc/alternatives/javac link will point to the not desired javac. Change it (as root) using:

$ln -sf /etc/alternatives/javac

Friday, October 23, 2009

Fine example to explain a Mutex and Threads

For what purpose we can use rubber chicken. Different people would use for different purpose.
I found this example while 'google'ing.

[When I am having a big heated discussion at work, I use a rubber chicken which I keep in my desk for just such occassions. The person holding the chicken is the only person who is allowed to talk. If you don't hold the chicken you cannot speak. You can only indicate that you want the chicken and wait until you get it before you speak. Once you have finished speaking, you can hand the chicken back to the moderator who will hand it to the next person to speak. This ensures that people do not speak over each other, and also have their own space to talk.

Replace Chicken with Mutex and person with thread and you basically have the concept of a mutex.]


Wednesday, October 14, 2009

Advanced Collaboration Grids

Grid computing technologies enable wide-spread sharing and coordinated use of network resources. Among the number of types of grids collaboration grid takes a significant attention from the researchers and communities. But so far collaboration has not been used in a consistence fashion by different communities. Hence identifying the issues related to grid collaboration and finding some open standard approaches to overcome these obstacles is much needed. These approaches can be different from each. But what important is that these approaches should follow open standards that can be agreed and used by every interested parties. Taking this matter into account I thought to open this tread to address the above matters.

Collaboration become regular and important in the grid paradigm. But so far collaboration has not been used in a consistence fashion by different communities for many reasons. Hence Identifying the related issues with the collaboration has become one of major concern among research communities for last couple of year. The challenge is to finding an open standard that can be agreed by every communities.

A grid is basically built on services. In other words a grid is a better example for Service Oriented Architecture(SOA). These services are at each separate layers in the grid architecture according to their functionality. Approaching to the concept of collaboration in the current grid services hierarchy collaboration can also be identified to a set of services. Therefore implementing a service based middleware to handle the the concurrent events coming from grid participants is quite natural. The same kind of implementation has been done by Indiana university but again its a shared event model using common message broker. They have proved the concept instantiating that model that enable working concurrently on a single OpenOffice files by many peers from any corner of the world. But the problem I see in this is the solution is application specific and so no common interface provided that can be used commonly. Therefore I believe that extending this concept to model a Service Based middleware instead of it's shared event based model that would be a more flexible in general.

Thursday, October 8, 2009

Dcache/Delasa Nominates for the e-Swabhimani award !

It is a great pleasure for me write it here that the project we have been working on at the LSF has been shortlisted for the national award of e-Swabhimani Awards 2009 under e-science and technology category. Even whether we would receive the award or not Dcache/Delase will remains as the first distributed web cache implemented so for. This was a team effort. I thankful all the members worked to take the project this far, specially Dr.sanjiva-adviser, wathsala-lead, nishshanka-se and shehani-pm.

Summing up the last 9 moths spent on this it was a great experience specially in implementing a research idea. It has a lot of varieties in terms of many common working experiences we meet in the commercial software development environment. As every elements in the world, these two environments also have good and bad. But I would rather satisfy by working in a environment like LSF, doing research. It catered me the freedom most importantly, let myself to be enjoyed of the work done, no QA team to reports bug :), also it keeps me on the study track.

Finally we believe that Dcache will be smart enough and beautiful to win the award. So that we would future treat to take her to a another level.

Friday, September 18, 2009

FOSS-ed 2009 -Trinco

I had a great time being as a FOSS advocator at FOSS-ed conference which was another FOSS event held in Trinco in last week. we were a 8 man team who came from various institutes and companies as FOSS advocators.
This was not the first time that i had been to Trinco. I had my first visit to Trico in 2004 when Tsunami came. The purpose of that journey was to provide water with IDPs.
Now when I look at these two visits, the objective of both visits was to help people. This time I spent a great couple of days at Trinco. I could able to be relaxed myself and felt the freedom of the life itself.


The people who had come to the event and the organizers of the event welcomed us at a great deal. This was a good example to how it is easy to live for northern and southern people in Sri Lanka in peace. Mindset is the most important factor for being good or bad. What I felt was the war is just a creation of group of people(what ever they are defined to be like). Even though I come up with lot of unorganized ideas about the conflict had I am not going to write those in here as its now over. This is ABOUT FOSS. Completely different from a war. :)



The two days conference and training session held at Northern governor office at Trinco. All the people who had participated for the event were public workers and they had several levels in IT knowledge but each had good enough knowledge at their levels rather I expected. So it was easy for us give to introduce FOSS and things and gave some practical session with the FOSS applications. Even the term FOSS was totally a new experience for them I hope we could able to convice them a lot about the context in it.

Sunday, August 23, 2009

The best programing language to start with

There are several leading programing languages(C, C++, C#, .Net, Visual Basic, Java, Ruby, HP, Perl, Python and more) that various programmers from various institutions are interested of writing programs. The choice of a programing language depends upon the requirement. But as a beginner to programing there are some important factors to be considered.

I started with java. It went good but now I believe that it would be better If I could start with C. I would not say that java as the first programing language is totally a bad choice. Its not a bad choice actually. In fact many people recommend it. But I think object orientation is not good design methodology for beginers because java is too far from machine. In other words Java is very high level language. Unless somebody know C or assembler it is difficult to understand what the java interpreter doing.

So I believe that C is the language to start with. Although no one can really suggest you a programing language, starting with C lead to lay a strong foundation to become a better programmer. The choice can be convinced. C has both high-level and low-level features and function-oriented approach. It is simple(somewhat tricky though) to learn and forms the base from which you can jump to any other language. Also C is high speed and versatility language. Not only those, the fact that many of the languages that have been developed during the following decades derive syntax of C. And C is not going to be a dead language as it is still being used widely and the demand for C is also at a higher position around the world. This is not just only my openion. Google for it and try to find the facts behind this in more details.

Thursday, July 30, 2009

P2P Instance Messaging - Dalesa-Sallapa was born at LSF

At LSF I could able to develop a zeroconf Instance Messagin(IM) platform (we named it with the sinhala term "Sallapa" which gives the meaning of "chat"). This attempt was initiated as a requirement by ICTA who funded us. ICTA wanted to give the chatting facility to the peers which runs Dalesa. Therefore since Dalesa is a Peer-To-Peer(P2P) overlay this IM platform also should have been configured according P2P manner. Hence the Sallapa was needed to implement as a zeroconf IM which works in P2P manner. So Sallapa assures the concept of decentralization which we believe and work on at LSF.

Sallapa has designed and developed as a pidgin plugging. One could ask the question why Sallapa was born as a pidgin plugging. We basically did not want to implement all the GUI things that is needed to a IM client. Other reasons are those pidgin is open source and it provides a complete and clear API and docs to its plugging architecture.

Ok now I want to talk about how Sallapa works. Once you install Sallapa It appears as a new IM communication protocol like Yahoo IM, Google Talk in pidgin. Then you can create new pidgin login account to Sallapa. Now if you are running Dalesa on you computer you are getting signed-in to you newly created Sallapa account and list all the other peers in your network who running Dalesa and logged into their Sallapa.

Does Sallapa run on top of Dalesa?
No, not like that actually. Architecturally Sallapa does not run on Dalesa. Dalesa is a P2P overlay which is to run on and hide the IP layer. Sallapa is also running on IP layer. So if someone got to think as Sallapa is running on Dalesa then that is meaningless. But Sallapa and Dalesa has integrated by IPC module which is used to check the status of Dalesa from Sallapa. That is the only link that Dalesa and Sallapa are in.

How Sallapa works Technically?
Sallapa uses MDNS to publish its presence in the network. In linux like environments Sallapa uses Avahi to do this. But in win32 like environments it uses separate MDNS implementation developed for win32.
Once Sallapa published the presence of a peer in the network others peers are callbacked by MDNS-SD(MDNS-Service Discovery) running in them and updated their buddy list accordingly. Now at the moment Sallapa uses Bonjour as the communication protocol to exchange messages.

Wednesday, May 27, 2009

web caching on P2P overlay + mesh networking

Mesh networking has recently become popular in deploying wireless networks.
Similarly with the growth of internet browsing, implementation of a P2P overlay for web caching has identified as a major requirement to reduce the latency of the web content delivery and the network bandwidth. So emerging these two concepts together facilitates to overcome underline issues and deliver advantages to all the stake holders in the phenomena.

Currently we are at LSF developing a set of software components to address the issues mentioned above. The idea is a p2p overlay to cache the web contents. Basically the system consists of two main components(layers) that are the P2P multicasting layer and the caching proxy. These two layers have integrated in a way so that each node in the p2p overlay cache the possible web content it brows. Later when some other node requests for a particular url, which has already been visited from a node in the group previously, is then served from the cache instead of going to the actual location of the resource. This obviously cut off the latency and the bandwidth. We basically have developed this to run on top of a mesh network which contains less number of peer nodes(not hundreds of) runing on both UNIX and Win distributions.

Tuesday, April 28, 2009