comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * OT: Google postings (was: Re: Java method) - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7e41087585d0c108 * (OT) Re: Using hobby source code in your job ? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a60dfe865a7807c4 * Can Java Programmer Learn C++ Quickly? - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7c7a28aa864e41ec * Sockets - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/edecab678cd31cd6 * Delete a panel inside a panel - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a3a93919190a899d * How to restrict direct access to JSP files, only allow access via servlet? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/514c912d89045a82 * Is there any java method which do the following function? - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f355c57a8ec1978b * Auto submit Struts form every 'n seconds - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5f1db635d5081dd3 * JavaBeans, Tomcat and deployment. - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/efc112c5ac70daa8 * how to get application path? Is that my method in getting path wrong? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c39434502d515e0d * Java double precision - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ffd916b2ccb1a75b * [ANN] Servertec Jenie 1.0.0 12/05/2004 - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/86afd10b0918f363 * Where to place configuration files when using WAR-Files - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/74dc1db3e419defd ============================================================================== TOPIC: OT: Google postings (was: Re: Java method) http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7e41087585d0c108 ============================================================================== == 1 of 1 == Date: Tues, Dec 7 2004 9:09 am From: Thomas Weidenfeller Andrew Thompson wrote: > There seems to be a problem with Google postings, if this one fits > the pattern, > - the OP is using Google Groups beta > - The message on post read 'could not post' > - The OP pressed 'back' then reposted it (twice, presumably) Google groups is switching its English version of their web interface to a new software version, which they were running for some time now as a separate beta version. Unfortunately, the software is still very much at beta stage, but that doesn't prevent google from switching back and forth between the old and the new beta version. Many Usenet groups are now plastered with duplicates, thanks to Google (wasn't their corporate motto "do no evil"?). The new software is broken in other ways, too. E.g. searching for message ids does no longer work, top level hierarchies have been renamed, the interface now requires javascript, etc. If you want to voice your opinion: http://groups-beta.google.com/support/bin/request.py /Thomas -- ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq ============================================================================== TOPIC: (OT) Re: Using hobby source code in your job ? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a60dfe865a7807c4 ============================================================================== == 1 of 1 == Date: Tues, Dec 7 2004 12:39 am From: Jim P Maarten Wiltink wrote: > "Jim P" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > >>I like that concept of 100 hours a week for the next 4 to 5 years. That >>is part of what the manager does. My dad owned his own business. and he >>would spend a lot of time simply thinking. and not all of during the >>work hours. - - - Believe me the good manager is thinking about cause >>and effect, schedules and that - - and not just 8 to 5. > > > Hey, I do that. Are you calling me a manager? Them's fighting words. > > (No, I don't have my own business.) > > Groetjes, > Maarten Wiltink > > and that is why you are a good programmer. You live this stuff. and 8 to 5 guy - turns it off as he leaves work. Jim P. ============================================================================== TOPIC: Can Java Programmer Learn C++ Quickly? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7c7a28aa864e41ec ============================================================================== == 1 of 3 == Date: Tues, Dec 7 2004 9:03 am From: "Chris Uppal" Rhino wrote: > I'd be very curious to know how long it took people here who were fluent > in Java to get fairly fluent in C++ if they started with approximately > the same skills I have today. I haven't gone from Java to C++ (I went the other way) but I think I can add something useful to this thread. The following is only personal opinion, of course, but it is backed by quite a bit of experience of working with C++ programmers of various grades. C++ is large, complicated, and /DIFFICULT/. There is no way that you can learn it quickly, no matter what your background. If you are intelligent, a good programmer, and are interested in understanding the details of programming languages, then you can probably become a very good C++ programmer in as little as three years. If not then it'll take a little longer... I would say that its a rare programmer who can (or should !) write C++ code without supervision with less than a year's (fulltime) practise. Obviously, people don't /really/ take that long to become "productive" -- what happens is that they learn a cut-down approximation to C++, and then use that. If they are well-taught (or lucky) then the various misconceptions and misunderstanding they have will not be /too/ serious, and they'll be able (usually) to write code that works, and modify existing code without (usually) introducing subtle bugs. The difference from languages like, say, Java is that misunderstand C++ is often dangerous. A "fairly fluent" C++ programmer is quite likely to be introducing bugs without knowing it (even when using features that they think they understand), whereas a "fairly fluent" Java programmer is quite likely to be writing reasonable Java, even if there are things about the language that they haven't yet learned. But what you are /really/ asking isn't about learning to write good C++, its more about knowing C++ well enough to claim that you know the language at interview ;-) How long that will take will depend on how honest you want to be, and on what you think /their/ requirements are. It's certainly possible to learn enough in a week or so (fulltime) that you can easily pass simple programming tests. BTW, I know this post sounds like a criticism of C++, and indeed it /is/ a criticism of C++, but I wouldn't want to give the impression that I dislike the language. It's a lot of fun to program in C++, there are so /many/ intellectual challenges. I just don't think its a particularly good choice for writing programs in... -- chris == 2 of 3 == Date: Tues, Dec 7 2004 8:36 pm From: Ian T Rhino wrote: > I realize that this is not entirely a Java question but I am hoping that > some of the people reading this newsgroup are Java programmers who went on > to learn C++. > > I am giving some thought to applying for some jobs that want people with > Java and C++ experience. I have been writing Java for several years and am > fluent enough that I don't have to post questions here very often. I have no > real C++ experience and not much C experience for that matter. > > However, the core Java statements are "borrowed" from C and C++ has often > been called "C with classes". Having programmed C++ for ~3years and now learning Java, I can say that C++ (and C ) has some nasties that takes years to completely get your head around. First of all: memory management. You've got to follow that object reference (and mallocs) everywhere it goes and anticipate every situation where it might be stranded. A good bounds checker will help, but still, it's something that you never think about with Java (garbage collector), but you should always be thinking about in C++. Second: Pointers. References (&), de-references(->), points(*().), pointer(*), pointer arithmetic, char arrarys, memory buffers, and so on. Learning pointers is the hardest part of C++, and once you have a good handle on that, some of the other things come easier too. Third: Null terminated character arrays. Useful, but often dangerous as you can kill the null terminator and have string functions wander off into other parts of the stack or the heap. Also, C style string functions are the source of many buffer overflow exploits. For most string handling <basic string> is your friend, but null terminated character arrays have enormous flexibility. Fourth: Learn the containers in STL as soon as practically possible, especially <map> and <list>. >It seems to me that it shouldn't take very > long to get up to speed on C++ if I am already fluent with Java and have at > least some knowledge of C. Good luck with that ;). Probably *the* best book (IMNSHO) for starting out with C++ is Dietel & Deitel C++ How to Program. It's as dense as a chocolate pudding, but it has all the bits. Ian == 3 of 3 == Date: Tues, Dec 7 2004 10:24 am From: "Tim Ward" "Rhino" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I realize that this is not entirely a Java question but I am hoping that > some of the people reading this newsgroup are Java programmers who went on > to learn C++. The other way round is easier, as others have said, because C++ is a vastly more complex language than Java. (This was deliberate; many of the nasties in C++ come from retaining backwards compatibility with C, without which C++ would have been just-another-OO-language-that-nobody-used, whereas Java was designed from scratch with all the difficult bits deliberately omitted.) Yeah, sure, learning the syntax differences is trivial and should take an afternoon (apart from templates, and of course the various obscurities that nobody uses such as pointer-to-member and stuff like that). If you've never done any real programming and have no idea what a computer is (ie if you've never done any machine code or assembler programming) then you may have trouble getting your head round pointers and references and suchlike; I've never seen why people find this difficult, but it's a fact that some do. On the memory management ... C++ is one of the languages that thinks "memory management is far too important to leave to the compiler" in contast to Java which thinks that "memory management is far too important to leave to the programmer". But once you've realised what you can do with proper destructors ... Anyway, the language is the smaller part of the problem, you'll have entire sets of basic C libraries, STL, GUI class libraries etc to learn, depending on the platform and toolkit. Some of these are harder and/or bigger and/or weirder than others. Virtual function calls in constructors ... oh yes, this is one that is definitely wrong in Java, whatever you think of the C++ interpretation. If you're going to end up using both languages on a daily basis it may be best to ensure that you never call a virtual function in a constructor! On the other hand throwing exceptions from constructors is not a problem in Java but is well worth avoiding in C++. -- Tim Ward Brett Ward Limited - www.brettward.co.uk ============================================================================== TOPIC: Sockets http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/edecab678cd31cd6 ============================================================================== == 1 of 2 == Date: Tues, Dec 7 2004 9:03 am From: "Chris Uppal" FunkyKarma wrote: > > But what will be the *content* of the communication? > > C programmers tend to want to just send structs, which is not portable. > > The content doesn't matter. Sending a struct is not a problem. In itself this is true -- how the sender put the bytes on the wire is not of interest to the receiver and does not in any way affect the validity of the bytestream. However it is /misleading/ in that the sender might be under the impression that he or she was writing well-defined bytes in a well-defined order, rather than just a semi-random mishmash that "happens" to work -- which is actually the case. -- chris == 2 of 2 == Date: Tues, Dec 7 2004 10:13 am From: Michael Borgwardt FunkyKarma wrote: >> But what will be the *content* of the communication? >>C programmers tend to want to just send structs, which is not portable. > > > The content doesn't matter. Yes, it does. Otherwise, there is no communication. > Sending a struct is not a problem. Yes, it is. > On the > receiving end you just have to know what bytes were written onto the wire. And you DON'T KNOW that with a struct! Because it uses compiler- and platform dependant padding, endianness and data type sizes. ============================================================================== TOPIC: Delete a panel inside a panel http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a3a93919190a899d ============================================================================== == 1 of 3 == Date: Tues, Dec 7 2004 10:06 pm From: "HS1" Hello all I have some sub-panels inside a main panel. The main panel is VerticalFlowLayout. Inside each subpanel, I have button "Delete". What I want is that when I click the "Delete" in a panel, this sub-panel will be disposed and the main panel will be updated. I do not want to have a variable main panel for each sub-panel as it is not a good design Is there a good way to do this. Do I have to create event handlers???? Thank you for your help SH1 == 2 of 3 == Date: Tues, Dec 7 2004 10:49 am From: "Niels Dybdahl" > I have some sub-panels inside a main panel. The main panel is > VerticalFlowLayout. Inside each subpanel, I have button "Delete". What I > want is that when I click the "Delete" in a panel, this sub-panel will be > disposed and the main panel will be updated. > I do not want to have a variable main panel for each sub-panel as it is not > a good design Why is it not a good design ? I think it is reasonable for an object to have a reference to whatever it is going to work on. Niels Dybdahl == 3 of 3 == Date: Tues, Dec 7 2004 4:14 pm From: Babu Kalakrishnan HS1 wrote: > Hello all > > I have some sub-panels inside a main panel. The main panel is > VerticalFlowLayout. Inside each subpanel, I have button "Delete". What I > want is that when I click the "Delete" in a panel, this sub-panel will be > disposed and the main panel will be updated. > I do not want to have a variable main panel for each sub-panel as it is not > a good design > Is there a good way to do this. Do I have to create event handlers???? > If the subpanel is directly added to the main panel, calling getParent() on the subpanel should give you a reference to it. BK ============================================================================== TOPIC: How to restrict direct access to JSP files, only allow access via servlet? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/514c912d89045a82 ============================================================================== == 1 of 1 == Date: Tues, Dec 7 2004 10:19 am From: Michael Borgwardt Anan wrote: > How to restrict direct access to JSP files, but allow access only via > servlet? Use the servlet-mapping entries in web.xml to funnel all accesses to the servlet(s). ============================================================================== TOPIC: Is there any java method which do the following function? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f355c57a8ec1978b ============================================================================== == 1 of 3 == Date: Tues, Dec 7 2004 1:28 am From: [EMAIL PROTECTED] (mikeotp) regards: Is there any java method which do the following function? file1-------------------->file2 The method's handle file2 is different from file1 by some specific characters. any suggestion is welcome. Thank you. May god be with you. == 2 of 3 == Date: Tues, Dec 7 2004 10:31 am From: Michael Borgwardt mikeotp wrote: > regards: > > Is there any java method which do the following function? > > file1-------------------->file2 > The method's handle What is it supposed to *do*?? == 3 of 3 == Date: Tues, Dec 7 2004 4:24 pm From: Babu Kalakrishnan Michael Borgwardt wrote: > mikeotp wrote: > >> regards: >> >> Is there any java method which do the following function? >> >> file1-------------------->file2 >> The method's handle > > > What is it supposed to *do*?? > I think you overlooked the last line of the post. You're expected to figure it out yourself with some divine help :-) ============================================================================== TOPIC: Auto submit Struts form every 'n seconds http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5f1db635d5081dd3 ============================================================================== == 1 of 1 == Date: Tues, Dec 7 2004 9:37 am From: "davout" Answering my own question here... but I wonder whether the <meta> tag will achieve what I'm looking for, like... <meta http-equiv="Refresh" content="4"> "davout" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Does anybody know of way of having a Struts form auto submit itself every > 'n' seconds? > > I'm trying to build a form that reports back on the progress of an > asynchronously executing task. > > > ============================================================================== TOPIC: JavaBeans, Tomcat and deployment. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/efc112c5ac70daa8 ============================================================================== == 1 of 3 == Date: Tues, Dec 7 2004 1:39 am From: "xterm" You can use JavaBeans with Servlets yes. Basically a Java Bean (not an EJB) is a reusable component that follows a certain template for use in your servlets/jsp. A good example of a javabean would be a Shopping cart bean which can hold the orders of a User throughout the Session. Another example is using a javabean to store information about a user for authentication purposes. Tomcat is a servlet container, users/companies do not use it as a webserver, however it is possible to do so for development. You can use Apache HTTPD and Tomcat together if you wish to use a stable system. == 2 of 3 == Date: Tues, Dec 7 2004 1:35 am From: Mike Cox xterm wrote: Thank you for your response. > You can use JavaBeans with Servlets yes. Basically a Java Bean (not an > EJB) is a reusable component that follows a certain template for use in > your servlets/jsp. What is the difference between a Java Bean and an EJB? > A good example of a javabean would be a Shopping > cart bean which can hold the orders of a User throughout the Session. > Another example is using a javabean to store information about a user > for authentication purposes. Can Tomcat do JavaBeans? > > Tomcat is a servlet container, users/companies do not use it as a > webserver, however it is possible to do so for development. You can use > Apache HTTPD and Tomcat together if you wish to use a stable system. I see. Is this better than using PHP or ASP? == 3 of 3 == Date: Tues, Dec 7 2004 3:12 am From: "xterm" > What is the difference between a Java Bean and an EJB? Nothing alike. There are 2 types of Java Beans, both imply a reusable component, however 1 type can refer to a custom created Graphical Component that can be integrated with Graphical applications, the other type is a reusable component that can be integrated with web components, example: class User{ private String username; private String password; public String getUsername(){ return username; } public String getPassword(){ return password; } // and the setters here } in this case you can use your java bean withing your web components using jsp taglibs such as: <jsp:useBean id="usr" class="User" scope="session"> and you can invoke the jsp:setProperty and jsp:getProperty to fetch/set data throught the session scope. an EJB is a whole different concept, it's a component that can be deployed on Application servers, they can provide several features, they can be looked up using naming services and they make use of the Application Server's stability, security and the lot... read about J2EE if you wish to learn more. > Can Tomcat do JavaBeans? Tomcat is a servlet/jsp container, hence yes it does contain the architecture. > I see. Is this better than using PHP or ASP? I cannot answer this since it'll cause a flame war, but to parse PHP scripts you need the interpreter which can be integrated with apache's httpd or microsoft's IIS, and for ASP the only way to parse asp pages is using IIS. With tomcat you most probably can hook it up to any webserver that supports connectors to tomcat. Basically requests are handled by the webserver and dispatched to the servlet container depending on the request, whether it's a jsp, servlet or any dynamic content. This is usually the way to go, if you need security and faster loading (eg: hosting all static content on the webserver, and keep the dynamic content on the servlet container). Distributed Systems is a very interesting field, you should read about it. ============================================================================== TOPIC: how to get application path? Is that my method in getting path wrong? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c39434502d515e0d ============================================================================== == 1 of 1 == Date: Tues, Dec 7 2004 5:39 pm From: "James" eg. c:\myapp\test.class c:\myapp\icon\icon1.gif c:\myapp\setting.cfg when I compile and run test.class in coding, I write something.setImageIcon(getClass().getResource("/icon1.gif")); after process something, the program will save the file setting in setting.cfg something.savefile(new File(getClass().getResource("/setting.cfg").toString())); all of this run ok, the image got load up, then when save setting, it got write back into setting.cfg file. Later I group all of this in 1 jar file. then when I try the program, it cannot run anymore. something related to nullpointerexception. I try to get out the path and I found out that when running in normal class(without jar), that code can get correct path and the file. but when run in jar(with main class) that code can't get correct path. It got something at between the parent path and class path. at center it come out something like jar file(it act like 1 level path) so I want to ask you all, normally how do you all get the running path correctly so that can load the image and save file back to running class's path ============================================================================== TOPIC: Java double precision http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ffd916b2ccb1a75b ============================================================================== == 1 of 2 == Date: Tues, Dec 7 2004 1:54 am From: [EMAIL PROTECTED] I know the following behaviour is an old problem, but still I don't understand why such a simple piece of code: double val = 0; for(int i=0;i<10;i++) { val+=0.1; System.out.println(val); } has the following (terrible) output: 0.1 0.2 0.30000000000000004 0.4 0.5 0.6 0.7 0.7999999999999999 0.8999999999999999 0.9999999999999999 ??? Why, as a developer, I have to use a trick like this to solve the problem: java.text.DecimalFormat df = new java.text.DecimalFormat("###.########"); double val = 0; for(int i=0;i<10;i++) { val+=0.1; val = df.parse(df.format(val)).doubleValue(); System.out.println(val); } Thank you in advance Vincenzo Caselli [EMAIL PROTECTED] http://www.censnet.it == 2 of 2 == Date: Tues, Dec 7 2004 11:11 am From: Michael Borgwardt [EMAIL PROTECTED] wrote: > I know the following behaviour is an old problem, > but still I don't understand why such a simple piece of code: [] > has the following (terrible) output: [] > 0.7999999999999999 > 0.8999999999999999 > 0.9999999999999999 > > > ??? Because double and float are internally represented as *binary* fractions according to the IEEE standard 754 and can therefore not represent decimal fractions exactly. http://mindprod.com/jgloss/floatingpoint.html http://www.math.byu.edu/~schow/work/IEEEFloatingPoint.htm > Why, as a developer, I have to use a trick like this to solve the > problem: > > java.text.DecimalFormat df = new > java.text.DecimalFormat("###.########"); > double val = 0; > for(int i=0;i<10;i++) { > val+=0.1; > val = df.parse(df.format(val)).doubleValue(); > System.out.println(val); > } *groan* You're 95% there and yet took the TOTALLY wrong turn at the last intersection. You want to *format* numbers, so why are you using DecimalFormat.parse()??? What do you think the format() method is for? Furthermore, if you really need exact representation of decimal fractions (usually the case only for financial applications), use java.math.BigDecimal. ============================================================================== TOPIC: [ANN] Servertec Jenie 1.0.0 12/05/2004 http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/86afd10b0918f363 ============================================================================== == 1 of 3 == Date: Tues, Dec 7 2004 5:44 am From: "Manuel J. Goyenechea" Servertec is happy to announce the release of Servertec Jenie, a collection of Java Classes and supporting native libraries that allows developers to directly access native libraries without having to use Java Native Interface (JNI) and without having to write C/C++ code. For more information, please visit: http://www.servertec.com/products/jenie/jenie.html == 2 of 3 == Date: Tues, Dec 7 2004 3:19 am From: "xterm" Very nice, good job. == 3 of 3 == Date: Tues, Dec 7 2004 3:20 am From: "xterm" Very nice, good job. ============================================================================== TOPIC: Where to place configuration files when using WAR-Files http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/74dc1db3e419defd ============================================================================== == 1 of 1 == Date: Tues, Dec 7 2004 3:23 am From: "Stephan Koser" Hi, we'd like to provide our web application as a WAR-File. Up to now we have our configuration files inside the WEB-INF directory. But we don't want to force our clients to unpack, edit and pack the war file if they want to configure the application. Instead we want to provide a configuration dialog at the first call of our application. But the question is: Where to place the configuration? We don't want to put it in the WAR file. So, are there any standards in J2EE where to place configuration files, that may change during runtime? Any hints? thank you. -- bye Stephan... ============================================================================== 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