Monday, August 31, 2009

Get radio button value in js

Suppose your radio button grop is "radiogroup".
function getradioSelection() {
var group=document.getElementsByName("radiogroup");
var grp='';
for(var k=0;k<group.length;k++){
if(group[k].checked){
grp=group[k].value;
}
return grp;
}

This method will return the selected radio button value.

Tuesday, August 25, 2009

Insert data into mysql from text file


Unload data into a text file.
Import data into a excel sheet. Then save the file again as .txt(Tab delimited) file.
Export file to your mysql server. vi the .txt file in linux. Then save the file using following command.
  • :%s/tab/|/g ---------->Then enter.
  • :wq!  ------------->Save the file
  • LOAD DATA INFILE "table.txt" INTO TABLE table
    FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n'
    ----> Load data to mysql server

Unload/load data from informix

unload to "table.txt" select * from table

This will unload data to your user login in database server. Suppose you logged as "test" user, it will unload data to folder "test".

load data from "table.txt" insert into table

Use this sql to load data from "table.txt" to a table.

Thursday, August 20, 2009


String qur="select a from table a";
Query q = em.createQuery(qur);
q.setFirstResult(0);
q.setMaxResults(10);

This will return the resultset limited to 10 in ejb.

Friday, August 7, 2009

How to log exceptions in dwr?

Add the following jar files to your project library.

commons-logging-1.1.1.jar
commons-logging-adapters-1.1.1.jar
commons-logging-api-1.1.1.jar
commons-logging-tests.jar
commons-logging-1.1.1-javadoc.jar
commons-logging-1.1.1-sources.jar
dwr.jar

Tuesday, August 4, 2009

Remove time in java.sql.Date using sql

to_char(disconnected_on,"%Y-%m-%d")

Here "disconnected_on" is the field in the table. If you use to_char() method it will remove time values and formate the date as "YYYY-MM-DD".

Ex :-
before use :- 2009-10-10 12:09
after usage :- 2009-10-10

Monday, August 3, 2009

Meta tag to refesh the page

This is the meta tag that is used to refresh the page.

<META HTTP-EQUIV=Refresh CONTENT='100; URL=index.php'>
Here, CONTENT='100 means time interval for a refresh.
URL is the page/url must be refreshed.