comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Microsoft and Sun JVM ? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dbdadd7a3dd948a4 * How to system("foo") in Java? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9626f7b0c131bcd0 * Tomcat startup problem - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/691dd280039df3ee * Serializable vs Externalizable - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8d424c3b3da836c3 * Array Constructor - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/46bb58d40a642599 * acceptable way to program - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/829184c5bd6bb8b0 * LOL..... I Just Found A Gwenyth Paltrow Sex Video Online. Take A Look....... 2EF0 - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/80bf494bd7bbe2df * Custom Protocol over TCP - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4b24f908bd6b6b6b * Good book on Java basics - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6b796f558b4a9484 * want some extra cash, try this - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f941dd0ae2ff3959 * Newbie's queries on wps and WebSphere Portal Server - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/446e8ec5a954be95 * Java Methods - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dbbde6e7a639949f * [personal java] need help do not know what is teh problem drawing image - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/73698ddcc823b285 * Java Architects / Sr. developers / Developers - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cd526f321112451c * Stuff the purple heart programmers cook up - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ff788c5b12bf8d8f * database access - PreparedStatement - DebuggableStatement - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/61b32931886071f9 * declare variable inside or outside block? - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/51e12987795dd5c4 ============================================================================== TOPIC: Microsoft and Sun JVM ? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dbdadd7a3dd948a4 ============================================================================== == 1 of 1 == Date: Sat, Jan 1 2005 8:16 am From: Andrew Thompson On Sat, 01 Jan 2005 02:34:45 -0500, IchBin wrote: > You would have to .. * >..distribute your applet with Sun's 'Java Web Start' .. If the applet is intended for Java 1.3+, this is an excellent solution. * Though there are other options, including Sun's HTMLConverter and the JavaVersionApplet. <http://physci.org/codes/javafaq.jsp#version> >..and this could download a JVM that is more Java compliment .. 'compliant' > ..and current... Like, this millenium! The MSVM (last version around 96?) is a dinosaur by comparison. [ F'Ups set to c.l.j.programmer ] -- 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: How to system("foo") in Java? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9626f7b0c131bcd0 ============================================================================== == 1 of 2 == Date: Sat, Jan 1 2005 8:20 am From: fishfry If I need to fork/exec some other Java code, I can use a thread, as long as I'm careful about shared resources. But what if I want to execute a process on the underlying operating system ... for example system("ls") on a Unix system? Surely someone must have some JNI code that does this? == 2 of 2 == Date: Sat, Jan 1 2005 2:08 am From: [EMAIL PROTECTED] (Ian A. Mason) Look at the java.lang.Runtime.exec family. Especially the exec(String[] cmdarray) one. ============================================================================== TOPIC: Tomcat startup problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/691dd280039df3ee ============================================================================== == 1 of 1 == Date: Sat, Jan 1 2005 12:58 am From: [EMAIL PROTECTED] (Kevin Lam) Dear experts, I am trying to start my web application using tomcat, but I get the following error, can anyone tell me what's happening? Thx Kevin type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: org.apache.jasper.JspCompilationContext.isTagFile()Z org.apache.jasper.servlet.JspServlet.service(JspServlet.java:256) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) root cause java.lang.NoSuchMethodError: org.apache.jasper.JspCompilationContext.isTagFile()Z org.apache.jasper.compiler.ParserController.parse(ParserController.java:137) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:237) org.apache.jasper.compiler.Compiler.compile(Compiler.java:456) org.apache.jasper.compiler.Compiler.compile(Compiler.java:439) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:508) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) ============================================================================== TOPIC: Serializable vs Externalizable http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8d424c3b3da836c3 ============================================================================== == 1 of 2 == Date: Sat, Jan 1 2005 9:15 am From: Andrew McDonagh Alex Molochnikov wrote: > "Norris Watkins" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>I didnt know that even with writeObject() defined, it will write the >>superclass "part" of the object. >>I somehow thought that one has to call defaultWriteObject() inside >>writeObject() for this to happen. > > > Yes, one does have to call the defaultWriteObject() to serialize the > superclass, and the serializable ivars of the given class. However, keep in > mind that you can control what instance variables to serialize by using the > "transparent" attribute which excludes the ivar from the serialization > process. All in all, the Serializable and Externalizable can be tuned to the > same performance. > > Alex Molochnikov > Gestalt Corporation > www.gestalt.com > > I think you mean 'transient' as in... private transient String aStringThatWOntBeSerialized = "wontBeSerialized"; == 2 of 2 == Date: Sat, Jan 1 2005 6:48 pm From: "Alex Molochnikov" "Andrew McDonagh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Alex Molochnikov wrote: > I think you mean 'transient' as in... > > private transient String aStringThatWOntBeSerialized = "wontBeSerialized"; Of course. That's what happens when one starts celebrating the New Year early... :-) ============================================================================== TOPIC: Array Constructor http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/46bb58d40a642599 ============================================================================== == 1 of 1 == Date: Sat, Jan 1 2005 2:34 am From: [EMAIL PROTECTED] Bent and Ryan, Thanks to you both. Peter ============================================================================== TOPIC: acceptable way to program http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/829184c5bd6bb8b0 ============================================================================== == 1 of 3 == Date: Sat, Jan 1 2005 6:36 pm From: steve On Sat, 1 Jan 2005 12:23:38 +0800, Ann wrote (in article <[EMAIL PROTECTED]>): > > "steve" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Hi, >> >> Recently I have been looking at the various ways people are implementing, >> interaction between java & oracle databases. >> >> I was always instructed on the purity of the data model, "normalize the >> data" etc. >> >> I have seen people Serializing java objects , such as purchase orders >> orders, customer records etc , then sticking the "object" into am oracle > blob >> column. >> >> finally when they want to retrieve it they de-serialize the object., work > on >> it then re-serialize and stuff it back into the oracle blob. >> >> to me this causes the following problems: >> >> 1. the object can become very big, and can only be recovered in it's >> entirety, and if it contains pictures ,etc, it can become huge. >> 2. the object becomes "closed", in that it cannot be modified or checked > in >> situ >> 3. it cannot be searched , without de-serialization. > > How do you sort on a field that contains just picures (not pictures in > objects.) > >> >> >> I'm looking to implement a java front end, (oracle back end), system ,that >> allows a product , to be inspected by an inspection team , and comments/ >> photographic record kept. >> >> using an "object approach" would make it very simple, but the size of the >> resulting object could be very large. >> >> does anyone have any thoughts how to accomplish this task. >> >> >> steve >> >> >> > > by giving the picture a key index, that ties back to a master object. If for example i have a factory record, and 50 ( Health & safety) pictures attached to that factory record, via a key, If i follow some peoples current advice ( Serialize, Serialize!!! ), i would have to de-serialize an object of about 6MB, either to disk or into memory. currently , i bring the master factory record over, then bring the pictures over on the fly. ( actually i bring 3k thumb nails over first), then pictures if requested by the user. my main point , was that Whilst i have no formal background in data management, or oracle databases, or system management ,etc . I am the "main man" by default, because i am technical ! ( you gotta love some companies) Therefore because i don't know I ask. steve == 2 of 3 == Date: Sat, Jan 1 2005 6:14 pm From: "Ann" "steve" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sat, 1 Jan 2005 12:23:38 +0800, Ann wrote > (in article <[EMAIL PROTECTED]>): > > > > > "steve" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > >> Hi, > >> > >> Recently I have been looking at the various ways people are implementing, > >> interaction between java & oracle databases. > >> > >> I was always instructed on the purity of the data model, "normalize the > >> data" etc. > >> > >> I have seen people Serializing java objects , such as purchase orders > >> orders, customer records etc , then sticking the "object" into am oracle > > blob > >> column. > >> > >> finally when they want to retrieve it they de-serialize the object., work > > on > >> it then re-serialize and stuff it back into the oracle blob. > >> > >> to me this causes the following problems: > >> > >> 1. the object can become very big, and can only be recovered in it's > >> entirety, and if it contains pictures ,etc, it can become huge. > >> 2. the object becomes "closed", in that it cannot be modified or checked > > in > >> situ > >> 3. it cannot be searched , without de-serialization. > > > > How do you sort on a field that contains just picures (not pictures in > > objects.) > > > >> > >> > >> I'm looking to implement a java front end, (oracle back end), system ,that > >> allows a product , to be inspected by an inspection team , and comments/ > >> photographic record kept. > >> > >> using an "object approach" would make it very simple, but the size of the > >> resulting object could be very large. > >> > >> does anyone have any thoughts how to accomplish this task. > >> > >> > >> steve > >> > >> > >> > > > > > > by giving the picture a key index, that ties back to a master object. So then you can sort on the blobs by giving them a key index! > > If for example i have a factory record, and 50 ( Health & safety) pictures > attached to that factory record, via a key, > If i follow some peoples current advice ( Serialize, Serialize!!! ), i would > have to de-serialize an object of about 6MB, either to disk or into memory. > > currently , i bring the master factory record over, then bring the pictures > over on the fly. ( actually i bring 3k thumb nails over first), then pictures > if requested by the user. > > > my main point , was that Whilst i have no formal background in data > management, or oracle databases, or system management ,etc . > I am the "main man" by default, because i am technical ! ( you gotta love > some companies) > > Therefore because i don't know I ask. > > steve > > > > > > > > > > == 3 of 3 == Date: Sat, Jan 1 2005 11:54 am From: "thufir" steve wrote: > Hi, > > Recently I have been looking at the various ways people are implementing, > interaction between java & oracle databases. > > I was always instructed on the purity of the data model, "normalize the > data" etc. > > I have seen people Serializing java objects , such as purchase orders > orders, customer records etc , then sticking the "object" into am oracle blob > column. > > finally when they want to retrieve it they de-serialize the object., work on > it then re-serialize and stuff it back into the oracle blob. > > to me this causes the following problems: > > 1. the object can become very big, and can only be recovered in it's > entirety, and if it contains pictures ,etc, it can become huge. > 2. the object becomes "closed", in that it cannot be modified or checked in > situ > 3. it cannot be searched , without de-serialization. > > > I'm looking to implement a java front end, (oracle back end), system ,that > allows a product , to be inspected by an inspection team , and comments/ > photographic record kept. > > using an "object approach" would make it very simple, but the size of the > resulting object could be very large. > > does anyone have any thoughts how to accomplish this task. > > > steve steve, i took the liberty of cross-posting your original post to comp.databases.oracle.misc, hope you don't mind! -- Thufir Hawat ============================================================================== TOPIC: LOL..... I Just Found A Gwenyth Paltrow Sex Video Online. Take A Look....... 2EF0 http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/80bf494bd7bbe2df ============================================================================== == 1 of 1 == Date: Sat, Jan 1 2005 12:58 pm From: [EMAIL PROTECTED] Hi LOL.... I cant believe she did this... Its not bad either!! I have put it on my site here http://www.sonicboards.com/sk.htm Take a look :) ---------------------------------------------------------------------------- --- Sogenetim ri puma meta lecoxeg rogigeke viweterevih fixicilefi punifire peve pogilafe licela sisosaro lo voli fa . ============================================================================== TOPIC: Custom Protocol over TCP http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4b24f908bd6b6b6b ============================================================================== == 1 of 1 == Date: Sat, Jan 1 2005 3:50 pm From: Jeffrey Spoon In message <[EMAIL PROTECTED]>, Phil Staite <[EMAIL PROTECTED]> writes >Note, UDP is problematic for anyone behind a firewall... :-( > >You may want to include in your protocol an exchange of "known >servers/nodes" so that if/once you get out past your firewall you can >rapidly expand the list of known nodes. > > Ah. Originally I though of doing it entirely in TCP but thought that would be wasteful for what would basically be a ping/pong at the start, before going onto the more permanent connection. I was going to use the local cache host scheme (less centralised than having a few host lookup servers). I suppose I could use a sort of "push" through other nodes to get out through the firewall somehow. -- Jeffrey Spoon ============================================================================== TOPIC: Good book on Java basics http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6b796f558b4a9484 ============================================================================== == 1 of 3 == Date: Sat, Jan 1 2005 3:55 pm From: Jeffrey Spoon In message <[EMAIL PROTECTED]>, Wendy S <[EMAIL PROTECTED]> writes >"Mr B." <[EMAIL PROTECTED]> wrote: >> Any recommendations on a good book on Java basics ? >> I am very experienced in Windows / C++ programming, but have no idea how >> to build bas classes to inherit from etc etc etc etc > >I recommend Joshua Bloch's "Effective Java". > Is that the guy who wrote the Collections framework? -- Jeffrey Spoon == 2 of 3 == Date: Sat, Jan 1 2005 3:55 pm From: Jeffrey Spoon In message <[EMAIL PROTECTED]>, anonymous <[EMAIL PROTECTED]> writes >Mr B. wrote: >> Hi >> Any recommendations on a good book on Java basics ? >> I am very experienced in Windows / C++ programming, but have no idea >>how to build bas classes to inherit from etc etc etc etc >> Also, I seem to miss some offline helpfiles on the Java methods, >>stuff like setText etc etc >> Anything available ? >> TIA >> Lars >'Java in a Nutshell' comes to mind. I have that too. The trouble is it's out of date already. I don't think there's really anything in there that you can't get from java.sun.com for free (plus most of it is more up-to-date). -- Jeffrey Spoon == 3 of 3 == Date: Sat, Jan 1 2005 2:28 pm From: "thufir" yes (i think). keep in mind it's out of date too, though! generics solves at least one of the idioms, etc. it's probably availably free at your library, though. the concepts behind the idioms aren't out of date all, IMHO. -- Thufir Hawat ============================================================================== TOPIC: want some extra cash, try this http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f941dd0ae2ff3959 ============================================================================== == 1 of 1 == Date: Sat, Jan 1 2005 7:56 am From: [EMAIL PROTECTED] want some extra cash, try this THIS REALLY CAN MAKE YOU EASY MONEY!! A little while back, I was on my computer having a grand old time, just like you are now and came across an article similar to this that said you could make thousands dollars within weeks with only an initial investment of $6.00! So I thought, "Yeah, right, this must be a scam", but like most of us, I was curious, so I kept reading. Anyway, it said that you send $1.00 to each of the 6 names and address stated in the article. You then place your own name and address in the bottom of the list at #6, and post the article in at least 200 newsgroups. No catch, that was it. So after thinking it over, and talking to few people first, I thought about trying it. I figured what have I got to lose except 6 stamps and $6.00, right? Like most of us I was a little skeptical and a little worried about the legal aspects of it all, So I checked it out with the U.S. Post Office (1-800-725-2161) and they confirmed that it is indeed legal! Then I invested the measly $6.00. Well GUESS WHAT!!?. Within 7 days, I started getting money in the mail! I was shocked! I figured it would end soon, but the money just kept coming in. In my first week, I made about $25.00. By the end second week I had made a total over $1,000.00! In the third week I had over $10,000.00 and it's still growing. Its Certainly worth $6.00, and 6 stamps, I have spent more than that on the lottery!! Let me tell you how this works and most importantly, why it works?.STEP 1: Get 6 separate pieces of paper and write the following on each piece of paper "PLEASE PUT ME ON YOUR MAILING LIST." Now get 6 US $1.00 bills and place ONE inside EACH of the 6 pieces of paper so the bill will not be seen through the envelope to prevent thievery. Next, place one paper in each stating the above phrase, your name and address, and a $1.00 bill. What you are doing is creating a service by this. THIS IS ABSOLUTELY LEGAL! Mail the 6 envelopes to the following addresses: #1) Jason Barone P.O. Box 1015 Glen Burnie, MD 21060-1015 #2) Jonathon Markwood 3308 Birdsong Way Birmingham, AL 35242 #3) Eben Mcgee 1876 #C Locust, Las Cruces, NM 88001 #4) Ricky DeMaio 471 McCutcheon rd, Hudson WI 54016 #5) P. Ortner 29 Briarlee Dr. Tonawanda, NY 14150 #6) O. Humphrey 8452 E. Louise Dr, Tucson, AZ 85730 STEP 2: Now take the #1 name off the list that you see above, move the other names up and add YOUR Name as number 6 on the list. STEP 3: Change anything you need to, but try to keep this article as close to original as possible. Now, post your amended article to at least 200 newsgroups, message board. All you need is 200, but remember, the more you post, the more money you make!---- Just copy this message, paste it in Word or Notepad, find message boards like this and paste away. Congratulations? THAT'S IT! All you have to do is jump to different newsgroups and post away, after you get the hang of it, and it will take about 30 seconds for each newsgroup! * REMEMBER, THE MORE NEWSGROUPS OR MESSAGE BOARD YOU POST IN, THE MORE MONEY YOU EILL MAKE!! BUT YOU HAVE TO POST A MINIMUM OF 200* That's it! You will begin receiving money from around the world within days! ============================================================================== TOPIC: Newbie's queries on wps and WebSphere Portal Server http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/446e8ec5a954be95 ============================================================================== == 1 of 1 == Date: Sat, Jan 1 2005 8:05 am From: [EMAIL PROTECTED] Hi all, Please forgive me if I have posted to an inappropriate group. I am new in the J2EE and hence in the WebSphere Portal Server. I am confused when working with the admin console and would like your kindly help. In the admin console, I select Application choice, it shows two entries, namely WebSphere Portal Server server1. What is the relationship between the WebSphere Application Server (WAS) and the WebSphere Portal Server (WPS), is the WPS a EAR running in the WAS? In selecting Enterprise Application, there are many installed applications. I expected they are EAR installed. Am I correct? There is one called wps. What is the relationship between this wps and the WebSphere Portal Server? Moreover, when I tried to installed a HelloWorld war through the Portlet deployment GUI, a Hello_xxx entry is added in the table of selecting Enterprise Application. I am installed a war, why it is shown as an EAR in the console? Please englighten me or direct me to any materials. Thanks in advance for your ideas and inputs. Earth ============================================================================== TOPIC: Java Methods http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dbbde6e7a639949f ============================================================================== == 1 of 1 == Date: Sat, Jan 1 2005 5:07 pm From: "Gemma" "IchBin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Gemma wrote: >> Hi all, >> >> I started programming Java a couple of months ago now and I recently >> started >> methods, although my understanding of methods still isn't great. >> >> I was wondering if anyone knows of any good online tutorials or examples >> of >> code. >> >> Thanks in advance to anyone who replies! >> >> > > > Two bible sources.. > > *Java Language Specification* > http://java.sun.com/docs/books/jls/second_edition/html/jTOC.doc.html > > *The Really Big Index* > http://java.sun.com/docs/books/tutorial/reallybigindex.html > Thanks for the URLs! ============================================================================== TOPIC: [personal java] need help do not know what is teh problem drawing image http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/73698ddcc823b285 ============================================================================== == 1 of 1 == Date: Sat, Jan 1 2005 9:20 am From: [EMAIL PROTECTED] (mchmiel) I ve written some code in WSDD compile it and run it under IDE works fine without problems but if i run the app on S80 Nokia device emulator it doeasn'y show the image. Look at the code: import java.awt.*; import java.awt.event.*; public class proba extends Frame { private Image image; public proba() { this.setLayout(new GridLayout(3, 1)); Toolkit tk = Toolkit.getDefaultToolkit(); Image im = tk.createImage("reklama.gif"); MediaTracker tracker = new MediaTracker(this); tracker.addImage(im, 1); try { tracker.waitForID(1); } catch (Exception e) { e.printStackTrace(); } CommercialCanvas cv = new CommercialCanvas(im); cv.setSize(new Dimension(im.getWidth(null),im.getHeight(null))); cv.setVisible(true); add(cv); cv.repaint(); pack(); show(); setVisible(true); } public static void main(String[] args) { System.out.println("IDZIEMY"); new proba(); } } class CommercialCanvas extends Canvas { private Image image; public CommercialCanvas(Image image) { this.image = image; } public void paint(Graphics g) { g.drawImage( image, 10,10,image.getWidth(this),image.getHeight(this), this); } } of course You have to provide the image caled reklama.gif :-) Mchmiel ============================================================================== TOPIC: Java Architects / Sr. developers / Developers http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cd526f321112451c ============================================================================== == 1 of 1 == Date: Sat, Jan 1 2005 11:00 am From: [EMAIL PROTECTED] We are a UK-based software firm, setting up our operations in Bangalore, India as a 100% EOU under STPI. We require persons with knowledge of front-end Java architecture - Swing, Eclipse, Ant, JUnit etc... Java Architects - 5+ years exp: The role is of leadership, to guide a team of developers. Good communication, Leadership skills, work with 2 - 4 teams on different projects, UK travel may be needed. Work location: Bangalore. Sr.Dev: 3+ years exp / Dev: 1.5+ years exp. Front-end Java Developers preferred. Mail to [EMAIL PROTECTED] ============================================================================== TOPIC: Stuff the purple heart programmers cook up http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ff788c5b12bf8d8f ============================================================================== == 1 of 1 == Date: Sat, Jan 1 2005 11:12 am From: "Last Timer" For Andrew the old hag: How much did java programmers contribute to the tsunami relief? NaN How many java programmers does it take to rewrite a C program? A class full of them What happens to StarBucks if java programmers save enough money to buy coffee there? They will rename themselves PointerBucks What happened to Java Woman? She gave birth to Java Man, named him Jesus and flew to Sun. ============================================================================== TOPIC: database access - PreparedStatement - DebuggableStatement http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/61b32931886071f9 ============================================================================== == 1 of 1 == Date: Sat, Jan 1 2005 12:06 pm From: "[EMAIL PROTECTED]" Don't forget MySQL and JBOSS ! ============================================================================== TOPIC: declare variable inside or outside block? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/51e12987795dd5c4 ============================================================================== == 1 of 3 == Date: Sat, Jan 1 2005 11:19 pm From: Angus Parvis Hi, I just asked myself, whether it is better to declare a variable inside or outside a block, if you only want to use it inside the block; I always do it like this: String foo; while (true) { foo = new String(); } Guess that's better than: while (true) { String foo = new String(); } In the second example i declare the variable String foo every time the loop is repeated - guess that's the worse solution, isn't it? Well, I'd be interested in your comments on this, thanks in advance, Angus == 2 of 3 == Date: Sat, Jan 1 2005 3:23 pm From: "Boudewijn Dijkstra" "Angus Parvis" <[EMAIL PROTECTED]> schreef in bericht news:[EMAIL PROTECTED] > Hi, > > I just asked myself, whether it is better to declare a variable inside or > outside a block, if you only want to use it inside the block; > > I always do it like this: > > String foo; > while (true) { > foo = new String(); > } > > Guess that's better than: > > while (true) { > String foo = new String(); > } > > In the second example i declare the variable String foo every time the loop > is repeated - guess that's the worse solution, isn't it? Declaration happens only inside the compiler. The JVM operates on numbered variables; in both cases 'foo' gets the same number every iteration. What remains is a matter of variable scope, rendering the second example the better one, provided that 'foo' is only needed inside the loop. == 3 of 3 == Date: Sat, Jan 1 2005 3:24 pm From: Andrew McDonagh Angus Parvis wrote: > Hi, > > I just asked myself, whether it is better to declare a variable inside > or outside a block, if you only want to use it inside the block; > > I always do it like this: > > String foo; > while (true) { > foo = new String(); > } > > Guess that's better than: > > while (true) { > String foo = new String(); > } > > In the second example i declare the variable String foo every time the > loop is repeated - guess that's the worse solution, isn't it? > > Well, I'd be interested in your comments on this, > > thanks in advance, > > Angus Hi, Actually the second is 'better' as its only needed within the block. Do not be fooled into thinking that the multiple declaration within the block would have dramatic performance issues - it doesn't. By declaring references as close to their actual use, it will enable easier refactorings as well as communicate their first usage easier. Its (was) typical for C programs to have all local variables defined at the beginning of a function, but this isn't (IMHO) a good practice. Andrew ============================================================================== You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer" group. To post to this group, send email to [EMAIL PROTECTED] or visit http://groups-beta.google.com/group/comp.lang.java.programmer To unsubscribe from this group, send email to [EMAIL PROTECTED] To change the way you get mail from this group, visit: http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe To report abuse, send email explaining the problem to [EMAIL PROTECTED] ============================================================================== Google Groups: http://groups-beta.google.com
