Gabriel Cane

Ranch Hand
+ Follow
since Mar 27, 2001
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gabriel Cane

I'm coding an application that does an INSERT into a database that triggers a delete on another record. Currently, the application has no way of letting the user know whether or not the triggered delete worked, only whether the INSERT failed.
The coworker who will be coding the trigger said that he would set the trigger to send a SQLSTATE message indicating whether or not the triggered delete (after the successful insert) worked.
My question is how do I capture this SQLSTATE message so that I can send it back to the user as an error/notification message? Will the SQLSTATE trigger an exception, or will I have to use some part of the JDBC API to capture this message.
Using the TimeZone classes, how can I get the beginning and ending dates for daylight saving time for a particular custom TimeZone.
21 years ago
I'm presently working on an application that has a feature that allows the user to configure the timezone for dates and times displayed on the machine. The configuration for the TimeZone works, but we need to take daylight savings time into account. What complicates matters is that some juridictions within different time zones don't use daylight savings time, such as Indianapolis, Indiana, for example.
Presently, the timezone information, including the display text, positive or negative offset from GMT, hours from GMT and minutes from GMT is taken from a property file for approximately 25 entries. These entries will at least double when we take into account different daylight savings methodologies within timezones. What complicates this even more is that different regions start and end daylight savings at different times.
I will be using the TimeZone object to take into account these different TimeZones.
My main question is whether I should put the different timezone/daylight savings rules into a database, instead of the property files. However, all other suggestions and perspectives on this problem will be welcome.
21 years ago
Using XPath, is it possible to combine to different expressions into a single query.
For example:
(I used the underscores to make it easier to read)
How would I create an XPath query to return all instances of kitchen AND closet in the same query?
Seperately, I would merely do:
1) Log in as root
2) edit /etc/profile
3) add your variables, as well as setting your classpath and path variable to include your JDK stuff
4) save the changes.
5) log out completely
6) log back in
It should work /etc/profile sets environmental variables for ALL USERS.
21 years ago
I'm having some problems with Xindice, the XML database.
Presently, I'm (trying) to run the Windows version of Xindice 1.0. I can run some of the example code, some not. The XUPdate code is giving me problems for a simple update on the database. When I try to run this code:
import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;
* Simple XML B API example to update the database.
public class XUpdate {
public static void main(String[] args) throws Exception {
Collection col = null;
try {
String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
Class c = Class.forName(driver);

Database database = (Database) c.newInstance();
col =
String xupdate = "<xu:modifications version=\"1.0\"" +
" xmlns:xu=\"\">" +
" <xu:remove select=\"/person/phone[@type = 'home']\"/>" +
" <xu:update select=\"/person/phone[@type = 'work']\">" +
" 480-300-3003" +
" </xu:update>" +
XUpdateQueryService service =
(XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");
catch (XMLDBException e) {
System.err.println("XML B Exception occured " + e.errorCode + " " +
finally {
if (col != null) {
I get this exception:
org.apache.xindice.client.corba.db.APIException: IDL rg/apache/xindice/client/corba/db/APIException:1.0
at org.apache.xindice.client.corba.db._CollectionStub.queryCollection(
at org.apache.xindice.examples.XUpdate.main(
XML B Exception occured 1 Query Processing Error
I looked at the javadocs and they say absolutely nothing on API Exceptions.
I'm running JDK 1.3 just as they asked and have all the jars they asked for in my CLASSPATH.
What's going on? How come their own example code would throw an exeption? Am I doing something wrong, or did they mess up their distribution?
Using the Java DOM classes, how would I go about getting a count of ONLY the descendent children of a parent node?
For example:
<bed />
<bedside_table />
<closet />
<oven />
<sink />
<fridge />
From the point of view of <house>, how would I get a count of 2 (kitchen and bedroom ONLY, not its children)?
What if I need to run Tomcat as a regular user? Is there a way for me to get Tomcat to use port 80?
21 years ago
I'm presently running Tomcat 3.3.1 on a Red Hat 6.2 server on port 8080, which is the default port for Tomcat. The problem occurs when I try to switch to port 80. After I edited to the server.xml to change the HttpConnector to port 80, running Tomcat gave me a permission denied message on port 80, followed by a really long stack trace.
I also tried changing to port number to 90, and I got exactly the same error message.
Our Red Hat 6.2 server was originally set up by an employee who has since been laid off from my company. He configured the installation to be ultra-secure, disabling such programs as the FTP command-line client and even ping
Now that this guy no longer works for us, there is no hard-core Linux expert at my company. We're left to scratch our heads and try to figure this out.
Where do I start? How do I change the Linux configuration so that port 80 will be free for tomcat to use?
We have no other option. A very large client specifically requested that we reconfigure Tomcat to run on port 80.
21 years ago
I solved the problem.
I had the boneheaded idea of copying my Windows batch file to a shell script file and then editing it. What I should have done instead was to create a brand new file in Linux and then add the command to that file.
My shell scripts now run the way they're supposed to.
21 years ago

Originally posted by Rob Levo:

I believe a ";" is required instead of a ":" as a separator for -cp paths.

No, in unix, the classpaths are separated by ":".
21 years ago
I'm having a very unusual problem. I have a java class that does operations on a database. I've made a Windows batch file that successfully runs this java class. Unfortunately, I can't get it to run off a unix shell. I can run a HelloWorld program using a no problem.
From the command prompt, I ran:
java -cp hsql.jar:. DropTables
and it worked.
I then created a shell script with these contents:
java -cp hsql.jar:. DropTables
Running, I got the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: DropTables
What am I doing wrong? I tried putting in the absolute path instead of the dot, and it still didn't work.
21 years ago
How would I find the machine name using the Java API?
I just tried printing out System.getProperties, and there doesn't appear to be anything relating to the actual name of the machine, only the property is remotely close to what I'm looking for.
Presently, I'm developing on Win2000, but we will be deploying on RedHat Linux 6.2.
21 years ago
Using non-deprocated API's, how do I take an existing XML file, make changes, and then save them back to the file?
I've gone through all the Java XML API documentation to no avail
Using the Date and DateFormat objects, using non-deprecated methods, how would I take a Java Date object and output it in GMT, specifically:
2002/04/07 hh:mm:ss
22 years ago