Saturday, August 2, 2008


The above picture was send to me through an e-mail. Below is some data I manage to get from internet about this wonderful butterfly.

Physical and Behavioral Characteristics
  1. Glasswing butterfly's wing are transparent. Its biological name is Greta oto.
  2. The opaque borders of its wings are dark brown sometimes tinted with red or orange, and its body is dark in color. Its wingspan is between 5.5 and 6 cm.
  3. Its abundantly found in in the amazon rain forest (South America).
  4. It feed on the nectar of a variety of tropical flowers.
  5. It lays eggs on plants of the tropical nightshade (a poisonous flowering plant). The red and purple striped caterpillars feed on these toxic plants and store the alkaloids in their tissues, making them distasteful to predators such as birds.They retain their toxicity in adulthood. The same alkaloids that make them poisonous also are converted into pheromones by the males, which use them to attract females.
  6. These butterflies has long migrations and their males gather for the purposes of competitive mating display.
Resources
  1. Greta oto in http://en.wikipedia.org/wiki/Glasswing_butterfly
  2. Transparent Butterfly in http://www.photopumpkin.com/photo-blog/transparent-butterfly/

Friday, July 25, 2008

Visualforce

Visualforce is a framework provided by Salesforce to build and deploy any kind of user interface in real-time. User interfaces build from Visualforce can have similar look and feel as the Salesforce web pages, or replace it with a complete unique style and set of interactions.


With introduction of Visualforce, salesforce.com created the first on-demand implementation of an MVC architecture. In the MVC architecture, the "model" represents the data model, the "view" represents the presentation of the data (user interface), and the "controller" represents the business logic that manipulates the data and controls the user interface.

Given below is an explanation of items in above diagram.

Pages


  1. "Canvas" or design surface similar to standard Web development model
  2. Composed of HTML, Page tags and merge fields
  3. Ability to reference any CSS, Flex, AJAX or other Web technology
  4. Supports standard query strings for parameters, referenced via /apex/page_name url syntax
  5. Composed on the server, not the client

Components

  1. Create Standard UI elements, such as detail areas and related lists, with a single tag
  2. Built in data binding
  3. Special UI elements, such as tab panels and repeat (iterators)
  4. Built in AJAX functionality supporting incremental page refresh
  5. Over 50 components in the first release
  6. Accessed through syntax

Controllers


  1. Controllers contain the logic and data references a page uses
  2. Separates presentation from logic
  3. Created in Apex code providing full access to Apex functionality (API, Web services,etc)
  4. Pages interact with controllers through components
  5. Maintain state across page interactions
  6. Standard controllers implement normal app behavior (view, edit, save, etc)


Referances:

Monday, July 14, 2008

Project Management

The following image was e-mailed to me by Sadeepa Palliyaguru. He has got this image from stumbleUpon



I think this image very funny and thought provoking. A Large number of project end up like this. But now there is savior called PMBOK Guide. The PMBOK Guide is set of guidelines which will help you to
  • Learn from past projects that have run into similar problems and avoid running into them again.
  • Plan and excecte projects to avoid common pitfalls

Population of Sri Lanka

Following was an interesting picture I found on population on Sri Lanka. I managed to get this picture from online edition of Daily Mirror


Following points should be noted from this picture

  • Increase in female population. This could be attributed to the ethnic conflict we having for more than 25 year and death of young people specially men due 2 JVP led insurgencies in early 1970s and late 1980s.
  • Sri lanka is economically depending on 2 of the most populous giants of world. Namely China and India. In future we will have to manage relationship with these competing giants very carefully because antagonizing either one will have serious consequences economically as militarily.

Wednesday, July 9, 2008

Polymorphism

Objects can respond differently to the same message (call of a method). Both waiter as kitchen respond to 'a black coffee' through prepare coffee method.
Action steps of this "prepare coffee" method of waiter and kitchen is different as given below.

Actions in Waiter's "prepare coffee" method
  • Pass the message to the kitchen.
  • Wait for response.
  • Delivers coffee and settles the account.
Actions in Kitchen's "prepare coffee" method
  • Kitchen brews fresh coffee
  • Passes it to the waiter.

As shown in above figure the same message with different implementations, that is polymorphism. The pseudo code representation of prepare method can be given as shown below

