Kasun’s Blog

Kasun Indrasiri

  • Kasun Indrasiri

  • Info

    Department of CSE
    University of Moratuwa,
    Sri Lanka

  • Archives

  • Categories

Archive for the ‘Computer Science’ Category

Let’s start Waving… – Google Wave

Posted by kasun04 on December 2, 2009

Real-time Communication and Collaboration tool

‘Google’, a name that is renowned for revolutionary products and ideas, came up with yet another revolutionary product called ‘Google Wave’. It’s needless to recapitulate about all the mysterious Google products such as Google Web Search, Google Earth, Gmail, Google Docs etc. which made a tremendous impact on the society. Their latest innovative product is Google Wave which is a real-time communication platform which is based on Google Web tool kit (HTML 5).


This was the Google’s biggest product launch in recent memory and it looks very promising indeed. Currently Google Wave is on its preview stage and allows limited access to the normal web users. (This is very similar to the way they started Gmail as they offer their services based on invitations). Few weeks back I subscribed to it and got the invitation recently. I tried it out most of its features and got really amazed with their idea and its performances. (Chrome is the best browser for try it out Google Wave ..and Firefox often crashed during ‘waving’ while Safari looks ok. He he… No IE please… Google decided to completely banned the IE users from Google Wave :D).

Mind blowing features

  • Real-time – you can see what someone else (I mean any of the participant for a given thread) is typing, character-by-character.. (No worries.. there is a way you can avoid this too )
  • Embeddability – Waves can be embedded on any blog or website.
  • Applications and Extensions – Gadgets, games .. far far superior to wearisome Facebook ..
  • Shared Documents– Offers a wonderful way to manage shared document. The participant can modify it on real time.. and also they can view the changes from its initial state (diff)
  • Open source – may be this is a business strategy
  • Playback – Awesome feature.. you can almost view the life cycle of a wave. (Like watching a video.. )
  • Natural language: Auto correction on the fly, as well as auto translation (with the use of Robots)
  • Drag-and-drop file sharing: Just drag and drop images that you want to share with others (may be this will get extend to other formats)
  • Cool Gadgets
    You can embed google maps, google images or search directly in to a wave

Please check out this video.

From Maps to Wave – Rasmussen Brothers

Among the coolest products of Google, Google Maps flying pretty high. As with most of the Google products, what was the turning point here was the ‘idea’. And that ‘idea’ of Google Maps came from two brothers from Sydney, Australia.

This is how CNN reports it.

“(CNN) — Lars and Jens Rasmussen were broke and jobless — with only $16 between them — when they made it big in the Web world by selling their idea for Google Maps.”

Lars and Jens Rasmussen were the genius brothers behind the superb idea of Google Maps. Yet again they came up with this revolutionary idea of ‘Google Wave’.

Lars Rasmussen and Jens Rasmussen during Google Wave internal demo.

So.. it’s a brief walk through about Google Wave… I’m pretty sure that this will become a super duper communication tool in near feature. This will be an huge challenge for existing communication tool (AIM sucks and FB is boring now.. OK!). So it’s the time to try it out.. be the very first few people who experienced a beauty of real-time communication and collaboration. Try it OUT!

See this video to get a complete overview of the product.

Posted in Computer Science | Leave a Comment »

Google – Business, Ethics and Life

Posted by kasun04 on April 15, 2009

‘Google’ – One of the innovative and revolutionary concept which was blossomed in early ’96, as a research project of Larry Page and Sergey Brin (Google’s President incharge of Technology). Google only consume a spam of 13 years to climb to the peek of internet search technology and now, its in a state which is almost untouchable and unreachable to the competitors.


I recently watch a nice interview with Sergey Brin and its really awesome as it reveals some of interesting  facts about Google, it’s challenges and  Sergey him self.

Google manufactures Nothing!


Yeah… it manufactures nothing but produce an IDEA. The idea or the mission is,
‘Accumulate all the world’s information and make it accessible and useful to everyone’. This sounds like an non-commercial or non-profitable but we should keep in mind that there is a underlying business process which may based on several revenue sources. In general, “Search Engines” use one or more of the following revenue sources.

– Charge advertisers for presenting online “banner” ads to users
– Collect marketing data on consumer habits, then selling the data or using it for targeted advertising.
– Charging websites to become listed
– Charging websites for better placement in lists
– Charging websites to purchase keywords for themselves
– Charging users for searches
– Charging other search engines to use their catalog

