comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Newbie question: handling arrays in separate class - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/72272e6c26a94a21 * help with my first project on first job, how to read a strange file, thanks a lot!!!!!!! - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8c32ba1a17d68c9a * Can someone use invokeLater() to call a public method from a JPanel? - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/70ac1bf0cc54a090 * comp.lang.java.{help,programmer} - what they're for (mini-FAQ 2004-10-08) - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4118e2f7c307830c * 1.4.2 translate errors - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/500030113b379ec * "Symbolic computation" - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a89d6f4799be886 * Oracle JDBC XA question - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3ded1e7f0747a226 * log4j and console in ANT/JUnit task - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2767a082c474af64 * To create an EXE file in Java - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee3427d831f71d73 * 1.5, rtf & word - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/50f7a7e4797096a9 * Am I the only one who questions JSTL, Struts Tags, XSL Tags? - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/48683f1f07068c7d * Can i use multiple bluetooth dongles on one computer?! - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bc883f14d78e1f6f * PostgreSQL/Eclipse/Tomcat - How to connect to DB? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3f7be2a279887571 * Convert UTF-8 encoded data from file into unicode escape - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/518625c508ec82f8 * any HTML/XML handling scripting language ? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4ad69fcbcf8cb59c * multiple statement objects per connection - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c8c89dc8f7a169a2 * performance problem when running java applications overnight - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/363862525372f8b2 * Map that takes a pair of keys? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b8bfed67959eb893 ========================================================================== TOPIC: Newbie question: handling arrays in separate class http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/72272e6c26a94a21 ========================================================================== == 1 of 1 == Date: Sat, Oct 23 2004 2:03 am From: "Tom" <[EMAIL PROTECTED]> Uzytkownik "Chris Smith" <[EMAIL PROTECTED]> napisal w wiadomosci news:[EMAIL PROTECTED] > In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > > I'm writing a sort of dicionary application for mobile phone and I though of > > having one class with all the data i.e texts sorted in 1dim. arrays of > > strings. The class should return one element from an array after providing a > > name of an array and a number of element in that array. > > That's the problem that I'm facing now and looking for solution. > > See the java.util.Map interface, and its concrete implementations > TreeMap and HashMap. > > -- > www.designacourse.com > The Easiest Way To Train Anyone... Anywhere. > > Chris Smith - Lead Software Developer/Technical Trainer > MindIQ Corporation My program is for J2ME environment that implements Connected, Limited Device Configuration CLDC1.0 If I understand it well it doesn't include TreeMap and HashMap classes in the java.util. The only suitable class that I see would be Hashtable, but it is created dynamically and I guess will not help me as I have problem with control of size of heap memory (very limited). My program is currently working buy all objects (screens, form, lists) are created dynamically at the beginning, heap mem. is almost full which limits my program. (I know it is wrong approach - I'm a beginner) Thus, I thought of keeping all texts in static arrays in one class (a sort of dictionary class) and taking only necessary texts from that class and use where necessary. Tom ========================================================================== TOPIC: help with my first project on first job, how to read a strange file, thanks a lot!!!!!!! http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8c32ba1a17d68c9a ========================================================================== == 1 of 1 == Date: Sat, Oct 23 2004 2:17 am From: Alex Hunsley <[EMAIL PROTECTED]> Paul Lutus wrote: > matt wrote: > > >>Java guys: >>this is my first project at my first job. so pls help if you could. >>i am working with a text file with strange format. The file has a lot >>of white space between the last line of valid text and the end of >>file character. And the file is update frequently. New valid text is >>appended behind the original valid text and overwrite some whitespace. >> I need to feed this file as an input to an application. but this >>application only take files without such whitespace. The application >>need to read the file frequently to see whether new text is appended. >>if there is, get the appended text. > > > First things first. Explain exactly what the file consists of. Do not > describe it, show it. OP: To add to that: as well as pasting the text of the file (or a pertinent example), a hexdump to show the actual bytes would be useful. (Or else we don't know what the whitespace we're seeing actually is - tabs, spaces, weird chars etc.) alex ========================================================================== TOPIC: Can someone use invokeLater() to call a public method from a JPanel? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/70ac1bf0cc54a090 ========================================================================== == 1 of 3 == Date: Sat, Oct 23 2004 2:28 am From: Alex Hunsley <[EMAIL PROTECTED]> ***C.Steamer*** wrote: > Basically I want the application to call invokeLater() to update the view of > the gui. This is for a simple card game.I want to call a public method > called updateHand(Hand hand) which I pass in a hand then it clears the items > in the JPanel and adds a Label representing each of the cards to the Jpanel. > For some reason if I call this method from the constructor of the JPanel but > the invoke method doesn't work. This is my code in the application layer. > Any suggestions why this isin't working? > For a start, post complete, compilable, working code that demonstrates the problem. Snippets aren't much use. Secondly - you are calling something from the constructor of JPanel, you say? How do you mean? Have you edited/recompiled the JPanel source; or overridden JPanel, or what? Anyway, sounds like you're suffering Constructoritis, the disease of doing far too much in constructors. Constructors should do very little - store passed in values, usually; constructors should *not* call non-final or non-private methods, and constructors shouldn't be doing GUI related things. Factor out that stuff into other method(s) that you call after the Constructor has done its stuff. Doing this may solve your problems. alex == 2 of 3 == Date: Sat, Oct 23 2004 1:35 pm From: "***C.Steamer***" <[EMAIL PROTECTED]> Yeah thanks for nothing dude, If you don't have anything useful to add don't say anything. "Alex Hunsley" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > ***C.Steamer*** wrote: >> Basically I want the application to call invokeLater() to update the view >> of the gui. This is for a simple card game.I want to call a public method >> called updateHand(Hand hand) which I pass in a hand then it clears the >> items in the JPanel and adds a Label representing each of the cards to >> the Jpanel. For some reason if I call this method from the constructor of >> the JPanel but the invoke method doesn't work. This is my code in the >> application layer. Any suggestions why this isin't working? >> > > For a start, post complete, compilable, working code that demonstrates the > problem. Snippets aren't much use. > > Secondly - you are calling something from the constructor of JPanel, you > say? How do you mean? Have you edited/recompiled the JPanel source; or > overridden JPanel, or what? Anyway, sounds like you're suffering > Constructoritis, the disease of doing far too much in constructors. > Constructors should do very little - store passed in values, usually; > constructors should *not* call non-final or non-private methods, and > constructors shouldn't be doing GUI related things. Factor out that stuff > into other method(s) that you call after the Constructor has done its > stuff. Doing this may solve your problems. > > alex == 3 of 3 == Date: Sat, Oct 23 2004 3:52 pm From: [EMAIL PROTECTED] (Paul Tomblin) In a previous article, "***C.Steamer***" <[EMAIL PROTECTED]> said: >Yeah thanks for nothing dude, If you don't have anything useful to add don't >say anything. It looked like a pretty useful answer to me. But if that's not what you want, don't be surprised if you don't get any answers. -- Paul Tomblin <[EMAIL PROTECTED]> http://xcski.com/blogs/pt/ [Hunt for Red October] also passed the "Is this believable" test. Such as, software that classes unknown sounds as sea animals mating ... -- rwp ========================================================================== TOPIC: comp.lang.java.{help,programmer} - what they're for (mini-FAQ 2004-10-08) http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4118e2f7c307830c ========================================================================== == 1 of 1 == Date: Sat, Oct 23 2004 2:25 am From: [EMAIL PROTECTED] (David Alex Lamb) Last-Modified: Fri Oct 8 11:38:42 2004 by David Alex Lamb Archive-name: computer-lang/java/help/minifaq Posting-Frequency: every 4 days Before posting read Jon Skeet's "How to get answers on the comp.lang.java.* newsgroups" at http://www.pobox.com/~skeet/java/newsgroups.html Java FAQs and advice: - Java FAQ (Andrew Thompson) http://www.physci.org/codes/javafaq.jsp including his list of other FAQs http://www.physci.org/codes/javafaq.jsp#faq - Java/Javascript/Powerbuilder HOWTO (Real Gagnon) http://www.rgagnon.com/howto.html - Java Glossary (Roedy Green) http://www.mindprod.com/jgloss.html - jGuru jFAQs (John Zukowski) http://www.jguru.com/jguru/faq/ - Focus on Java (John Zukowski) http://java.about.com/ - Java Q&A (David Reilly) http://www.davidreilly.com/jcb/faq/ - Java GUI FAQ (Thomas Weidenfeller) http://www.physci.org/guifaq.jsp comp.lang.java.help Set-up problems, catch-all first aid. According to its charter, this unmoderated group is for immediate help on any Java problem, especially when the source of the difficulty is hard to pin down in terms of topics treated on other groups. This is the appropriate group for end-users, programmers and administrators who are having difficulty installing a system capable of running Java applets or programs. It is also the right group for people trying to check their understanding of something in the language, or to troubleshoot something simple. comp.lang.java.programmer Programming in the Java language. An unmoderated group for discussion of Java as a programming language. Specific example topics may include: o types, classes, interfaces, and other language concepts o the syntax and grammar of Java o threaded programming in Java - sychronisation, monitors, etc. o possible language extensions (as opposed to API extensions). The original charter said that discussion explicitly should not include API features that are not built into the Java language and gave examples like networking and the AWT. These days AWT belongs in clj.gui, and networking (and many other APIs) are often discussed in clj.programmer. Do not post binary classfiles or long source listings on any of these groups. Instead, the post should reference a WWW or FTP site (short source snippets to demonstrate a particular point or problem are fine). For some problems you might consider posting a SSCCE (Short, Self Contained, Correct (Compilable), Example); see http://www.physci.org/codes/sscce.jsp Don't post on topics that have their own groups, such as: comp.lang.java.3d The Java 3D API comp.lang.java.advocacy Arguments about X versus Y, for various Java X and Y comp.lang.java.beans JavaBeans and similar component frameworks comp.lang.java.corba Common Object Request Broker Architecture and Java comp.lang.java.databases Using databases from Java comp.lang.java.gui Java graphical user interface design and construction comp.lang.java.machine Java virtual machines, like JVM and KVM comp.lang.java.security Using Java securely comp.lang.java.softwaretools Tools for developing/maintaining Java programs Don't cross-post between these groups and c.l.j.programmer or .help -- it just wastes the time of people reading the general groups. Don't post about JavaScript; it's a different language. See comp.lang.javascript instead. -- "Yo' ideas need to be thinked befo' they are say'd" - Ian Lamb, age 3.5 http://www.cs.queensu.ca/~dalamb/ qucis->cs to reply (it's a long story...) ========================================================================== TOPIC: 1.4.2 translate errors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/500030113b379ec ========================================================================== == 1 of 1 == Date: Sat, Oct 23 2004 2:50 am From: Alex Hunsley <[EMAIL PROTECTED]> Yogo wrote: > "Alex Hunsley" wrote > >>If the replying post is relaying information to the OP about something >>they did in their post the wrong way - then yes, it is clearly acceptable, >>if you look at the way Usenet works currently: how often is a post, which >>addresses the OP's bad form of posting style, marked 'off-topic'? Never >>seen it, in my experience. And I've never seen anyone make a fuss about it >>before now. > > > I've put "Off topic" in the subject of my reply to tell people that my reply > had nothing to do with the original topic "1.4.2 translate errors" so that > they don't have to loose time reading my reply if they are only interested > in the original topic. I think that makes sense. Perhaps it makes sense to you. It's not how usenet works though, and you're be wrong in trying to tell Paul Lutus that that is how it works. By all means, if you really feel the need, add "off-topic" to any of your replies where you address a technicality of how another poster has posted their article; but no-one else does this, and that is how usenet is. I suspect usenet works this way because a reply that addresses a technicality of the OP will usually not spawn off a branch of discussion itself; that subthread will usually die right there. It's not like a technicality addressing post will start off a huge sub-thread. (On occaisons I am sure it has, but those occaisons are very much the exception.) >>Can you provide links to messages on google groups that show anyone else >>is bothered by that? On the contrary, I can supply you with any number of >>posts that show that the thing you're complaining about is accepted >>standard practice. > > > Hmm, you've never seen people complaining about off-topic messages? That is not what I said. Go back and read what I wrote again: I said that I've never seen people complaining about messages addressing the usenet technicalities of another usenet post that weren't marked "off-topic". >>I think the key is that while mentioning a technicality about someones >>post isn't talking about the topic at hand, it isn't talking about a >>different topic either, which is what "off-topic" would suggest (at least >>to me). >> >>Tell me, honestly, what you think hurts usenet more: people multiposting >>ad nauseum, or people giving feedback on how better to use usenet without >>adding 'off-topic' to the subject line? > > > Personnally I don't care about multipost as long as the groups are related > to the topic. Then I think you have a poor understanding of usenet. Don't you want usenet to be productive and useful and not annoying when possible? I suggest you go and read up on why multiposting is counter-productive - there are actual reasons, you know! > But I'm annoyed by multipost when the message has nothing to > do with the group: it's like, hmmm, a time-waisting off-topic message > (without any clear mention of its off-topicness). Multi-posted or not, genuinely off-topic[1] messages that aren't marked so can be annoying, yes. [1] by 'genuinely off-topic' I mean posts that aren't talking about the original topic *or* about some technicality of the post they are replying to. alex ========================================================================== TOPIC: "Symbolic computation" http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a89d6f4799be886 ========================================================================== == 1 of 3 == Date: Sat, Oct 23 2004 3:23 am From: [EMAIL PROTECTED] (Jesper Sahner) Does Java support "symbolic computation" like CAS-systems (Computer Algebra System's), e.g. Mathematica, Maple, MATLAB etc.? == 2 of 3 == Date: Sat, Oct 23 2004 3:29 am From: Joona I Palaste <[EMAIL PROTECTED]> Jesper Sahner <[EMAIL PROTECTED]> scribbled the following: > Does Java support "symbolic computation" like CAS-systems (Computer > Algebra System's), e.g. Mathematica, Maple, MATLAB etc.? Not as standard. You can always find an additional library or roll your own. -- /-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\ \-------------------------------------------------------- rules! --------/ "B-but Angus! You're a dragon!" - Mickey Mouse == 3 of 3 == Date: Sat, Oct 23 2004 7:03 am From: Frank <[EMAIL PROTECTED]> On 23 Oct 2004 03:23:32 -0700, Jesper Sahner <[EMAIL PROTECTED]> wrote: > Does Java support "symbolic computation" like CAS-systems (Computer > Algebra System's), e.g. Mathematica, Maple, MATLAB etc.? By itself, no. Mathematica does add a library when installed to allow java programs to pass it computations. There are also other add-on libraries that you can surely find on the web. HTH -Frank ========================================================================== TOPIC: Oracle JDBC XA question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3ded1e7f0747a226 ========================================================================== == 1 of 1 == Date: Sat, Oct 23 2004 3:53 am From: [EMAIL PROTECTED] (spiderbug) > It's not totally explicit, however XA transaction boundaries are really demarcated > by > start and commit/rollback. The DBMS is obligated to maintain the XA transaction > information until then. Your scheme would force the DBMS to support two separate > transactions for a connection. That's a messy and not really useful capability. > > Containers (app servers, ...) won't allow this scenario to happen. Thanks a lot for replying, Lee. As far as the JDBC and JTA specs both say (I'm not sure about what the X/Open spec says) the transaction boundaries are demarcated by the start and end calls. <quote>Your scheme would force the DBMS to support two separate transactions for a connection. </quote> That's what the XAresource interface is supposed to do, IMO. In fact the JTA spec quite clearly says this in an example - but not concurrently. Of course, here 'only one transaction' means only one transaction at a single time - but what about one after the other, without commiting the first and use the same XAresource? Also, since the connection and the xaresource are tightly bound as far as marking transactional boundaries are concerned, there cannot be a case where the connection is operating in a different transaction than what the XAresource has been informed of through the start call. Hope the above paragraph was not confusing!! :) - Am a bit confused myself about the whole thing. Regards ~spiderbug~ ========================================================================== TOPIC: log4j and console in ANT/JUnit task http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2767a082c474af64 ========================================================================== == 1 of 1 == Date: Sat, Oct 23 2004 5:45 am From: [EMAIL PROTECTED] (BlueDolphin) Oscar kind <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > BlueDolphin <[EMAIL PROTECTED]> wrote: > > BTW, I am using ANT's JUnit task to run my program, does that affected > > something? > > No, but yes. You still need to make sure the loj4j configuration file is > loaded. So in this regard nothing changes. > > But, the way the log4j configuration file is loaded now may differ from > the way you usually do this. So it is something to verify again. Sure, I believe the log4j in ant is different, but how to work on it properly? It reads the root.logger settings from the logger.properties. Seems just have one default consoleappender, silently associate with the root.logger's setting... Any idea to split the relation? Thanks ========================================================================== TOPIC: To create an EXE file in Java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee3427d831f71d73 ========================================================================== == 1 of 1 == Date: Sat, Oct 23 2004 5:49 am From: "Michael Saunby" <[EMAIL PROTECTED]> "Gulapala" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I want to install the application in the client so that the souce code is > hidden. > Its like creating an exe file in VB or Cand giving it to the client.How > to > do it? > > > I want to note that Using the jad tool we can also construct the source > file from the class file > > The GNU java compiler does what you want but probably not for the reason you want it http://gcc.gnu.org/java/ The notion of hiding code to the extent that others cannot even reverse engineer it is generally something only that very insecure people or organisations try to do. Not nice people to work with or for. If you've analysed the risks and the cost/benefits of doing what you seem to want to do and it still seems like a good way to spend your time, then I reckon you're most likely doing things wrong. Try giving some thought to why the rest of the world doesn't have the same need. Michael Saunby ========================================================================== TOPIC: 1.5, rtf & word http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/50f7a7e4797096a9 ========================================================================== == 1 of 1 == Date: Sat, Oct 23 2004 6:01 am From: "Ike" <[EMAIL PROTECTED]> Does anyone know if the RTFEditorKit in 1.5 now handles recent MS Word RTF-type files, or is it still as it was with 1.4.2 ? Thanks, Ike ========================================================================== TOPIC: Am I the only one who questions JSTL, Struts Tags, XSL Tags? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/48683f1f07068c7d ========================================================================== == 1 of 2 == Date: Sat, Oct 23 2004 5:45 am From: "Darryl L. Pierce" <[EMAIL PROTECTED]> Greg Smith wrote: <snip about logic tags being in each taglib> Ummm, I only see it in the logic taglib. Where else do you see it? > Essentially, a taglib is an extension to HTML. And, as such, lets someone responsible for the HTML part of the project focus solely on HTML and extensions. They can focus on their area of expertise. > I feel that having > multiple IF statements weakens the programming environment. Why not > just use Java's IF. Because you then start muddying the HTML with a *different* language. Imagine writing C or C++ code and having inline assembler all over the code. Rather than sticking to one pure system you're now comingling two separate and disparate languages and have increased the level of complexity tremendously. What you're talking about is using scriplets to handle iteration, code flow, etc. but you're not saying why it's *better*. I'm actually suggesting it's worse and is one of the reasons why my old signature used to read "Friends don't let friends use scriplets". > Extending HTML to allow control structures > attempts to make HTML a programming language - which it is not. It is > a markup language. And those logic tags are also markup language elements. > And a pretty decent one at that. But HTML does > not lend itself well to describing programming constructs, in > particular flow control. > > Am I alone in this? IMO, yes. Mixing Java with HTML is bad mojo. Keep the webpages purely as markup. I'm not thrilled with having Javascript in, but realize it's a necessary evil sometimes. -- /** * @author Darryl L. Pierce <[EMAIL PROTECTED]> * @see The Infobahn Offramp <http://mcpierce.multiply.com> * @quote "Lobby, lobby, lobby, lobby, lobby, lobby..." - Adrian Monk */ == 2 of 2 == Date: Sat, Oct 23 2004 5:49 am From: "Darryl L. Pierce" <[EMAIL PROTECTED]> Greg Smith wrote: > i hear you... it does seem to me that we're forgetting the lessons > learned over the last 30 years of software engineering. to make > multiple pages when one (plus a little logic) will do, increases the > cost of maintenance. and maintenance is the most expensive phase of > the life cycle. but that may be a different thread. And that's where Tiles comes into the picture. The pages are modularized and the logic for including the specific piece is in the tiling. Your above approach would have a very complex algorithm for making one page do multiply outputs, while Tiles lets you have specific tiles with simpler logic. -- /** * @author Darryl L. Pierce <[EMAIL PROTECTED]> * @see The Infobahn Offramp <http://mcpierce.multiply.com> * @quote "Lobby, lobby, lobby, lobby, lobby, lobby..." - Adrian Monk */ ========================================================================== TOPIC: Can i use multiple bluetooth dongles on one computer?! http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bc883f14d78e1f6f ========================================================================== == 1 of 1 == Date: Sat, Oct 23 2004 6:11 am From: [EMAIL PROTECTED] (Edward Klepping) Paul Lutus <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Tell us how this relates to Java, our topic. Because i plan to write the application for it all in Java and therefore wondered if any of you would know how you would do this in java - ie if you know how all the bluetooth java API worked and therefore suggest a way of tackling this problem java stylee, or tell me if its not possible. Cheers ========================================================================== TOPIC: PostgreSQL/Eclipse/Tomcat - How to connect to DB? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3f7be2a279887571 ========================================================================== == 1 of 1 == Date: Sat, Oct 23 2004 6:35 am From: "Thomas Hoheneder" <[EMAIL PROTECTED]> > > try { > > Class.forName("org.postgresql.Driver"); > > Connection con = DriverManager.getConnection("" + > > "jdbc:postgresql://127.0.0.1:5432/registration", > > "<username>", "<password>"); > > } > > catch (ClassNotFoundException cnfe) { > > System.out.println(cnfe.toString()); > > } > > catch (SQLException sqle) { > > System.out.println(sqle.toString()); > > } > > > > I'm sure you got that to compile, but did it work? Yes, this worked. My only mistake was that I forgot to catch the ClassNotFoundException and SQLEsception. > I didn't think that JDBC drivers registered themselves properly when > their classes are loaded from a class loader different from the system > class loader. (Since you put the postgress jar in WEB-INF/lib it is > probably under a custom class loader created by your J2EE container.) > I believe Tomcat docs say to put jdbc driver jars into one of tomcats > lib directories, I forget which one now. Hmm... I have a book and it said to put the jdbc driver jar into the WEB-INF\lib directory - and this workes fine. > Anyway, you might want to read about Tomcats connection pooling. > You can set up a database connection pool through its UI and > get connections through JNDI. Thats the probably a better way > to retrieve database connections for your servlet. It will also > keep hardcoded usernames and passwords out of your source files. Ok, connection pooling is another chapter in my book as far as I have seen. For the first step I do it with hardcoded user name and password. But you're right, this is of cource no professional way. Nice greetings from Thomas ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= East/West-Coast Server Farms - Total Privacy via Encryption =--- ========================================================================== TOPIC: Convert UTF-8 encoded data from file into unicode escape http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/518625c508ec82f8 ========================================================================== == 1 of 2 == Date: Sat, Oct 23 2004 8:05 am From: [EMAIL PROTECTED] (Fritz Bayer) Hi, I'm looking for a little program, which reads utf-8 data from a file and writes it in the form of unicode escape into another text file. Why am I looking for something like this? Well, I have a file which contains utf-8 encoded data. That data I would like to build staticly into my program. So I would like to copy and paste it into a String constant (String ="\uxxxx\uxxxx..."). However, since I can't just open up a viewer and copy and paste the contents (of course), I would have to convert it into unicode escape. Then I could copy and paste those escape code into my program. I thought that their must be some source code / program aroung which does that? Fritz == 2 of 2 == Date: Sat, Oct 23 2004 1:20 pm From: Alex Kizub <[EMAIL PROTECTED]> Fritz: Convertion from utf-8 to unicode is Java loalization privilege. So, let Java do what it supposed to do. public class a{ public static void main(String []a) throws Exception { java.text.DecimalFormat f; f = new java.text.DecimalFormat(); f.applyPattern("\\u0000"); java.io.FileReader fr=new java.io.FileReader("a.java"); while (fr.ready()) { System.out.println(f.format(fr.read())); } fr.close(); } } Alex Kizub. Fritz Bayer wrote: > Hi, > > I'm looking for a little program, which reads utf-8 data from a file > and writes it in the form of unicode escape into another text file. > > Why am I looking for something like this? Well, I have a file which > contains utf-8 encoded data. > > That data I would like to build staticly into my program. So I would > like to copy and paste it into a String constant (String > ="\uxxxx\uxxxx..."). > > However, since I can't just open up a viewer and copy and paste the > contents (of course), I would have to convert it into unicode escape. > > Then I could copy and paste those escape code into my program. I > thought that their must be some source code / program aroung which > does that? > > Fritz ========================================================================== TOPIC: any HTML/XML handling scripting language ? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4ad69fcbcf8cb59c ========================================================================== == 1 of 1 == Date: Sat, Oct 23 2004 8:18 am From: Martin Honnen <[EMAIL PROTECTED]> Bru, Pierre wrote: > for ex, with WebL you can delete each table row that contains the word > "foo" with something like: > > P=GetURL("http://www.foo.bar/index.html"); > each e in Elem(P,"tr") contain Pat(P,"foo") Delete(e); end > PrintLn(Markup(P)); > > and many other easy handling like this one (check the PDF Reference > Manual for more) > > does something like that exist out of the box (or near out out the > box)? Maybe HttpUnit helps: http://www.httpunit.org/ -- Martin Honnen http://JavaScript.FAQTs.com/ ========================================================================== TOPIC: multiple statement objects per connection http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c8c89dc8f7a169a2 ========================================================================== == 1 of 2 == Date: Sat, Oct 23 2004 8:07 am From: "Madhur Ahuja" <[EMAIL PROTECTED]> Hello In the jdbc faq at sun site is clearly written that: java.sun.com\products\jdbc\faq.html | 15. Does the JDBC-ODBC Bridge support multiple concurrent | open statements per connection? | No. You can open only one Statement object per connection | when you are using the JDBC-ODBC Bridge. However, my program which uses 2 statement objects per connection runs fine without any problems. Why is this happening? Backend : MS Access java version "1.4.1_01" import java.sql.*; class Test { public static void main(String args[]) { MyTest a=new MyTest(); } } class MyTest { MyTest() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url="jdbc:Odbc:test"; Connection con=DriverManager.getConnection(url,"",""); Statement st=con.createStatement(); Statement st1=con.createStatement(); st.execute("insert into table1 values('madhur','ahuja')"); st1.execute("insert into table1 values('madhur','ahuja')"); st.close(); con.close(); } catch(Exception e) { e.printStackTrace(); } } } -- Madhur Ahuja [madhur<underscore>ahuja<at>yahoo<dot>com] Homepage http://madhur.netfirms.com == 2 of 2 == Date: Sat, Oct 23 2004 9:41 am From: Mark Thornton <[EMAIL PROTECTED]> Madhur Ahuja wrote: > Hello > In the jdbc faq at sun site is clearly written that: > java.sun.com\products\jdbc\faq.html > > | 15. Does the JDBC-ODBC Bridge support multiple concurrent > | open statements per connection? > | No. You can open only one Statement object per connection > | when you are using the JDBC-ODBC Bridge. > > However, my program which uses 2 statement objects per connection > runs fine without any problems. Why is this happening? > Backend : MS Access > java version "1.4.1_01" > > import java.sql.*; > > > class Test > { > > public static void main(String args[]) > { > MyTest a=new MyTest(); > > } > } > > > > class MyTest > { > > > MyTest() > { > try > { > > Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); > String url="jdbc:Odbc:test"; > > Connection con=DriverManager.getConnection(url,"",""); > Statement st=con.createStatement(); > Statement st1=con.createStatement(); > st.execute("insert into table1 values('madhur','ahuja')"); > st1.execute("insert into table1 values('madhur','ahuja')"); > st.close(); > con.close(); > } > catch(Exception e) > { > e.printStackTrace(); > } > > } > } > All the work for the first statement is complete before you start the second. Try doing two select statements and read say only half of the results from the first ResultSet before executing the second statement and then see if you can continue reading the remainder of the results from the first ResultSet. Mark Thornton ========================================================================== TOPIC: performance problem when running java applications overnight http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/363862525372f8b2 ========================================================================== == 1 of 1 == Date: Sat, Oct 23 2004 3:27 pm From: "John McGrath" <[EMAIL PROTECTED]> On 10/20/2004 at 4:34:43 PM, noah wrote: > > It's very possible that simply setting each of 3 JVMs to run in (just > a rough guess here) < 1/3 of your available memory, you shouldn't have > as much of a swapping problem. That presume that Windows will not swap out programs if it has enough physical memory to store them. While that may seem logical, it is not the way that Windows behaves. -- Regards, John McGrath ========================================================================== TOPIC: Map that takes a pair of keys? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b8bfed67959eb893 ========================================================================== == 1 of 1 == Date: Sat, Oct 23 2004 3:51 pm From: marcus <[EMAIL PROTECTED]> Thanx oscar -- that was what I was missing. I have a couple solutions I am going to benchmark. question about your code, tho > public boolean equals(Object o) { > // An object is always different from null. > if (o == null) { > return false; > } > // The first key is empty, but it's counterpart is not. > if (key1 == null && o.key1 != null) { > return false; > } > // The second key is empty, but it's counterpart is not. > if (key2 == null && o.key2 != null) { > return false; > } > // The first key is not empty, but differs from it's counterpart. > if (key1 != null && !key1.equals(o.key1)) isn't this last line recursing? ======================================================================= 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
