comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * java.net.SocketException: Insufficient buffer space - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7c9c56b240ed60b1 * Calendar.roll on december,31 !!!! - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ea6aea82ed17ba7a * Filtering files containing keywords - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4c5b8ec2cea85367 * Monitoring Threads - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9045cfd146a9387a * getting the disk absolute path of a web-app - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cbdd00f8c8b7f37a * ant-regexp - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/551310c43eaa6022 * "Could not find main-class" - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/631c41f6c0ad1a67 * SimpleDateFormat Problem - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ac9cfa8ffc3ffe2a * local disk based JDBC implementation - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3bcd34f5eb202fef * Classes SSH-SCP for Java - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b78404f5308632ce * Internationalization issues - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ad93acbcd40dab53 * applet's call comportement - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc1d4563dc67060c * Performance of null tests? - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e1febd5672a2f269 * viva questions - any ideas? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5ea074c24d5897ac * Newbie question about EJB-CMP: is it worth it when using multiple containers? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7783b0dd00f912fb ========================================================================== TOPIC: java.net.SocketException: Insufficient buffer space http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7c9c56b240ed60b1 ========================================================================== == 1 of 3 == Date: Thurs, Nov 4 2004 2:09 am From: [EMAIL PROTECTED] You didn't say which operating system you were using, but assuming windows. This is the WSAENOBUFS error code from the windows socket subsystem. See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/windows_sockets_error_codes_2.asp Regards, /Staffan Jeff wrote: > I did post the same content last night, but did not include the error in the > subject line. > > Does anyone have more detail on what this exception means? The JVM is > JRockit. > > Our server experiences this error when it's client sends heavy load (7 or 8 > Megabits/sec). In netstat, we see the tcp receive buffer growing large, > implying our server is falling behind. That should result in tcp closing > the advertised window to the client. It shouldn't throw an error so we're > not sure which buffer space is insufficient: tcp's or our > buffereInputStream. > > Socket probeSocket = sock.accept(); > probeSocket.setReceiveBufferSize(32768); > > BufferedInputStream is = new BufferedInputStream( > probeSocket.getInputStream(), 024000 ); > > Anybody have some experience with this error? > > Thanks > -- > Jeff == 2 of 3 == Date: Thurs, Nov 4 2004 4:13 am From: "Jeff" <[EMAIL PROTECTED]> "Esmond Pitt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > John C. Bollinger wrote: >> >> As I wrote elsewhere, a SocketException almost surely reflects an error >> condition reported by the native network stack. > > I agree with John's diagnosis. You haven't actually told us, but I suspect > the exception is being thrown by ServerSocket.accept() when the underlying > network stack is trying to allocate the accepted socket's send/receive > buffers. Make them smaller, and as John said your BufferedInputStream > buffer is much too high too. There isn't much point in making it any > larger than the socket receive buffer: all you're doing is fooling the > sending TCP/IP stack into sending faster, or should I say earlier, than > really necessary. > > EJP > The exception was thrown by the BufferedInputStream read. The ServerSocket.accept() completed and we are reading from the input stream when the problem occurs. We made the BufferedInputStream one meg to reduce the number of reads and off-load message reassembly. Our proprietary messages can be up to one meg. Rather than do multiple reads, then reassemble the packet, we let BufferedInputStream assemble the packet. Faster and less to debug. Once the tcp receive buffer fills, it should not accept more packets. That should be communicated to the sender by reducing the size of the receive window in the tcp header. This is an ancient, reliable mechanism. I think the problem lies in how the JVM accesses the tcp receive buffer. I hoped to find more information on the interaction of the JVM with the tcp stack. To the most recent post, we are running on SuSE linux. We use JRockit. I appreciate the continued contribution by newsgroup members. These are good questions that help us. == 3 of 3 == Date: Thurs, Nov 4 2004 5:21 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> Jeff wrote: > To the most recent post, we are running on SuSE linux. We use JRockit. Well, have you contacted BEA's support regarding the problem? Can you replace the VM? If yes, have you tried with Sun's VM or blackdown's VM? /Thomas ========================================================================== TOPIC: Calendar.roll on december,31 !!!! http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ea6aea82ed17ba7a ========================================================================== == 1 of 2 == Date: Thurs, Nov 4 2004 2:12 am From: Michael Borgwardt <[EMAIL PROTECTED]> Gianni wrote: > My application has this terrible bug and now is time to fix! > It works 364 days in the year but not on dec,31 > > I have to add one day to the "today". > > In fact on 2004-dec-31 I have 2004-jan-1 > > I use : > Calendar calendar = Calendar.getInstance(Locale.GERMANY); > calendar.roll(6, 1); > > but obviously does not work on dec,31... Sure it does. It gives the expected result according to the specification in the API doc. Why do you expect something else, or rather: what do you expect? == 2 of 2 == Date: Thurs, Nov 4 2004 4:17 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> Gianni wrote: > I have to add one day to the "today". > > In fact on 2004-dec-31 I have 2004-jan-1 > > I use : > Calendar calendar = Calendar.getInstance(Locale.GERMANY); > calendar.roll(6, 1); > > but obviously does not work on dec,31... It works according to the specification. What about spending a minute or two and reading the API documentation? > any idea how to fix it??? By using the method which is supposed to do what you want to do. BTW: I think it is rather uncool to use the number literal 6 instead of the predefined constant to address the field. /Thomas ========================================================================== TOPIC: Filtering files containing keywords http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4c5b8ec2cea85367 ========================================================================== == 1 of 2 == Date: Thurs, Nov 4 2004 2:18 am From: Andrew Thompson <[EMAIL PROTECTED]> On 4 Nov 2004 02:05:45 -0800, otimus wrote: > HOW CAN I ... We are hard of understanding, not hearing. Please refrain from SHOUTING. >...FILTER THE FILES WHICH CONTAIN A KEYWORD ... In the file *name* or the file *contents*? Search within Zip and Jar archives? Look inside sub-directories? * >..AND PUT INTO A DIFFERENT DIRECTORY. <http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#renameTo(java.io.File)> * Retaining the original directory structure? If not, what to do with duplicate (same) file names? Read the JavaDocs for java.io.File. All of them. With a little looping and some conditional logic they do 90% of what you want, as far as I can understand what you want, which is still not that much. Generally people do not spoon-feed answers on this group, but there is a group perhaps better suited to starters, described here.. <http://www.physci.org/codes/sscce.jsp> HTH -- 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 == 2 of 2 == Date: Thurs, Nov 4 2004 2:20 am From: Andrew Thompson <[EMAIL PROTECTED]> On Thu, 04 Nov 2004 10:18:40 GMT, Andrew Thompson wrote: > On 4 Nov 2004 02:05:45 -0800, otimus wrote: > >> HOW CAN I ... > > We are hard of understanding, not hearing. > Please refrain from SHOUTING. > >>...FILTER THE FILES WHICH CONTAIN A KEYWORD ... > > In the file *name* or the file *contents*? > > Search within Zip and Jar archives? > > Look inside sub-directories? * > >>..AND PUT INTO A DIFFERENT DIRECTORY. > > <http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#renameTo(java.io.File)> > > * Retaining the original directory structure? > If not, what to do with duplicate (same) file names? > > Read the JavaDocs for java.io.File. All of them. > > With a little looping and some conditional logic they > do 90% of what you want, as far as I can understand what > you want, which is still not that much. > > Generally people do not spoon-feed answers on this group, but > there is a group perhaps better suited to starters, described here.. > <http://www.physci.org/codes/sscce.jsp> Oops! That URL should be.. <http://www.physci.org/codes/javafaq.jsp#cljh> -- 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: Monitoring Threads http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9045cfd146a9387a ========================================================================== == 1 of 1 == Date: Thurs, Nov 4 2004 2:22 am From: snae <[EMAIL PROTECTED]> On Thu, 04 Nov 2004 10:32:29 +0100, Stefan Schulz wrote: > On Thu, 04 Nov 2004 09:16:09 +0000, snae <[EMAIL PROTECTED]> wrote: > >> Hi, >> >> I have an app that spawns a new Thread for several identical tasks that >> it >> needs to carry out. These tasks should never stop running and if they do >> I want to take action. >> >> I have looked at two methods of doing this. Using ThreadGroup and >> assigning each of the Threads to a ThreadGroup, then looping over the >> contents of the ThreadGroup to check if each Thread is running. The >> other >> method is simply to dump each Thread object into an ArrayList and loop >> over the contents of this. Either way I would have thought would do the >> trick - but which way is 'better'? >> >> The other question I have is - if a Thread stops execution, and is stored >> in one of the ways above, does the object persist?. I need to be able to >> restart a dead Thread, or at least get some information from that Thread >> in order to start a new Thread with the correct information. >> >> Thanks for any help. > > See the getState method (new in 1.5) for retrieving the status of a Thread > > The Runnable of the Thread does indeed persist... so just store your state > here, and if you ever need to, make a new Thread with the same Runnable. OK, thanks a lot - this is what I want to do. I have implemented state for the Runnable object so storing them and monitoring this way seems to be what I want. The Runnable object also has several timeout conditions which cause the continual looping of the thread should certain things fail - this ensures that the thread cannot get hung up, there are also other conditions that can cause the thread to stop, and require restarting. It is not enough for me to know simply that a thread stopped, which it seems ThreadGroup can inform me of, but I need to know which thread stopped and retrieve some information from the Runnable associated with it to start a new thread. ========================================================================== TOPIC: getting the disk absolute path of a web-app http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cbdd00f8c8b7f37a ========================================================================== == 1 of 2 == Date: Thurs, Nov 4 2004 2:35 am From: [EMAIL PROTECTED] (yair) hey all in a servlet running in tomcat, how can i get the full path of my web application on the disk (something like "c:\progran files\tomcat\webapps\myApp")? i don't want to write it in the web.xml or to pass it as a system property. thanks yair == 2 of 2 == Date: Thurs, Nov 4 2004 3:18 am From: Andrew Thompson <[EMAIL PROTECTED]> On 4 Nov 2004 02:35:57 -0800, yair wrote: > how can i get the full path of my web > application on the disk (something like "c:\progran > files\tomcat\webapps\myApp")? javax.servlet.ServletContext.getRealPath(java.lang.String) HTH -- 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: ant-regexp http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/551310c43eaa6022 ========================================================================== == 1 of 2 == Date: Thurs, Nov 4 2004 2:53 am From: [EMAIL PROTECTED] (david) I would like to use the following regexp: <replaceregexp flags="g" match="\n\[\s&&[^\n]]+" replace="\\\\n"> <fileset dir="/home/public/dbs/regexp" includes="applicationLogMessages.properties"/> </replaceregexp> unfortunately, eclipse marks this as an error as soon as i type a "&". my goal is to replace all NEWLINEs where the new line starts with a WHITESPACE with a \n, but keep it on the same line. if the next line is empty(simply a NEWLINE) i want to do nothing! how can i achieve this (without using &)? thankful for all hints. david == 2 of 2 == Date: Thurs, Nov 4 2004 3:01 am From: Michael Borgwardt <[EMAIL PROTECTED]> david wrote: > I would like to use the following regexp: > <replaceregexp flags="g" match="\n\[\s&&[^\n]]+" replace="\\\\n"> > <fileset dir="/home/public/dbs/regexp" > includes="applicationLogMessages.properties"/> > </replaceregexp> > > unfortunately, eclipse marks this as an error as soon as i type a "&". Ant scripts are XML, and & must be escaped with an entity & in XML. ========================================================================== TOPIC: "Could not find main-class" http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/631c41f6c0ad1a67 ========================================================================== == 1 of 2 == Date: Thurs, Nov 4 2004 2:55 am From: Tarlika Elisabeth Schmitz <[EMAIL PROTECTED]> Andrew Thompson wrote: > Thanks for getting back to us. I *always* post the results [or my own answers if need be ;-)]. I find that's the only justification for utilizing other people's help. Plus there is nothing more annoying than finding someone with the same problem in the archive but no solution. -- Best Regards, Tarlika == 2 of 2 == Date: Thurs, Nov 4 2004 3:33 am From: Andrew Thompson <[EMAIL PROTECTED]> On Thu, 04 Nov 2004 10:55:44 +0000, Tarlika Elisabeth Schmitz wrote: > Andrew Thompson wrote: > >> Thanks for getting back to us. > > I *always* post the results [or my own answers if need be ;-)]. >From what I've read of your posts, I am not surprised that you did. > I find that's the only justification for utilizing other people's help. Excellent point. > Plus there is nothing more annoying than finding someone with the same > problem in the archive but no solution. How about... "Thanks anyway - solved it." ;-) -- 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: SimpleDateFormat Problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ac9cfa8ffc3ffe2a ========================================================================== == 1 of 2 == Date: Thurs, Nov 4 2004 3:29 am From: [EMAIL PROTECTED] (Karl Vernet) Hi all, I use SimpleDateFormat in many classes, but I can't make it work with a very simple format : -------------------------------------- import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.Date; public class ParseDate { public static void main(String[] args) { System.out.println( System.getProperty("java.version") ); SimpleDateFormat dateFormat = new SimpleDateFormat( "dd MMM yyyy" ); ParsePosition pos = new ParsePosition( 0 ); Date theDate = dateFormat.parse( "01 Jan 2003", pos ); System.out.println( theDate.toString() ); } } -------------------------------------- it gives a java version of 1.4.2_05 and theDate is null !!!!!!! Any help would be very appreciated. Thanke in advance == 2 of 2 == Date: Thurs, Nov 4 2004 4:02 am From: Michael Borgwardt <[EMAIL PROTECTED]> Karl Vernet wrote: > I use SimpleDateFormat in many classes, but I can't make it work with > a very simple format : [] > SimpleDateFormat dateFormat = new SimpleDateFormat( "dd MMM yyyy" ); [] > it gives a java version of 1.4.2_05 and theDate is null !!!!!!! It works fine for me in 1.5.0, but I can't imagine a bug in such a basic functionality in 1.4 either. Is it perhaps a locale problem? The MMM part of the format is language dependant and you're using the default locale, which might be different from mine and the one you're expecting. ========================================================================== TOPIC: local disk based JDBC implementation http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3bcd34f5eb202fef ========================================================================== == 1 of 3 == Date: Thurs, Nov 4 2004 3:55 am From: Alex Hunsley <[EMAIL PROTECTED]> Thomas Kellerer wrote: > Juha Laiho wrote on 03.11.2004 17:12: > >>> >>> http://hsqldb.sourceforge.net/ - in memory or on disk database. >>> >> >> Derby; a project recently donated to Apache by IBM. Like hsqldb; don't >> know what are the actual differences. > > > Derby is the version of Cloudscape that was donated to Apache from IBM. > > For embedding into an application I would prefer HSQLDB. It's much > smaller (2MB download vs 80MB) and seems to offer (at least for the > mentioned type of application) a very similar performance. > > Thomas The version of derby I've just downloaded - jars only, no docs - was just above 2 megs in size. Which download are you talking about that was 80megs? I got it here: http://incubator.apache.org/derby/derby_downloads.html alex == 2 of 3 == Date: Thurs, Nov 4 2004 4:57 am From: Frank <[EMAIL PROTECTED]> Juha Laiho wrote: > Derby; a project recently donated to Apache by IBM. Like hsqldb; don't > know what are the actual differences. I'm on very thin ice here, but assume someone will correct me if I'm way off. Anyway, my impression is that Cloudscape works like a "real" disk-based db engine, while HSQLDB is caching the whole dataset in memory. Consequently, Cloudscape is a whole lot slower for small datasets, but probably scales better when all the data won't fit in memory. Issue is, for that kind of work you may not want an embedded db engine anyway.. It may do fine with a very small user base, though, and once you need more juice, migrating to db2 should be a piece of cake. Should I ever need to handle gigs of data in some single-user app, I'll give Derby another look, until then I'm doing fine with HSQLDB and PostgreSQL. == 3 of 3 == Date: Thurs, Nov 4 2004 5:01 am From: Thomas Kellerer <[EMAIL PROTECTED]> On 04.11.2004 13:57 Frank wrote: > Anyway, my impression is that Cloudscape works like a "real" disk-based > db engine, while HSQLDB is caching the whole dataset in memory. > HSQLDB has so called "cached" tables that are not (or not completely) stored in memory which would qualify as "real" disk-based as well. Thomas ========================================================================== TOPIC: Classes SSH-SCP for Java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b78404f5308632ce ========================================================================== == 1 of 1 == Date: Thurs, Nov 4 2004 3:59 am From: Alex Hunsley <[EMAIL PROTECTED]> Xavier wrote: > Hi, > > >>Learn how to use this really useful site called "Google". > > > Oh, yes ! How if I had not thought of it ! > > >>www.google.com > > > Wouldn't this be ... "google" ? Yes, it is google, that's what I said wasn't it? > > ..... > > If I post the question, it's that I have already searched on the web !! > > Xavier Then you really do need to learn how to use a search engine. Google returned lots of googd hits when I searched for a java ssh implementation. alex ========================================================================== TOPIC: Internationalization issues http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ad93acbcd40dab53 ========================================================================== == 1 of 1 == Date: Thurs, Nov 4 2004 4:14 am From: Abs <[EMAIL PROTECTED]> Hi! I'm using some ListResourceBundles to be able to internationalize my Swing app (menus, error messages, etc...). The user has the option to change the language used by the app in realtime using a menu option. My problem is that once the user selects the new language I need to reload all the menus, messages, etc.. already painted in my app. How can I reload them ? Thanks in advance ========================================================================== TOPIC: applet's call comportement http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc1d4563dc67060c ========================================================================== == 1 of 1 == Date: Thurs, Nov 4 2004 4:15 am From: "Emmanuel Freund" <[EMAIL PROTECTED]> > >>> Well, the AWT toolkit's environnement don't match the things i want to > >>> render. > >> > >> What 'things' are you referring to? Fonts (faces and sizes) > >> spacig or padding, borders etc. can all be controlled for > >> Swing components by setting a suitable Look and Feel. > > > > let's say: frames have to be in 1280*1024, there must be no resize button, > > the close button is a big button in the right-down corner, some things like > > that... it's easy to make a child of jframe with those function, but i don't > > see how to use Look and Feel to render those things... is it possible? > > Not without a custom VM. > > The issue here is you wanting to change *existing* frames. > That would allow you to change the look of frames produced by > (for example) my software. > > But what makes you think I want *my* software 1280*1024, with > the 'big button' on the right (and possibly your company's > moniker all over them) for *my* project.. > I see what u mean, and i now understand why it would violate sun licence. In fact, that wasn't for painting my company's logo, but to simplify the uses of the browser by forbiddin the openning of multiples windows... which i can do for normal internet frame but not for applet without forbidding the applet itself. Well, i would find an other way, or an other company ;) -- Emmanuel Freund [EMAIL PROTECTED] ========================================================================== TOPIC: Performance of null tests? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e1febd5672a2f269 ========================================================================== == 1 of 3 == Date: Thurs, Nov 4 2004 5:06 am From: [EMAIL PROTECTED] (Adam) I've just been having a discussion with a colleague and would be interested to hear people's opinions on which of the below code snippets would have the highest performance overhead. Assume that <do good stuff> would throw a NullPointerException if badger was null. (A) if(badger == null) { <do bad stuff> } else { <do good stuff> } (B) try { <do good stuff> } catch (NullPointerException npe) { <do bad stuff> } All help appreciated! Adam == 2 of 3 == Date: Thurs, Nov 4 2004 5:17 am From: Andrew Thompson <[EMAIL PROTECTED]> On 4 Nov 2004 05:06:34 -0800, Adam wrote: > I've just been having a discussion with a colleague .. A fellow student? (snip) > All help appreciated! What have the test cases of you and your colleague revealed thus far? -- 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 == 3 of 3 == Date: Thurs, Nov 4 2004 5:30 am From: "VisionSet" <[EMAIL PROTECTED]> "Adam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I've just been having a discussion with a colleague and would be > interested to hear people's opinions on which of the below code > snippets would have the highest performance overhead. > > Assume that <do good stuff> would throw a NullPointerException if > badger was null. > > (A) > > if(badger == null) { > <do bad stuff> > } else { > <do good stuff> > } > > (B) > > try { > <do good stuff> > } catch (NullPointerException npe) { > <do bad stuff> > } > > If badger is truly exceptionally null then (B) will be best because there is no conditional to test and there will rarely be any overhead of throwing the exception. On the other hand if badger is often null then (A) would be better since testing for null is very low overhead. Whilst throwing an exception is high overhead. -- Mike W ========================================================================== TOPIC: viva questions - any ideas? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5ea074c24d5897ac ========================================================================== == 1 of 1 == Date: Thurs, Nov 4 2004 5:48 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> Madhur Ahuja wrote: > My instructor gave me some sample viva questions. > Some of the questions, were quite odd. They are indeed. However, some of your answers are also odd :-) I will add a "disagree" to the answers where I think that you should put some more work in, and do some more research. > Q. What is the data structure used in the garbage collection > scheme of java[ or perhaps sun's jvm]. > A. I have found that, implementation of garbage collection is > implementation dependent. java specification only specifies > what is garbage collection and not what algorithm to apply. > > As regard of sun's jvm, i have found that it uses > *reference counting collectors* algorithm to find out unused > objects. disagree > Q. How is the memory map of a static variable, different from that > of non static variable. > A. This one is quite odd. I think it depends on the OS,platform > etc. In short one can say that only one copy of static variable is > maintained for a class having multiple instances. The question can indeed be interpreted in different ways, and the term "memory map" is odd. I would have constructed my answere around what is supported in the java "assembler language". > Q. What is the meaning of 2 in J2SDK and 1,4 in Java 1.4 > A. This confuses me lot. Perhaps anyone can help in this case. Also > the latest 1.5 has been termed as 5.0. This question is indeed odd. Many will answer that it is just a marketing stunt from Sun, but your instructor might be after something completely different (maybe Sun's marketing blurb about the '2'?). BTW: Do you pay much for this course? Can you change to a better instructor? I mean, even many of the non-odd questions are IMHO not to significant. There are much more important things to know about Java than that stuff. > Q. What do u know about drafts,specifications of J2SE? > A. Drafts? no idea about this. Perhaps these are same as versions. Also odd. Maybe he is after JLS and JSP stuff? > Q. What are the components of JFC? > A. Swing, AWT. Disagree. The definition of JFC was never to precise, but you IMHO missed one important part. > Q. What are the disadvantages of Swing over AWT? > A. Might be little slow. Oh well ... A lot of this is just opinions, and the actual advantages and disadvantages depend much on the context in which you use it. Indeed an odd question. Your instructor has most likely a particular opinion - maybe you find it in your course notes. But if this is what they teach you, then the course is not of the best quality. > Q. What are the major changes in java from versions 1.1,1.2,1.3,1.4 > A. Although the answer of this question is best found on the Sun's site. > My instructor told that he was interested in the version groups of java. > For ex, 1.1-1.2 is regarded as similar java version while 1.3-1.4 is > regarded as another equal java version. Has anyone ideas on this? Also an odd question, because the answer depends much on how one defines "similar", and if this is only about the Java the language, or the APIs, the class file format, the VM or whatever. > Q. There is a famous trick in java programming to prevent the > decompilation of your .class files(may be not successful). > what is that trick? > A. I have found about "encrypting the class files and decrypting them > while loading through a custom classloader inside the JVM". This > fails due to a API, which directly takes the unencrypted class files > as an argument.(taken from the www.javaworld.com) Disagree. This is definitely not what your instructor is after. But the question is also strange. The "trick" is not "famous", but just common. /Thomas ========================================================================== TOPIC: Newbie question about EJB-CMP: is it worth it when using multiple containers? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7783b0dd00f912fb ========================================================================== == 1 of 1 == Date: Thurs, Nov 4 2004 6:04 am From: Andrea Desole <[EMAIL PROTECTED]> I'm playing around with container managed persistence, and I noticed that there is no standard that defines the mapping between beans and databases. In fact, this is what the EJB specification says: "The Deployer, using the Container Provider s tools, determines how the persistent fields and relationships defined by the abstract persistence schema are mapped to a database or other persistent store, and generates the necessary additional classes and interfaces that enable the container to manage the persistent fields and relationships of the entity bean instances at runtime." If it's true then I will have problems if I have an application that supports multiple EJB containers, which is my case. So, my question is: isn't it better to write just some normal SQL once and use bean managed persistence, instead of writing and maintaining n different files (one for each container) for the same mapping? How complex should my SQL be to make CMP really valuable in this case? Thanks Andrea ======================================================================= 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