Google’s mission is to critical as having the correct information that you need  and accessible anytime that you want is very important to each and every aspect of the human life.

Google is a  gigantic “Jewish” company?

Both founders of Google, Sergey and Larry are Jewish. Its first employee was Jewish and many of the seniors were Jewish too. So definitely, Google has some Jewish characteristic  in its business process. In this case, Google’s main opponent, Microsoft was also  founded by a Jewish person.

larry-page-sergey-brinLarry Page and Sergey Brin (both are Jewish)

Unbiased Search Results!

Google doesn’t to any moderation or alteration to the search results (‘search hits’), which means Google provides results based on the query that the user executed. For example, I google for “Internet Browser” and the result set contains the ranked hits in this order.  – Opera, Firefox, Safari, IE7 and finally Chrome. This shows the integrity of search engine. Google supposed to provides users with the information they required and the presentation of the result set is not modified by the Search Engine as it uses an unbiased scheme in ‘Query and Result Processing’.

Google- Privacy  and Identity


When it comes to internet search, Google track all the activities that you did using Google. (may be based on your IP or if you use gmail while searchine. And also even if you use dynamic IP, it gives some identity of  your country, region etc.). Google knows what your interest and may be there the things that you don’t want to reveal to anybody. So, its clear that there is some conflict here.  And the most important thing here is that, the commercial value (or may military) of the information kept with Google. It can be used as a global business survey where you can identify the potential clients of a given product and the geological distribution of the community.

In this particular interview, Sergey Brin was questioned  about this issue but his response was that there were no any cases of exposing of users search history. Yet he didn’t reject that fact that the amount of user information (and to which extent)  is kept  with Google

Google Earth ‘s impact on military and security activities

When we use Google Earth for the first time, it’s not a surprise that the impact of Google Earth on military activities comes to our mind.


But according to Sergey, most of the high ranking  security agencies are claimed that there is no impact of Google Earth on military and security activities.

Google – No 1 Place to work and 20% of working time is yours!



Google is considered to be the best place to work with numerous facilities and  good exposure to almost every technology. Apart from that, the employees are supposed to spend 20% of their working time on some personal work(technical stuff). The products like “Orkut”(social network) and “Google News” are the outcomes of this nice policy. I guess this is really a cool thing. Every company should think about giving there engineers a free time where they can work on their own projects etc. (Of course this allocated 20% time is not supposed be wasted on facebook or similar stuff :D)

Finally… Is Sergy Brin   a happy person

He claimed that he is a happy person and also comment on the fact that most of the business professionals at his level ‘Are NOT’.


Sergey Brin and Anne Wojcicki

You can watch the complete interview of Sergey Brin here.

Posted in Computer Science | 3 Comments »

Googling, Searching and Information Retrieval

Posted by kasun04 on March 8, 2009


As many computer addicted people, I also a “Google” junkie. I believe that most computer users can’t exists without Google or at least they need a good alternative like ‘LiveSearch’ or ‘Yahoo’. I don’t want to go in to a search engine comparison but just to show how we are depended distributed information providers.

In the modern parlance, the word ‘Search’ is a very ambiguous one. However an ordinary user more likely to interpret that one as ‘Google’ or some other search engine. So, the proficient guys in the fields of ‘search engine’ replace the word ‘search’ with ‘Information Retrieval(IR)’.

Information Retrieval (IR) is defined as, finding the materials (items/documents) of an unstructured nature (text) that satisfies an information need from within large collections(stored on computers).

Its obvious that the IR is not just bounded to web search yet web search is the dominant member of Information Retrieval. In the modern days Information Retrieval is fast becoming the dominant form of information access overtaking traditional database-style search.

However the definition is restricted to ‘unstructured data’ but IR systems capable of processing ‘semi-structured’ data as well. For example a book may be structured as ‘Title’, ‘Preface’, ‘Chapters’ etc. Also Information Retrieval also supports users in browsing or filtering document collections or further processing them. (similar to arrange books on a shelf based on their topics). The classification process is more or less automated in IR systems.

IR Systems can be classified in to three prominent categories.

Web Search


In web search the IR system has to deal with billions of documents distributed among millions of computers and server billions of users across the web. So, the performance is a major issue and system is more focused towards handling billions of documents and serving billions of user is most optimal manner. However, the hardware and other resources are provided in large scale and managing them in optimal way is another issue.

Personal IR