Class Waiter {
Prepare Coffee () {
Pass the message to the kitchen
Get
the response from kitchen
Settle the account
Deliver the coffee
}
}

Class Kitchen {
Prepare Coffee () {
Brews fresh coffee
Deliver the coffee to waiter
}
}

This type of polymorphism is called in several names like Single polymorphism, Overriding, Dynamic binding polymorphism, Late binding polymorphism

There is another type of polymorphism called Multiple polymorphism. This can be viewed as Object responding similarly for different types of messages.

In the above image two different messages are given as "money for black coffee" and "black coffee". Since the response is similar the action "prepare coffee" name is persevered. A parameter is introduced to the action (method) to distinguish the two types of messages. The pseudo code representation of prepare method can be given as shown below

Class Waiter {
Prepare Coffee () {
Pass the message to the kitchen
Get
the response from kitchen
Settle the account
Deliver the coffee
}

Prepare Coffee (money) {
Settle the account
Pass the message to the kitchen
Get
the response from kitchen
Deliver the coffee
}
}

This type of called by names like Overloading, Static binding polymorphism, Early binding polymorphism.
The Static binding and Early binding polymorphism names are used because the reference to a method occur at the compile time. In other words if following code is used in a Object Oriented language it will give an error because "kitchen" object does not have a "
Prepare Coffee (money)" method.

waiter.Prepare Coffee (money);
kitchen.Prepare Coffee (money);


Resources

Encapsulation

Encapsulation means object acting as a container for its features (variables and methods). Objects cannot see other objects variables and their method implementations. But objects can exchange things between each other through public methods. Here a public method acts as door between 2 objects. But the public method will not show other object the steps it will take to give the output.As shown in the above figure, it is similar to a customer going to a canteen and ordering a cup of tea over the counter. Here the customer does not know how the canteen prepares a cup of tea. He only knows how to order a cup of tea.

Resources

Thursday, July 3, 2008

Cloud Computing

Definition
Using Computing resources which are typically owned and operated by a third-party provider who maintains facility housing computer systems and associated components, such as telecommunications and storage systems. Even though the third-party provider's resources are distributed (sometimes located in different locations) the consumer will see resource being offered by one entity. Consumers of cloud computing services purchase computing capacity on-demand and are not concerned with the underlying technologies used to achieve the increase in server capability.

Reasons for Cloud Computing to be popular
  • Connectivity cost between computer resources continue to fall.
  • Computing hardware becomes more efficient at operating at scale.
  • The economic incentives to share hardware among multiple users are increasing.
  • The drawbacks in performance and interactive response that used to discourage remote and distributed computing solutions are being greatly reduced
Because of above reasons usage of cloud computing encompass not only web application but storage management, providing raw computing power and other specialized services.

Examples
  • Software as a Service (SaaS) offer by Salesforce is a cloud computing service offered to manage customer relationships in an organization.
  • Google Apps which offer collaborative usage of Google Calender, Google Doc etc

Relationship to Grid Computing
Cloud computing is technically realized through grid computing. Grid computing is term used for 2 categories of distributed computing
  1. Online computation or storage offered as a service supported by a pool of distributed computing resources.
  2. The creation of a "virtual supercomputer" composed of a network of loosely-coupled computers, acting in concert to perform very large tasks.
Advantages of Cloud Computing
  • Location of infrastructure in areas with lower costs of real estate and electricity.
  • Improving overall utilization of resources by sharing capacity among a large pool of users.
  • Separation of infrastructure maintenance duties from domain-specific application development. Thereby allowing uses of cloud computing to concentrate on application development.
  • Separation of application code from physical resources. Thereby providing an common API to access the physical resources.
  • Ability to use external assets to handle peak loads.
  • Not having to purchase assets for one-time or infrequent intensive computing tasks. Thereby introducing a concept of subscription to service instead of buying a software.
  • Ability to scale to meet changing user demands quickly, usually within minutes
Architecture
The architecture behind cloud computing is a massive network of "cloud servers" interconnected as if in a grid running in parallel, sometimes using the technique of virtualization (making multiple physical resources appear as a single virtual resource) to maximize the utilization of the computing power available per server.
The image below gives the architecture behind cloud computing.

