serving the solutions day and night

Pages

Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Wednesday, August 24, 2011

Matrix Report using SQL Server XML and XSLT Code

Desiging Matrix Report using SQL Server XML, XSLT and JAVA Code
In the above matrix report image is grouped week by employee vs employee by week.
Part 1 - SQL CODE
DECLARE @depart_id int
DECLARE @startdate datetime
DECLARE @enddate DATETIME

SET @depart_id = 314
SET @startdate = '01/01/2001'
SET @enddate = '02/28/2001'

DECLARE @e_id int
DECLARE @ename varchar(100)
Creating temporary table

Monday, March 21, 2011

JAVA String

  1. Convert to String
    //Integer to String
    int number = 1234;
    String strtoint = Integer.toString(number); //1234
    strtoint = "" + number; //1234
    //Double to String
    strtoint = Double.toString(number); //1234.0
    //Long to String
    strtoint = Long.toString(number); //1234
    //Flot to String
    strtoint = Float.toString(number); //1234.0
    //Binary to String
    strtoint = Integer.toBinaryString(number); //10011010010
    strtoint = Integer.toString(number,2); //10011010010
    //Hexadecimal to String
    strtoint = Integer.toHexString(number); //4d2
    strtoint = Integer.toString(number,16); //4d2

Sunday, February 27, 2011

Checkstyle 5.3

  1. CheckStyle is a tool to help programmers to write JAVA coding standard.
  2. Download and unzip checkstyle-5.3 into a convenient directory.
  3. It is a program to inspect your JAVA source code and list/point out errors that deviate from a defined set of JAVA coding standard.
  4. By default it supports the Sun JAVA Code Conventions (sun_checks.xml), and also support any customize coding standard.
  5. It can be invoked with an ANT task, a command line program and integrated into IDE (Eclipse, IntelliJ, NetBeans) and other tools (TextPad).

Sunday, February 20, 2011

Eclipse and Tomcat Confirguration, Create War.

1)Download and extract Eclipse IDE for Java EE Developers

2)Download and extract or install Apache Tomcat

3)Open your browser, type http://localhost:8080 and verify tomcat is running.

Sunday, February 13, 2011

Java Servlet CRON job through Tomcat

Apache Tomcat server won't support to run servelt automatically (Resin will support through <run-at> tag). So i created time scheduler job to perform cron job through Tomcat.

1) Create Schedular Servelt
package com.dns.blog;

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
* Parser Schedular to run every one hour to parse the file.
*
* @author Daynight
* @version 1.0 02/23/2011
*/

Thursday, October 7, 2010

Java Database Access Model

This blog is going to explain how to design java database access model?. It contains 3 part, 1st part is for database model code, 2nd part is for access model code and 3rd part is for stored procedure sql code.

Database access model is used to connect database, retrieve records and passing input/output parameters using Stored Procedures. All the connections and transactions are in one class file. Designed simple method which is used to connect database and to produce the result set.

In the class file, one method is taking care of connecting the database, another method is to retrieve the result set and last method is doing for insert, modify and delete the record.

Monday, September 27, 2010

Java Naming and Directory Interface (JNDI) with Environment Variables

The environment allows you to define your variables name, value and type. At runtime the environment values are not allowed to modify.

Declared the environment variables using the <env-entry> tag in the deployment descriptor (WEB-INF/web.xml in Tomcat). The elements of the <env-entry> tag are:
* <description>: an optional description.
* <env-entry-name>: the entry name.
* <env-entry-value>: a value.
* <env-entry-type>: the java variable type(Boolean, Byte, Double, Character, Float, Integer, Long, Short, String).

Wednesday, August 25, 2010

How to configuring a SQL Server datasource in Apache Tomcat using Java Naming and Directory Interface (JNDI) InitialContext Program?

Download the latest sql server database driver and place it into the lib folder. Restart Tomcat server, once the below changes are done.

1. web.xml configuration
Go to Tomcat root directory -> then explore webapps directory -> select cos (i.e., it is your project folder) and finally select WEB-INF folder. Open web.xml file, if not one, then create web.xml configuration file. Add the below code after <web-app> root tag.

Tuesday, June 22, 2010

Installtion, Configuring Internet Information Server (IIS) with Apache Tomcat

Internet Information Server (IIS) can not execute Servlets and Java Server Pages (JSP). Using Apache Tomcat redirector plugin (isapi_redirect.dll) will let IIS send Servlets and JSP requests to Apache Tomcat.

This blog explains installation of Tomcat and how to setup IIS to interface with Apache Tomcat 6.0.26.

Install Apache Tomcat 6.0.26
1)Download Apache Tomcat 6.0.26 'zip' or '32-bit/64-bit Windows Service Installer' file and 'unzip' or 'install' it. Download link

Tuesday, June 8, 2010

AJAX, Send/Receive XML Request/Response using JAVA - Part 2

I blogged What Ajax is and higher-level codes, let's put all together and example for send XML request/response using Ajax enabled Java application.

Sequence Diagram for AJAX Using JAVA

Monday, May 10, 2010

CAPTCHA Image Code - JAVA, JSP, AJAX

CAPTCHA - Completely Automated Public Turing test to tell Computers and Humans Apart
A CAPTCHA is used to ensure that the response is not generated by a computer, means response from human. It is used to distinguish between human and bots.

Saturday, May 8, 2010

Force SSL/https using code - PHP, JAVA, .NET, C#.NET

Below the codes will explain to detect if URL is secured ssl with php, .net or java in https. If not, then code will automatically change to the secured page from http to https.

Wednesday, April 7, 2010

Smart Card Java Card Technology

Java Card Technology - allows applets written in Java language to be executed on smart cards JCT provides JSRE (JC Runtime Environment)

Saturday, April 3, 2010