Showing posts with label How To. Show all posts
Showing posts with label How To. Show all posts

Sunday, November 4, 2012

What is XML ?


Markup language that define a set of rules for encoding documents in a form that is both human-readable and machine-readable.
• It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications.
 • Can be embedded with all types of oop language with parsing.
 Benefits-
 1. Simple
 2. Self description
3. Contains machine readable context information
 4. Facilitates the aggregation of data
5. Can embed multiple datatypes and existing data.

How to insert a record in table using hibernate.


Hibernate is a ORM.To insert the record in table basically a object is inserted which contain the all attribute of that record field. for insertion create a bean class of that types variable and apply getter and setter property.now initialize a object of that class inject the values and save the object after it the table is updated and record is inserted.

To see the code click here.

Saturday, November 3, 2012

How to write hibernate code in java application


To use hibernate first setup the environment of hibernate .After that need to create some files in application as-

1. Hibernate.cfg.xml file contain database configuration,connection pool,user,username,password and other sql information. the main thing is that we can not change file name the name always as it is.

<hibernate-configuration>
<session-factory>
  <property name="hibernate.connection.driver_class">
     com.mysql.jdbc.Driver</property>
  <property name="hibernate.connection.url">
jdbc:mysql://localhost:3306/hibern</property>
  <property name="hibernate.connection.username">root</property>
  <property name="hibernate.connection.password">root</property>
  <property name="hibernate.connection.pool_size">10</property>
  <property name="show_sql">true</property>
  <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
  <property name="hibernate.hbm2ddl.auto">update</property>
  <!-- Mapping files -->
  <mapping resource="createtable.hbm.xml">
 </mapping></session-factory>
  </hibernate-configuration>

How to set Hibernate environment in java application


To provide the ORM in java application need to implement the hibernate. To implement the hibernate need the jars or libraries which is provided by hibernate download these jar and add these jar in application and use the benefits of hibernate.

To download the Hibernate jars click on below link-

http://sourceforge.net/projects/hibernate/files/hibernate3/3.6.10.Final/hibernate-distribution-3.6.10.Final-dist.tar.gz/download

After download that library. add these jars in project. now application is ready to use hibernate.

Friday, June 15, 2012

How to import xml file in another xml ?


We can split our container definition in many xml file and can use it  in diffrent manner.One of them,load all xml in ApplicationContext or BeanFactory. Another is import all xml file in a perticular xml file now load this single xml in context.
Here we discuss that how to import a xml file into another xml file.for this use <import > tag in <beans> tag and set the path of xml in resource  property of import tag. To illustrate it lets see a example-
Directory Structure-

Wednesday, June 13, 2012

How to Injecting the bean properties before load xml in application and out side xml


in Spring Framework we injected the beans in xml file ,than the xml loads in application.But here  another new feature of spring framework is that we can inject the bean property outside the xml and before the load xml in application. applyBeanPropertyValues() method on AutowireCapableBeanFactory to apply a bean definition’s properties to an existing bean.(click for example)

Monday, May 7, 2012

How to access the beans from the XML file by BeanFactory




To access the Beans from the XML file we can use BeanFactory.(see the example)

             BeanFactory fact=new XMLBeanFactorynew (new FileSystemResources("XMLfilename.xml"));

To access the Beans from the XML file we can also use ApplicationContext.

             ApplicationContext context=new ClassPathXmlApplicationContext("XMLfilename.xml");

Friday, January 13, 2012

How to create a TCL script in router for ping ?


Router ios version 12.3 or higher version are support TCL script on router. To write a simple TCL script for ping different interfaces or devices use that code----

foreach address
{
x.x.x.x
x.x.x.x
x.x.x.x
.
.
}
{ping $address}

Saturday, January 7, 2012

How to configure GNS3 to a virtual box client.


To configure the GNS3 with a virtual box client follow these steps-
1.-->  Start the gns3 and drag a router from the list and drop it to the working windows.
2.-->  Like router also drag a cloud and drop in working window.



