| http://javaservice.objectweb.org/ |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- 64-bit Sparc laptopIf you are a Solaris on SPARC user, you might want to know that
Tadpole is running a drawing on its websit, www.tadpolecomputer.com,
for one of its new 64-bit SPARC laptops.
John Davis
- 3
- Perfomance for multiple inserts> Statement stmt = con.createStatement();
> stmt.addBatch("insert into table_name1 ...");
> stmt.addBatch("insert into table_name2 ...");
> stmt.addBatch("update table_name3 ...");
> stmt.addBatch("update table_name4 ...");
> stmt.addBatch("delete from table_name5 ...");
> stmt.executeBatch();
>
> And that is a good idea because the critical part of operations
> like this is the Statement-object. That has the direct connection
> with the SQL-server-side. And now you are able to execute a lot
> of statements with only 1 Statement-object, this looks like
> an sql-batch-script.
And if you (original author) going to benchmark, you could try concatenating
insert queries into a one large sql formula. Then you just run it and let
dbserver do the job.
StringBuffer sBuffer = new StringBuffer();
sBuffer.append("Insert Into ....;");
sBuffer.append("Insert Into ....;")
sBuffer.append("Insert Into ....;");
stmt = connection.createStatement(sBuffer.toString());
stmt.execute();
- 4
- opening default browserHello everybody.
I'm new to Java.
I have created simple JPanel: Help->About.
I have placed there a link to my web page with message: download the
newest version.
OK it is a text message - I want to add sth like in Eclipse's
Help->About - a link to my page.
How can I open in Java a page in default system browser?
I'm newbie, I searched with google but every time I entered word
related to browser or opening browser I have - yes - Java but 'Java
Script' results...
thanks in advance for Your help
best regards R
- 6
- How to get path to current directory?Hello.
How to get path to current directory and put this path to object of class
String?
I found FileSystemView.getHomeDirectory() but it returns path to home
directory for example:
C:\Documments and Settings\Thomas
Thanks for help.
- 7
- wholesale,hoody ( paypal accept ) ( www.top-saler.com ) wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
wholesale,hoody ( paypal accept ) ( www.top-saler.com
)
- 8
- Finding Available JREs I'm hoping someone here can point me in the right direction. What
is the most reliable way to detect the available JREs installed on a
target system? Is the Windows registry sufficient under Windows?
Where does one look on a Linux system?
Any help on this matter would be greatly appreciated.
Thanks!
Damon Courtney
- 9
- OT(?) - Java Applet and Browser IssueI'm trying to troubleshoot the cause of the following errors:
basic: Registered modality listener
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@a6aeed,
refcount=1
basic: Added progress listener: sun.plugin.util.GrayBoxPainter@af8358
basic: Loading applet ...
basic: Initializing applet ...
basic: Starting applet ...
network: Connecting http://www.java.com/jsp_utils/JavaCallJS.class with
proxy=DIRECT
network: Connecting http://www.java.com/jsp_utils/JavaCallJS/class.class
with proxy=DIRECT
load: class JavaCallJS.class not found.
java.lang.ClassNotFoundException: JavaCallJS.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed.
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more
basic: Exception: java.lang.ClassNotFoundException: JavaCallJS.class
The error that has caught my eye is "open HTTP connection failed". I
have local Java apps (Eclipse IDE, Unlimited FTP) that run fine but
can't access the internet. But applets don't run - just generate errors
like above. Turns out that there are no Java related plugins in the
Firefox plugins directory. I've got Quicktime and Flash related files
there, but nothing Java related. If I try to install JRE 5, it tells me
that it's already installed. Yet applets (e.g. www.java.com) cause
General Exception Errors and I still have no Java related files in my
plugins directory.
Anybody have ideas as to the cause of this? Coudl somebody tell me
which files need to be in the plugins directory? Maybe I can just copy
them there myself.
Thx
-K2
- 9
- Ltd. Enrollment NotificationAttention Potential Candidate:
You may now qualify for our unique University Education Program. For a limited amount of students - No tests, classes, books, or interviews required*
Yourself, and a limited number of other candidates are invited to take advantage of this Special Enrollment
Bachelors, Masters, MBA, and Doctorate (PhD) available in the field of your choice - 100% Verifiable Documents will be shipped to you within 2 weeks.
CALL US 24-7 - This Special Enrollment Ends Soon
1 (310) 281 - 6248
Thank You
Erin Reilly,
Educational Counsellor,
Internet Admissions Office
*Education awarded on life and past work experience.
--
To UNSUBSCRIBE, email to email***@***.com
with a subject of "unsubscribe". Trouble? Contact email***@***.com
- 9
- 9
- How to intercept Ctrl key - eg Ctrl E being pressed on Java console programHello
I am writing console programs and my program waits streaming in text input
from the screen. But I need a way for the user to abort - I thought Ctrl
E - but how can I know when Ctrl E has been pressed.
I am roughly doing this sort of thing:
import java.io.*;
public class blah
{
public static void main(String[] args)
{
// declaration section:
BufferedReader cin = null; // console input
String conline;
try
{
cin = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter strings to remove last character");
System.out.println("waiting... Press Ctrl E to end session");
while ((conline = cin.readLine()) != null)
{
// If Ctrl E detected abort - break out - BUT HOW???
System.out.println("processing: " + conline);
int len = conline.length();
String strRemovedot = conline.substring(0,len-1);
System.out.println(strRemovedot);
}
cin.close();
}
catch (IOException e)
{
System.err.println("IOException: " + e);
}
}
}
- 14
- problem with Retroguard and Java 2 JDK?Hello
I have previously used Retroguard with jdk 1.1.8 but am having
problems using j2sdk 1.4.2_03. Get the following errors in the log
file. Any ideas why please?! The scr and run batch files which I am
using follow the error messages...
Geoff
# Unrecoverable error during obfuscation:
# java.lang.ClassNotFoundException:
symantec.itools.awt.util.dialog.ModalDialog
java.lang.ClassNotFoundException:
symantec.itools.awt.util.dialog.ModalDialog
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at a.a.a.f.a(Unknown Source)
at a.a.a.f.a(Unknown Source)
at a.a.a.f.j(Unknown Source)
at a.a.a.j$4.a(Unknown Source)
at a.a.a.j.a(Unknown Source)
at a.a.a.j.a(Unknown Source)
at a.a.a.j.a(Unknown Source)
at a.a.a.j.a(Unknown Source)
at a.a.a.j.a(Unknown Source)
at a.a.a.j.if(Unknown Source)
at a.a.a.s.do(Unknown Source)
at a.a.a.s.a(Unknown Source)
at RetroGuard.a(Unknown Source)
at RetroGuard.a(Unknown Source)
at RetroGuard.main(Unknown Source)
1. scr batch file
set CLASSPATH=d:\retro\retroguard.jar;d:\retro\symbeans.jar
c:\j2sdk1~1.2_0\bin\java -classpath %CLASSPATH% RGgui
2. run bacth file
set CLASSPATH=d:\retro\retroguard.jar;d:\retro\symbeans.jar
c:\j2sdk1.4.2_03\bin\java -classpath %CLASSPATH% RetroGuard 030204.jar
ob030204.jar 030204.rgs 030204.log
- 14
- Passing an unknown number of parameters to AntHEllo,
You can pass parameters from the command line to your ant build file
by using properties.
Using ant -Dname=value lets you define values for properties on the
Ant command line.
These properties can then be used within your build file as any normal
property: ${name} will put in value.
However,
Let's say that I have the following java program:
++++++++++++++
class Test {
public static void main(String argv[]) {
for (int i = 0; i < argv.lenght;i++)
System.out.println("param " + i + ": " + argv[i]);
}
}
++++++++++++++
and I have the following ant file:
++++++++++++++
<project basedir=".">
<target name="run">
<java fork="true" classname="Test"/>
</target>
</project>
++++++++++++++
How do I need to modify the ant file so that executing "ant run one
two three" from the command line, produces:
++++++++++++++
param 1: one
param 2: two
param 3: three
++++++++++++++
(and it works for any number of parameters)
Many thanks,
DAvid
- 14
- Hel me! I'm going mad!!!Excuse me if I'm repetitive but I need help.
I thank Micheal Dunn but his suggestion is too particular and it's too
legates to a specific map of a museum.
I have this problem.
I have a map of a generic museum. Every room has maximum 4 links to other
room. These links have not a cost(the cost is always 1). I must implement a
algorithm to determinate the shortest path from a room to another room.
I have created a Class room, this class have these methods eand these data:
Method:
public int getNumVicini() //this method gives the number of room linked the
the object room in question;
public int getVicino(int v)//this method returns the 1st or the2nd or the
3rd or the 4th
public int getId()//return the id of the room
public String getPercorsi(int i)//return the path from the object room to
the room with id equals to i
public boolean verifyVicino(int v)//This method verify if a room with id
equals to v is linked to the object room
The there are the method addVicino(int i) that insert i inthe array vicini,
the method setname, setid, getname, getid etc.
Data:
private int vicini[]=new int[4];//this array contains the id of the linked
rooms
public String percorsi[]= new String[9];//this array contain the path from
the object room to all the others rooms in percorsi[0] there is the path
from object room to the room with id=0, in percrosi[1] path from object room
to the room with id[1], etc.
private int id;//in this int there's the id of the room
private String nome;//in this string there's the name of the room
In the main I have an array that contains all the room of the museum(Room
museum[]=new Room[x]).
The I have created a class Path to determinate the shortest path from a room
to another room.
This is the class Path:
public class Path {
private Room start;
public Path(Room r){ //the constructor take a room the room of start
and set the path to the linked room
for(int i=0; i<r.getNumVicini(); i++){
r.verifica[r.getVicino(i)]=true; //r.getVicino(i) give the id of
the linked rooms and set the verify[x], where x is the id of the linked
room, to true, because the shortest path is immediate
r.percorsi[r.getVicino(i)]+=r.getId()+ " " +
r.getVicino(i);//set the path to the linked room i equals to the id of the
start room an the id of the end room in this case the is of the end room is
the id a linked room
}
start=r;//it assigns the object r to start
}
private void findRoad2(Room end){ //this method permit to calculate
the path from 2 rooms that have a common linked room, but I don't know how
do to determinate a path for 2 room if between these 2 rooms there is more
of one room for example if I have these room 2-9-6-8(hte number are the id
of the room , the - are the link), with this method I am able to
derterminate the path from 2 to 9, from 2 to 6, but not for 2 to 8
for(int i=0; i<start.getNumVicini(); i++){
for(int j=0; j<end.getNumVicini(); j++){
if(start.getVicino(i)==end.getVicino(j) &&
start.verifica[end.getId()]==false){//This cycle verify if there is a common
linked room(like the room 9 in the example of the path from 2to6)
start.verifica[end.getId()]=true; //if there is this
common linked room it sets the verify[end.getId()] to true to indicate that
the path it is been determinated
start.percorsi[end.getId()]=start.getId()+ " " +
start.getVicino(i) + " " + end.getId(); //set the path, this path is equals
to start id and the id of the common linked room and end room id
}
}
}
}
If I have a map of the museum of this type:
7-8-3
| | |
6-4-2
| | |
5-0-1
(this map is only an example I could have a museum with 13 rooms that are
arranged in irregular way)
with the code that I have written I can determinate the path from 7 to 8,
from 7 to 6, from 7 to 4, from 7 to 3 and from 7 to 5, but NOT from 7 to 0,
from 7 to 1 or from 7 to 2
At the same way I can determinate the path from 0 to 5, from 0 to 1m from 0
to 4, from 0 to 8, from 0 to 2, from 0 to 6, but NOT from 0 to 3, from 0 to
7.
The some thing is for the rest of the rooms. I don't know how do to
determinate the rest of the path.
How can I do?
Thanks and excuse me.
- 15
- Microsoft Hatred FAQemail***@***.com wrote...
> On Tue, 25 Oct 2005 15:35:47 +0000, Not Bill Gates wrote:
>
> > Heck, I dunno. Like you, I don't even really care all that much.
>
> You don't care that innovation in desktop software has been crippled by
> the actions of the monopoly player Microsoft?
You need to first prove innovation in desktop software has been
crippled, don't you?
- 16
|
| Author |
Message |
Steve

|
Posted: 2006-11-29 3:59:00 |
Top |
java-programmer, http://javaservice.objectweb.org/
http://javaservice.objectweb.org/
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Notifying ClientsHi,
I want my server to notify all the clients connected to it.
Basically the server should send the no. of files (count) in each
directories. I don't want the server to send this to each and every
client individually. This should be done in an efficient way.
Will JMS be used efficiently for this? or Is there any other way
to do this efficiently?
Thanks,
Ganesh
- 2
- Progress bar to show the progress of a taskIn my application one click on the start button will fire one specific
task which includes some numerical computation routines and data
visualization routines.
Want to use progress bar to show the progress of the task execution,
even after reading sun's java swing tutorials still not clear how to
set the maximum length of the progress bar and update the progress
status.
Really appreciate your time and kind help!
Thanks a lot.
- 3
- Accessing the associated dataModel when a particular frame is selectedI have JDesktop containing one or more JInternalFrames. Each of these
frames contains a JScrollPane which in turn contains a JTable, each
with its own tableModel. I wish to add a row to the table in the
currently selected frame. How do I recover the tableModel to do this?
I can do it if I only have a single table using:
table.getModel().addRow(item);
but it would be easier for my end users if they could have multiple
tables open. The tables all have the same structure but have differing
numbers of rows. I also may need to edit existing items in the tables.
In line with the MVC architecture of Swing, it appears as if I am
trying to get to the model through the view rather than keeping the
model separate. This implies that I should keep a list (collection?)
of each model as I create it in my application. The difficulty then
becomes associating the currently selected view with the appropriate
model so that the editing is done in the appropriate table.
Any ideas or suggestions?
Oh, and a happy new year to everyone :-)
Bob
- 4
- Newbie question on stopping an applicationI have a simple console application that prompts the user to enter two
numbers and then the program multiplies these two numbers and spits out
the product. No problem so far. The difficulty I'm having is that if
someone enters a negative number, I want the program to reply something
like "Does not accept negative numbers!" then stop. I tried using
"break;" but it generated an error message and said that I was using it
"outside the loop" or something like that. I would be grateful if
someone could give me a clue on what I might use for this. Thank you
very much. My code is below.
public class Kilowatt
{
private double costKiloWattHours; //example 8.42 which means cents
private double hoursUsedPerYear; //example 653
private double annualCost;
public void setCost(double cost)
{
if (cost <= 0)
{
//I want the program to say "You can't enter a negative number."
//Then the program should stop execution.
}
else
{
costKiloWattHours = cost / 100;
}
}
public void setHours(double hours)
{
hoursUsedPerYear = hours;
}
public double getAnnualCost()
{
annualCost = costKiloWattHours * hoursUsedPerYear;
return annualCost;
}
}
import java.util.Scanner;
class Kilowatt_Test
{
public static void main(String[] args)
{
double myCost;
double myHours;
Scanner myScanner = new Scanner(System.in);
System.out.print("What's the cost per kilowatt hour? ");
myCost = myScanner.nextDouble();
Kilowatt myKilowatt = new Kilowatt();
myKilowatt.setCost(myCost);
System.out.print("How many kilowatt-hours are used per year? ");
myHours = myScanner.nextDouble();
myKilowatt.setHours(myHours);
System.out.println("The annual cost is: " +
myKilowatt.getAnnualCost());
}
}
- 5
- Oracle JDBC executeQuery() hanging with a to_char() in the selectCalling statement.executeQuery() hangs, anyone experienced this? Using
the Oracle thin driver v9.2.0.1.0 running on a Solaris 8 box. The
code:
Connection connection = cdrDataSource.getConnection();
Statement statement = connection.createStatement();
String sql = "SELECT
TO_CHAR(SOFIXML.SOFI_LIB.SOFI_GET_XML('CA89352LAC42', NULL, NULL))
FROM DUAL";
ResultSet resultSet = statement.executeQuery(sql);
if(resultSet.next()) {
return resultSet.getString(1);
}
The SOFI_GET_XML function returns a CLOB and I'm using TO_CHAR() to
convert is into a VARCHAR2 for speed. Not doing a TO_CHAR and
processing the CLOB works fine but is a little slow. The query runs
fine through both TOAD and SQLPlus.
Thanks, Chris
- 6
- Can start() method access applet parameters?I have a signed applet that needs to read in data passed from HTML
page
via PARAM elements defined in EMBED tag. Since I cannot launch a
method
directly via JavaScript (bug), I thought I'd try to see if I could get
the
code to run as needed via the start() method by reloading the page.
But my
applet is not recognizing the parameter values being passed in (when
output
for debugging, they show up as null). Can parameters be passed like
this to
the start() method??
Test HTML page:
<html>
<head><title>
Test a Signed Applet
</title></head>
<body>
<EMBED type="application/x-java-applet;jpi-version=1.4.2"
name="Launch" code="LaunchHSDXPlugIn.class"
archive="LaunchHSDXPlugIn.jar" WIDTH=120 HEIGHT=75
<PARAM NAME="ImageFile"
VALUE="\\ain-www06.devsrv\output\mapfile.jpg">
<PARAM NAME="VBCodeLocation"
VALUE="\\ain-www06.devsrv\RivCopy\CopytoClipboard.exe">
</EMBED>
<br><br>
<img name="copy" src="copy.png" onMouseDown="location.reload(true);">
</body>
</html>
Test JAVA code:
import java.applet.*;
import java.io.*;
public class LaunchHSDXPlugIn extends Applet
{
public void start()
{
System.out.println("\n** In start method.\n");
try
{
String getval = null;
getval = getParameter("ImageFile");
System.out.println("the imagefile is " + getval);
Runtime.getRuntime().exec("w:\\hyperionics\\hypersnap\\hsdx.exe -
fixed_title " + getval);
Thread.sleep(2500);
getval = getParameter("VBCodeLocation");
System.out.println("the vbcodelocation is " + getval);
Runtime.getRuntime().exec(getval);
}
catch (SecurityException e1)
{
System.out.println("\n** An access control error occurred
attempting to run LaunchHSDXPlugIn applet.\n");
e1.printStackTrace();
}
catch (IOException e2)
{
System.out.println("\n** Error attempting to execute HyperSnap or
copy to clipboard.\n");
e2.printStackTrace();
}
catch (Exception e3)
{
System.out.println("\n** An error occurred attempting to run
LaunchHSDXPlugIn applet.\n");
e3.printStackTrace();
}
}
}
- 7
- Problem with "if - else" statement in for loopI am having problems with this section of code...
public void updateRank(){
int x = -1;
int y = -1;
String winnerMemNum = JOptionPane.showInputDialog
("Enter winner's membership number:");
int wMemNum = Integer.parseInt(winnerMemNum);
for(int i=0;i<list.size();i++){
Player temp = (Player)list.get(i);
if(temp.getMemberNumber() == wMemNum)
x = i;
else
System.out.println("Player not found");
break;
}
I want the condition in the if statement to be tested for every element
in the list before the code in the else block executes, but at the
moment it is only testing the first element. I know I need to put
brackets in, but when I did that, the whole thing stopped working! Any
ideas?
- 8
- Event-Handling: Using one single class for different events?
Hi!
I am rather new to Java, so please, don't blame me for this question.
What I want is to seperate the GUI- from the Application code. Hence,
I have created three classes:
1. a Main class
2. a MainFrameCommand class, which parses the events
3. a MainFrameGUI class, that creates and paints the gui
(for a trivial example see end of this post)
Now, my question is this: Is it correct, to put all the various events
into one single command class (i.e, Focus-, Key-, Mouse-, and Windows-
Events) and then register the various event-listeners using this
single class?
It works perfectly, however, I wonder if this is a legal way to do so,
or is it necessary to create a seperate class for every different
event-listener-type?
Example:
------------------------------------------------------------
1. Main Class
------------------------------------------------------------
class Main {
public static void main(final String[] args) {
MainFrameCommand cmd = new MainFrameCommand();
MainFrameGUI gui = new MainFrameGUI(cmd);
}
}
------------------------------------------------------------
2. MainFrameCommand Class
------------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
class MainFrameCommand
implements KeyListener, MouseMotionListener, WindowListener {
/* Key Listener */
public void keyPressed(KeyEvent event) {}
public void keyReleased(KeyEvent event) {}
public void keyTyped(KeyEvent event) {}
/* MouseMotion Listener */
public void mouseMoved(MouseEvent event) {}
public void mouseDragged(MouseEvent event) {}
/* WindowListener */
public void windowClosed(WindowEvent event) {}
public void windowOpened(WindowEvent event) {}
public void windowClosing(WindowEvent event) {}
public void windowActivated(WindowEvent event) {}
public void windowDeactivated(WindowEvent event) {}
public void windowIconified(WindowEvent event) {}
public void windowDeiconified(WindowEvent event) {}
}
------------------------------------------------------------
3. MainFrameGUI Class
------------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
class MainFrameGUI extends Frame {
public MainFrameGUI(MainFrameCommand cmd) {
super("Window");
setSize(300, 300);
setVisible(true);
/* !!!!!!!!!!!!!!!!!!!!!!! HERE'S THE CRUCIAL QUESTION
!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!! Is it legal to add register all these
!!!!!!!!!!!!!!!!!!!!!!! event listeners using the same object?!?
*/
addKeyListener(cmd);
addWindowListener(cmd);
addMouseMotionListener(cmd);
}
public void paint(Graphics g) {}
}
- 9
- Problem communicating with socket applicationI am experiencing problems when trying to communicate with a TCP socket
based application that does not always append a <CR> at the end of the data
and so cannot use readLine on a BufferedInputStream.
I have tried using a simple read in to a char array but have found that
where the application has sent 4 records using 4 separate socket writes, my
read operation has resulted in them all being read in to one array and I
have no means of determining where one record ends and the next begins,
unless there are <CR> appended to each record, which as I stated is not
always the case :(
Using a normal unix socket read operation in C++ I would not have this
problem as each read operation would result in one record.
How can I get java sockets to operate in a similar manner as unix socket
reads so that one record is obtained in each read operation, regardless of
whether it is appended with a <CR> or not?
TIA,
Pep.
- 10
- Checbox help!!!I am trying to write a program that calculates the price when the checkboxes
are selected and the calculate button is pressed.
Now I am not sure how to code the part where you click the box and the price
of that item appears. Any suggestions?
Here is what I have now:
import java.awt.*; //Abstract Window Toolkit (AWT) for creating
//painting graphics, interfaces and images
import java.applet.*; //gives the classes for an applet to create and
//communicate in applet context
import java.awt.event.*; //gives classes and interface for different
//types of events from the AWT
import java.text.DecimalFormat; //this class formats decimal numbers
public class PetsApplet extends Applet implements ActionListener
{
//labels declared
Label welcomeLabel = new Label ("Welcome to the Pet Clinic");
Label price = new Label("The total price is $0");
Label current = new Label("The current price is $0");
Label serLabel = new Label("Select the service:");
//string text declared
String currentString = new String();
String priceString = new String();
//checkboxes identified
Checkbox officeBox = new Checkbox("Office Visits $10");
Checkbox vacBox = new Checkbox("Vaccination $25");
Checkbox xrayBox = new Checkbox("X-Rays $40");
Checkbox hosBox = new Checkbox("Hospitalization $100");
Checkbox denBox = new Checkbox("Dentistry $50");
Checkbox labBox = new Checkbox("Laboratory Work $30");
Checkbox heartBox = new Checkbox("Heartworm Prevention $35");
Checkbox boardBox = new Checkbox("Boarding $5");
Checkbox preBox = new Checkbox("Prescription $55");
Button calcButton = new Button ("Calculate");
Label outputLabel = new Label("Click the calculate button for total price");
//price variables of the services declared along with the totalPrice
int totalPrice = 0;
int officeBoxPrice = 10, vacBoxPrice = 25, xrayBoxPrice = 40, hosBoxPrice =
100;
int denBoxPrice = 50, labBoxPrice = 30, heartBoxPrice = 35, boardBoxPrice =
5, preBoxPrice = 55;
public void init()
{
//adds all the components to the applet interface
setBackground (Color.blue);
add(welcomeLabel);
add(serLabel);
add(officeBox);
add(vacBox);
add(xrayBox);
add(hosBox);
add(denBox);
add(labBox);
add(heartBox);
add(boardBox);
add(preBox);
add(current);
add(calcButton);
calcButton.addActionListener(this);
add(outputLabel);
add(price);
}
public void actionPerformed(ActionEvent e)
{
//the current price statement is identified
if (officeBox.getState())
currentString = ("The current price is $"+ Integer.toString
(officeBoxPrice));
if (vacBox.getState())
currentString = ("The current price is $"+ Integer.toString (vacBoxPrice))
;
if (xrayBox.getState())
currentString = ("The current price is $"+ Integer.toString (xrayBoxPrice))
;
if (hosBox.getState())
currentString = ("The current price is $"+ Integer.toString (hosBoxPrice))
;
if (denBox.getState())
currentString = ("The current price is $"+ Integer.toString (denBoxPrice))
;
if (labBox.getState())
currentString = ("The current price is $"+ Integer.toString (labBoxPrice))
;
if (heartBox.getState())
currentString = ("The current price is $"+ Integer.toString (heartBoxPrice)
);
if (boardBox.getState())
currentString = ("The current price is $"+ Integer.toString (boardBoxPrice)
);
if (preBox.getState())
currentString = ("The current price is $"+ Integer.toString (preBoxPrice))
;
//the text is set equal to currentString
current.setText (currentString);
//total price is calculated
totalPrice = 0;
if (officeBox.getState())
totalPrice += officeBoxPrice;
if (vacBox.getState())
totalPrice += vacBoxPrice;
if (xrayBox.getState())
totalPrice += xrayBoxPrice;
if (hosBox.getState())
totalPrice += hosBoxPrice;
if (denBox.getState())
totalPrice += denBoxPrice;
if (labBox.getState())
totalPrice += labBoxPrice;
if (heartBox.getState())
totalPrice += heartBoxPrice;
if (boardBox.getState())
totalPrice += boardBoxPrice;
if (preBox.getState())
totalPrice += preBoxPrice;
//output statement for total price is identified
priceString = ("The total price is $" + Integer.toString (totalPrice));
price.setText (priceString);
//statements to clear the fields after the calculate button is clicked
officeBox.setState(false);
vacBox.setState(false);
xrayBox.setState(false);
hosBox.setState(false);
denBox.setState(false);
labBox.setState(false);
heartBox.setState(false);
boardBox.setState(false);
preBox.setState(false);
}
}
- 11
- JTabbedPane doesn't follow Sun's UI standard?
I'm using the JTabbedPane control.
While looking for a way to get rid of the line between the tabs and the
selected frame, I noticed that the Sun guidelines show that there shouldn't
be one there in the first place:
http://java.sun.com/products/jlf/ed2/book/HIG.Windows3.html#38176
Is this maybe a result of using the system L&F on MS windows?
Is there any way of changing this?
-Bella
- 12
- Available memory and limit on thread creationJoseph Dionne wrote:
<snip>
>> Of course if you only had a J2EE server...
>> Seriously, this is the sort of situation where you could justify
>> the complexity and expense. Stateless or even stateful session
>> EJBs would fit the bill. Let the container manage the details.
>> Why re-invent the wheel?
>
> Because I have a frugal customer who is already not terribly excited
> about paying my bill? The real world sucks!
Read Roedy's reply carefully. He was able to succinctly describe the
limitations of the HTTP protocol, namely that it's stateless. What I
would suggest you consider is a hybrid of available technologies.
Given what you've described to-date, I would lean towards a JMS
solution. This would provide "loose coupling" and incorporates some
of Roedy's suggestions in terms of queueing requests/responses.
Insofar as J2EE servers, have you had a look at JBoss? While I
wouldn't recommend it for commercial, mission-critical applications,
it can serve as a powerful development platform when linked with the
Eclipse IDE. It might be enough to demonstrate to your client that
there IS a better way.
I'm just throwing out suggestions as what you're describing is quite
complex and would involve a major investment in time for development.
That will translate to $$, no matter how much or little you charge
per hour.
- 13
- Using pictures from the jar?
I create the jar with my classes, pictures and some txt files. The
application is starting just fine if picture folder is out of the jar.
If the folder picture is in the jar I don't see the pictures on my buttons
and everywhere.
How to solve that problem?
- 14
- Stack and Thread SafetyMay I assume that a stack is thread safe since it extends the
synchronized vector class?
Thanks.
--
Kenneth P. Turvey <email***@***.com>
Artificial Intelligence Algorithms Wiki
http://ai.squeakydolphin.com
- 15
- Java clock offsettable by minutes?I'm trying to find a Java clock applet that will allow me to offset the
minutes. Ideally, something attractive, customizable, TZ-sensitive *AND*
with a minutes offset.
I've searched pretty thoroughly, but that last requirement doesn't seem to
exist in the online archives. (Note that I mean a real minutes offset, not
just a 0030 TZ offset - i.e., make the clock run exactly 10 minutes slow or
15 minutes fast.)
Oh, and something outta the box... I'm, uh, not a Java programmer. :P
Ad(thanks)vance.
--
|=- James Gifford = FIX SPAMTRAP TO REPLY -=|
|=- So... your philosophy fits in a sig, does it? -=|
|
|
|