This is the counterpart of web search. The Personal IR is more focused on information retrieval of a single computer and server a single user at time. So, its obvious that the resources are limited and also the scale of the system is so small. Yet we need to provide the easy to use and efficient IR system to the user. A most suitable example of a personal IR system is the ‘search’ utility provided by your OS. These IR systems are extremely lightweight (hit F3 to invoke :)).

Enterprise, Institutional and Domain-Specific Search


In these IR Systems retrievals might be provided for collections such as ‘internal documents’ of the company, a collection of research articles etc. In this scenario, the documents are stored locally and distributed among an internal distributed-file system and handful of dedicated computers may provided to the system.

In those three categories, web search is the most widely used and has immense influence on typical computer users. Despite the fact that all the IR categories based on similar kind of design (document feeding , processing, indexing and ranking etc), the detailed designs and the implementations of web search specific IR are quite rare and hardly published.

However, the companies like ‘Google’ are claiming (see Sergey’s speech )that they have published a great deal of information about the ‘Google’ design etc but its really hard to find them, apart from the research article that Sergey Brin and Lawrence Page published for Stanford University during the early days of Google.(http://infolab.stanford.edu/~backrub/google.html)

Posted in Computer Science | Leave a Comment »

Visitor Pattern

Posted by kasun04 on December 25, 2008

In Object Oriented Design, the visitor patter is one of the obscure pattern yet powerful enough to solve many complex OO scenarios. Visitor Pattern is also not really easy to understand at the first glance but you need to dig it around with practical examples. (I guess it’s not just for Visitor pattern but also for all the other patterns)

I would like to give a clean and simple introduction to visitor pattern with this post. So let’s start with a simple example ofthe usage of Visitor pattern

Visitor Pattern is often useful when there are fair numbers of related classes. One of the common examples of such a scenario is ‘drawing different shapes’. In this case we have a set of related classes; Circle, Trangle, Rectangle etc.

Now, if we are going to implement a draw() function for all these classes i.e. circle::draw(), trangle::draw().. etc we may be drawing different shapes but we are replicating a fair amount of code in all the classes. (Because the underlying methods, that we use to draw a ‘shape’ is similar)

Visitor pattern is quite capable of solving this kind of scenarios. Here what we are doing is that we port all the draw methods of each shaped inherited classes (Circle, triangle, Rectangle) to one common class called ‘DrawVisitor’ or simply ‘Visitor’. Then in the ‘DrawVisitor’ we have a set of functions overloads based on the type of object passed to it (Circle, Triangle, Rectangle etc), which implements the ‘drawing logic’. And its obvious that since we use a single visitor class to do the drawing of shapes we can share whatever the resources that we want to draw and can reuse drawing code.

There are a lot of concerns about using Visitor pattern, because applying visitor pattern to a given scenario often makes things ambiguous. However the applicability of

Visitor pattern is justified by James Cooper (author of a Java companion to the GoF) by giving us a real world scenario which is essentially solvable only from visitor pattern. His primary example :

Suppose you have a hierarchy of Employee-Senior Manager-Vendor etc. They all enjoy a normal vacation day accrual policy, but, Senior Manger also participates in a “bonus” vacation day program. As a result, the interface of class SeniorManager(as well as ‘Vendor’ and ‘SecurityOfficer’) is different than that of class Employee. We cannot polymorphically traverse a Composite-like organization and compute a total of the organization’s remaining vacation days. This is how we use the visitor pattern to solve this problem.

Create a ‘VacationVisitor’ which handles all the vacation manipulations and implementing different vacation manipulations in polymorphic visitor methods.

– Each visited instance (Employee, SeniorManager etc) is implementing an ‘accept’ method which in turns call the polymorphic visitor method.

– This method call procedure is termed as ‘Double Dispatch’


– The complete class design looks like this.


“The Visitor becomes more useful when there are several classes with different interfaces and we want to encapsulate how we get data from these classes.”

There are several motivations to use the visitor pattern.

– Add functions to class libraries for which the source is unrevealed or simple source is unavailable

– Obtain data from a distinct collection of unrelated classes and use it to present the results of a global calculation to the user program

– Gather related operations into a single class rather than force you to change or derive classes to add these operations

– Collaborate with the Composite pattern

Posted in Computer Science | Leave a Comment »

Fastest and Elegant Browser on Earth – Opera 9.52

Posted by kasun04 on August 30, 2008

Opera 9.52 is considered to be as the most powerful web browser that offers number of utilitarian features without penalizing the performance. As its counter part, Mozilla Firefox becoming more and more famous among web users, Opera is also becoming one of the major competitors against Firefox. Although many people are used to boring and tiresome Firefox, Opera’s latest version came up with a bunch of awesome features.

Faster Rendering Engine – Presto Rendering Engine

Opera uses their very own rendering engine (layout engine); ‘Presto’. ‘Presto’ is much faster than the tedious
‘Gecko’ layout engine (Mozilla project’s layout engine).

Elegant Look

You should use it and experience it. Here are some screen captures.

Download Manager with BitTorrent

Download files quicker with Opera. Opera starts downloading as soon as you’ve saved the file, so there’s no wasted time. Pause and resume downloads with the push of a button, and choose multiple files to download simultaneously without any fuss. Opera also features built-in support for the social file distribution protocol, BitTorrent, which makes it easy to download Torrent files without the need for a separate application.
I guess you know this .. Firefox download manager sucks!!

Opera Link and Speed Dial

Access your favorite Web sites everywhere!. Opera link syncs your bookmarks and Speed Dial between your computers and mobile phone. See the screen shots to see the use of speed dial.
(Firefox and IE copied this from opera. )

Tabs and Sessions

Most comprehensive tab browsing was introduced by Opera. Opera is very light on your computer, so it’s possible to have many tabs open at once. Drag and drop tabs around to change their order, or get a preview pausing over them with your mouse. You can even save a session of tabs for later, making it easy to pick up where you left off.

Zoom and Fit to width

Is it difficult to read the content on a page? Use Opera’s Zoom button in the lower right corner to resize Web
pages. If the page is too wide for your screen, simply hit “Fit to Width” and Opera will resize the Web page so you avoid horizontal scrolling.

Built-in e-mail and newsfeeds

Opera’s built-in e-mail client features improved responsiveness. It also retrieves and searches your mail and news feeds even faster than before. In Opera, newsfeeds are stored on your computer so you can read them later, even when you’re offline. Easily tag articles so you know which ones you want to read, which ones are important, which ones are funny, etc.

Quick Find

Have you ever forgotten the page where you found that great article or that perfect gift? When using Opera the browser remembers not only the titles and addresses, but the actual content of the Web pages you visit.

Visit – http://www.opera.com/

Posted in Computer Science | Leave a Comment »

How to stop popoing out the IE when AIM starts up.

Posted by kasun04 on July 27, 2008

This is a problem that I was suffering for sevaral months.  Anyway i found a way to do so. Not that its hard to do but I guess people can’t find it.

Disable AIM Today or AIM Dashboard from popping up in Internet Explorer

  • Open Aim 6.5
  • Click Edit
  • Click Settings
  • Click Sign In / Sign Out
  • Click None
  • Click Save

Hope this helps 🙂

Posted in Computer Science | Leave a Comment »

Information retrieval (IR) Systems: Enterprise and Web Search

Posted by kasun04 on July 27, 2008

I heard many people now tends to talk about a new era of computer and information technology called Information age (Some may call it Digital or Wireless age according to his preferences). So, It’s clear that in the

present world ‘information’ (digitally represented) becomes the master and we all relaying on it.

When it comes to information, gathering and storing information is almost done up to the perfection owing to modern development of computer science. But the ‘information retrieval’ is still a challenge to the ICT world.

The area of computer science dealing with searching and processing collections of multimedia documents is known as Information Retrieval (IR). The IR systems solve the effective storing and querying of textual (or multimedia) documents.

The systems can be used for web pages searching in the Internet or a specified collection of documents are often referring to as ‘Search Engines’.

More precisely “Googling” is more or less the most popular way of information retrieval mechanism from the world’s largest collection of multimedia and textual document collection; the World Wide Web. Apart from Google, there are several information retrieval systems yet to become famous like Yahoo, Live Search etc.

Web Search Engine are quite popular but the modern business models relying on much more customizable IR system that you can plug various different collections of data to the IR system. For example a company may want to use the web, a pre-defined set of documents and some other third part IR retrieval system to be used as the company data repository to the company IR system. This is where the ‘Enterprise Search Engines’ come in to play.

Currently world’s most famous and reputed Enterprise Search Platform is the FAST Search and Transfer (now owns by Microsoft Cooperation) which is able to beat the giant’s (Google’s) Enterprise Search Platform. By the way FAST do support crawling through the internet but as a web search engine FAST is no way near Google.

So, its clear that both Google and FAST are going on two different path while both of them are the predominant leaders in each streams (web & enterprise search).

Information Retrieval use various different technologies to store and retrieve information and web search and enterprise search uses different strategies in their own methodology.

Posted in Computer Science | Leave a Comment »

GNU Make parallelization – GNU make with –j Option

Posted by kasun04 on July 27, 2008

The Software Professionals often have deal with massive code bases which comprises of at least 10000 source file or more. If you want build the code base to binaries (or make with GNU auto tools) it would take at lease 10 hrs to build such a code base. (For me it took nearly 8 hours to build the whole source tree on a 8-core CPU server).

And many build processes run for hours with build managers commonly typing ‘make’ or some other third party build tool command and going home for the night (God sake, if the build break in between). GNU Make’s solution to this problem is parallel execution: a simple command-line option causes GNU Make to run jobs in parallel using the dependency in the Makefile to run in the correct order. For that you can use –j option to specify the number of parallel executions that you required.

-j N or –jobs N

To start GNU Make in parallel mode you can to specify either the -j or –jobs option on the command-line
The argument to the option is the maximum number of processes that GNU Make will run in parallel.

For example, typing make –j 4 will allow GNU Make to run up to 4 subprocesses in parallel. This would give a theoretical maximum speed up of 4x cutting build time by a quarter. The theoretical time is,
however, severely limited by restrictions in the Makefile.

Follow these steps before you run in to GNU make parallel build

Step 1:

Verify the number of CPU cores in your build server/machine. You can use following command and count the number of CPU cores (0 – n). (say n)

less /proc/cpuinfo

Step 2:

Give the –j option with the number of CPU cores available (number
of jobs must be less than or equal to the number of CPU cores). For example you
can give,

make –j 8 <other parameters and options>


Be careful, if you specify the number of jobs higher than
the number of CPU core, then you may have to build your code base more or less
for a weeks 🙂 owing to context switching overhead.

I hope to discuss the benefits and fit falls of this method in near future.

Posted in Computer Science | Leave a Comment »

SCP in 60 seconds

Posted by kasun04 on July 19, 2008

‘Secure Copy’ is a common but a tedious command to remember even for Linux experts. So, I’ll try to present you a clean and complete how to guide on SCP.

scp stands for secure cp (copy), which means that you can copy files across an ssh connection that will be encrypted, and therefore secured. You can this way copy files from or to a remote server, you can even copy files from one remote server to another remote server, without passing through your PC.

Putting a single file

  • devcmb1> scp mydata.dat dev77.fastasa.no:NewData.txt

copy file “mydata.dat” from your current computer/directory to your home directory on dev77.fastasa.no, And re-naming the copy on newton “NewData.txt”.

  • devcmb1> scp mydata.dat dev77.fastasa.no:

Same as the previous one but the file is copied as it is (without renaming).

  • devcmb1> scp mydata.py dev77.fastasa.no:/se/etc/src/ linguistics.py

copy file to a specific directory on dev77.fastasa.no, giving the file a new name there.

  • ktest@tframe. fastasa.no>

scp mydata.dat kasundev@dev77.fastasa.no:new.dat

copy file from your account on tframe to your home directory on dev77, where your username is different (kasundev)

Getting a single file

  • devcmb1> scp dev77.fastasa.no:mydata.dat ./mydata.dat

copies file “mydata.dat” from the your home directory on dev77 to your current working directory on devcmb1

  • devcmb> scp dev77.fastasa.no:mydata.dat ./

same thing — it is enough just to indicate the directory, and the copied file will be named the same as the original, by default

  • devcmb> scp kasundev@dev77.fastasa.no:cvs/se/test.xml ./

gets the file from my “cvs/se” subdirectory (relative to kasundev’s home directory on dev77)

Putting an entire directory

  • devcmb> scp -r my_source dev77.fastasa.no:Mysrc/bck/

copy directory “ my_source ” recursively (i.e., the directory and all its contents) from devcmb into a new directory “bck” in your home directory on dev77 (the directory “Mysrc” must already exist).

(Anyway I prefer to create a tar file and copy that files to the destination and unpack it … This is more clean.. I guess.. 🙂)

Getting an entire directory

  • devcmb> scp -r kasun@dev70:MySrc/bck ./my_src/

copy directory “Mysrc/bck/” recursively (i.e., the directory and all its contents) from dev70 (where you are “kasun” into a new directory “my_src” in your current working directory on devcmb.

Posted in Computer Science | Leave a Comment »