Monday, February 4, 2013
Good Morning Beach Negambo
Sunday, January 15, 2012
Useful commands (Unix/Win)
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
Sunday, January 23, 2011
Next generation framework for Java based web applications
Wednesday, September 15, 2010
Friday, February 19, 2010
Impelementing audio streaming using RTP in Java
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
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
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
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
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
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/javacTo 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:
Friday, October 23, 2009
Fine example to explain a Mutex and Threads
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
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 !
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
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
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
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
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.