Skip to main content

Posts

Showing posts from 2013

HOW TO USE ORACLE TIMESTAMP DATATYPE AND ITS CLASSES

TIMESTAMP IN ORACLE ------------------------------- CREATE TABLE DEMO ( ID NUMBER PRIMARY KEY, TD_I TIMESTAMP, TD_II INTERVAL YEAR TO MONTH, /*Indicates an Interval of Year to Month : eg. Interval of 2 Years, 3 Months.*/ TD_III INTERVAL DAY TO SECOND, /*Indicates an Interval of Day to Second : eg. Interval of 2 Days,5 Hours, 5 Min and 5 Seconds.*/ TD_IV TIMESTAMP WITH LOCAL TIME ZONE,  TD_V TIMESTAMP WITH TIME ZONE ); INSERT INTO DEMO(ID,TD_I,TD_II,TD_III,TD_IV,TD_V) VALUES(1,'01-JAN-2010 12:25 PM','2-3','3 10:10:10','01-AUG-2005 8:00:00 AM','01-AUG-2005 8:00:00 AM +5:30'); select * from demo; SELECT sysdate,sysdate+TD_II "Future Date",(sysdate+TD_II)-sysdate "Days Difference" FROM DEMO;

Connection to Oracle Database Using JSP

<%@page import="java.sql.*"%> <% Connection conn=null; try{ Class.forName("oracle.jdbc.driver.OracleDriver"); conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","INVCTLSYS","FUSION"); Statement stmt=conn.createStatement(); ResultSet rs=stmt.executeQuery("SELECT * FROM TBL_PURCHASED_INVOIE_REGISTER"); while(rs.next()) { out.println(rs.getInt("SYS_ID")+"   ->   "+rs.getInt("VENDOR_SYS_ID")+"   ->   "+rs.getString("VENDOR_NAME")+"   ->   "+rs.getString("INVOICE_ID")+"<br>"); } }catch(Exception e){out.println(e.getMessage());} %>

Using OpenGL: Drawing a rectangle or Square

#include <i:\windows\system32\glut.h> #include <i:\windows\system32\glu.h> #include <i:\windows\system32\gl.h> #include <windows.h> void Display(void) { glClear(GL_COLOR_BUFFER_BIT); //glRectf(-5.0,5.0,5.0,-5.0); glRectf(-7.0,7.0,7.0,-7.0); glutSwapBuffers(); } void init(void) { glClearColor(0.0,0.0,0.0,0.0); //glColour3f(0.0,0.0,1.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-10.0,10.0,-10.0,10.0,-10.0,10.0); } int main (int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);  //For animations you should use double buffering glutInitWindowSize(300,300); glutInitWindowPosition(100,100); glutCreateWindow("Rectangle Example"); glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); init(); glutDisplayFunc(Display); glutMainLoop(); return 0; }

Setting up OpenGL environment for Microsoft Visual C++

Hi Friends, before starting the setting up OpenGL environment, please do the following first: 1.       Install Microsoft Visual C++ 6.0 (Comes with Ms Visual Studio 6.0) 2.       Download the file called “opengl95.exe” and “glutdlls.zip” from internet. [Just open browser-> navigate http://www.google.com -> type upper mentioned file name and search -> you will definitely find the appropriate link to download.] 3.       Run opengl95.exe file and it will be extracted and will be generated some files. Copy those files and 4.       Extract the file “glutdlls.zip” and it will also generate some more files. 5.       Now, combine all extracted files from two sources (opengl95.exe and glutdlls.zip) and place in one location. Setting up OpenGL environment for Microsoft Visual C++ With any system, you can start with a C\C++ compiler and install appropriate OpenGL header files (.h) and libraries. Three libraries associated with header files are required for the use of

Subscriber Identification Module (SIM)

A subscriber identity module or subscriber identification module (SIM) is an integrated circuit that securely stores the International Mobile Subscriber Identity (IMSI) and the related key used to identify and authenticate subscribers on mobile telephony devices ,such as mobile phones and computers. It is also a portable memory chip used mostly in cell phones that operate on the Global System for Mobile Communications (GSM) network. These cards hold the personal information of the account holder, including his or her phone number, address book, text messages, and other data. When a user wants to change phones, he or she can usually easily remove the card from one handset and insert it into another. SIM cards are convenient and popular with many users, and are a key part of developing cell phone technology. Sim Cards are of four (4) Types. Named as Below H1, H2, H3, H4 H1= You Will Get Normal Network On This Sim H2= You Will Get Better Network On This Sim, Means Strong H3= Y

How to show icon and text in the same cell?

  The DataGridView control does not have any built-in support for showing an icon and text in the same cell. Through the different painting customization events, such as the CellPainting event, you can easily display an icon next to the text in the cell.       The following example extends the DataGridViewTextColumn and cell to paint an image next to the text. The sample uses the DataGridViewCellStyle.Padding property to adjust the text location and overrides the Paint method to paint an icon. This sample can be simplified by handling the CellPainting event and performing similar code.      public   class   TextAndImageColumn  :  DataGridViewTextBoxColumn          {              private   Image  imageValue;              private   Size  imageSize;              public  TextAndImageColumn()              {                  this .CellTemplate =  new   TextAndImageCell ();              }              public   override   object  Clone()              {              

Connect to Oracle : A java servlet program

import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; public class connToHr extends HttpServlet {     public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException     {                         PrintWriter out=res.getWriter();         try         {             String conURL="jdbc:oracle:thin:@localhost:1521:orcl";             String conUSER="HR";             String conPASSWORD="HR";                String uniDriver="sun.jdbc.odbc.JdbcOdbcDriver";             Driver d=(Driver)Class.forName(uniDriver).newInstance();                Connection con=DriverManager.getConnection(conURL,conUSER,conPASSWORD);             Statement stmt=con.createStatement();             ResultSet rs;                  rs= stmt.executeQuery("SELECT * FROM EMPLOYEES");                 while(rs.next())             {                 out.println("<HTML><BODY><H1>THE EMPLOY

A Hit Count Using Java Servlet's Session Tracking

import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class SessionTracker extends HttpServlet {         public void doGet(HttpServletRequest req,HttpServletResponse res)         throws ServletException,IOException         {                res.setContentType("text/html");                PrintWriter out=res.getWriter();                HttpSession session=req.getSession(true);                Integer count=(Integer)session.getValue("tracker.count");                if(count==null)                {                         count=new Integer(1);                }else{                         count=new Integer(count.intValue()+1);                }                session.putValue("tracker.count",count);                out.println("<HTML><BODY><H1>SESSION TRACKING DEMO</H1>");                out.println("You've visited this page "+count+((count.intValue()==1)?" time.":"times."

Setting up Java Servlet & JSP Environment With APACHE TOMCAT SERVER

================================================================= Setting up Java Servlet and JSP Environment With APACHE TOMCAT SERVER ================================================================= •    Required tools     o    Jdk [eg. Jdk7.0]     o    Apache Tomcat Server [eg. Tomcat 7.0]        [Note: This tutorial will work on Apache tomcat  7.0]      [Note: Place your tomcat directory into C:\]      [Note: Install the jdk into C:\Program files\]   •    Sitting up Java Environment     o    Install JDK     o    After successful installation find the “BIN” directory within installation directory       [eg. C:\Program Files\Java\jdk1.6.0_26\bin]. Copy the full path and set the “PATH” environment variable as the copied path; [eg. PATH=C: \Program Files\Java\jdk1.6.0_26\bin]                          [Nb. How to set environment variable? Follow at last of this topic] •    Setting up Apache     o    CREATE three environment variables as JAVA_HOME, JRE_HOME,