comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Undo - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7434631ea0c81ec8 * How best to do this... - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/139fe9ada71808aa * J2ME: The Complete Reference - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/29dde018c381d116 * Memory leakage problem with a database application - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cd24fb0a93e5b285 * what u program? - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee20f99e67fd5410 * java.io.FileReader and java.io.FileWriter encoding - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/48b32bb0299455e8 * nested locks - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e57863f17acef231 * Data input in java programs - 5 messages, 5 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/832cdb3f83b8583e * Change color depth of [Buffered]Image - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d0bd95f0a8125dbc * Better looking fonts in Java - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fd4bf36346e298a5 * update doesnt´t work ? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3619d270a4e29711 * .NET Programmer Needs To Learn Java - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b99c5dff939a0cea * Tomcat and classloaders - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9d1677b8e903332e * simpleDateFormat and April month - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/383df9c88dcb10ba * Java trick - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfd25be52dc6a3ad * test if the string is a blank data string - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/681d0b9bedeb1d23 * J2ME Regular Expressions - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6e182702e3f20a35 ========================================================================== TOPIC: Undo http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7434631ea0c81ec8 ========================================================================== == 1 of 3 == Date: Fri, Sep 17 2004 1:33 am From: "Adam" <[EMAIL PROTECTED]> Does anyone know any tutorials, guides, code samples on how to use javax.swing.undo package? I've been searching sun's site for last half of an hour and found nothing :( Thanks in advance, Adam == 2 of 3 == Date: Fri, Sep 17 2004 2:35 am From: Thomas Schodt <[EMAIL PROTECTED]> Adam wrote: > Does anyone know any tutorials, guides, code samples > on how to use javax.swing.undo package? > I've been searching sun's site for last half of an hour > and found nothing Google [ sun java javax.swing.undo ] <http://www.google.com/search?hl=en&ie=UTF-8&q=sun+java+javax.swing.undo&btnG=Google+Search> javax.swing.undo (Java 2 Platform SE v1.4.2) <http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/undo/package-summary.html> Description <http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/undo/package-summary.html#package_description> Implementing Undo and Redo <http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html#undo> == 3 of 3 == Date: Fri, Sep 17 2004 3:15 am From: Thomas Fritsch <[EMAIL PROTECTED]> Adam wrote: > Does anyone know any tutorials, guides, code samples > on how to use javax.swing.undo package? > I've been searching sun's site for last half of an hour > and found nothing :( > > Thanks in advance, > Adam Take a look at Sun's Notepad sample application (with undo/redo-support) file:whereYourJdkIsInstalled/demo/jfc/Notepad/src/Notepad.java or http://www-uxsup.csx.cam.ac.uk/java/jdk-1.2.2/demo/jfc/Notepad/src/Notepad.java -- Thomas<dot>Fritsch<squiggle>ops<dot>de ========================================================================== TOPIC: How best to do this... http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/139fe9ada71808aa ========================================================================== == 1 of 1 == Date: Fri, Sep 17 2004 1:38 am From: "Adam" <[EMAIL PROTECTED]> "Will Hartung" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Paul Lutus" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Ike wrote: >> >> > But I want to maintain the order of the tems in the >> > ArrayList....I > dont >> > think a Map does that. -Ike >> >> So why not read the documentation to see if it, or a related class, >> does? >> Hint: TreeMap. > > Actually, you want a TreeSet... Actually a LinkedHashSet :) Adam ========================================================================== TOPIC: J2ME: The Complete Reference http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/29dde018c381d116 ========================================================================== == 1 of 1 == Date: Fri, Sep 17 2004 1:58 am From: [EMAIL PROTECTED] (Tabrez Iqbal) "Darryl L. Pierce" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Andrew Thompson wrote: > > > I went hunting at amazon, and while I found this.. > > > <http://www.amazon.com/exec/obidos/tg/detail/-/0072227109/ref=sib_rdr_dp/103-4155585-8239062 > %5Fencoding=UTF8&no=283155&me=ATVPDKIKX0DER&st=books> > > ..it fails to mention the CDLC/MIDP versions, > > and the only 'example page' offered is the > > front cover. :-( > > Then I would wager it's a MIDP 1.0 book. I personally don't have that one. yes, it covers only the first versions of MIDP and CDLC. Unfortunately, the other book that I have, J2ME in a Nutshell, also does not cover new versions of CDLC/MIDP. tabrez ========================================================================== TOPIC: Memory leakage problem with a database application http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cd24fb0a93e5b285 ========================================================================== == 1 of 2 == Date: Fri, Sep 17 2004 2:00 am From: [EMAIL PROTECTED] (Devian) Hi, I am getting OutOfMemory exception in my database application done with JBuilder 9.0.In that application a main frame which is a main window for that application has a jTree.When a tree node is clicked in that tree the related jFrame opens by finding the class.And when the opened frame closed dbDisposeMonitor(which is a member of the opened frame) works but the memory usage of the program never decreases.Some part of the suspicious code is here : // opens Frame // FormInfo is the selected node's related class it holds the frame name which will be opened private void OpenFrame(FormInfo f) { String sFullName = "package." + f.GetFormName(); int iFrmIdx; for(iFrmIdx = 0; iFrmIdx < FRM_COUNT; ++iFrmIdx){ // Forms is an FormInfo array which is defined in the class of main frame if(Forms[iFrmIdx] == null) continue; if(Forms[iFrmIdx].GetFormName().matches(f.GetFormName())) break; } try { // Frames is a MyFrame class(inherited by jFrame) whic is defined in the class of main frame Frames[iFrmIdx] = (MyFrame) Class.forName(sFullName).newInstance(); Frames[iFrmIdx].SetFormIndex(iFrmIdx); Frames[iFrmIdx].setTitle(Forms[iFrmIdx].GetFormTitle()); // The frame which is related to f will be kept in Frames array for disposing. Frames[iFrmIdx].pack(); Frames[iFrmIdx].setBounds(jPanel1.getBounds()); Frames[iFrmIdx].setLocationRelativeTo(jPanel1); Frames[iFrmIdx].show(); f.SetOpenStatus(true); } catch(ClassNotFoundException eClsExc) { eClsExc.toString(); } catch(InstantiationException eInsExc) { eInsExc.toString(); } catch(IllegalAccessException eIllAcc) { eIllAcc.toString(); } } While the opened frame is closing Frames[iFrmIdx] is set to null.And all of the components of the frame is set to null.But the memory leakage problem goes on.Finally gc() is closed after the frame closed but this dos not solve the problem. Any advice? Thanks == 2 of 2 == Date: Fri, Sep 17 2004 3:01 am From: Babu Kalakrishnan <[EMAIL PROTECTED]> Devian wrote: > > While the opened frame is closing Frames[iFrmIdx] is set to null.And > all of the components of the frame is set to null.But the memory > leakage problem goes on.Finally gc() is closed after the frame closed > but this dos not solve the problem. > Are you sure you're calling dispose() on the frame before setting it to null ? BK ========================================================================== TOPIC: what u program? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee20f99e67fd5410 ========================================================================== == 1 of 3 == Date: Fri, Sep 17 2004 2:09 am From: jaYPee <[EMAIL PROTECTED]> On 16 Sep 2004 21:36:09 -0800, [EMAIL PROTECTED] (Malcolm Dew-Jones) wrote: >jaYPee ([EMAIL PROTECTED]) wrote: >: I just wanted to know what most program u do in java? coz i'm a vb >: programmer and i do a lot of database programming. > >Gee, I guess this is what happens when you do too much vb programming... coz i want to learn java and i want to know how java can help me in shifting or learning other programming languages. i want to know why i should use java instead of using vb. thanks again. == 2 of 3 == Date: Fri, Sep 17 2004 2:12 am From: Joona I Palaste <[EMAIL PROTECTED]> jaYPee <[EMAIL PROTECTED]> scribbled the following: > On 16 Sep 2004 21:36:09 -0800, [EMAIL PROTECTED] (Malcolm > Dew-Jones) wrote: >>jaYPee ([EMAIL PROTECTED]) wrote: >>: I just wanted to know what most program u do in java? coz i'm a vb >>: programmer and i do a lot of database programming. >> >>Gee, I guess this is what happens when you do too much vb programming... > coz i want to learn java and i want to know how java can help me in > shifting or learning other programming languages. > i want to know why i should use java instead of using vb. > thanks again. I believe Malcolm meant you should start writing in English instead of k3wl h4x0r d00dsp33k. -- /-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\ \-- http://www.helsinki.fi/~palaste --------------------- rules! --------/ "This is a personnel commuter." - Train driver in Scientific American == 3 of 3 == Date: Fri, Sep 17 2004 5:54 am From: bugbear <[EMAIL PROTECTED]> jaYPee wrote: > On 16 Sep 2004 21:36:09 -0800, [EMAIL PROTECTED] (Malcolm > Dew-Jones) wrote: > > >>jaYPee ([EMAIL PROTECTED]) wrote: >>: I just wanted to know what most program u do in java? coz i'm a vb >>: programmer and i do a lot of database programming. >> >>Gee, I guess this is what happens when you do too much vb programming... > > > coz i want to learn java and i want to know how java can help me in > shifting or learning other programming languages. > > i want to know why i should use java instead of using vb. Do you also want to know when you should use capital letters instead of using lower case? BugBear ========================================================================== TOPIC: java.io.FileReader and java.io.FileWriter encoding http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/48b32bb0299455e8 ========================================================================== == 1 of 3 == Date: Fri, Sep 17 2004 2:06 am From: Mario Maestro <[EMAIL PROTECTED]> Hi, I recently changed the hosting for my website (from Linux to Linux) and now I'm experiencing some trouble with java.io.FileReader and java.io.FileWriter: their getEncoding() method returns ASCII (returned ISO8859_1 on the previuos host). I've set -Dfile.encoding=ISO-8859-1 but nothing has changed, except that javax.mail.internet.MimeUtility.getDefaultJavaCharset() effectively returns ISO-8859-1. Does anyone know how the default encoding is selected? I report some system properties: file.encoding.pkg: sun.io user.country: US java.runtime.version: 1.4.2_04-b05 os.version: 2.4.27 user.timezone: America/New_York file.encoding: ISO-8859-1 user.language: en java.version: 1.4.2_04 java.vendor: Sun Microsystems Inc. ----- Mario == 2 of 3 == Date: Fri, Sep 17 2004 4:54 am From: Matthias Fraass <[EMAIL PROTECTED]> Mario Maestro wrote: > Hi, > > I recently changed the hosting for my website (from Linux to Linux) and > now I'm experiencing some trouble with java.io.FileReader and > java.io.FileWriter: their getEncoding() method returns ASCII (returned > ISO8859_1 on the previuos host). I've set -Dfile.encoding=ISO-8859-1 but > nothing has changed, IMHO the pitfall is that you have to use "ISO8859-1"! > except that > javax.mail.internet.MimeUtility.getDefaultJavaCharset() effectively > returns ISO-8859-1. Don't mix up character encoding and file encoding - char encoding is a different story. Matthias == 3 of 3 == Date: Fri, Sep 17 2004 5:31 am From: Mario Maestro <[EMAIL PROTECTED]> Matthias Fraass wrote: > IMHO the pitfall is that you have to use "ISO8859-1"! The right name is ISO-8859-1 (see http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html). I tried anyway (with ISO8859-1 and ISO8859_1) but it doesn't work. I admit I'm a bit confused in general. By the way the file.encoding property shouldn't be a solution at all, since it wasn't set on my previous hosting (and everything was fine). On this one, nothing changes if I set it or not. > Don't mix up character encoding and file encoding - char encoding is a > different story. FileReader/Writer javadocs talk about "default character encoding". javax.mail.internet.MimeUtility.getDefaultJavaCharset() gets the system's default locale and returns the corresponding default Java charset. When reading a file (written in bytes), Java needs to know which charset to use to convert 8-bit to 16-bit, and I need to know how the default one is picked up. ========================================================================== TOPIC: nested locks http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e57863f17acef231 ========================================================================== == 1 of 1 == Date: Fri, Sep 17 2004 2:35 am From: "VisionSet" <[EMAIL PROTECTED]> "Michael Borgwardt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > The only way you could theoretically get a deadlock were if you added the "this" object > to the HashSet *and* if the class's equals() or hashCode() methods (which are called from > within HashSet) were synchronized *and* if at some point you called a method on the set > without first synchronizing on "this". Thankyou Michael, that clarifies the issue. -- Mike W ========================================================================== TOPIC: Data input in java programs http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/832cdb3f83b8583e ========================================================================== == 1 of 5 == Date: Fri, Sep 17 2004 2:51 am From: "Hatzigiannakis Nikos" <[EMAIL PROTECTED]> I am new to Java but an experienced programmer in C. I am trying to find a simple way to read data from the keyboard in a java program. The java.io package seems to be the solution but I find very complicated to use those classes for a simple keyboard input. Is there any simpler way? Any help o reference will be appreciated!!! == 2 of 5 == Date: Fri, Sep 17 2004 3:03 am From: "KC Wong" <[EMAIL PROTECTED]> Pls don't multipost... I've answered your question in comp.lang.java.help. == 3 of 5 == Date: Fri, Sep 17 2004 3:05 am From: Michael Borgwardt <[EMAIL PROTECTED]> Hatzigiannakis Nikos wrote: > I am new to Java but an experienced programmer in C. > > I am trying to find a simple way to read data from the keyboard in a java > program. > > The java.io package seems to be the solution but I find very complicated to > use those classes for a simple keyboard input. > > > Is there any simpler way? No. But it's not really difficult at all, you just need to do this: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Then you can call br.readLine() to read user input. Be aware that this is not an unnecessary restriction: it is not possible to read keyboard input character by character as it's typed, because the JVM doesn't make the input available on System.in until the user types <Return>. And there's no way around that except creating your own consile window via the GUI classes. == 4 of 5 == Date: Fri, Sep 17 2004 3:12 am From: Andrew Thompson <[EMAIL PROTECTED]> On Fri, 17 Sep 2004 12:51:49 +0300, Hatzigiannakis Nikos wrote: > I am new to Java but an experienced programmer in C. You seem to be new to the usenet news-groups as well. Please refrain from multi-posting. <http://www.physci.org/codes/javafaq.jsp#xpost> -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.lensescapes.com/ Images that escape the mundane == 5 of 5 == Date: Fri, Sep 17 2004 4:41 am From: Gordon Beaton <[EMAIL PROTECTED]> On Fri, 17 Sep 2004 12:05:13 +0200, Michael Borgwardt wrote: > Then you can call br.readLine() to read user input. > > Be aware that this is not an unnecessary restriction: it is not > possible to read keyboard input character by character as it's > typed, because the JVM doesn't make the input available on System.in > until the user types ><Return>. And there's no way around that > except creating your own consile window via the GUI classes. In fact the JVM doesn't care, it doesn't even receive the user input until the console itself makes it available (for example, when the user presses Return). If you can change the buffering behaviour of your text console (for example with stty on unix) the JVM is happy to let you read one character at a time from System.in. Of course then you lose the editing capabilities provided by the console, and either have to live without them or provide them yourself in your application. By the same token, you could use Java in a pipe where the input doesn't even come from a console, and completely different buffering rules apply. /gordon -- [ do not email me copies of your followups ] g o r d o n + n e w s @ b a l d e r 1 3 . s e ========================================================================== TOPIC: Change color depth of [Buffered]Image http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d0bd95f0a8125dbc ========================================================================== == 1 of 1 == Date: Fri, Sep 17 2004 2:59 am From: Martin <[EMAIL PROTECTED]> Hello, I want to change the color depth of a given image (gif, jpg, png) with the help of the Java API, so no extra libraries (if possible). If you suggest using IndexColorModel then I would need your help too - I don't know how to build r[] g[] b[] values which the constructor needs - like values needed for 8b, 16b etc. Any other suggestions appreciated. Thanks in advance, Martin ========================================================================== TOPIC: Better looking fonts in Java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fd4bf36346e298a5 ========================================================================== == 1 of 1 == Date: Fri, Sep 17 2004 3:11 am From: John <[EMAIL PROTECTED]> I am writing a small XHTML printing class, and am testing it against Firefox. I have noticed that the default font in Firefox shows up quite fine (1 pixel line on the screen). I want to get Java to do this as well (the printed output is much fatter). Any suggestions? John ========================================================================== TOPIC: update doesnt´t work ? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3619d270a4e29711 ========================================================================== == 1 of 2 == Date: Fri, Sep 17 2004 3:53 am From: [EMAIL PROTECTED] (gzell) Hi, My JFrame holds a JPanel. This JPanel holds an instance from a class which is extended from Canvas. Because I did´nt wont to clear the drawings on this canvas-area I added a method update(Graphics g) which only calls paint(g). But everytime, when I call repaint(), my canvas-area first get´s a "clear screen" . Is there anyone who knows why ? Thanks for helpful comments, Guenter Zell == 2 of 2 == Date: Fri, Sep 17 2004 4:35 am From: Andrew Thompson <[EMAIL PROTECTED]> On 17 Sep 2004 03:53:39 -0700, gzell wrote: > My JFrame holds a JPanel. <http://www.physci.org/codes/javafaq.jsp#cljg> > ..Is there anyone who knows why ? Yep. It's because of that thing you did (or failed to do) in the code you did not supply. <http://www.physci.org/codes/sscce.jsp> -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.lensescapes.com/ Images that escape the mundane ========================================================================== TOPIC: .NET Programmer Needs To Learn Java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b99c5dff939a0cea ========================================================================== == 1 of 1 == Date: Fri, Sep 17 2004 4:16 am From: huy <[EMAIL PROTECTED]> scorpion53061 wrote: > Hello, > > I am a vb.net programmer. That being said I have been forced to conclude I > need to learn java ... Try becoming just a programmer instead of a vb.net programmer or a java programmer. You wil learn much more and find it easier to use different languages. > Some questions: > > 1. Is there a low cost way to learn, compile and develop for this langauge? > (aka Visual Studio but not costing an arm and a leg like this platform) If you understood all the OOP concepts in vb.net or c++ you should'nt have too much trouble. Huy ========================================================================== TOPIC: Tomcat and classloaders http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9d1677b8e903332e ========================================================================== == 1 of 1 == Date: Fri, Sep 17 2004 5:28 am From: [EMAIL PROTECTED] (Erik Berglund) Babu Kalakrishnan <[EMAIL PROTECTED]> wrote in message > By "host" do you mean different physical computers or a different > webapp running under the same Tomcat instance ? Under the same Tomcat instance but under different virtual hosts > > If it is the former, I would expect them to be running under different > JVMs and you should be able to setup each one by calling the > TimeZone.setDefault(TimeZone) method (I'm not sure if there is a > system property that defines this which would make it easier to > provide the value on the commandline). > > If they are different webapps running under the same Tomcat instance, > I'm not very sure if Tomcat provides a way for core library classes to > be loaded from a different classloader. As far as I can recall, only > external libraries found in the WEB-INF/lib directory or classes found > in the WEB-INF/classes directory are loaded by the Context classloader > in preference to an already existing class in the parent (system) > classloader. > > In such a scenario, the only workaround that I can see is to run > multiple instances of Tomcat (and bind them to different AJP connector > ports if they are on the same physical machine) so that each process > runs under its own private JVM (might be pretty resource intensive if > done on a single machine) > Yepp, this works great ! Just defining a CATALINA_BASE for each user (country) then each country has its own configuration file :-) I had to fiddle around with the ports for the connectors and the server port as well to prevent bringing down wrong instance when stopping. Now it looks like this: One Apache installation configured with a bunch of virtual hosts. Each virtual host connects to its own tomcat instance by using different JK "workers". Now it is even possible to take down tomcat completely for one country only. This is specially good since we have had problems replacing WAR files which forced us to restart tomcat completely which all countries then suffered from. What I also noticed was that our xalan.jar which we had in shared/lib was not loaded anymore. So that needed to be copied as well to CATALINA_BASE Well I am not a Tomcat expert but this works. Thanks ! /Erik > BK ========================================================================== TOPIC: simpleDateFormat and April month http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/383df9c88dcb10ba ========================================================================== == 1 of 1 == Date: Fri, Sep 17 2004 5:34 am From: [EMAIL PROTECTED] (Nurettin Arslankaya) Hi, here is the all code and execution result : /* Code Starts here */ /* -------------------------------------------- */ package DateFormatTester; import java.text.*; import java.util.*; public class dtfmTest { public dtfmTest() { } public static void main(String[] args) { dtfmTest dtfm = new dtfmTest(); System.out.println("Testing Dateformatter "); System.out.println("----------------------"); try { System.out.println(dtfm.DateToStr(dtfm.StrToDate("1980-04-01 00:00:00"))); System.out.println(dtfm.DateToStr(dtfm.StrToDate("1975-04-12 00:00:00"))); } catch (Exception ex) { } } public Date StrToDate(String DT) throws Exception { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return formatter.parse(DT); } public String DateToStr(Date dt) throws Exception { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return formatter.format(dt) ; } } /* Execution result */ /* -------------------------------------------- */ /* Testing Dateformatter ---------------------- 1980-04-01 01:00:00 1975-04-12 01:00:00 */ Paul Lutus <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Nurettin Arslankaya wrote: > > > Hi, > > > > possibly, i had a bug to report. Here is sample code to test : > > > > public Date StrToDate(String DT) throws Exception { > > SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd > > HH:mm:ss"); > > return formatter.parse(DT); > > } > > That is not all the code you are using in your test. Please post a complete, > short, working program. > > > When I test with fallowing data I got wrong result. > > > > 1980-04-01 00:00:00 returns 1980-04-01 01:00:00 > > Using what output routine? > > > 1975-04-12 00:00:00 returns 1975-04-12 01:00:00 > > > > for the dates It works wrong for 1 hour. when you enter 1980-04-01 > > 01:00:00 it works correct but if you enter 1980-04-01 00:30:00 it > > returns also 1 hour later time. > > > > > > possibly there are several dates that has problem. I am using jre 1.4. > > Does anyone know why it resulting wrong. > > No, no one knows. Why? You did not post your code. ========================================================================== TOPIC: Java trick http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfd25be52dc6a3ad ========================================================================== == 1 of 3 == Date: Fri, Sep 17 2004 5:42 am From: [EMAIL PROTECTED] (Razvan) Hi ! public class CDummy { static int toto = 7; CDummy getDummy() { return null; // pay attention here ! } public static void main(String args[]) { System.out.println("CDummy."); CDummy dmy = new CDummy(); System.out.println(dmy.getDummy().toto); } } Well... can you guess the output of the above code ? (try not to run the code) I have my own explanation but I don't want to spoil your fun:)) Regards, Razvan == 2 of 3 == Date: Fri, Sep 17 2004 5:50 am From: Joona I Palaste <[EMAIL PROTECTED]> Razvan <[EMAIL PROTECTED]> scribbled the following: > Hi ! > public class CDummy > { > static int toto = 7; > CDummy getDummy() { > return null; // pay attention here ! > } > public static void main(String args[]) > { > System.out.println("CDummy."); > CDummy dmy = new CDummy(); > System.out.println(dmy.getDummy().toto); > } > } > Well... can you guess the output of the above code ? (try not to run the code) > I have my own explanation but I don't want to spoil your fun:)) Yes, we're all aware of this. IMHO it's a nasty kludge that only serves to confuse people. The people who designed Java and wrote the JLS must have been smoking some pretty heavy stuff when they allowed this. -- /-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\ \-- http://www.helsinki.fi/~palaste --------------------- rules! --------/ "Life without ostriches is like coffee with milk." - Mika P. Nieminen == 3 of 3 == Date: Fri, Sep 17 2004 6:21 am From: Jacob <[EMAIL PROTECTED]> Razvan wrote: > System.out.println(dmy.getDummy().toto); You're accessing a static variable so which instance you you use as reference doesn't matter, only its class does. Makes sense to me. For code readbility: Always refer to static elements (variable or methods) by class, not instance: System.out.println (CDummy.toto); ========================================================================== TOPIC: test if the string is a blank data string http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/681d0b9bedeb1d23 ========================================================================== == 1 of 1 == Date: Fri, Sep 17 2004 5:46 am From: bugbear <[EMAIL PROTECTED]> Hal Rosser wrote: > I would check that possibility as well, because zero-length does not mean > null. Heh. In the SQL92 spec, you're quite right. Oracle (sadly) believe that zero-length does mean null. Shit happens. BugBear ========================================================================== TOPIC: J2ME Regular Expressions http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6e182702e3f20a35 ========================================================================== == 1 of 1 == Date: Fri, Sep 17 2004 5:48 am From: bugbear <[EMAIL PROTECTED]> Andrew Thompson wrote: > On Thu, 16 Sep 2004 11:44:17 +0100, bugbear wrote: > >>Olivier Laurent wrote: > > >>>I would like to use regular expressions for a J2ME application. The >>>regex package isn't include in J2ME. Has anybody ever studied an >>>alternative? > > .. > >>"regular expression" package java > > > ..hmmm. Those 42,900 hits look interesting, > but I think these 798 might be more topical > <http://www.google.com/search?q=%22regular+expression%22+package+j2me> Granted on total hits, but google is a *ranking* search Engine and the 4th and 5th hits (conveniently located on the first page of Google's response) seem to perfectly answer the question. BugBear (who likes ranking engines) ======================================================================= You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer". comp.lang.java.programmer [EMAIL PROTECTED] Change your subscription type & other preferences: * click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe Report abuse: * send email explaining the problem to [EMAIL PROTECTED] Unsubscribe: * click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe ======================================================================= Google Groups: http://groups-beta.google.com ------------------------ Yahoo! Groups Sponsor --------------------~--> $9.95 domain names from Yahoo!. Register anything. http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/BCfwlB/TM --------------------------------------------------------------------~-> <a href=http://English-12948197573.SpamPoison.com>Fight Spam! Click Here!</a> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/kumpulan/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
