Tech Rocks

Coldfusion
Java
JQuery

An online resource for latest web technologies like Coldfusion, JRun, Pro*C, JQuery, HTML5, PHP, W3C, Java, J2EE, C, C++, ORACLE, PL/SQL, MySql, Ajax, Coldbox, Fusebox, UNIX, JavaScript, NodeJS and much more... contact@tech-rocks.org

Sunday, October 31, 2010

Batch Inserts to Oracle using Java

See the following example:

import java.sql.*;

public class ExamplePreparedStatementBatch {
public static void main(String[] args) {
Connection con = null;
try {
oracle.jdbc.pool.OracleDataSource ds = new oracle.jdbc.pool.OracleDataSource();
ds.setDriverType("thin");
ds.setServerName("localhost");
ds.setPortNumber(1521);
ds.setDatabaseName("XE");
ds.setUser("hr");
ds.setPassword("abcd");
con = ds.getConnection();

PreparedStatement ps = con
.prepareStatement("INSERT INTO contact (cnid, cnname)"
+ " VALUES (?, ?)");

ps.setInt(1, 10);
ps.setString(2, "X");

ps.addBatch();

ps.setInt(1, 11);
ps.setString(2, "X");

ps.addBatch();

ps.setInt(1, 12);
ps.setString(2, "X");

ps.addBatch();

ps.setInt(1, 13);
ps.setString(2, "X");

ps.addBatch();

int[] counts = ps.executeBatch();

int count = 0;
for (int i = 0; i <>
count += counts[i];
}
System.out.println("Total effected rows: " + count);

ps.close();

con.close();
} catch (Exception e) {
System.err.println("Exception: " + e.getMessage());
e.printStackTrace();
}
}
}

Saturday, October 23, 2010

Multiple configuration settings for multiple applications in coldbox


Is there a way in coldbox to do this?

The idea is to get a set of interceptors and configuration settings specific to an application in a multi-application coldbox skeleton.

Friday, October 22, 2010

Coldbox Multi-Application under a single skeleton


The idea is to get the different applications under a single structured skeleton. The advantage is that models views and controllers can be shared between different applications. More reuse!!

Need advice on this...


Thursday, October 21, 2010

Coldbox Multi-Application Architecture


A rough idea of Coldbox Multi-Application Architecture -- To create different applications under a single framework skeleton. Need Clarity on this.

Friday, April 17, 2009

The Java Archive Tool

Sun Microsystems, Inc.
Typical usage to combine files into a jar file is:
C:\Java> jar cf myFile.jar *.class

If you have a pre-existing manifest file whose name: value pairs you want the jar tool to include for the new jar archive, you can specify it using the m option:
C:\Java> jar cmf myManifestFile myFile.jar *.class

To extract the files from a jar file, use x, as in:
C:\Java> jar xf myFile.jar
To extract only certain files from a jar file, supply their filenames:
C:\Java> jar xf myFile.jar foo bar

Updates an existing file jarfile (when f is specified) by adding to it files and directories specified by inputfiles. For example:
jar uf foo.jar foo.class

would add the file foo.class to the existing jar file foo.jar. The u option can also update the manifest entry, as given by this example:
jar umf manifest foo.jar

Creating executable jar files

http://csdl.ics.hawaii.edu/~johnson/613f99/modules/04/jar-files.html

Main-Class: psae.HelloWorld
jar cmf mainClass psae.jar psae
jar tf psae.jar
java -jar psae.jar Philip

Saturday, April 11, 2009

Accessing Iframes

function loadyahoo(){
//alert(window.frames['myFrame']);
window.document.frames['myFrame'].location = "test1.html";
alert(window.frames['myFrame'].document.all.nametxt.value);
window.frames['myFrame'].document.getElementById('nametxt').value="Jeetu is great!";
/*var iframeEl = document.getElementById('myFrame');
if ( iframeEl.contentDocument ) { // DOM
var form = iframeEl.contentDocument.getElementById('nametxt');
} else if ( iframeEl.contentWindow ) { // IE win
var form = iframeEl.contentWindow.document.getElementById('nametxt');
}*/
//form.value="jeetu alex";
//window.document.getElementById('myFrame').src = "test1.html";
//alert(document.getElementById('myFrame').contentWindow.document.getElementById('nametxt'));
//document.getElementById('myFrame').contentWindow.document.getElementById('nametxt').value="Jeetu";
}