Monday, April 29, 2013

create restful web service using eclipse


In this article I would like to explain the creation of sample restful service,  
Tools used,

  • Eclipse Indigo
  • Maven build tool
Create restful web service using jersey.


We have to install maven plugins in Eclipse to start, follow the below section to install maven tool in Eclipse.

Install maven tool


  • Also add Maven Integration for Eclipse WTP using the repository 
http://m2eclipse.sonatype.org/sites/m2e-extras select only ‘Maven Integration for Eclipse WTP’ and install


In order to set local maven repository go to the workspace and run the command
mvn -Declipse.workspace= eclipse:add-maven-repo
if the above command is not working, set the maven_home appropriately in the environment variable.

Create Project
Now you have to go and create a new project in the Eclipse. Go New=>project=>Maven Project=> and click next in the final window give as given in the window
In the final step you can provide as follows
Now you can remove the junit test classes and packages if you want and you can make the changes in the generated package and class.


Create a restful web service.

You can create a restful service class as given below.
package com.smashplus;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
@Path("/test")
public class TestRest {
@GET
@Path("/{name}")
public Response getMsg(@PathParam("name") String name) {

String output = "Hello, " + name;

return Response.status(200).entity(output).build();
}
}
In the above class we used following annotations. 

@Path(path) annotation Sets the path to base URL + /path provided. The base URL is based on your application name, the servlet and the URL pattern from the web.xml" configuration file.

@PathParam : Used to inject parameter values from the URL into a method parameter. This way we can inject values like ID to pass to the restful service.

@Get : GET Request

