My Sites


Monday, June 10, 2013

A Look At The Uptime Of 50 Popular APIs

Application Programming Interface (API) is a specification of how some software components should interact with each other.In practice in most of the cases an API is a library that usually includes specification for routines, data structures, object classes, and variables.
You Can find any API from following link....cheers!!!

http://webapifinder.com/api/mostpopular
 

Wednesday, June 5, 2013

Jquery on Eclipse Juno

1) Install the plugin of following id JSDT jQuery Integration
(You can find it on Eclipse market places)
2)Go to Project Explorer--> JavaScript Resources

3)Right click on it and go to properties.
4)select "Add javascript library"
 enter image description here
5)select "j Query Library"
6) You will get code completion as follows  
 enter image description here

Monday, June 3, 2013

What is there behind Facebook?

Facebook 

1.Memcached
This is a distributed memory caching system which Facebook uses a caching layer between the web servers and MySQL servers.
2.HipHop for PHP
 Hip pop converts PHP (Server-side HTML embedded scripting language) into c++ code which can be then be compiled for better performance.And also PHP is used for the front-end.

3.Haystack
This is the Facebook's high performance photo storage/retrieval system.haystack is an object store.Facebook serves around 1.2 million photos per second.And each photo is saved in 4 different resolutions,resulting in more than 80 billion photos.
    4 .Cassandra
    Cassandra is a distributed storage system with no single pint of failure

    5.Scribe
    This is a flexible logging system that Facebook uses for many purposes internally.
  
   6.Erlang
   Used for the chat engine.

Wednesday, May 29, 2013

What is delegation in oops concept?

Delegation allows the behavior of an object to be defined in terms of the behavior of another object.Delegation is alternative to class inheritance. Delegation is a way of making object composition as powerful as inheritance. In delegation, two objects are involved in handling a request.A receiving object delegates operations to its delegate. this is analogous to the child classes sending requests to the parent classes.

How to Iterate Over a Map in Java

1.Iterating over entries using For-Each loop.

Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
    System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
}

 

2.Iterating over keys or values using For-Each loop.

Map<Integer, Integer> map = new HashMap<Integer, Integer>();
//iterating over keys only
for (Integer key : map.keySet()) {
    System.out.println("Key = " + key);
}
//iterating over values only
for (Integer value : map.values()) {
    System.out.println("Value = " + value);
}

 

 3. Iterating using Iterator.  

Using Generics

Map<Integer, Integer> map = new HashMap<Integer, Integer>();
Iterator<Map.Entry<Integer, Integer>> entries = map.entrySet().iterator();
while (entries.hasNext()) {
    Map.Entry<Integer, Integer> entry = entries.next();
    System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
}

 Without Generics:

Map map = new HashMap();
Iterator entries = map.entrySet().iterator();
while (entries.hasNext()) {
    Map.Entry entry = (Map.Entry) entries.next();
    Integer key = (Integer)entry.getKey();
    Integer value = (Integer)entry.getValue();
    System.out.println("Key = " + key + ", Value = " + value);
} 

4. Iterating over keys and searching for values (inefficient).

Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for (Integer key : map.keySet()) {
   
Integer value = map.get(key);
   
System.out.println("Key = " + key + ", Value = " + value);
}

Tuesday, April 23, 2013

My First Work :) :)

Still because I am a first year student my exposure to different technologies is somewhat low.For the first year we are learning programming concepts with C++.
Anyway I am very new to java programming.For now I'm very much know the basics but beyond that I still learning it.
So Pearson :) ...As my first task I had to join a new team which they were creating new web applications to Pearson dashboard.So I was given some time for a POC (Proof of concept).My task was to check whether we can integrate Google Chart tool with our applications.I had to go through the Google JSAPI API,Google Visualization API and I had to create some sample applications of jsp and servlets in J2EE from Eclipse juno IDE.Also I had to convert the javaobjects to JSON strings using Jackson...
I was able to achieve my task successfully within the given time which I was very happy.I got some help from my collegues for that.
So as I'm new to J2EE I would like to mention some areas which I found interesting for all the beginners out there.Cheers!!
Apache Maven
So some users may say it's a build tool which used in preprocessing ,compilation,packaging ,testing and distribution.Some users might say it's a project management tool.Indeed! What I also like to call Maven,is a project management tool.Because it is a PM tools with all the  features in a build tool.In addition to building capabilities Maven has the option to run reports and generate websites also.And specially what is great about Maven is,it provides the facilities to communicate among members  of the working team.
Tomcat
It is an open source stand-alone web server which provides the official reference implementation of the JSP (Java Server Pages) and java Servlets technoogies.Simply it serves dynamic web content based on Java technology.In other words it is a cotntainer for servlets.First we have to create JSP code or servlets,create some web pages in HTML to reference them,Then what happens is,it compiles everything, deploy it to Tomcat (which encapsulates it in a container), and test it via a web browser.

Ant-It is a java based software (Mainly a build tool)

Cactus-It is a test framework for unit testing server side code

JSON It means Java Script Object Notation.It is a syntax uses for storing and exchanging text information much like XML.JSON is smaller than XML but faster and easier to understand.
{
"student": [
{ "firstName":"Amila" , "lastName":"Iddamalgoda" }, 
{ "firstName":"Malith" , "lastName":"Iddamalgoda" }, 
{ "firstName":"Siri" , "lastName":"Iddamalgoda" }
]
}
Uses to describe the data objects.It is a platform independent language.

JACKSON It is a high performance JSON processor java library.I used this for converting Java object to/from JSON.
Jackson contains 6 seperate .jars.For the conversion I only needed the "jackson-mapper-asl".Just add the following dependency to the pom.xml in maven project.

  <repositories>
 <repository>
  <id>codehaus</id>
  <url>http://repository.codehaus.org/org/codehaus</url>
 </repository>
  </repositories>
 
  <dependencies>
 <dependency>
  <groupId>org.codehaus.jackson</groupId>
  <artifactId>jackson-mapper-asl</artifactId>
  <version>1.8.5</version>
 </dependency>
  </dependencies>

Monday, April 22, 2013

Useful Eclispe IDE Shortcut keys

Programming java based applications(java,jsp,servlets,android) in Eclipse is very easy.Much easier if we know the essential shortcut keys of Eclipse.Here I have mentioned some effective shortcut keys which I found very interesting. Cheers!!

Ctrl+N -For a new project
Ctrl+Alt+n   -Create a new class,file..etc
Ctrl+Shift+R- Open Resource
Ctrl+S-Save project
F5-Refresh
Ctrl+space-Intellisence
Ctrl+D-Delete Line
Ctrl+F-Open find and replace dialog
Shift+Ctrl+y-Change selection to all lower cases
Shift+Ctrl+x-Change selection to all lower cases
Ctrl+Shift+/ Add block comment
Ctrl+Shift+\ Remove block comment
Ctrl+/-Add single line comment
Ctrl+L-Go to line
F11-Debug
Ctrl+h -Open File Search
Ctrl+Shift+F-Format code
Alt+Shift+R-Refactoring -Rename