Unique Perspective on C++
Its not worthy to write a blog post on the impacts of the Software Development on economy, society and life style. Its one of the major driving forces in the modern world. When it comes to software development, the programming languages has an immense impact on software engineering. As an incontestably candidate of programming languages, I would like to talk about C++ a bit.

Well, the most common questions arises at this particular point are, “Why C++ ?”, “Isn’t it dying ?”.
Yes.. C++ is not used in the same frequency as Java or C#. But, its not dying, its not obsolete.. In fact it’s the heart of modern software development process.
‘Choosing the right tool’ is so important in the Software Development process. So in that context, C++ is a tool; a ‘complicate tool’. And it’s a tool that is difficult to learn, how to use properly.
The complexity of C++ has encouraged most software developers to go for alternatives like Java, C# etc. Then again, the complexity is a consequence of its programming power and the performance.
C++ -Complexity
The uniqueness of a proficient C++ programmers can be observed in many distinct ways
- For a proficient C++ programmer, it’s essential to have a solid understanding of, What compiler does, what linker does, what run time system does and what OS does.
- Memory Management. No garbage collection, so the developer needs to taken care of memory allocation and de-allocation. (’pointers’ is always a nightmare to a C++ developer
)
- OS level Concurrency. No pseudo processes or threads (like threads provided by run time systems). Should use processes and threads directly provided by the operating system.
- Generic Programming. (Templates)
- Interfacing with hardware. (C++ is the best programming language to communicate with hardware)
- Generic Programming. (Templates)
Why C++ ?
Nowadays, selecting C++ for the development of the conventional software system is simply a waste of time and money. We don’t need C++ to develop a traditional business management software system or a web application.
The famous programming languages like Java or C#.Net are often humiliated by some of the requirements of the software system. These applications are often termed “Demanding Applications”.
Demanding Applications
Performance is a major and a crucial requirement of a demanding application. Also, robustness, responsiveness and fault tolerance is also critical in the context of demanding systems. If you still confused about the demanding applications or systems, just now you are working on one of the most complicated demanding system. It’s the operating system. Linux or Windows; both use C/C++. The role that played by C++ in the modern era of Computer Science is obvious when we consider the most common demanding systems .
- Operating Systems – Windows, Mac and Linux is mostly (if not totally) developed using C/C++.
- Embedded Systems – Every embedded system is a real mess of constrained resources and unlimited requirements. So, to maximize the throughput and minimize the resource consumption, C++ immerges as the best development methodology. In fact, embedded systems is the next era of C++ development.
- Hardware Drivers - Almost all the hardware drivers are implemented by C++
- ”The’ most popular windows application. – Well, everybody knows about it. It’s modern success story of Microsoft. Yes.. Its “Microsoft Office suit”. Each and every module of MS-Office is developed using C++.
- Search Engine Core – Google Search Engines is a best example of a demanding system. The performance is the most crucial factor of a search engine. Therefore C++ is the consentaneous candidate to develop the core (or heart) of a search engine.
- Trading Systems – Again this is for the sake of performance and handling the immense amount of load. C++ is a must.
- Real Time Systems - This also a well known case where C++ is mandatory.
So, this is the showstopper for the jerks who claimed that ‘C++ is dying..its obsolete’ . (inspired from a interview with C++ genius, Scott Meyers)
True Colors of Patriotism
Last few weeks or so, the whole Colombo city was covered with Sri Lankan national flag. Sri Lankans are still celebrating not the victory over LTTE but the true independence. As well as enjoying the independence I also enchanted with the beauty of our national flag. To me.. It’s the most beautiful flag in the world (I even heard some Cricket commentators claim that it’s a very colorful flag.). Now we can hoist our national flag with the pride of being able to wipe out the terrorism from our country. It almost took three decades to bring the true independence to the island nation. And we should keep in mind that, the independence that we achieved is formed with the blood and tears of our true patriots. The unanimous credit should goes to HE the president, Armed forces and to the whole Sri Lankan community which is the sheer power behind everything.
However, there are so many people who acts as co-possessor of Victory and Independence of Sri Lanka. Patriotism is suddenly in vogue. Its everywhere.. Nowadays in SL anybody that you meet in a street is a ‘lion hearted patriot’.. anybody who migrated to US or Europe is a ‘true nationalist’ .. There are some people whose ‘patriotism’ is often ignited by alcohols… It’s a dilemma that how a man who migrated to some other country can boast about the sovereignty and the independency of his motherland. All these ‘Non-returning Sri Lankans are the genuine illustrations of ‘Pseudo Patriotism’.