Then we need to add the web.xml file, This will have the mapping to the corresponding restful service class. Here if the request comes matches with the path  /resources/*  it will redirect to the jersey servlet and jersey container will find appropriate resource class available in the mentioned package here it is com.smashplus and the resource class is TestRest. Web.xml file should add in to the path src\main\webapp\WEB-INF\.

<web-app id="WebApp_ID" version="2.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/j2ee" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 <display-name>Restful Web Application</display-name>

 <servlet>
  <servlet-name>TestServlet</servlet-name>
  <servlet-class>
       com.sun.jersey.spi.container.servlet.ServletContainer
   </servlet-class>
  <init-param>
       <param-name>com.sun.jersey.config.property.packages</param-name>
       <param-value>com.smashplus</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
 </servlet>

 <servlet-mapping>
  <servlet-name>TestServlet</servlet-name>
  <url-pattern>/resources/*</url-pattern>
 </servlet-mapping>

</web-app>


final pom.xml file will look like as follows
..code excluded..
<packaging>war</packaging>
...code excluded..
<build>
    <finalName>restdemo</finalName>
    <plugins>
       <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>2.3.1</version>
           <configuration>
               <source>1.6</source>
               <target>1.6</target>
           </configuration>
       </plugin>
       <plugin>            
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-war-plugin</artifactId>
 <configuration>
   <webXml>src\main\webapp\WEB-INF\web.xml</webXml>        
 </configuration>
</plugin>
    </plugins>
    </build>
Now you can deploy the war file to the server. I am using Tomcat 6.0 for the deployment, and visit below service URL http://localhost:8080/restdemo/resources/test/Smashplus

The output will be,


Hello, Smashplus
Download Souce code(select File=>Download) 
Share your thoughts

Friday, April 26, 2013

Disqus Error in Blogger

If you are getting the below error in IE9 after configuring the Disqus in your blogger site

This page is forcing your browser to use legacy mode, which is not compatible with Disqus.Please see our troubleshooting guide to get more information about this error.

Troubleshoot the error

This error occurring is due to IE7 emulation. Some websites force Internet Explorer to load emulating an older version of Internet Explorer. You can check by opening the development tools (Press F12) and checking the Document Mode.

If it says Internet Explorer 7 Standards, you can switch this to Internet Explorer 8/9 Standards to load Disqus properly. If you are a user of this webpage you can follow this.



If you are the owner of this blog you can correct this issue.
The most common reason the page would load in IE7 standards is because of the EmulateIE7 meta tags. Look in your page source and find an HTML tag similar to this:

Click on Template->Edit HTML-> Edit Template-> Ctrl+F and Search for 'EmulateIE7' in the editor window. Following line will appear.


<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>

You can either remove this or change it to use the latest version of IE available as follows:


<meta content='IE=9; IE=8; IE=7; IE=EDGE; chrome=1'  http-equiv='X-UA-Compatible'/>


Then open the development tool again (press F12) in your site and you can see the document mode changed in to IE9 standards. Now the Disqus will load properly.



Now see the Disqus will appear as follows.

Try it out..
Share your thoughts

Friday, April 19, 2013

Various Courses after SSLC

This year SSLC results are publishing after April 25th. Following Lists out the various career path students can can follow after SSLC.

Higher Secondary Courses .(Plus Two)

Three different groups are available in Higher Secondary Course. Outlined below. In all the three categories English and any second language is mandatory subject. Second language you can chose based on your likes Mostly students opting for Malayalam, Hindi, Arabic, Urdu. Options for Sanskrit, Syrian French etc are available.

Following listing out various groups and the options are available.

a) Science Group
This group of course will be the first step which moulds based on your interest. If you would like to pursue a career in the Medical Field or Engineering field you have to choose this group.

Mandatory subjects are Physics and Chemistry,Various sub combinations are available for the rest of the courses as given below.


  •  Mathematics and Biology
  • Mathematics and Computer Science.
  • Home Science and Biology,
  • Mathematics and Home Science.
  • Mathematics and Electronics.
  • Mathematics and Geology.
  • Computer Science and Geology
  • Mathematics, Statistics
  • Biology, Psychology.
b) Humanities Group

Combination 1:
Main: History, Economics, Political Science

Optional
  • Geography 
  • Sociology
  • Geology
  • Music
  • Gandhian Studies
  • Philosophy
  • Social Work.
  • Psychology
  • Anthropology
  • Malayalam
Combination 2:

Main: Islamic History and Culture, Economics, Political Science

Optional:
  • Geography
  • Sociology
Combination 3:

Main: History, Economics, Geography and

Optional:
  • Malayalam
  • Hindi
  • Arabic
  • Urdu Etc.
Other combinations are below,
  • History, Philosophy, Sanskrit Sahitya and Sanskrit Sastra.  
  • History, Economics, Political Science and Statistics.
  • Sociology, Social Work, Psychology and Statistics.
  • Economics, Statistics, Anthropology and Social work
  • Economics, Gandhian Studies, Communicative English and Computer applications.
  • Journalism, English Literature, Communicative English and Psychology
  • History, Economics, Sociology and Malayalam
  • History, Economics, Political Science and Malayalam
  • History, Economics, Gandhian Studies and Malayalam
  • Social Work, Journalism, Communicative English and Computer Applications.
  • History, Economics, Sociology and Hindi
  • History, Economics, Sociology and Arabic.
  • Sociology,Journalism,Communicative English and Computer Application
c) Commerce Group

Following are the options available in commerce group

1.Business Studies, Accountancy, Economics, Mathematics.

2.Business Studies, Accountancy, Economics, Statistics.

3.Business Studies, Accountancy, Economics, Political Science.

4.Business Studies, Accountancy, Economics, Computer Applications

Poly technic Courses

Following list of courses are offering in the Polytechnic colleges in Kerala.
1. Civil Engineering
2. Mechanical Engineering
3. Electrical & Electronics Engineering
4. Electronics Engineering
5. Textile Technology
6. Computer Engineering
7. Instrument Technology
8. Commercial Practice
9. Electronics & Avionics
10. Electronics & Instrumentation
11. Electronics & Communication
12.Computer Application & Business Management
13. Computer Hardware and Maintenance

There are 49 gevernment poly technic colleges are in Kerala also 6 financing colleges spread in 14 districts of Kerala. Above listed courses are offering in these colleges

List of colleges offering poly technic courses - Visit for details
Prospectus for the last year 2012-2013 : link you can refer for the details
Share your thoughts

Tuesday, April 16, 2013

Dubai Salik - Details

What is Salik

Salik is the  Dubai’s road toll collection system.
The heart of the system is the Salik tag which is attached to the vehicle windshield and utilizes the latest Radio Frequency Identification (RFID) technology to positively identify the vehicle as it passes through a Salik tolling point.

Motorists with electronic Salik car tags will be automatically charged Dh4 each time they pass through the gates, with an upper limit of Dh24 a day regardless of the number of trips.Commuters without Salik tags, or insufficient Salik account credit, will be fined if they pass through the gates

Salik Gates

 There are four Salik gates in Dubai — two on Shaikh Zayed Road and one each on Al Maktoum and Al Gharhoud bridges. Two more salik gates introduced in April 15, 2013. Listed below.

New Salik Gates
  1. Al Ittihad Road near Al Mamzar Bridge - Will be using by Sharjah and Ajman-based commuters
  2. Beirut Road near Airport Tunnel.
How it works

Each time you pass through a Salik tolling point your vehicle is detected using Radio Frequency Identification (RFID) technology that is built into your Salik sticker tag and the toll of AED 4 will be deducted from your prepaid toll account.
  ref:http://www.salik.gov.ae/en/home 

Share your thoughts

Monday, April 8, 2013

How do I find a job in Dubai

Job in Dubai

Create profile
Your profile which you can call as Resume, CV or bio-data that is the catalogue which clearly explains about yourself. You should have a clear resume to highlight your strengths, achievements, job profile etc. You have to update your contact and reference information.
job in dubai
Dubai again becoming a job hub for handful of jobs

Spread your profile 

=> Register in the online career sites. 
Following are the popular portal in Dubai that lists various jobs in various industries. 
=> Share with your network

Apply
=> You can login and apply in the job sites for the advertised position which matches your skill set 
=> Apply for the position listing in the news paper like gulfnews, khaleejtimes etc.
=> Apply for the suitable position listing company websites 
     eg:www.emiratesgroupcareers.com

Please note You have to highlight your skills which matches for the job. Like if you are applying for IT position you have to highlight your  IT skills.

Interviews
If your resume shortlisted the company will call for the interview. So dont miss your mail box checking everyday. Also confirm your timings with the company for the intervew.
Prepare well before going for the interview. Also learn some thing related to the company from internet.











Share your thoughts