| CachedRowSet and double column types |
|
 |
Index ‹ java-programmer
|
- Previous
- 3
- Ant : how can I use properties to store nested elementHi all,
I have a build script which uses <fileset> nested in <path> to store
the classpath and then this <path> is used in javac. e.g.
<path id="MY_CLASSPATH">
<fileset dir="${build.dir.lib}" includes="**/*.*"/>
<fileset file="${global.lib.j2ee}"/>
</path>
<javac
srcdir = "${project.compile.src}"
destdir = "${project.compile.dest}">
<classpath>
<path refid="MY_CLASSPATH"/>
</classpath>
</javac>
I just wondering is it possible to store the fileset in the properties
file so that I can reference it in other place? I want to do a fileset
instead of writing all the jar file names explicitly.
e.g.
In the properties file:
project.compile.classpath=dir:${build.dir.lib}:file:${global.lib.j2ee}
(or something like that....)
then in my build.xml:
<javac
srcdir = "${project.compile.src}"
destdir = "${project.compile.dest}">
classpath = "${project.compile.classpath}">
</javac>
- 3
- Strange JFrame / JPanel behaviourDear friends,
I have a problem with a JFrame (NewJFrame) and a JPanel (JP) subclass.
NewJFrame acts as a container for JP. Now, let's suppose that "a" is a
JP instance variable, with public modifier, to put it simple.
So, if I want to modify "a" from NewJFrame, and JP is a NewJframe's
instance variable, it can be done as follows:
jp.a = 8; // for instance
so far so good.
But, I've found a strange behaviour: when I try to print "a" from JP's
paintComponent() (overloaded), its value remains unchanged.
Here is the code, edited with Netbeans:
// ===================================================================
/**
*
* "container" JFrame
*/
public class NewJFrame extends javax.swing.JFrame {
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuBar jMenuBar2;
private javax.swing.JMenuItem jMenuItem1;
private JP j = new JP();
public NewJFrame() {
initComponents();
}
private void initComponents() {
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuBar2 = new javax.swing.JMenuBar();
jMenu2 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenu1.setText("Menu");
jMenuBar1.add(jMenu1);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jMenu2.setText("Menu");
jMenuItem1.setText("Item");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem1);
jMenuBar2.add(jMenu2);
setJMenuBar(jMenuBar2);
pack();
}
// </editor-fold>
// modify "a" from NewJFrame
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
j.a++;
System.out.println("a: "+ j.a);
j.repaint();
System.out.println("a: "+ j.a);
}
public void init2(){
JP j = new JP();
getContentPane().add(j, java.awt.BorderLayout.CENTER);
pack();
}
public static void main(String args[]) {
NewJFrame n = new NewJFrame();
n.init2();
n.setVisible(true);
System.out.println(n.j);
n.j.a = 3;
System.out.println(n.j.a);
}
}
// "extended" JPanel
import java.awt.Graphics;
import javax.swing.JPanel;
/**
*
* extended JPanel
*/
public class JP extends JPanel{
public int a =0;
/** Creates a new instance of JP */
public JP() {
}
public void paintComponent(Graphics g){
System.out.println(this.a);
// [snip]
}
}
=========================================================================
In "jMenuItem1ActionPerformed", (using a JMenu) I tried to
- increment a
- print a (apparently incremented)
- invoke JS repaint, which prints a, again, but NOT incremented... why?
- reprint a: now it says it's incremented!!!
every time I call paintComponent (for example, resizing the component),
it says that a is "its" a.
It seems like paintComponent maintains its own copy of a, with the
unchanged value, or that paintComponent doesn't see any update to a...
Is it a mistake (I hope) or a bug?
Any help would be appreciated.
- 3
- Preparing a StringHello
I am preparing xpath queries for xml parsing.
To make each xpath query i have to add variables and join more Strings.
I was wondering if there is any way i can create java string same as
SqlPrepareStatement
somthing like
String p = "my name is ?"
public void foo("joe"){
//add name in string p so that
//p = "my name is joe"
}
any help
thanks
Pinto
- 5
- Generic file name validation code?I need to validate a file name but it has to work on Windows & Unix!
Does anybody know of java code that does this?
thanks in advance
harry
- 11
- Java Window/GUI HelpOk im trying to create a program in java right now and my knowledge of
it has proved somewhat .... limited.....
Info:
Im making a program using javaspaces to simulate an auction over the
network.
Requirements:
1) user can add a lot to the auction
2) browse current lots on sale
3) users can withdraw their item from sale.
OK now this has to be done as a GUI which is what is hindering me.
The only type of GUI work i have done have been fairly static.
Just a plain window with a few buttons and such which might bring up a
picture or change some text in a text box or something.
But what im having trouble with now is the whole GUI design and how to
go about it.
Say i had 3 butons in my window |Add| |Browse| |withdraw|.
Clicking any of these should change the whole structure of the window
and i dont know how to do this..
Itd be a case of clearing half of the window off and redrawing over
the top of it.
Unless i went the route of having an extremely simple window with 3
buttons, clicking each would open up a new window with the desired
options...
What would be the best way to go about it? and how would i go about
implementing it? just a few tips are needed :)
Im really not a windows fan... a console app would take an hour or so.
This is gonna keep me going for aaaaaages :$
I hope im making sense and not babbing too much - 36 hours without
sleep and a huge abundance of caffeine is warping my mind o.O
- 14
- negative dns caching problem *resolved* (was Re: JDK 1.5.0 patchsetAfter months of fighting with this, today I stumbled upon the answer. It
was a java command line test case that led me to it.
>From the command line, FreeBSD's JDK does -exactly- what it is supposed to
with negative caching. My test case involved restarting BIND, adding a
firewall rule for a host's name servers, having Java try to resolve the
name (and of course fail), having Java wait while removing the firewall
rule and having Java try again to resolve the name. All the while I was
watching network traffic with tcpdump.
Exactly as it is supposed to, the JDK tried again and succeeded after I
removed the firewall rule.
So this meant that it had to be something to do with Tomcat or
commons-daemon/jsvc.
On a whim, I removed the entry for Tomcat's native libraries, and it
started to work correctly.
Then I did an ldd against libtcnative, and found that I had compiled it
with gcc 4.2.1. Knowing that there are problems with gcc 4.2, I
recompiled with gcc 3.4.6. It continues to work correctly.
So this turned out to be a multi-pronged problem. Earlier I was building
a version of the JDK that somehow never read java.security, and that
required wiping out the work directory entirely and bootstrapping off the
Diablo JDK. Then, something about compiling the Tomcat native libraries
with gcc 4.2.1 was apparently creating this bad behaviour situation.
So if you're using Tomcat, and you want to use the Tomcat native
libraries, do not compile them with gcc 4.2. In fact, you probably will
want to make sure you compile them with the same major.minor version of
gcc you used to compile libapr just to be safe. The Tomcat native library
IS capable of screwing your DNS resolution.
Nick
On Sun, 28 Oct 2007, Nick Johnson wrote:
> Sadly, this does NOT correct the eternal negative caching problem. That
> problem still remains, even though I've configured the JDK not to cache
> negative results at all.
>
> I can do a tcpdump and see that the JDK makes no attempt whatsoever to
> query a host again after it has previously timed out. Nothing I've tried
> to fix the problem has had any effect.
>
> Nick
>
> On Fri, 26 Oct 2007, Nick Johnson wrote:
>
> > It remains to be seen whether this will resolve the problems I've been
> > having with InetAddress caching, but I am hopeful that it will.
>
>
--
"Courage isn't just a matter of not being frightened, you know. It's being
afraid and doing what you have to do anyway."
Doctor Who - Planet of the Daleks
This message has been brought to you by Nick Johnson 2.3b1 and the number 6.
http://healerNick.com/ http://morons.org/ http://spatula.net/
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 14
- need Java book for a C# / C C++ proficient programmer?hi,
I've never cared for Java before but now i feel like learning it. I'm
an MCP and a pretty experienced programmer. Also, i plan to take the
SCJP and maybe the SCMAD exams.
Is there a java book out that is for a programmer?? I already have a
copy of Hebert S. java reference, that would be my last option. Also,
i would want the books to somewhat cover the exams I plan to do.
Thanks so much
Gideon
- 14
- reading \n from a fileI am reading from a file and storing in String.
I need to separate a word so that part of it goes to next line
abc\nxyd
I am moving this text to button.setText() and this should
appear on the button as
abc
xyz
for that I am putting newline escape there.
it is not working. I have tried putting unicode string in
place of \n that also is not working.
how to do it?
-Rawat
- 14
- How to identify the cause of ClassCastException?Hi,
I have two classes: State and WarmState.
public class State
{
... //many fields
}
public class WarmState extends State
{
... //more fields
}
Now, I have a State reference state, whose corresponding object was
created and filled. I believe/guess/thought it is a WarmState object.
Now I need to pass state to a method which only take WarmState
parameter. So I cast state to WarmState type. But I ran into
ClassCastException. Like I said, state was created and loaded from a xml
file. I hope to find out what caused ClassCastException. But neither of
these gave me a clue:
e.getMessage()
e.getLocalMessage()
e.printStackTrace()
Thank you for your help.
- 14
- Newbie Question: Eclipse RCP - three questionsHi all,
I'm trying to develop Eclipse RCP database based application and I've faced
following problems.
First :
I don't know where can I create and dispose the ImageRegistry ?
Class WorkbenchAdvisor doesn't seem to be right place to do this, I couldn't
find the method
like initializeImageRegistry.
Second:
Where should I keep for example the database connections or references to
the beans
shared among different parts of the application especially further plugins ?
Third:
Is there any example of the real database driven RCP application with source
code available
or at least an article describing this topic ?
Thank's in advance
--
Marcin Misiewicz
- 14
- JAXB & Excel 2003I downloaded Microsoft Office 2003 Reference Schemas from:
http://www.microsoft.com/downloads/details.aspx?familyid=fe118952-3547-420a-a412-00a2662442d9&displaylang=en
Then I tried to use JAXB on them, specifically excel.xsd and
excelss.xsd. The first one passes OK, but doesn't contain Worksheet
element, which is the root element for Excel 2003 documents saved as
XML. The other schema, excelss.xsd, contains the definition of this
element, but doesn't pass through JAXB. The output of:
xjc -p generated excelss.xsd
is:
-------------------- cut here ---------------
parsing a schema...
[ERROR] Property "Name" is already defined.
line 219 of file:/C:/xls/office.xsd
[ERROR] The following location is relevant to the above error
line 204 of file:/C:/xls/office.xsd
[ERROR] Property "Namespaceuri" is already defined.
line 214 of file:/C:/xls/office.xsd
[ERROR] The following location is relevant to the above error
line 199 of file:/C:/xls/office.xsd
[ERROR] Property "Url" is already defined.
line 224 of file:/C:/xls/office.xsd
[ERROR] The following location is relevant to the above error
line 209 of file:/C:/xls/office.xsd
[ERROR] Property "FullColumns" is already defined.
line 590 of file:/C:/xls/excelss.xsd
[ERROR] The following location is relevant to the above error
line 5042 of file:/C:/xls/excel.xsd
[ERROR] Property "FullRows" is already defined.
line 595 of file:/C:/xls/excelss.xsd
[ERROR] The following location is relevant to the above error
line 5047 of file:/C:/xls/excel.xsd
[ERROR] Property "DefaultColumnWidth" is already defined.
line 555 of file:/C:/xls/excelss.xsd
[ERROR] The following location is relevant to the above error
line 5057 of file:/C:/xls/excel.xsd
[ERROR] Property "DefaultRowHeight" is already defined.
line 560 of file:/C:/xls/excelss.xsd
[ERROR] The following location is relevant to the above error
line 5052 of file:/C:/xls/excel.xsd
[ERROR] Property "Fill" is already defined.
line 374 of file:/C:/xls/office.xsd
[ERROR] The following location is relevant to the above error
line 405 of file:/C:/xls/office.xsd
[ERROR] Property "Colors" is already defined.
line 422 of file:/C:/xls/office.xsd
[ERROR] The following location is relevant to the above error
line 429 of file:/C:/xls/office.xsd
[ERROR] Property "Path" is already defined.
line 597 of file:/C:/xls/vml.xsd
[ERROR] The following location is relevant to the above error
line 616 of file:/C:/xls/vml.xsd
[ERROR] Property "Opacity2" is already defined.
line 288 of file:/C:/xls/vml.xsd
[ERROR] The following location is relevant to the above error
line 316 of file:/C:/xls/vml.xsd
[ERROR] Property "Title" is already defined.
line 292 of file:/C:/xls/vml.xsd
[ERROR] The following location is relevant to the above error
line 314 of file:/C:/xls/vml.xsd
[ERROR] Property "Path" is already defined.
line 745 of file:/C:/xls/vml.xsd
[ERROR] The following location is relevant to the above error
line 771 of file:/C:/xls/vml.xsd
[ERROR] Property "Path" is already defined.
line 531 of file:/C:/xls/vml.xsd
[ERROR] The following location is relevant to the above error
line 551 of file:/C:/xls/vml.xsd
[ERROR] Property "Wrapcoords" is already defined.
line 44 of file:/C:/xls/vml.xsd
[ERROR] The following location is relevant to the above error
line 46 of file:/C:/xls/vml.xsd
[ERROR] Property "Path" is already defined.
line 647 of file:/C:/xls/vml.xsd
[ERROR] The following location is relevant to the above error
line 663 of file:/C:/xls/vml.xsd
[ERROR] Property "Spid" is already defined.
line 664 of file:/C:/xls/vml.xsd
[ERROR] The following location is relevant to the above error
line 666 of file:/C:/xls/vml.xsd
[ERROR] Property "Path" is already defined.
line 681 of file:/C:/xls/vml.xsd
[ERROR] The following location is relevant to the above error
line 701 of file:/C:/xls/vml.xsd
[ERROR] Property "Path" is already defined.
line 623 of file:/C:/xls/vml.xsd
[ERROR] The following location is relevant to the above error
line 640 of file:/C:/xls/vml.xsd
[ERROR] Property "Path" is already defined.
line 569 of file:/C:/xls/vml.xsd
[ERROR] The following location is relevant to the above error
line 590 of file:/C:/xls/vml.xsd
[ERROR] Property "Fill" is already defined.
line 198 of file:/C:/xls/vml.xsd
[ERROR] The following location is relevant to the above error
line 207 of file:/C:/xls/vml.xsd
[ERROR] Property "Path" is already defined.
line 711 of file:/C:/xls/vml.xsd
[ERROR] The following location is relevant to the above error
line 729 of file:/C:/xls/vml.xsd
Failed to parse a schema.
-------------------- cut here ---------------
Any ideas?
- 14
- Eclipse 3.1.1_3 / jdk-1.5.0p2_3 core dump#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# SIGSEGV (0xb) at pc=0x2865b2dc, pid=65081, tid=0x8060000
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0-p2-rinyu_02_jan_2006_11_07 mixed mode)
# Problematic frame:
# C [libzip.so+0x102dc] inflate_fast+0xcc
#
--------------- T H R E A D ---------------
Current thread (0x08060c00): JavaThread "main" [_thread_in_native, id=134610944]
siginfo:si_signo=11, si_errno=0, si_code=12, si_addr=0x0040001b
Registers:
EAX=0x0040001b, EBX=0x2865f914, ECX=0x00000002, EDX=0x08056c80
ESP=0xbfbfc538, EBP=0xbfbfc59c, ESI=0x00001000, EDI=0x00000005
EIP=0x2865b2dc, EFLAGS=0x00010206
Top of Stack: (sp=0xbfbfc538)
0xbfbfc538: 2807d900 280763f8 280763f8 2865b210
0xbfbfc548: bfbfc578 2805a224 2807a864 00000001
0xbfbfc558: 00000000 00000001 00000000 00000001
0xbfbfc568: 2807d900 00000000 b42ad500 00000000
0xbfbfc578: 000a0008 00060004 000c0003 00090008
0xbfbfc588: 00090008 0833e000 0040001b 45175424
0xbfbfc598: 00001000 bfbfc62c 4516a188 0833b00c
0xbfbfc5a8: 00001000 0000001b 0833e064 0833e050
Instructions: (pc=0x2865b2dc)
0x2865b2cc: d4 23 45 ec c1 e0 03 03 45 10 89 45 f4 8b 45 f4
0x2865b2dc: 0f b6 00 89 45 f0 8b 45 f0 85 c0 75 34 8b 45 f4
Stack: [0xbfa00000,0xbfc00000), sp=0xbfbfc538, free space=2033k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libzip.so+0x102dc] inflate_fast+0xcc
C [libz.so.3+0x5188] inflate+0xea8
C [libfreetype.so.9+0x26887] FTC_SBitCache_Lookup+0x88e7
C [libfreetype.so.9+0x269cb] FTC_SBitCache_Lookup+0x8a2b
C [libfreetype.so.9+0x26a69] FTC_SBitCache_Lookup+0x8ac9
C [libfreetype.so.9+0x7421] FT_Stream_EnterFrame+0x61
C [libfreetype.so.9+0x7a7d] FT_Stream_ReadFields+0x7d
C [libfreetype.so.9+0x2c7cc] FT_Stream_OpenLZW+0x574c
C [libfreetype.so.9+0x2db55] FT_Stream_OpenLZW+0x6ad5
C [libfreetype.so.9+0x2e398] FT_Stream_OpenLZW+0x7318
C [libfreetype.so.9+0xadb7] FT_Load_Char+0x3f7
C [libfreetype.so.9+0xba7c] FT_Open_Face+0x16c
C [libfreetype.so.9+0xae88] FT_New_Face+0x48
C [libfontconfig.so.1+0x131b5] FcFreeTypeQuery+0xb5
C [libfontconfig.so.1+0x12598] FcFileScanConfig+0x218
C [libfontconfig.so.1+0x1291a] FcDirScanConfig+0x1fa
C [libfontconfig.so.1+0xcd5d] FcConfigBuildFonts+0xbd
C [libfontconfig.so.1+0x15f7f] FcInitLoadConfigAndFonts+0x2f
C [libfontconfig.so.1+0x15fc7] FcInit+0x27
C [libfontconfig.so.1+0xce82] FcConfigGetCurrent+0x22
C [libfontconfig.so.1+0x17f1e] FcFontList+0x1e
C [libpangoft2-1.0.so.0+0x832c] _pango_fc_font_map_remove+0x25c
C [libpango-1.0.so.0+0x14776] pango_font_map_list_families+0x56
C [libpango-1.0.so.0+0x11757] pango_context_list_families+0xb7
C [libswt-pi-gtk-3139.so+0x33724] Java_org_eclipse_swt_internal_gtk_OS__1pango_1context_1list_1families+0x74
j org.eclipse.swt.internal.gtk.OS._pango_context_list_families(I[I[I)V+0
j org.eclipse.swt.internal.gtk.OS.pango_context_list_families(I[I[I)V+10
j org.eclipse.swt.graphics.Device.getFontList(Ljava/lang/String;Z)[Lorg/eclipse/swt/graphics/FontData;+53
j org.eclipse.jface.resource.FontRegistry.bestData([Lorg/eclipse/swt/graphics/FontData;Lorg/eclipse/swt/widgets/Display;)Lorg/eclipse/swt/graphics/FontData;+51
j org.eclipse.jface.resource.FontRegistry.bestDataArray([Lorg/eclipse/swt/graphics/FontData;Lorg/eclipse/swt/widgets/Display;)[Lorg/eclipse/swt/graphics/FontData;+3
j org.eclipse.ui.internal.themes.ThemeElementHelper.installFont(Lorg/eclipse/ui/internal/themes/FontDefinition;Lorg/eclipse/ui/themes/ITheme;Lorg/eclipse/jface/preference/IPreferenceStore;Z)V+107
j org.eclipse.ui.internal.themes.ThemeElementHelper.populateRegistry(Lorg/eclipse/ui/themes/ITheme;[Lorg/eclipse/ui/internal/themes/FontDefinition;Lorg/eclipse/jface/preference/IPreferenceStore;)V+84
j org.eclipse.ui.internal.Workbench.initializeFonts()V+29
j org.eclipse.ui.internal.Workbench.init(Lorg/eclipse/swt/widgets/Display;)Z+527
j org.eclipse.ui.internal.Workbench.runUI()I+39
j org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Lorg/eclipse/swt/widgets/Display;Lorg/eclipse/ui/application/WorkbenchAdvisor;)I+11
j org.eclipse.ui.PlatformUI.createAndRunWorkbench(Lorg/eclipse/swt/widgets/Display;Lorg/eclipse/ui/application/WorkbenchAdvisor;)I+2
j org.eclipse.ui.internal.ide.IDEApplication.run(Ljava/lang/Object;)Ljava/lang/Object;+98
j org.eclipse.core.internal.runtime.PlatformActivator$1.run(Ljava/lang/Object;)Ljava/lang/Object;+257
j org.eclipse.core.runtime.adaptor.EclipseStarter.run(Ljava/lang/Object;)Ljava/lang/Object;+170
j org.eclipse.core.runtime.adaptor.EclipseStarter.run([Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Object;+57
v ~StubRoutines::call_stub
V [libjvm.so+0x25c581]
V [libjvm.so+0x34fb15]
V [libjvm.so+0x25c3db]
V [libjvm.so+0x371a49]
V [libjvm.so+0x3744b6]
V [libjvm.so+0x2bad54]
C [libjava.so+0xc142] Java_sun_reflect_NativeMethodAccessorImpl_invoke0+0x22
j sun.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0
j sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+87
j sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6
j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+111
j org.eclipse.core.launcher.Main.invokeFramework([Ljava/lang/String;[Ljava/net/URL;)V+181
j org.eclipse.core.launcher.Main.basicRun([Ljava/lang/String;)V+107
j org.eclipse.core.launcher.Main.run([Ljava/lang/String;)I+4
j org.eclipse.core.launcher.Main.main([Ljava/lang/String;)V+10
v ~StubRoutines::call_stub
V [libjvm.so+0x25c581]
V [libjvm.so+0x34fb15]
V [libjvm.so+0x25c3db]
V [libjvm.so+0x26543f]
V [libjvm.so+0x2724cb]
C [java+0x3ae2] _init+0x2ba6
C [java+0x1389] _init+0x44d
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.eclipse.swt.internal.gtk.OS._pango_context_list_families(I[I[I)V+0
j org.eclipse.swt.internal.gtk.OS.pango_context_list_families(I[I[I)V+10
j org.eclipse.swt.graphics.Device.getFontList(Ljava/lang/String;Z)[Lorg/eclipse/swt/graphics/FontData;+53
j org.eclipse.jface.resource.FontRegistry.bestData([Lorg/eclipse/swt/graphics/FontData;Lorg/eclipse/swt/widgets/Display;)Lorg/eclipse/swt/graphics/FontData;+51
j org.eclipse.jface.resource.FontRegistry.bestDataArray([Lorg/eclipse/swt/graphics/FontData;Lorg/eclipse/swt/widgets/Display;)[Lorg/eclipse/swt/graphics/FontData;+3
j org.eclipse.ui.internal.themes.ThemeElementHelper.installFont(Lorg/eclipse/ui/internal/themes/FontDefinition;Lorg/eclipse/ui/themes/ITheme;Lorg/eclipse/jface/preference/IPreferenceStore;Z)V+107
j org.eclipse.ui.internal.themes.ThemeElementHelper.populateRegistry(Lorg/eclipse/ui/themes/ITheme;[Lorg/eclipse/ui/internal/themes/FontDefinition;Lorg/eclipse/jface/preference/IPreferenceStore;)V+84
j org.eclipse.ui.internal.Workbench.initializeFonts()V+29
j org.eclipse.ui.internal.Workbench.init(Lorg/eclipse/swt/widgets/Display;)Z+527
j org.eclipse.ui.internal.Workbench.runUI()I+39
j org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Lorg/eclipse/swt/widgets/Display;Lorg/eclipse/ui/application/WorkbenchAdvisor;)I+11
j org.eclipse.ui.PlatformUI.createAndRunWorkbench(Lorg/eclipse/swt/widgets/Display;Lorg/eclipse/ui/application/WorkbenchAdvisor;)I+2
j org.eclipse.ui.internal.ide.IDEApplication.run(Ljava/lang/Object;)Ljava/lang/Object;+98
j org.eclipse.core.internal.runtime.PlatformActivator$1.run(Ljava/lang/Object;)Ljava/lang/Object;+257
j org.eclipse.core.runtime.adaptor.EclipseStarter.run(Ljava/lang/Object;)Ljava/lang/Object;+170
j org.eclipse.core.runtime.adaptor.EclipseStarter.run([Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Object;+57
v ~StubRoutines::call_stub
j sun.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0
j sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+87
j sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6
j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+111
j org.eclipse.core.launcher.Main.invokeFramework([Ljava/lang/String;[Ljava/net/URL;)V+181
j org.eclipse.core.launcher.Main.basicRun([Ljava/lang/String;)V+107
j org.eclipse.core.launcher.Main.run([Ljava/lang/String;)I+4
j org.eclipse.core.launcher.Main.main([Ljava/lang/String;)V+10
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x081af600 JavaThread "Worker-4" daemon [_thread_blocked, id=135985152]
0x09239e00 JavaThread "Worker-3" daemon [_thread_blocked, id=153030656]
0x09220800 JavaThread "Worker-2" daemon [_thread_blocked, id=153225728]
0x09220400 JavaThread "Worker-1" daemon [_thread_blocked, id=153224704]
0x09220000 JavaThread "Worker-0" daemon [_thread_blocked, id=153223680]
0x084b0400 JavaThread "Start Level Event Dispatcher" daemon [_thread_blocked, id=139134464]
0x0849fe00 JavaThread "Framework Event Dispatcher" daemon [_thread_blocked, id=139132928]
0x08484600 JavaThread "State Data Manager" daemon [_thread_blocked, id=138954752]
0x08190400 JavaThread "process reaper" daemon [_thread_in_native, id=135857664]
0x08140c00 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=135532032]
0x08140800 JavaThread "CompilerThread0" daemon [_thread_blocked, id=135531008]
0x08140400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=135529984]
0x08140000 JavaThread "Finalizer" daemon [_thread_blocked, id=135528960]
0x0806bc00 JavaThread "Reference Handler" daemon [_thread_blocked, id=134659584]
=>0x08060c00 JavaThread "main" [_thread_in_native, id=134610944]
Other Threads:
0x08130100 VMThread [id=134658560]
0x0805ac00 WatcherThread [id=135660032]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 2880K, used 2457K [0x2d570000, 0x2d880000, 0x2e920000)
eden space 2624K, 87% used [0x2d570000, 0x2d7abf40, 0x2d800000)
from space 256K, 66% used [0x2d800000, 0x2d82a6f8, 0x2d840000)
to space 256K, 0% used [0x2d840000, 0x2d840000, 0x2d880000)
tenured generation total 37824K, used 15811K [0x2e920000, 0x30e10000, 0x3d570000)
the space 37824K, 41% used [0x2e920000, 0x2f890d88, 0x2f890e00, 0x30e10000)
compacting perm gen total 8192K, used 8069K [0x3d570000, 0x3dd70000, 0x41570000)
the space 8192K, 98% used [0x3d570000, 0x3dd51600, 0x3dd51800, 0x3dd70000)
No shared spaces configured.
Dynamic libraries:
0x08048000 /usr/local/jdk1.5.0/bin/java
0x28083000 /usr/lib/libpthread.so.2
0x280a9000 /lib/libc.so.6
0x281a0000 /usr/local/jdk1.5.0/jre/lib/i386/client/libjvm.so
0x285f4000 /lib/libm.so.4
0x2860e000 /usr/local/jdk1.5.0/jre/lib/i386/native_threads/libhpi.so
0x2861f000 /usr/local/jdk1.5.0/jre/lib/i386/libverify.so
0x2862c000 /usr/local/jdk1.5.0/jre/lib/i386/libjava.so
0x2864b000 /usr/local/jdk1.5.0/jre/lib/i386/libzip.so
0x41855000 /usr/local/jdk1.5.0/jre/lib/i386/libnet.so
0x41866000 /usr/local/jdk1.5.0/jre/lib/i386/libnio.so
0x44bc2000 /usr/home/rinyu/.eclipse/org.eclipse.platform_3.1.1/configuration/org.eclipse.osgi/bundles/34/1/.cp/libswt-pi-gtk-3139.so
0x44c05000 /usr/X11R6/lib/libgtk-x11-2.0.so.0
0x44f08000 /usr/local/lib/libgthread-2.0.so.0
0x44f0c000 /usr/X11R6/lib/libXtst.so.6
0x44f11000 /usr/X11R6/lib/libgdk_pixbuf-2.0.so.0
0x44f28000 /usr/X11R6/lib/libgdk-x11-2.0.so.0
0x44fac000 /usr/X11R6/lib/libXrandr.so.2
0x44fb0000 /usr/X11R6/lib/libXrender.so.1
0x44fb8000 /usr/X11R6/lib/libXi.so.6
0x44fc0000 /usr/X11R6/lib/libXinerama.so.1
0x44fc3000 /usr/X11R6/lib/libXext.so.6
0x44fd1000 /usr/X11R6/lib/libX11.so.6
0x4509b000 /usr/X11R6/lib/libpangocairo-1.0.so.0
0x450a2000 /usr/X11R6/lib/libpangoft2-1.0.so.0
0x450c9000 /usr/X11R6/lib/libfontconfig.so.1
0x450f9000 /usr/local/lib/libfreetype.so.9
0x45165000 /lib/libz.so.3
0x45176000 /usr/X11R6/lib/libpango-1.0.so.0
0x451af000 /usr/local/lib/libatk-1.0.so.0
0x451c8000 /usr/local/lib/libgobject-2.0.so.0
0x45202000 /usr/local/lib/libgmodule-2.0.so.0
0x45206000 /usr/local/lib/libglib-2.0.so.0
0x4528d000 /usr/local/lib/libiconv.so.3
0x4537a000 /usr/local/lib/libcairo.so.2
0x453d0000 /usr/local/lib/libintl.so.6
0x453da000 /usr/X11R6/lib/libXcursor.so.1
0x453e3000 /usr/X11R6/lib/libXfixes.so.3
0x453e8000 /usr/local/lib/libexpat.so.5
0x4540a000 /usr/local/lib/libpng.so.5
0x4542f000 /usr/local/lib/libglitz.so.1
0x45458000 /usr/X11R6/lib/X11/locale/lib/common/xlcDef.so.2
0x45482000 /usr/home/rinyu/.eclipse/org.eclipse.platform_3.1.1/configuration/org.eclipse.osgi/bundles/34/1/.cp/libswt-gtk-3139.so
0x28055000 /libexec/ld-elf.so.1
VM Arguments:
jvm_args: -Xms40m -Xmx256m
java_command: /usr/local/eclipse/startup.jar -os freebsd -ws gtk -arch x86 -launcher /usr/local/eclipse/eclipse -name Eclipse -showsplash 600 -exitdata 1260004 -vm /usr/local/bin/java -vmargs -Xms40m -Xmx256m -jar /usr/local/eclipse/startup.jar
Environment Variables:
JAVA_HOME=/usr/local/jdk1.5.0
PATH=/usr/local/bin:/home/rinyu/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/local/Gamess:/usr/local/Mopac93
LD_LIBRARY_PATH=/usr/local/jdk1.5.0/jre/lib/i386/client:/usr/local/jdk1.5.0/jre/lib/i386:/usr/local/jdk1.5.0/jre/../lib/i386:/usr/X11R6/lib/mozilla::/usr/X11R6/lib/mozilla
SHELL=/bin/csh
DISPLAY=:0.0
HOSTTYPE=FreeBSD
OSTYPE=FreeBSD
MACHTYPE=i386
--------------- S Y S T E M ---------------
OS:FreeBSD
uname:FreeBSD 6.0-STABLE FreeBSD 6.0-STABLE #0: Tue Jan 3 08:01:57 CET 2006 email***@***.com:/usr/obj/usr/src/sys/MYKERNEL i386
rlimit: STACK 65536k, CORE infinity, NOFILE 11095
CPU:total 1 family 6, cmov, cx8, fxsr, mmx
Memory: 4k page, physical 1364144k
vm_info: Java HotSpot(TM) Client VM (1.5.0-p2-rinyu_02_jan_2006_11_07) for freebsd-x86, built on Jan 2 2006 12:16:08 by root with gcc 3.4.4 [FreeBSD] 20050518
-------------------------------------------------------------------------------
DMESG:
Copyright (c) 1992-2005 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD 6.0-STABLE #0: Tue Jan 3 08:01:57 CET 2006
email***@***.com:/usr/obj/usr/src/sys/MYKERNEL
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: AMD Athlon(tm) XP 3000+ (2162.74-MHz 686-class CPU)
Origin = "AuthenticAMD" Id = 0x6a0 Stepping = 0
Features=0x383fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE>
AMD Features=0xc0400800<SYSCALL,MMX+,3DNow+,3DNow>
real memory = 1610547200 (1535 MB)
avail memory = 1564954624 (1492 MB)
mptable_probe: MP Config Table has bad signature: 4\^C\^_
ACPI APIC Table: <Nvidia AWRDACPI>
ioapic0 <Version 1.1> irqs 0-23 on motherboard
acpi0: <Nvidia AWRDACPI> on motherboard
acpi0: Power Button (fixed)
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x4008-0x400b on acpi0
cpu0: <ACPI CPU> on acpi0
acpi_button0: <Power Button> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
agp0: <NVIDIA nForce2 AGP Controller> mem 0xe0000000-0xe3ffffff at device 0.0 on pci0
pci0: <memory, RAM> at device 0.1 (no driver attached)
pci0: <memory, RAM> at device 0.2 (no driver attached)
pci0: <memory, RAM> at device 0.3 (no driver attached)
pci0: <memory, RAM> at device 0.4 (no driver attached)
pci0: <memory, RAM> at device 0.5 (no driver attached)
isab0: <PCI-ISA bridge> at device 1.0 on pci0
isa0: <ISA bus> on isab0
pci0: <serial bus, SMBus> at device 1.1 (no driver attached)
ohci0: <OHCI (generic) USB controller> mem 0xe9085000-0xe9085fff irq 20 at device 2.0 on pci0
ohci0: [GIANT-LOCKED]
usb0: OHCI version 1.0, legacy support
usb0: SMM does not respond, resetting
usb0: <OHCI (generic) USB controller> on ohci0
usb0: USB revision 1.0
uhub0: nVidia OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 3 ports with 3 removable, self powered
ohci1: <OHCI (generic) USB controller> mem 0xe9082000-0xe9082fff irq 21 at device 2.1 on pci0
ohci1: [GIANT-LOCKED]
usb1: OHCI version 1.0, legacy support
usb1: SMM does not respond, resetting
usb1: <OHCI (generic) USB controller> on ohci1
usb1: USB revision 1.0
uhub1: nVidia OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 3 ports with 3 removable, self powered
ehci0: <EHCI (generic) USB 2.0 controller> mem 0xe9083000-0xe90830ff irq 22 at device 2.2 on pci0
ehci0: [GIANT-LOCKED]
usb2: EHCI version 1.0
usb2: companion controllers, 4 ports each: usb0 usb1
usb2: <EHCI (generic) USB 2.0 controller> on ehci0
usb2: USB revision 2.0
uhub2: nVidia EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub2: 6 ports with 6 removable, self powered
nve0: <NVIDIA nForce MCP2 Networking Adapter> port 0xc400-0xc407 mem 0xe9084000-0xe9084fff irq 20 at device 4.0 on pci0
nve0: Ethernet address 00:11:2f:b6:ba:d0
miibus0: <MII bus> on nve0
rlphy0: <RTL8201L 10/100 media interface> on miibus0
rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
nve0: Ethernet address: 00:11:2f:b6:ba:d0
pci0: <multimedia, audio> at device 5.0 (no driver attached)
pcm0: <nVidia nForce2> port 0xb000-0xb0ff,0xb400-0xb47f mem 0xe9080000-0xe9080fff irq 22 at device 6.0 on pci0
pcm0: <Avance Logic ALC650 AC97 Codec>
pcib1: <ACPI PCI-PCI bridge> at device 8.0 on pci0
pci1: <ACPI PCI bus> on pcib1
skc0: <Marvell Gigabit Ethernet> port 0x9000-0x90ff mem 0xe8000000-0xe8003fff irq 17 at device 4.0 on pci1
skc0: Marvell Yukon Lite Gigabit Ethernet rev. A3(0x7)
sk0: <Marvell Semiconductor, Inc. Yukon> on skc0
sk0: Ethernet address: 00:11:2f:b6:c4:40
miibus1: <MII bus> on sk0
e1000phy0: <Marvell 88E1000 Gigabit PHY> on miibus1
e1000phy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX-FDX, auto
pci1: <network> at device 5.0 (no driver attached)
atapci0: <nVidia nForce2 UDMA133 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xf000-0xf00f at device 9.0 on pci0
ata0: <ATA channel 0> on atapci0
ata1: <ATA channel 1> on atapci0
pcib2: <ACPI PCI-PCI bridge> at device 30.0 on pci0
pci3: <ACPI PCI bus> on pcib2
nvidia0: <GeForce FX 5200> mem 0xe5000000-0xe5ffffff,0xd0000000-0xdfffffff irq 19 at device 0.0 on pci3
nvidia0: [GIANT-LOCKED]
fdc0: <floppy drive controller> port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on acpi0
fdc0: [FAST]
fd0: <1440-KB 3.5" drive> on fdc0 drive 0
sio0: <16550A-compatible COM port> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
sio0: type 16550A
sio1: <16550A-compatible COM port> port 0x2f8-0x2ff irq 3 on acpi0
sio1: type 16550A
ppc0: <ECP parallel printer port> port 0x378-0x37f,0x778-0x77b irq 7 drq 3 on acpi0
ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode
ppc0: FIFO with 16/16/16 bytes threshold
ppbus0: <Parallel port bus> on ppc0
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: model IntelliMouse, device ID 3
npx0: [FAST]
npx0: <math processor> on motherboard
npx0: INT 16 interface
pmtimer0 on isa0
orm0: <ISA Option ROMs> at iomem 0xc0000-0xcefff,0xd0000-0xd3fff,0xd4000-0xd57ff,0xd6000-0xd6fff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
Timecounter "TSC" frequency 2162744203 Hz quality 800
Timecounters tick every 1.000 msec
ipfw2 (+ipv6) initialized, divert loadable, rule-based forwarding enabled, default to deny, logging limited to 100 packets/entry by default
ad0: 152627MB <SAMSUNG SP1614N TM100-30> at ata0-master UDMA100
acd0: DVDROM <HL-DT-STDVD-ROM GDR8163B/0L23> at ata1-master UDMA33
acd1: CDRW <TEAC CD-W552E/1.13> at ata1-slave UDMA33
Trying to mount root from ufs:/dev/ad0s1a
NVRM: detected agp.ko, aborting NVIDIA AGP setup!
pid 65081 (java), uid 1001: exited on signal 6 (core dumped)
Best regards,
Laszlo Rinyu
--
===========================================================================
---------------------------------------------------------------------------
Laszlo Rinyu
junior researcher
Institute of Nuclear Research of the Hungarian Academy of Sciences (ATOMKI)
Laboratory of Environmental Studies
H-4001 Debrecen, Bem sqr. 18/c, Pf.: 51,
Hungary
Tel : +36-52-509-200 / 11405
Fax : +36-52-509-282
Home: +36-30-2-580-114
e-mail: email***@***.com
---------------------------------------------------------------------------
===========================================================================
- 16
- linux-jdk 1.6.0 ("mustang")Hello!
I would like to know if somebody had good experience running jdk 1.6.0
"mustang" on 6.0?
P.S. Sorry for short question 8)
--
NEVE-RIPE, will build world for food
Ukrainian FreeBSD User Group
http://uafug.org.ua/
- 16
- Printing questionsHello!
I'm trying to develop an application to print PDF files, using JPedal.
Two questions:
1) I'd like users can specify printing properties, like size,
margins... following an example on JPedal site I tryed:
// new attribute set
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
// dialog
printJob.printDialog(aset);
// read dialog properties
PageRanges r = (PageRanges)aset.get(PageRanges.class);
PageFormat pf = (PageFormat)aset.get(PageFormat.class);
but it doesn't work... :(
Is there a way to set those parameters via code? I need to set margins
to 0,0,0,0...
2) I'd like to improve the quality of printed docs... I think it uses
a very low quality to render my PDF (like 72dpi or so), is there a way
to increase dpi? In a PDFProducer for TFax I was able to do that
passing a bigger BufferedImage to Jpedal, is there a way to do the
same thing here (without redifining the print() method)?
Thanks!
- 16
|
| Author |
Message |
donlelel

|
Posted: 2006-12-24 23:01:00 |
Top |
java-programmer, CachedRowSet and double column types
Hi, there,
I have a CachedRowSet obtained from Sun's CachedRowSetImpl and I'm
trying to use it with a MySql database. I have a table test that has
the basic column types. If I use a plain double column type and I have
to update a row with the double field having the fraction part
something like 1/3 (i.e. 0.3333....), then the acceptChanges fails with
the error
javax.sql.rowset.spi.SyncProviderException: 1 conflicts while
synchronizing
If I have a double(12,2) column type or the like (i.e. I limit the
precision) or if I have a fixed fraction part (something like 0.5,
let's say), then acceptChanges works fine.
I havent logged the sqls generated by the acceptChanges of the
CachedRowSetImpl, but I remember encountering something similar on some
different software components and what was happening in that case (and
I suppose it's happen in this case too) is that the sqls generated were
trying to find the original row using all the fields in the row and not
only the primary key, as it should be the case, i.e. there was
something like :
update test set f1=x1, f2=x2, f3=x3 where f1=y1 and f2=y2 and f3=y3
Now, since there's that "unlimited" number of digits after the decimal
point, it wouldnt have found the original record (maybe because there
was a different number of digits used to represent the same number on
the MySql server and on the MySql client).
My question - is there a way to tell CachedRowSet how the row
identification should be done (to say what goes into the "where"
clause)? Eventually is there a smarter, free implementation of
CachedRowSet ?
Thanks, Don
PS. See used code and table data bellow.
---------------------------------
package dbtools;
import com.sun.rowset.CachedRowSetImpl;
import javax.sql.rowset.CachedRowSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.*;
import java.sql.*;
public class CacheRecSet {
Connection connection = null;
Random rand = new Random();
private Log log = LogFactory.getLog(this.getClass());
/** Creates a new instance of CacheRecSet */
public CacheRecSet() {
}
protected void setUp() {
if (connection != null) {
return;
}
/*
// MySql through OBDC
String uri =
"jdbc:odbc:mysqlodbcdbstorage;UID=tintin;PWD=tintin";
log.info("Initializing connection from '" + uri + "'");
try {
// Load the JDBC-ODBC bridge driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException e) {
log.error("Opening connection",e);
return;
}
try {
connection = DriverManager.getConnection(uri);
log.info(" Loaded connection from '" + uri + "'");
} catch (Exception e) {
log.error("ERROR Opening connection");
return;
}
*/
// MySql direct
String uri =
"jdbc:mysql://localhost:3306/dbstorage?user=tintin&password=tintin";
log.info("Initializing connection from '" + uri + "'");
try {
// Load the driver
Class.forName("org.gjt.mm.mysql.Driver");
} catch (ClassNotFoundException e) {
log.error("Opening connection", e);
}
// add support for connection pooling
// Class.forName("org.apache.commons.dbcp.PoolingDriver");
try {
connection = DriverManager.getConnection(uri);
log.info(" Loaded connection from '" + uri + "'");
} catch (Exception e) {
log.error("Opening connection",e);
}
/*
// PostgreSql direct
String uri =
"jdbc:postgresql://localhost:5432/dbstorage?user=tintin&password=tintin";
log.info("Initializing connection from '" + uri + "'");
try {
// Load the driver
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException e) {
log.error("Opening connection", e);
}
try {
connection = DriverManager.getConnection(uri);
log.info(" Loaded connection from '" + uri + "'");
} catch (Exception e) {
log.error("Opening connection", e);
}
*/
}
protected void tearDown() {
if (connection != null) {
try {
connection.close();
} catch (Exception e) {
log.error("Closing connection");
}
}
connection = null;
}
public void testMulti() {
if (connection == null) {
log.error("testMulti - null connection");
}
log.info("testMulti");
CachedRowSet crset;
try {
java.sql.Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM test where
RecId = 1"); // for postgresql it doesnt work like this
//ResultSet rs = stmt.executeQuery("SELECT * FROM test
where "RecId" = 1"); // for postgresql it works like this
crset = new CachedRowSetImpl();
crset.populate(rs);
log.info("SIZE = "+crset.size());
if (crset.size() > 0) {
crset.first();
double fract = (double)1 / 3;
//fract = fract/3;
double dbl = (rand.nextInt(50)*1000) + fract;
java.util.Date dt = new java.util.Date();
java.sql.Date dt2 = new java.sql.Date(dt.getTime());
crset.updateInt("Married", 0); // int field (wanted as
bool...)
crset.updateString("Name", "coco"); // varchar field
crset.updateDouble("Salary", dbl); // double fld
crset.updateDate("DtCreate", dt2); // date field
String comments = "a test "+dt.toString() + " ===> " +
rand.nextInt(50);
crset.updateString("Comments", comments); // blob field
crset.updateInt("Age", rand.nextInt(50)); // int field
//int [] keys = {1};
//crset.setKeyColumns(keys);
//crset.setTableName("test"); // when dealing
PostGreSql, needed to be added as it seems...
crset.updateRow();
crset.acceptChanges(connection);
}
rs.close();
} catch (Exception e) {
log.error("testMulti",e);
return;
}
log.info("...OK");
}
public static void main(String args[]) {
CacheRecSet instance = new CacheRecSet();
instance.setUp();
instance.testMulti();
instance.tearDown();
}
}
-----------------------------------
CREATE DATABASE IF NOT EXISTS dbstorage;
USE dbstorage;
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
`RecID` int(10) unsigned NOT NULL auto_increment,
`Married` int(11) default NULL,
`Name` varchar(200) default NULL,
`Salary` double(10,2) default NULL,
`DtCreate` date default NULL,
`Comments` text,
`Age` int(10) unsigned default NULL,
PRIMARY KEY (`RecID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40000 ALTER TABLE `test` DISABLE KEYS */;
INSERT INTO `test`
(`RecID`,`Married`,`Name`,`Salary`,`DtCreate`,`Comments`,`Age`) VALUES
(1,0,'coco',15000.33,'2006-12-24','a test Sun Dec 24 00:20:09 EST 2006
===> 25',22),
(2,1,'0',NULL,NULL,NULL,NULL),
(3,NULL,'silviu',NULL,NULL,NULL,12);
/*!40000 ALTER TABLE `test` ENABLE KEYS */;
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Error handling java GUILet's say that I'm reading the inputs from a TextField widget:
JTextField jt = new JTextField(20);
String text = jt.getText();
if ( !text.equals("OK") )
{
// print some error message to the user
}
If the input is bad, I want to print some error message to the user but
at the same time I don't want to exit my GUI. How do I do that? Should
I be using exceptions? Can someone point me to some sample codes
somewhere on how error handling is performed in JAVA?
Thanks
Thierry
- 2
- Known problem with JComboBox?Hi,
just wondering if this is a known problem:
I have to set JComboBox.setLightWeightPopupEnabled(false) due to the
constellation of my framework.
Now the scrollbar of the combo won't be updated as long as the box is
entirely displayed within my JFrame. As soon as part of it is out of the
window the scrollbar will work.
What's that all about? Is there a "semi lightweight mode" or something like
that?
Thanks.
Ren?
- 3
- Why Java's math expression (power) is so inconvenient and error prone?Hi,
My program need a lot of calculation of power. In many programming
languages,
2**3 = 8; //or
2^3 = 8;
The syntax is clean and easy. But in Java,
Math.pow(2, 3) = 8; //It is so long, and complicated and error prone
Again, in many languages,
EXP(1) = 2.7 //e value
But in Java,
Math.pow(Math.E, 1) = 2.7 //You see, so complicated
Normally, in one calculation, 2**3 or EXP(3.5) is only part of
expression, like "a + b**3 + EXP(-a)". In Java, it will be very long and
error prone!
- 4
- IE7 BetaI can not get JAVA to run in IE7 Beta. Actually, it didn't run under IE6
either. I've exhausted my limited knowledge already. Any advice? Links?
- 5
- 6
- 7
- Question about Master and Working Memory from Chapter 17 of the Java Language SpecificationOk the following is from Chapter 17 of the Java Language
Specification.
"A variable is any location within a program that may be stored into.
This includes not only class variables and instance variables but also
components of arrays. Variables are kept in a main memory that is
shared by all threads. Because it is impossible for one thread to
access parameters or local variables of another thread, it doesn't
matter whether parameters and local variables are thought of as
residing in the shared main memory or in the working memory of the
thread that owns them.
Every thread has a working memory in which it keeps its own working
copy of variables that it must use or assign. As the thread executes a
program, it operates on these working copies. The main memory contains
the master copy of every variable. There are rules about when a thread
is permitted or required to transfer the contents of its working copy
of a variable into the master copy or vice versa."
Does this mean that, say, in the following code, there are two working
copies of the integer variable X (one belonging to aThread and one
belonging to bThread) and one master copy?
public class TestThread {
public static void main(String[] args) {
aClass a = new aClass();
Thread aThread = new Thread( a );
Thread bThread = new Thread( a );
aThread.start();
bThread.start();
}
}
class aClass implements Runnable{
int X;
public void run( ) {
while (true) {update();}
}
synchronized void update(){
X++;
}
}
- 8
- Mars CoordinatesDoes anyone know how to convert (x,y) position of the mouse on a map
of Mars to the coordinates of Mars. I know there's a class in java
that is called Coordinate but i don't know how it works.
- 9
- 10
- Add pps or flash or dat to java app.Do any one knows how 2 add pps or flash or video to java application?If
u know plz sent me a sample sourse code to my mail with needed
libraries.
<email***@***.com>
- 11
- Problem about generics and class arrayCan somebody explains why the last line of code doesn't compile ?
public class TestClassArray {
private static class A {
}
private static class B extends A {
}
Class[] rawClasses = { B.class }; // warning
Class<?>[] wildcardsClasses = { B.class };
// error : Cannot create a generic array of Class<? extends
TestClassArray.A>
Class<? extends A>[] upperBoundClasses = { B.class };
}
- 12
- Which IDE?Hello
I am a newbe to Java and to programming.
I am looking for an IDE which I can:
Download free from the net
Have a good documentation and tutorials
Be able to get sum help on the compiler itself on this group (or any other
newsgroup)
----
Elisha Dvir
052-3738817
- 13
- Variable scope access questionHi,
I am not sure my question is valid or not. It is the following:
public class MyClass {
public void doA() {
int num = 10;
doB();
//Now, num value has been changed
}
public void doB() {
//I need to access and change the value num inside doA. But I don't
know how to do it.
}
}
Is this possible? Thank you for your help.
- 14
- HTTPConnection - verbose error messagesI have a java application that polls an asp page for the purpose of
inserting to a data base. I am interested in seeing verbose (ie
unfriendly HTTP error messages) when there is an internal server error
(code 500). Below is the code snippet that makes the application's web
connection and captures the response messages.
String user = "";
//String user = "Someone";
try{//create url object
urlWithQueryString =
"http://www.someaddress.com/lpt/lpt_login.asp?User=" + user +
"&FName=Alonzo&LName=Garbonzo&timeStamp=20060110_1106";
System.err.println("urlWithQueryString ln 35: " +
urlWithQueryString);
url = new URL(urlWithQueryString);
}catch(MalformedURLException mURLE){
System.err.println( "MalformedURLException thrown in WriteToWebDB: ln
41 " + mURLE.getMessage() );
System.err.println("");
return NetworkStatus.NETWORK_CONNECTION_PROBLEM;
}
try{//open connection. Write data succeeds or fails here
connection = (HttpURLConnection)url.openConnection();
inputStream = connection.getInputStream();
connection.setInstanceFollowRedirects(true);
}catch(IOException iOE1){
try{
System.err.println( "IOException caught in WriteToWebDB: ln 52");
System.err.println("Connection response code ln 53: " +
connection.getResponseCode());
System.err.println("Connection message ln 54: " +
connection.getResponseMessage());
System.err.println("Exception message ln 55: " + iOE1.getMessage());
}catch(IOException iOE){System.err.println("IOException caught ln 56"
+ iOE.getMessage());}
return NetworkStatus.NETWORK_CONNECTION_PROBLEM;
}
********************************************
Below are three examples of server output - the first two have
defective connection strings to force server error and one is a good
connection string that inserts to the data base. Note that defective
string passed from the application returns an error message without
much information while the defective string passed from a browser
returns a verbose and detailed error message. Can anyone help in
discovering a way to recover verbose detailed error messages in the
java application? Any help is greatly appreciated.
Guy Sussman
********************************************
Web server output to application connection when String user = ""
urlWithQueryString ln 35:
http://www.guysussman.com/lpt/lpt_login.asp?User=&FName=Alonzo&LName=Garbonzo&timeStamp=20060110_1106
IOException caught in WriteToWebDB: ln 52
Connection response code ln 53: 500
Connection message ln 54: Internal Server Error
Exception message ln 55: Server returned HTTP response code: 500 for
URL:
http://www.guysussman.com/lpt/lpt_login.asp?User=&FName=Alonzo&LName=Garbonzo&timeStamp=20060110_1106
********************************************
Web server output to browser connection when String user = ""
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Field 'tbl_test.Usr' cannot
be a zero-length string.
/lpt/lpt_login.asp, line 25
********************************************
Web server output to application connection when String user =
"Someone"
urlWithQueryString ln 35:
http://www.guysussman.com/lpt/lpt_login.asp?User=Someone&FName=Alonzo&LName=Garbonzo&timeStamp=20060110_1106
Http connection status (WriteToWebDB ln.69): OK ResponseCode = 200
********************************************
- 15
- Backing up databasesI am looking to write some basic scripts to back-up various files and
databases as well as restore them. Do you think this would be easier
and better to do using Ant or Ruby?
I would appreciate any insight available.
Thanks!
|
|
|