Posts

Showing posts from July, 2010

configuration mysql-JDBC in weblogic 8.1

step 1: copy your mysql connectivity jar into weblogic_home/server/lib step2: edit the env in the weblogic_home/common/bin/commenv.cmd/sh step3: append your connectivity jar path step4: edit configDB.cmd/sh if needed step5: create the Datasource for your database and create JNDI for your DataSource.

Stored procedure to parse long string into tokens by using delimiter

DELIMITER $$ DROP PROCEDURE IF EXISTS `datawarehouse`.`aggregateStudent`$$ CREATE DEFINER=`root`@`%` PROCEDURE `aggregateStudent`(IN adata LONGTEXT) BEGIN DECLARE tempData LONGTEXT; DECLARE fulldata LONGTEXT; DECLARE st1 LONGTEXT; DECLARE sValue LONGTEXT ; DECLARE rFulldata LONGTEXT; DECLARE firstrecord LONGTEXT ; DECLARE len INT ; DECLARE recordsize INT ; DECLARE studentid VARCHAR(50); DECLARE subjectid VARCHAR(50); DECLARE chapterID VARCHAR(50); DECLARE formLevel VARCHAR(50); DECLARE classlevel VARCHAR(50); DECLARE schoolid VARCHAR(50); DECLARE tempSchool VARCHAR(50); DECLARE score DOUBLE(12,2); DECLARE nomore_data INT DEFAULT 0; DECLARE flen INT ; DECLARE ids INT ; DECLARE no_schoolinfo INT DEFAULT 0; SET fulldata=adata; SET firstrecord= SUBSTRING(fulldata,1,INSTR(fulldata,'**')-1); SET rFulldata= SUBSTRING(fulldata,LENGTH(firstrecord)+3,LENGTH(fulldata)); SET tempData=firstrecord; SET recordsize=LENGTH(firstrecord); CREATE TABLE IF NOT EXISTS temp...

some utilities for swing

public class GraphicLocation { static Toolkit toolkit = Toolkit.getDefaultToolkit(); static Dimension screenSize = toolkit.getScreenSize(); public static int windowWidth(int x) { return (screenSize.width - x) / 2; } public static int windowHeight(int x) { return (screenSize.height-x)/2; } public static int mainwindowWidth(int x) { return (screenSize.width - x) /3; } public static int mainwindowHeight(int x) { return (screenSize.height-x)/3; } } //to sort the vector/arraylist public class Sorter implements Comparator { public int compare(Object arg0, Object arg1) { return arg0.toString().toUpperCase().compareTo(arg1.toString().toUpperCase()); } } // to assign custom image to the tree node UIManager.put("Tree.leafIcon", getImage(TreeProperties.getProperty("leafIcon").toString())); UIMan...

add image on panel as background

import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; public class BackgroundImagePanel { /** * Set up contraints so that the user supplied component and the background * image label overlap and resize identically */ private static final GridBagConstraints gbc; static { gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.NORTHWEST; } /** * Wraps a Swing JComponent in a background image. Simply invokes the * overloded variant with Top/Leading alignment for background image. * * @param component - to wrap in the a background image * @param backgroundIcon - the background image (Icon) * @retur...