Defeating Terrorism in Sri Lanka is a sacred and a precious thing for all its citizens. As we enjoy the independency we should salute and show our gratitude to its contributor; armed forces, the president, families of all the armed forces, government, local and international community (India, Pakistan, China and Russia in particular). (But not those bloody ‘pseudo patriots’)
Finally, the courage and the dauntlessness of our heroes cannot be explain through a couple of sentences.. But this is a nice poem(translation) written during the Indian revolution around 1940′ when they fight against the British governors.
This day, we walk along with death, and laugh at its pale spectre..
We will not fear those cruel swords, our courage is far sharper..
Mistake not our silence for submission. For beneath lies lava, molten..
O Martyre, O men of valour.. One day the enemy will sing your praises…
We will show our mettle .. When the moment of truth arrives….
For courage lives in deeds, not boastful lies.
We’ve gathered in the enemy’s lair, my friend
In the hope of dying for our motherland…
We will not fear those cruel swords, our courage is far sharper.
This day, we walk along with death and laugh at its pale spectre…..
Google – Business, Ethics and Life
‘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 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
)
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.
i Love .. iTunes
Recently I’ve started using iTunes as my music player. Latest version of iTunes (8.1.0.52) looks really cool and GUI is splendid as any other apple application. As I noticed that the sound quality is also improved with ACC format though it’s a slight difference from mp3.
You can organize your music repository with the ease of use with iTunes and playing an album is just like fetching a CD and playing it. And you can search any ‘artist’, ‘album’, ‘Genre’, ’song’ etc using the embedded quick search. Albums are displayed on a 3-D pane where you can select the album by just clicking on album cover. (see the screen shot)

Also you can listen to any type of radio streaming through iTunes and you’ll nearly 1000+ radio streams.
You have ‘alternative’, ‘ambient’, ‘blues’, ‘Folk’, ‘Jazz’, ‘Latino’, ‘Pop’ (you name it.. iTunes got it)and many more streams.

Looks soo.. ’sympathetic’ to Vista too…

Use it once and enjoy forever….
Googling, Searching and Information Retrieval

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)
The Romantic Opera – Kasun Kalhara


Nowadays Sri Lankan music stream is flooded with a lot RnB and Hiphop music and many people merely want to listen to such styles of music. And all the radio stations are backing such music and ruining the natural music taste of Sri Lankans. All those commercial oriented artists tend to release their 5-6 tracks per a month. This is something simply related to the quantity and they simply want to create a music track using computers and other equipments. Once they create the track there are people who can write some strange words to tally with the track and the beat. Finally they’ll come up with a music video and all the TV stations eagerly waiting to play their music video.This is the story of Iraj, BnS, .. (you name it)
But .. They have forgotten the fact that there are some (I think its few
) people in Sri Lanka who still loves the instinctive slow music (mood songs) which is a blend of soothing voices and acoustic music.

Kasun Kalhara is one of the exceptions thrown from the Sri Lankan modern music stream. As I see he is the best production by Dr. Premasiri Kemadasaa (Kemadasa master) and doubtless selection of the best voice in the modern generation. Not only his voice but he is a composer too.. But not a synthetic composer who solitary depends on Computer and keyboard.
‘The Romantic Opera’ is his latest album and in my opinion it is the best music release of him. The titled rack, ‘The Romantic Opera’ is inspired from Opera style music.
Opera is an art form in which singers and musicians perform a dramatic work (called an opera) which combines a text (called a libretto) and a musical score -wikipedia
And this album is a combination of a set of distinct music tracks. It has some ‘Latin’ music, some of ‘Chinese or Japanese’ music, some of ‘Indian’ music and a lot of ‘Western’ and ‘Sri Lankan’ music. Most of the songs are composed using acoustic music and very less number of music instruments were used.
You’ll not able to listen to this sort of music when you switch on the radio or TV.. You’ll never hear any of these songs when you are travelling on a bus… Soo… you need to find/buy it and listen to it… because that’s the way that most true Sri Lankan music lovers used to do…

