Wednesday, February 4, 2015

Device Driver Using Eclipse

Basic Device Driver Using Eclipse

Hi friend, Development of Device Driver for kernel of is a tedious task but if you have your best IDE Eclipse then this work will be very easy.
In this article I am going to show how you can develop your basic device driver with Eclipse using Linux Kernel Development Plug in.

Basic Requirement:

  1. Linux Ubuntu/Debian or other
  2. Eclipse IDE
  3. Linux Kernel Development Plug-in

Steps for Creating Basic Driver:


First we need to install the Eclipse plug-in that is Linux Kernel Development from  Eclipse Market   Place.

 

After successful installing of plug-in in your IDE, Kindly Restart  your IDE. Now you will see the new icon in your eclipse.Now we ready to create the our first Driver.

Go to project create new project from Select Wizard  and choose the new Device Driver Project.


Now Give Name for your Driver. In this sample I gave name as MyDriver and author name pankaj  as you can see in this image.Click Finish.

Now you can see that your sample device driver is ready in Package Explorer.
In your workspace one MyDriver.c file is there.This file is auto generated file by eclipse. Now your Driver module is there to load in your kernel.

 

For adding this module to kernel you have to select project  and go to  utility in  in following way which is given below-


After that






Thanks 
              
                























Monday, January 26, 2015

RestWebService

Simple Rest Creation


Steps for rest creation 

If we want to create Rest webService so we have to follow following rules:
  1. Create Project RestWebService and inside src,create  package com.pankaj.rs.
  2. Create class RestDemo.java.
  3. Use annotation @Path and give path like this:@Path("resttest")
  4. Create one method inside that class:restTest().
  5. use annotation again GET. It will accept the request which will come by path.
  6. Use annotation again for display the output as you want. @Produces(MediaType.TEXT_PLAIN). it will return the output in Text Format.

you can see the code given below:

package com.pankaj.rs;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("resttest")
public class RestDemo {
       
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String restTest() {
        return "welcome to rest Service";
    }
       
}

  7. After that deploy this application in Tomme Server/Tomcat Server.
  8. you can access this service in your Browser by given path:
     http://localhost:8080/RestWebService/resttest/


    OUTPOUT: welcome to rest Service


Two request Handle by One Service:

For that you have to give path inside the class on the the top of the method like given below.
If we want to send any value from url the we have to use specific way in path annotation and we have to use @PathParam("userValue") String name in method parameter.It will same as the value we are passing in path variable.
@Path("resttest/{userValue}").

Full Code is given  below:

package com.pankaj.rs;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;


public class RestDemo {
    //String name ="Hello Rest";
    @Path("resttest")
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String restTest() {
        return "welcome to rest Service";
    }
   
    @Path("resttest/{userValue}")
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String restTestParam(@PathParam("userValue") String name) {
        return name;
    }
   
}

After that deploy in Tomme Server.

   when you will normal url:
   http://localhost:8080/RestWebService/resttest/
         
      outpout: welcome to rest Service
 
 
   when you will give parameter in URL the output will be different.

http://localhost:8080/RestWebService/resttest/I%20love%20my%20India
     outtput:I love my India

Friday, January 23, 2015

WebService

                 Creating WebService Using Eclipse

For Creating webService using Apache Tomme Server is very Simple.You can create the webservice by following way-
Basic Requirement:
       1.JDK 1.7
       2.Apache Tomme Server or Apache Tomcat Server 7
       3.Eclipse IDE
       4.Soap GUI Tool

Package Structure In Eclipse                     


This the Simple structure ,which we can follow to create web service.

Steps For Creating Service  

 a.First we will create a  Class
          HelloService.java.  
    
package com.pankaj.ws;

import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService
public class HelloService {
private String message = new String("Hello, ");

public void Hello() {
}

@WebMethod
public String sayHello(String name) {
return message + name + ".";
}
}

In this class ,@WebService annotation is responsible for creating webservice.We can say that this class is annotation based Service.With this way, you can skip the process of creating the wsdl by Eclipse. Due to this annotaion wsdl will genrate automaticlly.

2. After creating this class we will deploy this class to Tomme server.

    For getting wsdl we will use the following proces-
             http://localhost:8080//WebServiceDemo/HelloServiceService?wsdl



Wednesday, January 21, 2015

Hackers Quality


