Friday, 31 August 2012

Track your lost devices like laptops & mobiles


I want to discuss about a system called as PREY
Its let's you to keep track of your expensive devices like
laptos, tabs & mobiles,
It can easily runs with windows, anroid, iOS  

How it works if you lost your devices
  • Its install into your pc in hidden mode, so thief cannot see it
  • From remote location via internet you can send message of theft.
  • Application can detect the location
  • Sends the screen shots & picture of thief in case of laptop
  • You can track the activities
You can find more details about it on http://preyproject.com/


Thursday, 30 August 2012

How to manage all passwords


For a regular internet user I  am sure that they must face the problem to remember the various web site's passwords. 
Its really too difficult to manage & remember all the login information, if we are not regularly using some web accounts it may happen that after a time either we forgot login name or the password. Some time it also take long time to recollect the login information.
Some of us use same password for all the logins or use some pattern to memorize all the password which is not a good idea.

Recently searched for the same and I found a good tools for that which I have described below





This tool allow us to set a master password & other all our logins are managed.
It gives plug-in for browser, after installing the plug-in when we enter the login information it ask to save the info. once we save the info next we don't need to worry about the login info username & password are automatically inserted & also offer for auto login.
we can use this tool for form filling, Fill the form information in advance and use it when ever required.

One feature about this tool which I liked most is
we can  share our password to our friends & that also without showing the password, isn't it COOL   
  • Combines a web service with a stand-alone program
  • Packed with features such as automatically filling in passwords, and accessing your passwords anywhere.
  • Internet Explorer 6+, Firefox 2.0+, Chrome 4+, Opera 11+, Safari 5+
  • Freeware and also provide premium accounts with other facilities
  • Download linkGet free LastPass Premium account

Thursday, 26 July 2012

C# File copy application, Learning file manipulation [source code attached]

file copy icon File copy
This is a simple file copy application in which you will going know about file handling functions and also some threading concepts available in C#

Overview of application
  • Developed in visual studio 2008, language C#
  • It's a Windows forms application
  • Only one instance can run at a time (using SingleExecution.cs)
  • FileCopy.cs contain main logic for program
  • Defination.cs is a static class holding the labels used within program
  • Download : Source code, Application
Screen shots


Thursday, 12 July 2012

JSP: How JSP is working ?


A basic tip for JSP beginners !!
  1. Get the request for any page (for eg: login.jsp)
  2. Search respective JspServlet (loginServlet.java)
  3. Parse the JspServlet file after that it  generate the servlet source and then load it
  4. finally generate the response & then send it !!
JSP execution

Thursday, 31 May 2012

Understanding JPA entities

  • A JPA entity is a java class referring to one row of a table
  • Each entity has same number fields/properties as in table structure
  • It can be with or without relationship
  • that is One to one, One to many or many to many
  • Consider the following table structure for one to many relationship
  • For above table structure two entity will be created
  • Categories.java (manage Categories table)
  • Products.java (manage product table)



//////////////////////////////////////////////////////////////////////
// CATEGORIES

package entities;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;

/**
* The persistent class for the Categories database table.
*
*/
@Entity
@Table(name="Categories")
public class Categories implements Serializable {
private static final long serialVersionUID = 1L;

@Id
@Column(name="CategoryId", unique=true, nullable=false)
private String categoryId;

@Column(name="CategoryName")
private String categoryName;

@Column(name="Description", length=50)
private String description;

//bi-directional many-to-one association to Products
@OneToMany(mappedBy="category", cascade={CascadeType.PERSIST, CascadeType.REMOVE})
private List products;

 public Categories() {
 }

public String getCategoryId() {
return this.categoryId;
}

public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}

public Object getCategoryName() {
return this.categoryName;
}

public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}

public String getDescription() {
return this.description;
}

public void setDescription(String description) {
this.description = description;
}

public List getProducts() {
return this.products;
}

public void setProducts(List products) {
this.products = products;
}

}
//////////////////////////////////////////////////////////////////////
// PRODUCTS
package entities;


import java.io.Serializable;
import javax.persistence.*;


/**
* The persistent class for the Products database table.
*
*/
@Entity
@Table(name="Products")
public class Products implements Serializable {
private static final long serialVersionUID = 1L;

@Id
@Column(name="ProductId", unique=true, nullable=false)
private String productId;

@Column(name="ProductName", length=50)
private String productName;

@Column(name="Supplier", length=50)
private String supplier;

//bi-directional many-to-one association to Categories
 @ManyToOne
@JoinColumn(name="CategoryId")
private Categories category;

 public Products() {
 }

public String getProductId() {
return this.productId;
}

public void setProductId(String productId) {
this.productId = productId;
}

public String getProductName() {
return this.productName;
}

public void setProductName(String productName) {
this.productName = productName;
}

public String getSupplier() {
return this.supplier;
}

public void setSupplier(String supplier) {
this.supplier = supplier;
}

public Categories getCategory() {
return this.category;
}

public void setCategory(Categories category) {
this.category = category;
}

}
  • Above two class represent two tables Categories and products
  • You need to import javax.persistence.*
  • Using above classes & EntityManager we can fetch data from database
  • Consider the following code ....

public static void main()
{
 // Creating entity manager to create Db query
 EntityManagerFactory factory = Persistence.createEntityManagerFactory("WebWithJPA");
 javax.persistence.EntityManager em = factory.createEntityManager();
 
 try 
 {
  // Creating Query using JPQL
  Query objQuery = em.createQuery("select c from Categories c");
 
  // Getting result set in List
  List objC = (List) objQuery.getResultList();
  
  // Listing all categories and its related products
  for (Categories c : objC) 
  {
   System.out.println("Category Name: " + c.getCategoryName());
   for (Products p : c.getProducts()) 
   {
    System.out.println("* " + p.getProductName());
   }
  }
}