Explanation of the constituents of the cloud computing architecture is given below.
  • User interaction interface: This is how users of the cloud interface with the cloud to request services.
  • Services catalog: This is the list of services that a user can request.
  • System management: This is the piece which manages the computer resources available.
  • Provisioning tool: This tool carves out the systems from the cloud to deliver on the requested service. It may also deploy the required images.
  • Monitoring and metering: This optional piece tracks the usage of the cloud so the resources used can be attributed to a certain user.
  • Servers: The servers are managed by the system management tool. They can be either virtual or real.

Following are the 4 principles laid down by Albert Wenger of Union Square Ventures defining a perfect cloud.
  • No more machines
i.e when deploying cloud infrastructure you shouldn't have to worry about individual
machines. i.e using Amazon means dealing with machine instances, therefore according to
him it is not cloud computing.
  • Code over configuration
The cloud should be really easy to deploy. The set up should basically take care of itself
and there should be no reason for you to waste valuable time worrying about configuring your cloud set up.
  • No fail whale
The cloud must painlessly scale and your code should keep working like it did the day you
first wrote it no matter how much you grow. i.e code needs to scale without unreasonable expectations placed on the developer.
  • It's mashable
Cloud computing should make it really easy to bring web services together.

Reference

Wednesday, July 2, 2008

UML,Class Diagrams & Netbeans 6.1

UML representation of a class has 3 compartments as shown in Figure 1

Figure 1

1. The name compartment (required) contains the class name and other documentation-related information: E.g.:
Some_class «abstract»

{ author: George Jetson
modified: 10/6/2999
checked_out: y
}
  • Guillemets identify stereotypes. E.g.: «utility», «abstract» «interface».
  • Can use a graphic instead of word.(«interface» often represented as small circle)
  • Access privileges or visibility (see below) can precede name
  • Use italics for abstract-class and interface names.
2. The attributes compartment (optional):
Everything except constant values must be private, Always.

3. The operations compartment (optional) contains method definitions:
message_name(arguments): return_type
Resist the temptation to use implementation-language syntax.

Visibility (access privileges) indicated as follows:


+public
#protected
~package
-private
--implementation visibility (inacessible to other objects)
(+)forced public.Override of an interface method
that should be treated as private, even if it's declared as public



How to create class diagrams in Netbeans 6.1

1. «utility», «abstract» «interface» can be created as shown in Figure 2

Figure 2

2. Attribute of a class can be created by right-clicking on the Attributes label in class diagram as shown in Figure 3.

Figure 3

3. Properties of the attribute can be set by selecting the new attribute by clicking on it and editing the properties as shown in Properties window (Figure 4)

Figure 4

4. Operation of a class can be created by right-clicking on the Operations label in class diagram as shown in Figure 5

Figure 5

5. Properties of the operation can be set by selecting the new operation by clicking on it and editing the properties as shown in Properties window (Figure 6)

Figure 6


References

Tuesday, June 17, 2008

JUnit 3.8 in Brief

Following text was extracted from "Test Driven - PRACTICAL TDD AND ACCEPTANCE TDD FOR JAVA DEVELOPERS" book.

1. The name of the class should indicate that it’s a test—for example, have the class name start with Test.
2. Extend from JUnit’s TestCase class.
3. The instance variables set up in the setUp() method represent the common fixture for the test methods.
4. Prepare a known state for the test by overriding the protected setUp() method.
5. If using Java 5, it’s good to add the @Override annotation to setUp() and tearDown() to avoid typos.
6. Clean up after our test by overriding the protected tearDown() method.
7. All public void methods starting with test are considered test cases by the JUnit 3.8 TestRunner.
8. Test methods can declare any exceptions—JUnit catches them.
9. Can declare any number of helper methods as long as they don’t look like test methods.
10. Extending TestCase gives a bunch of assertion methods such as assertEquals().

Friday, March 14, 2008

Web sites & Information

Most of the web sites today has lot of data, thereby getting the reader overloaded. A reader has to read a lot to find a interesting in them.

What users need is new set of browsers where user can expose relevant information. These browsers should allow the users see following items at a click of a button for a given web page.

1) Only images/ media files
2) Heading & Sub-heading
3) Starting paragraph
4) Conclusion
5) First sentence of a paragraph.
6) Last sentence of a paragraph.
7) Any combination of items 1 to 6

With above type of arrangement user can scan a web page and decide whether data in the site is relevant for him.