Posts

Showing posts from 2010

Trade mark at title in jframe

.setTitle("Hello \u2122"); e.g. this.setTitle(“Title \u2122”);

mysqldump

mysqldump --host=10.1.23.224 --user=root --password=password frameworkdb> tests.sql

php to java webservice

SOAP connection to Java Web Service from PHP Source: http://coding.derkeiler.com/Archive/PHP/alt.php/2006−09/msg00127.html · From: tayze@xxxxxxxxx · Date: 9 Sep 2006 08:43:35 −0700 I've been struggling with this for a while and am finally resorting to asking for help. Below is the code that works in java: −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− import java.net.URL; import java.util.Vector; import org.apache.soap.Constants; import org.apache.soap.Fault; import org.apache.soap.SOAPException; import org.apache.soap.rpc.Call; import org.apache.soap.rpc.Parameter; import org.apache.soap.rpc.Response; import java.io.*; import java.util.*; public class TopXCall { public static void main(String argv[]) { try { String endpoint = "http://infao5501.ag5.mpi−sb.mpg.de:8080/soap/servlet/rpcrouter; // Initialize the method parameters Vector params = new Vector(); // Create the call. Call call = new Call(); call.setTargetObjectURI("TopXService"); call.setMethodName(...

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...

firefox port issues

The built in webserver in Visual Studio 2005, formerly known as Casini, uses a dynamic or static port on the localhost machine (e.g. http://localhost:2049/default.aspx). It is dynamic by default, but you can make it static if you choose. That works very well except when you try it in Firefox. It simply gives you this response: This address uses a network port which is normally used for purposes other than Web browsing. Firefox has cancelled the request for your protection. It does that by default whenever you use a port other than port 80 - the default website port. It took me a lot of digging to find the solution and here it is. - Open Firefox - Type about:config in the address field - Right click anywhere on the screen - Click new > string - Enter preference name as: network.security.ports.banned.override - Enter string value as: 2049 (or whatever port number you want)

jboss port change

Jboss port changes : 1. Goto the deploy folder of the server instance you use. 2. Goto the jbossweb-tomcat55.sar inside that deploy folder. 3. Find the file named server.xml inside that folder. (tomcat service file).

mysql max connection

SET @@global.max_connections = 1250; SELECT @@global.max_connections;

create dynamic textboxes in html

Dynamic Textbox/title> 0 1 2 3 4 5

sample to create right join

SELECT s.total,temp.code ,s.subject_id,temp.academicRecord_id,temp.examDate,temp.TYPE,temp.educationLevel_id FROM school_ilms.subjectresult s RIGHT JOIN ( (SELECT er.id,e.code,er.academicRecord_id,er.examDate,e.TYPE ,e.educationLevel_id FROM school_ilms.exam e RIGHT JOIN (school_ilms.examresult er ) ON (e.id=er.exam_id) WHERE e.TYPE='G' OR e.type='S') AS temp) ON(s.examResult_id=temp.id);

create tomcat instance in linux using one tomcat as a base

This is configuring the tomcats : making one tomcat into base and run remaining instances CATALINA_BASE=/home/stp/tomcat8080 /usr/apache-tomcat-6.0.20/bin/catalina.sh start tail -f tomcat8080/logs/catalina.out COPY FILE FROM CONF cp /usr/apache-tomcat-6.0.20/conf/* tomcat8080/conf/ TO EDIT THE SERVER.XML IN TOMCATS for i in 1 2; do sed -e s/8080/808$i/g -e s/8005/$((8005+$i*100))/g -e s/8009/$((8009+$i*100))/g conf/server.xml > tomcat808$i/conf/server.xml ; done CREATE TOMCAT INSTANCES for i in 1 2; do cp -r tomcat8080 tomcat808$i; done TO COPY THE CONF FILE INTO TOMCATS cp tomcat8080/conf/server.xml conf/

creating signed jar

example jar -cvmf META-INF/MANIFEST.MF MMSB-APP.jar *.* jarsigner MMSB-APP.jar mimos.stp

script to get avg mem and avg cpu usage in linux

#!/bin/bash -x #for (( i = 0 ; i while true do dt=`date`; #st1=`free -gos awk 'NR==1{print $2}'` used="`free -g awk 'NR==2{print $3}'`" total="`free -g awk 'NR==3{print $4}'`" #echo "total : " $total "used : " $used `date` # calculate the average memory echo "total : " $total "used : " $used "avg-mem" `expr $used/$total*100 bc -l` "----------" `iostat -xtc` >> tt.txt # to wait for 2 seconds sleep 2 done tested in centos 5 version