Life is a dream for the wise, a game for the fool, a comedy for the rich, a tragedy for the poor. Sholom Aleichem
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.
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."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.
<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
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
Saturday, April 13, 2013
How to Make Your Web Site as User's Home Page
I have included the following java script code.So,copy it and paste it inside your Homepage code.Once the Hyperlink is clicked that Website will be the Homepage of the browser.... Cheers !!!
<script language="JavaScript">
if (document.all){
document.write
('<A HREF="javascript:history.go(0); "onClick="this.style.behavior=\'url(#default#homepage)\';
this.setHomePage(\'http://www.YourWebSiteHere.com\');">');
document.write('<font size="5" color=6699FF face=arial>
<B>Click Here to Make My Web Page Your Homepage</B></font></a>');
}
</script>
<script language="JavaScript">
if (document.all){
document.write
('<A HREF="javascript:history.go(0); "onClick="this.style.behavior=\'url(#default#homepage)\';
this.setHomePage(\'http://www.YourWebSiteHere.com\');">');
document.write('<font size="5" color=6699FF face=arial>
<B>Click Here to Make My Web Page Your Homepage</B></font></a>');
}
</script>
Monday, April 8, 2013
Pearson at a glance
Pearson has a primary listing on the London Stock Exchange and is a constituent of the FTSE 100 Index. It has a secondary listing on the New York Stock Exchange.
Pearson Learning Solutions (PLS) features a rich set of learning tools, resources, and support services for educators worldwide. Our learning platform has driven the building and support of sophisticated fully online, on-ground, and blended learning environments since 1996. We are backed by the world’s leading education technology company, Pearson, helping to educate more than 130 million learners worldwide. We create customizable online learning systems, courses, and programs that take advantage of Pearson’s vast array of digitized and rich-media learning materials. We give students, teachers, and administrators what they need to reach new and exciting levels of academic achievement.
Pearson Education,
a company of Pearson, PLC has the most widely trusted and respected
programs in educational and professional publishing, and offer the most
comprehensive range of educational programs, in all subjects, for every
age and level of student, from preK-12 through higher education and on
into professional life. Our unparalleled businesses and brands include
Prentice Hall, Longman, Scott Foresman, Addison Wesley, Allyn &
Bacon, Benjamin Cummings, PASeries, ELLis, Celebration Press,
PEMSolutions, SuccessMaker, Waterford, and Family Education Network.
Pearson eCollege is a Pearson company that creates, services and powers many of the most successful online programs globally with Pearson Learning Studio, offering a personalized learning environment built on the most advanced, scalable and dependable SaaS(Software as a Service) learning platform available today. Together these platforms serve over 9 million students.
Begining Starts Now...
I always wanted to write my own blog, but unfortunately for lack of time, I never did,
until now. This week I decided to start my blog.So first of all let me introduce my self...
I'm Amila Iddamalgoda and I'm currently working at Pearson Lanka (Pvt) Ltd (former ecollege) as a Software Engineer (trainee).And I'm still a first year undergraduate in BEng Software Engineering(Hons) awarded by University of Westminster (UK). I'm doing my degree at Informatics Institute of Technology(IIT)Colombo,Sri Lanka.I studied at Sivali Central College ,Ratnapura,Sri Lanka from grade 1 to G.C.E.A/Ls.
I'm Amila Iddamalgoda and I'm currently working at Pearson Lanka (Pvt) Ltd (former ecollege) as a Software Engineer (trainee).And I'm still a first year undergraduate in BEng Software Engineering(Hons) awarded by University of Westminster (UK). I'm doing my degree at Informatics Institute of Technology(IIT)Colombo,Sri Lanka.I studied at Sivali Central College ,Ratnapura,Sri Lanka from grade 1 to G.C.E.A/Ls.
Subscribe to:
Posts (Atom)