3.--> Now Double click on cloud and select a C1 menu on the left hand list .
         after that select NIO ethernet tab.Here is the drop down list in which select a  virtual
        Box host only network. add this and apply the settings.

Thursday, December 8, 2011

How to get java source code to a .class file


To get the java source code to a class file download a software of cavaj . install in system and and launch the application the layout of the application as--

Steps to get source code-
1--> Choose file menu.
2-->select open tab.
3-->give the location of the class file and click open. now you can show the code of the class file.

Sunday, November 20, 2011

How to add a filter in dynamic web project of java or control traffic on web






We can add a Filter in web project of java to filter the traffic on the web server.
    Basically filter a class as the Servlet Class in java. To make a Filter, class is necessary implements with the interface.
Source code to add the filter on the project:-
CounterFilter.java
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class CounterFilter implements Filter  // create a class implements by Filter interface
{
       FilterConfig con;
   
  public void destroy()
  {
            }
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws         IOException, ServletException {
                       
                        ServletContext context=con.getServletContext();
                        Integer count=(Integer)context.getAttribute("count");
                        if(count==null)
                        {
                                    count = new Integer(0);
                        }
                       
                        count=new Integer(count.intValue()+1);
                        context.setAttribute("count", count);
                       
                       
                        chain.doFilter(request, response);
            }

Saturday, October 15, 2011

How to execute a privilege mode command on configuration mode in Router



When we execute a privilege command like show, clear commands on global mode of router .Then it show an error message


Router(config)#show ip int
                ^
% Invalid input detected at '^' marker.
Router(config)#


To solve out this problem do command it used to execute privilege commands on global mode.


Router(config)#do show ip int brief
Interface              IP-Address      OK? Method Status                Protocol

FastEthernet0/0        10.1.1.1        YES manual up                    down

FastEthernet0/1        unassigned      YES unset  administratively down down

Vlan1                  unassigned      YES unset  administratively down down
Router(config)#

Monday, October 10, 2011

How to worms are infects to networks what are the steps are used to infect network?



Worms are a particularly dangerous type of hostile code. They replicate themselves by independently exploiting vulnerabilities in networks. Worms almost always slow down networks.
   Hackers and Attackers use five basic phases of attack, regardless of whether a worm or virus is employed-
1.           Probe -The goal is to find computers that can be subverted. Internet Control Message Protocol (ICMP) ping scans are used to map networks. Then the application scans and identifies operating systems and vulnerable software. Hackers can obtain passwords using social engineering, dictionary attack, brute-force attack, or network sniffing.

Thursday, October 6, 2011

How to change the ip address in linux


To change the IP address of a network device in linux can use terminal or GUI. here  change by  using the terminal mode with  the help of few commands .
To reach the command terminal follow instructions -

-> Goes to Applications ---> Accessories ---> Terminal.
-> To check the IP address enter command 

Tuesday, October 4, 2011

How to connect two computers via lan and share data ?



We connect two computer via lan and also share the data . the step for this as :-
To connect two computers via lan need a lan Ethernet cable .

First connect two computer via Ethernet cable  for this insert the cable ends in lan card port in both computers.
First select a computer and perform this procedure-
Goes to control panel -> network and sharing center  -> local area connection.
Right click on it and select properties.
In which find internet protocol version 4 (TCP/IPv4) and double click on it.

Saturday, October 1, 2011

How to create a simple java 3d program to make a ball ?


A simple java application to create a ball . To execute a java 3d program necessary to install java 3d package in the system properly. The code of the program is:-
 import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
import javax.media.j3d.*;
import javax.vecmath.*;

Tuesday, September 27, 2011

How to start ping and ipconfig commands on Window xp/7.


Steps to start these cmmands:
----> First Go to c:/windows/system32 .
---->check ipconfig and ping command exsist.


 

Site Status

Man Behind Technical Today

Hello, I am Navin Bansal. I am a student of MCA in Rajsthan Institute of Engineering and Technology and owner of this blog. I share my view and ideas among people.