‘The Romantic Opera’ is a must listen music album of true Sri Lankan music fan.. Believe me .. It awesome.
We always call that the ‘music’ is an universal thing… yes it is.. That’s why we love A.R Rahman’s … that’s why we love Josh Groban.. and that why we should love Kasun Kalhara.
Visitor Pattern
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
Chrome, Firefox, Safari and Opera – CPU and Memory usage
I perfromed a CPU usage and Memory usage test on Google Chrome, Firefox, Apple Safari and Opera. I simply ignore IE7 because the real battle comes when IE8 is officially relesed.
Here are my results. (or proofs) as screen shots.
IDLE State
Same Tabs Opened (various site were selected. Gmail, Apple, BBC, Youtube vedio streaming)
So then, we can analyze the resource usage.
Chrome vs Opera
This is another comparison between Opera and Chrome.
Bottom Line
You have to decide which browser to be used.
Search Engine Technology-An In depth Analysis (I)
A search engine is an information retrieval system (IR Systems-See my prior post) designed to help find information stored on a computer systems. Search engines minimize the time required to find information and the amount of information which must be consulted.
The search engine technology is evolved over the past decade or so, owing to the continuous and rapid grow of World Wide Web. As the information systems grow bigger and bigger the amount information stored in the information systems became enormous. So as an information retrieval system, the search engine has to be evolved in order to be sync. with the growing stored data.
The most public, visible form of a search engine is a Web search engine which searches for information on the World Wide Web. And more or less that the most important form of the search engine, because the www is the world’s fastest growing, distributed and fault tolerant information system. As an important business product the Enterprise Search Engines also play a critical role as most of the companies need to have their own customizable information retrieval system which is beyond a conventional web search engine.
Regardless of web or enterprise search, the technology used by the both forms are quite similar. in fact from the core (or heart) of the both engine looks almost the same. Here is a brief overview of different forms of Search Engines.
Web Search Engines
A Web search engine is a search engine designed to search for information on the World Wide Web. Information may consist of web pages, images and other types of files (including pdf, doc etc.). Web Search products are typically free to use and the vendors generate revenue via advertising.
Challenges:
- The number of documents to be indexed (tens of billions)
- The number of users (hundreds of millions)
Major Vendors:
- Microsoft
- Yahoo
Enterprise search Engines
Enterprise search is the practice of identifying and enabling specific content across the enterprise to be indexed, searched, and displayed to authorized users. Enterprise Search Engine facilitates the application of search technology to information within an organization. And most of ES vendors tend to focus exclusively on Enterprise Search and do not also offer Web Search or Desktop Search products.
Challenges:
- Index documents from a variety of sources such as: File systems, Intranets, Document Management Systems, E-mail, Databases.
- Present a consolidated list of relevance ranked documents from these various sources
- Many applications require the integration of structured data as part of the search criteria and when presenting results back to the users controls are vital
- if users are to be restricted to documents to which they are granted access by the various document repositories within the enterprise
Major Vendors:
- Microsoft (FAST Search & Transfer, Convera)
- Autonomy
- Dieselpoint
- Endeca
- Exalead
- IBM
- ORACLE
Desktop search
Desktop search is about searching the documents personal to a single user (i.e. a local hard drive and email folders).Most of the leading Desktop Search products are provided as free downloads, or for a small fee per user.
Challenges:
- To offer the search on the user’s local machine without impacting the performance of other applications running locally.
Vendors:
- Microsoft
- Google & Copernic/Coveo.
Leave a Comment
Leave a Comment
Leave a Comment