The world is full of fascinating problems waiting to be solved.

Being a hacker is lots of fun, but it's a kind of fun that takes lots of effort. The effort takes motivation. Successful athletes get their motivation from a kind of physical delight in making their bodies perform, in pushing themselves past their own physical limits. Similarly, to be a hacker you have to get a basic thrill from solving problems, sharpening your skills, and exercising your intelligence.
If you aren't the kind of person that feels this way naturally, you'll need to become one in order to make it as a hacker. Otherwise you'll find your hacking energy is sapped by distractions like sex, money, and social approval.
(You also have to develop a kind of faith in your own learning capacity — a belief that even though you may not know all of what you need to solve a problem, if you tackle just a piece of it and learn from that, you'll learn enough to solve the next piece — and so on, until you're done.)

No problem should ever have to be solved twice.

Creative brains are a valuable, limited resource. They shouldn't be wasted on re-inventing the wheel when there are so many fascinating new problems waiting out there.
To behave like a hacker, you have to believe that the thinking time of other hackers is precious — so much so that it's almost a moral duty for you to share information, solve problems and then give the solutions away just so other hackers can solve new problems instead of having to perpetually re-address old ones.
Note, however, that "No problem should ever have to be solved twice." does not imply that you have to consider all existing solutions sacred, or that there is only one right solution to any given problem. Often, we learn a lot about the problem that we didn't know before by studying the first cut at a solution. It's OK, and often necessary, to decide that we can do better. What's not OK is artificial technical, legal, or institutional barriers (like closed-source code) that prevent a good solution from being re-used and force people to re-invent wheels.
(You don't have to believe that you're obligated to give all your creative product away, though the hackers that do are the ones that get most respect from other hackers. It's consistent with hacker values to sell enough of it to keep you in food and rent and computers. It's fine to use your hacking skills to support a family or even get rich, as long as you don't forget your loyalty to your art and your fellow hackers while doing it.)

The Hacker Attitude


Hackers solve problems and build things, and they believe in freedom and voluntary mutual help. To be accepted as a hacker, you have to behave as though you have this kind of attitude yourself. And to behave as though you have the attitude, you have to really believe the attitude.
But if you think of cultivating hacker attitudes as just a way to gain acceptance in the culture, you'll miss the point. Becoming the kind of person who believes these things is important for you — for helping you learn and keeping you motivated. As with all creative arts, the most effective way to become a master is to imitate the mind-set of masters — not just intellectually but emotionally as well.
Or, as the following modern Zen poem has it:


  •   To follow the path:
  •   Look to the master,
  •   Follow the master,
  •   Walk with the master,
  •   See through the master,
  •   Become the master.
So, if you want to be a hacker, repeat the following things until you believe them:

Hacker


The Jargon File contains a bunch of definitions of the term ‘hacker’, most having to do with technical adeptness and a delight in solving problems and overcoming limits. If you want to know how to become a hacker, though, only two are really relevant.

There is a community, a shared culture, of expert programmers and networking wizards that traces its history back through decades to the first time-sharing minicomputers and the earliest ARPAnet experiments. The members of this culture originated the term ‘hacker’. Hackers built the Internet. Hackers made the Unix operating system what it is today. Hackers make the World Wide Web work. If you are part of this culture, if you have contributed to it and other people in it know who you are and call you a hacker, you're a hacker.

The hacker mind-set is not confined to this software-hacker culture. There are people who apply the hacker attitude to other things, like electronics or music — actually, you can find it at the highest levels of any science or art. Software hackers recognize these kindred spirits elsewhere and may call them ‘hackers’ too — and some claim that the hacker nature is really independent of the particular medium the hacker works in. But in the rest of this document we will focus on the skills and attitudes of software hackers, and the traditions of the shared culture that originated the term ‘hacker’.

There is another group of people who loudly call themselves hackers, but aren't. These are people (mainly adolescent males) who get a kick out of breaking into computers and phreaking the phone system. Real hackers call these people ‘crackers’ and want nothing to do with them. Real hackers mostly think crackers are lazy, irresponsible, and not very bright, and object that being able to break security doesn't make you a hacker any more than being able to hotwire cars makes you an automotive engineer. Unfortunately, many journalists and writers have been fooled into using the word ‘hacker’ to describe crackers; this irritates real hackers no end.
The basic difference is this: hackers build things, crackers break them.