comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * what is a portal page? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d9455a9b130cbcd5 * 40714 Mining the Web: Jacobian Matrix Constructs with eigenVector Searching 40714 - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6b51c900e893a07d * implementing comparable - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9f2d220f347ddff4 * Deserializing in JDK1.5 without unchecked cast warning - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f79675ff00f1ea8d * program arguments - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/44d9b350ac879ea0 * Problem with double buffering.. - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9aeb201d21113d93 * default constructor in Java versus C++ - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b0018dff5a806578 * Unable to have tags within tags?? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d0b216afc2658f5c * static vs. non-static method - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/67ffb5659c18541b * use com port as parallel port - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/43f0abc240232d51 * Calendar.getInstance() wrong?? - 6 messages, 6 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f3454bcad8dd780c * ide sugestions for j2me dev - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/95ffdcc28f2b1a33 * how to use format? - 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3fc0459d7c798baf * 'A'++ == 'B': Always True? - 6 messages, 6 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bb79b41e32f311b2 * Character Encoding of a DOM object - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/989f73fe61ccf13b * Java Thread Analysis - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c30c46b2c50ca5f * Attributes always empty when parsing XML documents - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f93920023b216158 * What is package cache in a jar file - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dec0c6e21c7d3f0b * HTML convert to XHTML - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5f47c654f1264a65 * Where do I get the javacc java api document? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6c8f306325d131f4 * IE not detecting Java plug in. - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ca11ea82f98b83f * Java 1.5 Enums - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8cd26ba0bb283203 * How to write an efficient maximum function? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f759ff7cc130859e ========================================================================== TOPIC: what is a portal page? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d9455a9b130cbcd5 ========================================================================== == 1 of 2 == Date: Tues, Nov 16 2004 3:20 pm From: "Ryan" <[EMAIL PROTECTED]> What does that mean? Also what is a portlet? I saw something called 'SOA' also. thanks. == 2 of 2 == Date: Tues, Nov 16 2004 3:25 pm From: Andrew Thompson <[EMAIL PROTECTED]> On Tue, 16 Nov 2004 18:20:06 -0500, Ryan wrote: > What does that mean? What does Google say? <http://www.google.com/search?q=define+%22portal+page%22> >..Also what is a portlet? ditto? <http://www.google.com/search?q=define+portlet> > I saw something called 'SOA' also. I saw a donkey called 'Henry'. > thanks. You're welcome. -- 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: 40714 Mining the Web: Jacobian Matrix Constructs with eigenVector Searching 40714 http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6b51c900e893a07d ========================================================================== == 1 of 1 == Date: Tues, Nov 16 2004 2:01 pm From: "Web Science" <[EMAIL PROTECTED]> Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics, manifolds, science, physics, chemistry, law, legal, government, home, office, business, domain lookup, medical, travel, food, university students, searching, searchers, surfing, advanced search, search tools Chemistry, mathematics, physical sciences, engineering, aerospace, astronomy, photography, news, computers, software, investment, venture capital, stakeholder, Biology, Chemistry, Geosciences, Biotechnology, Medical, Nursing, Anthropology, psychology, psychiatry, Philosophy, History, Business, bachelor, Ph.D., Masters, administrative, MBA, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics, manifolds, physics, chemistry, law, legal, health, government, home, office, business, domain, lookup, medical, travel, food, university, students, search, searches, search engine, directory, directories, category, categories, help, searching, searchers, surfing, advanced search, search help, search tips Beta Users and advanced features Sign-up here... http://www.eigensearch.com/inc/constructs/betasignup.htm Central to eigenSearch Advanced is the freedom to construct complex search explorations, save the forms for later use; and apply weight factor to each phrase and term. EigenSearch processing will apply eigenvector math and Jacobian matrices to construct search terms that are tailored to your exploration. Cross-pollination is also applied as described below. The eigenvector approach is clearly highly advanced and would normally be useful for very sophisticated applications. Nevertheless, anyone may utilize the method. An advanced form is simply a matrix in which the user types words and phrases randomly in a multi-cell form (please click thumbnail to view). Advanced features EigenOperator (cross pollination) and eigenvector constructs Cross document content pollination within every web site directory tree (unlike conventional search engines and tools eigenSearch checks for your terms and phrases and drills down though multiple directory documents) EigenSearch cross-pollination is applied to documents within the same (tree) level in a URL (peer documents). Thereby limiting the amount of contamination of results Illustration: "Blood Hounds" + "English Breed" will present documents that contain either of these phrases within the same peer level in a document storage structure; for example, within the directory: www.smartdogs/hounds. eigenSearch limits pollinating occurrences outside a peer level. For example; "blood hounds" + "English breed" found in two different directories would not report an eigenSearch result: i.e. "Blood hounds" found in www.smartdogs/hounds and "English Breed" found in. www.smartdogs/hounds/Europe would not be found. EigenSearch therefore searches one tree (peer) level in a site and looks for multiple occurrences of multiple phrases across all documents within this peer level. Corporate products can be tailored to drill down infinite levels for eigenOperator (cross-pollinating operator) matching. eigenSearch single phrase results will find all documents and show the results as independent findings. This way the user can find results across many documents and the combined highly constrained results are reserved for a single level cross pollination. Extremely high (cross-pollinating) eigenValues will correspond to finely granular and refined search explorations. Beta users receive the following features: Login and password Save search constructs for later use in your own personal construct tables EigenOperator (cross Pollinating Operator) advanced features as described above (eigenvector to follow) Database (Table) upload and eigenvector computations EigenSearch seeks 300,000 beta testers for its advanced eigenOperator based cognitive engine. This engine will allow for a multiplicity of search parameters for users to select so as to mathematically narrow results. The system will employ eigenVectors, eigenValues and eigenMatrices to determine relevance to user searches; thereby rendering high fidelity confirmed search results. Naturally the computational power for doing such math is why beta testers are required. Each tester is welcome to comment on user friendliness, speed, change and ergonomic elegance. It is an eigenSearch goal to continue advancing the user interface so as to remain intuitively simple to use while at the same time providing hi-fidelity explorations. All beta testers will receive a login and password, which provides entry into features for saving search constructs and parameters according to their own classification approach. Saved results and parameters can be used at any time and modified to alter search results. Beta users will be able to import their own data sets (2-dimentional) and perform an eigenValue analysis. <r<p_ ========================================================================== TOPIC: implementing comparable http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9f2d220f347ddff4 ========================================================================== == 1 of 2 == Date: Tues, Nov 16 2004 3:26 pm From: steve <[EMAIL PROTECTED]> I have a set of data stored in a vector, which is used to display a table on screen. the user is allowed to select the table col, and sort the data (ass/dec) as follows: colindex= col number ascending= true/false Vector data = model.getDataVector(); Collections.sort(data, new utils.columnSorter(colIndex,ascending)); The actual vector contains an object for each row in the table. so the basic object may contain a collection of strings/dates/ int as the interface is standard: public int compare(Object a, Object b) so i need to be passed 2 objects into "compare" this then needs splitting down either into : 1. an object array 2. a vector so basically i need to take a single object & split it down into a multiple array, but it needs to be type safe, so it cannot just be converted to an array of strings. I would prefer a vector so that i can use public int compare(Object a, Object b) { Vector myvector1=a; Vector myvector2=b; Object myobject1 =myvector1.get(colIndex); Object myobject2 =myvector2.get(colIndex); do instanceof testing/ for string /int/date etc. can anyone give me a hand on how to split a single object into a multi object, or into a vector. == 2 of 2 == Date: Tues, Nov 16 2004 6:33 pm From: Chris Smith <[EMAIL PROTECTED]> Steve, I'm afraid your question is somewhat unclear. I'm not quite sure where you're starting from. Can you please describe in detail exactly what's in the vector you mention, and how you intend to identify the selected "column" of data within the elements? -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: Deserializing in JDK1.5 without unchecked cast warning http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f79675ff00f1ea8d ========================================================================== == 1 of 1 == Date: Tues, Nov 16 2004 3:55 pm From: [EMAIL PROTECTED] (Andrew Lee) Hi, I am using JDK1.5 and am wondering if it is possible to deserialize an Object and not get an unchecked cast warning from the compiler when I cast it to another type. In my code I deserialize an Object and cast it to Hashtable<Integer, String> and I get an unchecked cast warning. If I cast it to just a Hashtable object I don't get the warning until I actually try and use it (e.g. with the "put" method). I understand that I am casting an Object to a type that could cause a runtime error (hence the warning), but how can I deserialize a Hashtable directly? I would like to create warning-free code for JDK1.5 and am hoping this is not stopping me from doing it. Thanks in advance. ========================================================================== TOPIC: program arguments http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/44d9b350ac879ea0 ========================================================================== == 1 of 1 == Date: Tues, Nov 16 2004 4:21 pm From: Jeff Kish <[EMAIL PROTECTED]> On Tue, 16 Nov 2004 18:26:38 +0100, Thomas Weidenfeller <[EMAIL PROTECTED]> wrote: >Jeff Kish wrote: >> mmm I have a feeling you are a unix sort of user, so you have a more mature >> OS/environment that I >> do. > >I use Solaris. I bet my newsgroup headers give it away. > >> Now I need to figure out a way to expand programmatically the >> file-spec-wildcard passed in as a >> parameter. > >Google for "file globbing" or "wildcard" source code (almost any >programming language should do, the code should be easily portable to Java). > >/Thomas I can't believe it. I think I've actually found it... It seems this may be a part of Java, and you do turn it off with quotes. Here is what I found from a report at: http://www.mail-archive.com/[email protected]/msg00009.html RE: GlobFilenameFilter problem -------------------------------------------------------------------------------- From: Dan Lipofsky Subject: RE: GlobFilenameFilter problem Date: Wed, 21 Feb 2001 14:19:08 -0800 -------------------------------------------------------------------------------- Please ignore this bug report. It turns out that java was expanding *.html to package.html (because it exists in the current working directory). Since package.html did not exists in x nothing got printed. I used the quotes to turn off shell globbing. I never knew that Java did globbing too. This is so obnoxious. Does anyone know if there is a way to turn off java globbing (JDK 1.3, Win 2000). Also, if Sun went through the effort of implementing globbing for processing the command line, why didn't they go ahead and make it part of the API???? - Dan > -----Original Message----- > From: Dan Lipofsky [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 21, 2001 12:54 PM > To: '[EMAIL PROTECTED]' > Subject: GlobFilenameFilter problem > > > I am encountering a problem with GlobFilenameFilter. > It correctly catches files for the pattern 'i*.html' > but not the more general '*.html'. I am using version 2.0. > Here is proof: > > public static void main(String args[]) { > File srcDir = new File(args[0]); > FilenameFilter filter = > (args.length>1) > ? (new org.apache.oro.io.GlobFilenameFilter(args[1])) > : null; > File[] files = srcDir.listFiles(filter); > for (int i=0; i<files.length; i++) { > System.out.println((files[i].isDirectory() ? "DIR " : "file")+" > "+files[i]); > } > } > > $ java Test x > file x\allclasses-frame.html > DIR x\com > file x\deprecated-list.html > file x\help-doc.html > file x\index-all.html > file x\index.html > file x\overview-tree.html > file x\package-list > file x\packages.html > file x\serialized-form.html > file x\stylesheet.css > $ java Test x 'i*.html' > file x\index-all.html > file x\index.html > $ java Test x '*.html' > $ ========================================================================== TOPIC: Problem with double buffering.. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9aeb201d21113d93 ========================================================================== == 1 of 2 == Date: Tues, Nov 16 2004 4:38 pm From: David Zimmerman <[EMAIL PROTECTED]> Andrew Thompson wrote: > On 15 Nov 2004 10:38:09 -0800, Angelo wrote: > > >>>With 99% certainty I can say the problem is in your code. >> >>Yes, is in my code :) > > * ..and 68.7% of statistics are made up on the moment. > And 95.674% of all statistics are overly precise == 2 of 2 == Date: Wed, Nov 17 2004 12:12 am From: Andrew Thompson <[EMAIL PROTECTED]> On Wed, 17 Nov 2004 00:38:28 GMT, David Zimmerman wrote: > And 95.674% of all statistics are overly precise Them's fightin' words! The figure is 95.674 +/- 0.0005%. ========================================================================== TOPIC: default constructor in Java versus C++ http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b0018dff5a806578 ========================================================================== == 1 of 1 == Date: Tues, Nov 16 2004 4:46 pm From: [EMAIL PROTECTED] (hiwa) "KiLVaiDeN" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > "Matt" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > I try to compare the default constructor in Java and C++. > > > > In C++, a default constructor has one of the two meansings > > 1) a constructor has ZERO parameter > > > > Student() > > { //etc... > > } > > > > 2) a constructor that all parameters have default values > > > > Student(int age = 10, String name = "Joe") > > { //etc... > > } > > > > However, In Java, default constructor means a constructor has ZERO > parameter only. > > > > Student() > > { //etc... > > } > > > > The following will yield compile errors > > Student(int age = 10, String name = "Joe") > > { //etc... > > } > > > > Any ideas why Java doesn't support that? > > > > Please advise. Thanks!! > > it doesn't support that same syntax, but it can be done easily by simply > doing a default constructor ( without any parameter ) and inside declaring > the default values of the variables. > > Student() { > age = 10; > name = "Joe"; > //etc.. > } > > I think Java doesn't support the earlier syntax because it makes the syntax > of the constructor different than the one of other functions, and removing > that features, gives a function declaration quasi equal to the one of the > constructors. > > K And you can this in Java: public Student(){ //no-arg constructor this(10, "Joe", /*etc.*/); //call another constructor } public Student(int age){ this(age, "Joe", /*etc.*/); //call another constructor } //etc. ========================================================================== TOPIC: Unable to have tags within tags?? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d0b216afc2658f5c ========================================================================== == 1 of 2 == Date: Tues, Nov 16 2004 6:12 pm From: "Ann" <[EMAIL PROTECTED]> "Kwasi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am using WSAD 5.1 and am having problems when compiling lines like > the following: > <input type="hidden" name="domainName" value="<c:out > value={requestScope.domainNm}"> where c is defined as the jstl taglib > The error I get when I try to do this is "the value of attribute value > must not contain the '<' character. Somehow I have a strange and very > strict compiler that is not very friendly. Anyone have any ideas as to > what I might be doing wrong?? 1. you only have one '>' 2. try escape like this value="\<c:out == 2 of 2 == Date: Tues, Nov 16 2004 6:41 pm From: Chris Smith <[EMAIL PROTECTED]> Kwasi wrote: > I am using WSAD 5.1 and am having problems when compiling lines like > the following: > <input type="hidden" name="domainName" value="<c:out > value={requestScope.domainNm}"> where c is defined as the jstl taglib What tool is giving you these errors? Is it the WebSphere application server at runtime, or some development tool such as a page validator? If your server implements JSP 2.0, you can simply do away with the obsolete c:out tag, and write this instead: <input type="hidden" name="domainName" value="${requestScope.domainNm}"> I'm assuming that the mismatched quotes and brackets and such in your example was a typo in your newsreader. Copy and paste can prevent confusion like this in the future. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: static vs. non-static method http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/67ffb5659c18541b ========================================================================== == 1 of 3 == Date: Tues, Nov 16 2004 6:54 pm From: "Ryan" <[EMAIL PROTECTED]> What is the difference? == 2 of 3 == Date: Tues, Nov 16 2004 7:02 pm From: Chris Smith <[EMAIL PROTECTED]> Ryan wrote: > What is the difference? > A non-static method does something to a specific object. A static method is just a piece of code, and it's only put into a class as a convenient place to put it. Static methods don't work with any specific object. As a result, non-static methods can do things that static methods can't -- for example, they can access the state or call other non-static methods of the object they working with. These things aren't possible in a static method, because there *is* no object that they are working with. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 3 of 3 == Date: Tues, Nov 16 2004 11:19 pm From: "KiLVaiDeN" <[EMAIL PROTECTED]> "Ryan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What is the difference? > > static members = Class defined, means you can use the methods / attributes with the class name directly, and they are shared by all objects of that class. instance members = are defined for each object, can manipulate object own attributes, and there is a copy of each of these members for each object instanciated. Hope I was clear enough, good luck K ========================================================================== TOPIC: use com port as parallel port http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/43f0abc240232d51 ========================================================================== == 1 of 1 == Date: Tues, Nov 16 2004 8:02 pm From: Babu Kalakrishnan <[EMAIL PROTECTED]> Oscar kind wrote: > b3ny <[EMAIL PROTECTED]> wrote: > >>>I think you have the wrong end of the stick here. >> >>i knew thus... but the serial port has more than one in/output channels... >>RxD and TxD are the two data channels, but whats up with the status bits?? >>DCD DSR RTS CTS and DTR can't i use them as normal in/outputs??? > > > No. These bits are used by the serial port controller (i.e. the hardware) > to control when to send bits over the communication wires. After all, the > buffers on both sides must not overflow. > > Even though the software can tell the controller which handshaking > protocol to use (i.e. the pins or using special bit patterns on the > communication line), the controller is in charge. Not the software. > That isn't quite right - at least for the 16450/16550 compatible serial ports that are used in the IBM PC architecture. Flow control must always be performed by software - (The nomenclature "Hardware" vs. "Software" flow control only differentiates between whether the signalling of these states is done through the hardware pins RTS/CTS or as part of the data stream - XON/XOFF) So while you cannot control the state of the TxD pin (or read that of the RxD pin) programmatically, all the remaining pins (DTR and RTS as outputs and DSR,CTS,DCD and RI as inputs) can be controlled / read asynchronously from the PC. ========================================================================== TOPIC: Calendar.getInstance() wrong?? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f3454bcad8dd780c ========================================================================== == 1 of 6 == Date: Tues, Nov 16 2004 2:36 pm From: "Eric" <[EMAIL PROTECTED]> I am using JBuilder 2005 with Tomcat 5 to develop JSPs. Inside my JSP I have the following code: int monthA = Calendar.getInstance().MONTH; int monthB = new Date().getMonth(); monthA is getting the value of 2 (incorrect, it is not March) monthB is getting the value of 10 (correct, it is November) My system clock is correct (WinXPsp2) Any ideas why the Calendar class is reporting the incorrect month? Thanks in advance. -Eric == 2 of 6 == Date: Tues, Nov 16 2004 8:13 pm From: Babu Kalakrishnan <[EMAIL PROTECTED]> Eric wrote: > I am using JBuilder 2005 with Tomcat 5 to develop JSPs. Inside my JSP I > have the following code: > > int monthA = Calendar.getInstance().MONTH; This is equivalent to int monthA = Calendar.MONTH; BK == 3 of 6 == Date: Tues, Nov 16 2004 8:26 pm From: Todd de Gruyl <[EMAIL PROTECTED]> On 2004-11-16, Eric <[EMAIL PROTECTED]> wrote: > I am using JBuilder 2005 with Tomcat 5 to develop JSPs. Inside my JSP I > have the following code: > > int monthA = Calendar.getInstance().MONTH; > int monthB = new Date().getMonth(); > > monthA is getting the value of 2 (incorrect, it is not March) > monthB is getting the value of 10 (correct, it is November) > > My system clock is correct (WinXPsp2) > > Any ideas why the Calendar class is reporting the incorrect month? according to the docs: <http://java.sun.com/j2se/1.5.0/docs/api/java/util/Calendar.html>, Calendar.MONTH is defined as a static int (You seem to be asking for something other than what you mean.) You probably want: Calendar.getInstance().get(Calendar.MONTH) -- Todd de Gruyl [EMAIL PROTECTED] == 4 of 6 == Date: Tues, Nov 16 2004 8:28 pm From: "Murray" <[EMAIL PROTECTED]> "Babu Kalakrishnan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Eric wrote: >> I am using JBuilder 2005 with Tomcat 5 to develop JSPs. Inside my JSP I >> have the following code: >> >> int monthA = Calendar.getInstance().MONTH; > > This is equivalent to > > int monthA = Calendar.MONTH; > > BK > To elaborate on this in case you didn't get it, Calendar.MONTH is a static field that represents the month field number. It isn't the month value. You need Calendar.getInstance().get(Calendar.MONTH); == 5 of 6 == Date: Tues, Nov 16 2004 8:31 pm From: Sudsy <[EMAIL PROTECTED]> Eric wrote: > I am using JBuilder 2005 with Tomcat 5 to develop JSPs. Inside my JSP I > have the following code: > > int monthA = Calendar.getInstance().MONTH; > int monthB = new Date().getMonth(); > > monthA is getting the value of 2 (incorrect, it is not March) > monthB is getting the value of 10 (correct, it is November) > > My system clock is correct (WinXPsp2) > > Any ideas why the Calendar class is reporting the incorrect month? It's not; you're accessing the value of a class variable, not that of an instance. Your first line is equivalent to the following: int monthA = Calendar.MONTH; It the value of the class variable used as a selector in the get method. Try the following code: System.out.println( Calendar.MONTH ); System.out.println( Calendar.getInstance().MONTH ); System.out.println( Calendar.getInstance().get( Calendar.MONTH ) ); The first two lines will produce the same result, not matter what month it is currently. The last shows how to invoke the get method on an instance, using the aforementioned selector, to get the appropriate value. HTH -- Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development. == 6 of 6 == Date: Wed, Nov 17 2004 1:09 am From: "Tony Morris" <[EMAIL PROTECTED]> "Eric" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am using JBuilder 2005 with Tomcat 5 to develop JSPs. Inside my JSP I > have the following code: > > int monthA = Calendar.getInstance().MONTH; > int monthB = new Date().getMonth(); > > monthA is getting the value of 2 (incorrect, it is not March) > monthB is getting the value of 10 (correct, it is November) > > My system clock is correct (WinXPsp2) > > Any ideas why the Calendar class is reporting the incorrect month? > > Thanks in advance. > > -Eric > > All the more reason to always use enums where appropriate (manually created type-safe enums prior to 1.5), not ints, not String, not all the other nasties I've seen before. This will prevent mistakes like the one you are making. I suggest a peek at the API Spec. to figure out why. -- Tony Morris http://xdweb.net/~dibblego/ ========================================================================== TOPIC: ide sugestions for j2me dev http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/95ffdcc28f2b1a33 ========================================================================== == 1 of 2 == Date: Tues, Nov 16 2004 9:21 pm From: [EMAIL PROTECTED] (Mike Crabs) can anyone recommend an ide that does not require some kind of super computer to be able to use it. i'de like to dabble in j2me development - which is to make little tiny thin kvm running applications - and all the ide's ive seen require some kind of heavy ass computer with 512 mb of ram and shit like that. Why the fuck do you need a mainframe to develope kvm shit. help me out comrads tyia == 2 of 2 == Date: Tues, Nov 16 2004 9:37 pm From: Sudsy <[EMAIL PROTECTED]> Mike Crabs wrote: <snip> > Why the fuck do you need a mainframe to develope kvm shit. <snip> You don't! But you need better manners than you've demonstrated to reasonably expect any assistance. > help me out comrads That fails all spelling checks. Did you mean comrades? If so then you might want to post to those newgroups friendly to Communists/Marxists/Leninists... ;-) -- Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development. ========================================================================== TOPIC: how to use format? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3fc0459d7c798baf ========================================================================== == 1 of 4 == Date: Tues, Nov 16 2004 9:53 pm From: "nick" <[EMAIL PROTECTED]> for (int j = 0; j <= 7; j++) { System.out.println(Integer.toBinaryString(j)); } the result: 0 1 10 11 ..... how to make the print result become: 00000 00001 00010 00011 ........ thanks! == 2 of 4 == Date: Wed, Nov 17 2004 12:34 am From: Andrew Thompson <[EMAIL PROTECTED]> On Wed, 17 Nov 2004 13:53:34 +0800, nick wrote: > 0 > 1 > ..... > > how to make the print result become: > 00000 > 00001 > ........ java.text.DecimalFormat 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 == 3 of 4 == Date: Wed, Nov 17 2004 12:41 am From: "Skip" <[EMAIL PROTECTED]> "nick" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > for (int j = 0; j <= 7; j++) { > System.out.println(Integer.toBinaryString(j)); > } > > > the result: > 0 > 1 > 10 > 11 > ..... > > how to make the print result become: > 00000 > 00001 > 00010 > 00011 > ........ String binary = Integer.toBinaryString(...)); int fixedLenght = 8; int currentLength = binary.length(); int difference = fixedLength - currentLength; StringBuffer sb = new StringBuffer(); for(int i=0; i<difference; i++) { sb.append('0'); } sb.append(binary); binary = sb.toString(); ~~ HTH == 4 of 4 == Date: Wed, Nov 17 2004 1:37 am From: Babu Kalakrishnan <[EMAIL PROTECTED]> Andrew Thompson wrote: > On Wed, 17 Nov 2004 13:53:34 +0800, nick wrote: > > >>0 >>1 >>..... >> >>how to make the print result become: >>00000 >>00001 >>........ > > > java.text.DecimalFormat > Not really recommended. DecimalFormat (as the name indicates) formats numbers using Base 10 - Not binary. So you'd have to 3 conversions : first to a binary string - then convert it to a decimal number and then use decimalformat for formatting, which is overkill. May be something like : public static String createBinaryString(int number, int minDigits) { // assert that digits <= 31 // Will need to use long if digits > 31 int orMask = 1 << minDigits; if (number < 0 || (orMask > 0 && number >= orMask)) // result will be longer { return Integer.toBinaryString(number); } else { String s = Integer.toBinaryString(number | orMask); return s.substring(1); } } BK ========================================================================== TOPIC: 'A'++ == 'B': Always True? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bb79b41e32f311b2 ========================================================================== == 1 of 6 == Date: Tues, Nov 16 2004 10:11 pm From: [EMAIL PROTECTED] (Fritz Foetzl) The program public class IncrementCharMain { public static void main(String[] args) { char ltr = 'A'; System.out.println (ltr); ltr++; System.out.println(ltr); } } produces the output A B on my system, as I'd expect. However, I'm not very familiar with Unicode or with Java's handling of character data. Will this program always produce the same output, regardless of the platform hosting the JRE/JVM? If not, is there a better way to get "the next letter" without writing a long and clunky switch statement? (I'm cautious because in C, incrementing characters is non-portable; although adjacent letters have consecutive values in ASCII, this is not true of EBCDIC. I've never actually seen an EBCDIC system, but presumably they're out there.) ff == 2 of 6 == Date: Tues, Nov 16 2004 10:14 pm From: "Mike Schilling" <[EMAIL PROTECTED]> "Fritz Foetzl" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The program > > public class IncrementCharMain { > public static void main(String[] args) { > char ltr = 'A'; > System.out.println (ltr); > ltr++; > System.out.println(ltr); > } > } > > produces the output > > A > B > > on my system, as I'd expect. However, I'm not very familiar with > Unicode or with Java's handling of character data. Will this program > always produce the same output, regardless of the platform hosting the > JRE/JVM? If not, is there a better way to get "the next letter" > without writing a long and clunky switch statement? > > (I'm cautious because in C, incrementing characters is non-portable; > although adjacent letters have consecutive values in ASCII, this is > not true of EBCDIC. I've never actually seen an EBCDIC system, but > presumably they're out there.) Yes. All Java systems use Unicode as their in-memory character set. > > ff == 3 of 6 == Date: Tues, Nov 16 2004 10:19 pm From: Chris Smith <[EMAIL PROTECTED]> Fritz Foetzl wrote: > (I'm cautious because in C, incrementing characters is non-portable; > although adjacent letters have consecutive values in ASCII, this is > not true of EBCDIC. I've never actually seen an EBCDIC system, but > presumably they're out there.) No need to worry too much. Incrementing 'A' will always produce 'B', because the two code points are adjacent in Unicode (Unicode is a superset of ASCII). The only case where your program would produce different output is in the unlikely event that the system default encoding doesn't actually represent one or both of the characters 'A' and 'B'. Then, of course, it's impossible to print 'A' or 'B', and a placeholder character (generally '?') will be printed instead. That relates to output, though; the variables still have values of 'A' and 'B', but those values just may not print correctly to the screen. An EBCDIC system is likewise translated as part of the output process, so the actual values of variables in Java are still Unicode code points. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 4 of 6 == Date: Wed, Nov 17 2004 12:17 am From: "Vincent Cantin" <[EMAIL PROTECTED]> 'A' cannot be incremented, it is not a variable :p == 5 of 6 == Date: Wed, Nov 17 2004 12:53 am From: Gordon Beaton <[EMAIL PROTECTED]> On Wed, 17 Nov 2004 16:17:59 +0800, Vincent Cantin wrote: > 'A' cannot be incremented, it is not a variable :p And even if it could, the expression 'A'++ == 'B' would be false due to the choice of postincrement operator. A better example would have been 'A' + 1 == 'B', for both reasons. /gordon -- [ do not email me copies of your followups ] g o r d o n + n e w s @ b a l d e r 1 3 . s e == 6 of 6 == Date: Wed, Nov 17 2004 1:10 am From: Michael Borgwardt <[EMAIL PROTECTED]> Chris Smith wrote: > The only case where your program would produce different output is in > the unlikely event that the system default encoding doesn't actually > represent one or both of the characters 'A' and 'B'. But this would only matter during compilation. Once the program is compiled, it will produce the same results on any standards-conforming JVM. ========================================================================== TOPIC: Character Encoding of a DOM object http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/989f73fe61ccf13b ========================================================================== == 1 of 1 == Date: Tues, Nov 16 2004 10:52 pm From: "Rakesh Pandit" <[EMAIL PROTECTED]> All: How can one find out the character encoding of a DOM Document after an XML file has been converted to the DOM object. Thanks Rakesh ========================================================================== TOPIC: Java Thread Analysis http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c30c46b2c50ca5f ========================================================================== == 1 of 1 == Date: Tues, Nov 16 2004 11:13 pm From: [EMAIL PROTECTED] (Vladimir Kondratyev) I think that YourKit Java Profiler (http://www.yourkit.com) can be useful in your situation. You need to capture memory snapshot and open all instances of java.lang.Thread. ========================================================================== TOPIC: Attributes always empty when parsing XML documents http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f93920023b216158 ========================================================================== == 1 of 2 == Date: Tues, Nov 16 2004 11:46 pm From: "Andy Carson" <[EMAIL PROTECTED]> > No attributes in there. An attribute (date) would look like this: > > <PersonResultSet date="04/11/16"> Thanks a lot! == 2 of 2 == Date: Tues, Nov 16 2004 11:52 pm From: "Andy Carson" <[EMAIL PROTECTED]> Thanks for the code sample! Are there more effective parsers? The code sample you provided suggests that the reading of the values is a bit messy ... (I'm very found of the way you handle XML in the .Net-environment. In C#/.Net you just define a schema (sort of a data set) and then the parser just load that schema with the correct values automatically. ) ========================================================================== TOPIC: What is package cache in a jar file http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dec0c6e21c7d3f0b ========================================================================== == 1 of 2 == Date: Tues, Nov 16 2004 11:46 pm From: "HS1" <[EMAIL PROTECTED]> Hello all I know that a jar file is considered as zip file. I see a Jar file that has a package cache. Could you please tell me the purpose of this "package" or locate a tutorial about content of a jar file... Many thanks SH1 == 2 of 2 == Date: Wed, Nov 17 2004 12:54 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> HS1 wrote: > Hello all > I know that a jar file is considered as zip file. I see a Jar file that has > a package cache. Do you mean the jar index? AFAIR that one is there since Java 1.3. The Jar file format is documented in the JDK documentation. You did download the JDK documentation when you fetched the JDK, didn't you? /Thomas ========================================================================== TOPIC: HTML convert to XHTML http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5f47c654f1264a65 ========================================================================== == 1 of 2 == Date: Wed, Nov 17 2004 12:11 am From: [EMAIL PROTECTED] (mike) regards: From http://webpageworkshop.co.uk/main/xhtml_converting A HTML document can be converted to XHTML document. By the following Steps: Step 1: Convert elements to lowercase Step 2: Replace the !DOCTYPE declaration Step 3: Change the <html> tag Step 4: Make sure all elements are closed Step 5: Ensure all attributes are quoted Step 6: 'Un-minimize' minimized attributes Step 7: Make sure that every image has an 'alt' attribute Step 8: Check for 'overlapping' elements Step 9: Check 'type' attributes for script and style elements Step 10: Validate your code! Could I achieve the above 10 steps by using HTMLparer? Welcome to see your opinions. Or maybe I may try another api like JDOM? thank you May god be with you == 2 of 2 == Date: Wed, Nov 17 2004 12:45 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> mike wrote: > regards: > > From http://webpageworkshop.co.uk/main/xhtml_converting > A HTML document can be converted to XHTML document. > By the following Steps: [...] > Or maybe I may try another api like JDOM? Sounds more like you want JTidy. Google for it. /Thomas ========================================================================== TOPIC: Where do I get the javacc java api document? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6c8f306325d131f4 ========================================================================== == 1 of 1 == Date: Wed, Nov 17 2004 12:25 am From: "Vincent Cantin" <[EMAIL PROTECTED]> > java'cc'? I have heard of javac, but not javacc. javacc is a Java Compiler Compiler. ========================================================================== TOPIC: IE not detecting Java plug in. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ca11ea82f98b83f ========================================================================== == 1 of 2 == Date: Wed, Nov 17 2004 12:48 am From: [EMAIL PROTECTED] (Guru) Yes. java applet loads and i can see the java coffee cup icon at system tray. Version : 1.4.2_03 "Mickey Segal" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > What happens on an external URL such as www.segal.org/java/configuration/ ? > Does a Java applet appear? If so, what does it say for Java version? > > "Guru" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > It is a internal URL. You can not access it. > > My main problem is IE not detecting the Java plug in installed > > in the system. == 2 of 2 == Date: Wed, Nov 17 2004 1:28 am From: Andrew Thompson <[EMAIL PROTECTED]> Please refrain from top-posting, I find it most confusing. <http://www.physci.org/codes/javafaq.jsp#netiquette> On 17 Nov 2004 00:48:06 -0800, Guru wrote: > "Mickey Segal" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL > PROTECTED]>... >> What happens on an external URL such as www.segal.org/java/configuration/ ? > Version : 1.4.2_03 The problem might be the applet call, make a minimised test case of your 'internal URL' that both fails *and* validates[1], then post it here, or on Geocities (inside a .ZIP) or similar. [1] <http://validator.w3.org/> -- 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: Java 1.5 Enums http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8cd26ba0bb283203 ========================================================================== == 1 of 1 == Date: Wed, Nov 17 2004 1:01 am From: "Tony Morris" <[EMAIL PROTECTED]> "Jesper Nordenberg" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Chas Douglass <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > > "Tony Morris" <[EMAIL PROTECTED]> wrote in > > news:[EMAIL PROTECTED]: > > > You want to create an enum and a reverse mapping. > > > Suppose you have 2 ints {0,1} that mean something {BLACK, WHITE}. > > [snip] > > > > Thanks, that solution was totally non-obvious to me, but it works > > perfectly. > > You can skip the map and the int by using the ordinal() method, for > example: > > MyEnum getEnumFor(int value) { > for (MyEnum v : MyEnum.values()) > if (v.ordinal() == value) > return v; > } > > Just remember to store value.ordinal() in the database and don't > change the order of the enum constant declarations. > > /Jesper Nordenberg Which incurs a performance overhead (O(n) search time instead of O(1)) and the other disadvantages that you mention for what advantage? -- Tony Morris http://xdweb.net/~dibblego/ ========================================================================== TOPIC: How to write an efficient maximum function? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f759ff7cc130859e ========================================================================== == 1 of 1 == Date: Wed, Nov 17 2004 1:54 am From: bugbear <[EMAIL PROTECTED]> You're both well on the way to discovering some comp-sci: http://www.cs.brandeis.edu/~hugues/sorting_networks.html (BTW, this also counts as a reply to the guy who asked about using comp-sci stuff for real life tasks) BugBear ======================================================================= 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
