comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Strategy help for java search engine weighting - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/61841a87697ddc1e * Is session id machine independent and unique? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/94c349e02b2efcb4 * How to create a excute file - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/453049a84ae975c2 * old Java compiler - 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a0a7bed0e02e6a2a * Read an XQuery file, substitute a filename for a symbol and save in a string - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8d4544ab1f1507b * Full Screen Game - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/512b4296a1e5c69f * Distributable libraries? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c8f7365e0f965e0d * Parsing integers - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c9daf0a4f5c7e11e * background image help - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b0ae1fde552f3595 * default constructor in Java versus C++ - 6 messages, 5 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b0018dff5a806578 * J2ME Clie TJ37 - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bddd3f7bc08dbf92 * Difference between JavaServerFaces and JavaServerPages+Swing ? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8aece321c50238bc * Repainting a image in java - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/218e95a0a0ff772 * Using java.util.regex in JDK 1.3 - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2a4390453d4e5927 * JRE 5.0 autoinstallation page? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bb1d843769ea8496 * Access Oracle Objects via PLSQL from JDBC - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f049290e884fb671 * memory problem - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/843591c39a553b18 ========================================================================== TOPIC: Strategy help for java search engine weighting http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/61841a87697ddc1e ========================================================================== == 1 of 2 == Date: Sun, Nov 14 2004 8:31 pm From: "Chris" <[EMAIL PROTECTED]> > I'm converting a search engine from Delphi to Java and would like some help > with my strategy. This is for the oraclepower.com website. > > BACKGROUND: > I have a table of links that I need to match up with keywords the user > enters. If the user enters the keywords "oracle" and "reports" I query the > database for all link titles and descriptions that exist in the table > something like this > > SELECT col1..coln > FROM LINK_LIST > WHERE title like '%keyword%' or subject like '%keyword%' > > I then pull the recordset into what is called a client data set (Delphi), > which is a > recordset "in memory" instead of one directly attached to a database or XML > file. I > then use an algorithm to weight each result based on where and how many > times it appears in title and link, then sort by weight, then display the > resource to the web page. > > QUESTION: > > Do the java libraries have an object that can easily be loaded from a > ResultSet, have a weight column added to it then sort itself, then examine > the columns from the memory object; or do I have to create this object > myself? > > If I have to create this myself, what objects will help me reduce the coding > / designing (ie other than ArrayList or some generic collection). Should > this be done with SAX and an in-memory XML object (no file needed, and would > slow things down)? Should I create a collection that loads itself from a > ResultSet including metadata and can sort by a particular column, set of > columns? I know how I would do it in Delphi, but need some insight into > various java solutions. First, let me recommend you reconsider the make/buy decision. Buying a search engine written in Java can save you a lot of time. Dieselpoint http://dieselpoint.com is a good choice for this kind of thing. But if you want to do it yourself, creating a class is not hard. Try this: public class Result implements Comparable { // add getter and setters for these fields private int weight; private String title; private String text; private String whatever; public int compareTo(Object o) { return ((Result)o).weight - weight; } } Use the Result class thusly: ArrayList list = new ArrayList(); ResultSet rs = (get your result set here) while (rs.next()) { Result result = new Result(); result.setTitle(rs.getString(title)): ... etc .. // perform weight calcs here result.setWeight(weight); list.add(result); } Object [] array = list.toArray(); java.util.Arrays.sort(array); The code above isn't tested, but you get the idea: the secret is to implement the Comparable interface, and then take advantage of the Arrays.sort() method, which depends on it. == 2 of 2 == Date: Sun, Nov 14 2004 8:55 pm From: "Tom Dyess" <[EMAIL PROTECTED]> Re Buying v. Making: I wrote the original (Delphi/ISAPI) and it works fine. The exercise of converting this to java is to give me a reason to learn java on a realistic project more than anything. Lol. Ya, I was thinking of making something generic similar to various Delphi classes. That way I can do something like Obj.SortByField(String field), Obj.FieldAsString(String fieldname), next(), prev(), Obj.LoadFromResultSet(ResultSet rs), etc. I was thinking of creating objects with an aggregated ArrayList (rows) of another aggregated ArrayList (fields) in which the custom "Field" objects would store the metadata. It seems that it's a little too lowlevel, not that that's a problem, but I'd hate to do it if something similar was already done by classes already defined in the java distro. Tom "Chris" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> I'm converting a search engine from Delphi to Java and would like some > help >> with my strategy. This is for the oraclepower.com website. >> >> BACKGROUND: >> I have a table of links that I need to match up with keywords the user >> enters. If the user enters the keywords "oracle" and "reports" I query >> the >> database for all link titles and descriptions that exist in the table >> something like this >> >> SELECT col1..coln >> FROM LINK_LIST >> WHERE title like '%keyword%' or subject like '%keyword%' >> >> I then pull the recordset into what is called a client data set (Delphi), >> which is a >> recordset "in memory" instead of one directly attached to a database or > XML >> file. I >> then use an algorithm to weight each result based on where and how many >> times it appears in title and link, then sort by weight, then display the >> resource to the web page. >> >> QUESTION: >> >> Do the java libraries have an object that can easily be loaded from a >> ResultSet, have a weight column added to it then sort itself, then >> examine >> the columns from the memory object; or do I have to create this object >> myself? >> >> If I have to create this myself, what objects will help me reduce the > coding >> / designing (ie other than ArrayList or some generic collection). Should >> this be done with SAX and an in-memory XML object (no file needed, and > would >> slow things down)? Should I create a collection that loads itself from a >> ResultSet including metadata and can sort by a particular column, set of >> columns? I know how I would do it in Delphi, but need some insight into >> various java solutions. > > First, let me recommend you reconsider the make/buy decision. Buying a > search engine written in Java can save you a lot of time. Dieselpoint > http://dieselpoint.com is a good choice for this kind of thing. > > But if you want to do it yourself, creating a class is not hard. Try this: > > public class Result implements Comparable { > // add getter and setters for these fields > private int weight; > private String title; > private String text; > private String whatever; > > public int compareTo(Object o) { > return ((Result)o).weight - weight; > } > } > > Use the Result class thusly: > > ArrayList list = new ArrayList(); > ResultSet rs = (get your result set here) > while (rs.next()) { > Result result = new Result(); > result.setTitle(rs.getString(title)): > ... etc .. > > // perform weight calcs here > > result.setWeight(weight); > list.add(result); > } > > Object [] array = list.toArray(); > java.util.Arrays.sort(array); > > The code above isn't tested, but you get the idea: the secret is to > implement the Comparable interface, and then take advantage of the > Arrays.sort() method, which depends on it. > > ========================================================================== TOPIC: Is session id machine independent and unique? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/94c349e02b2efcb4 ========================================================================== == 1 of 1 == Date: Sun, Nov 14 2004 8:46 pm From: marcus <[EMAIL PROTECTED]> or better yet, learn to read "Returns a string containing the unique identifier assigned to this session. The identifier is assigned by the servlet container and is implementation dependent." this is not hard. Andy Flowers wrote: > The format of a Session Id is AFAIK unique to each and every vendor. > > Session Ids have the possibility to be reused though. If the session on > machine A times out then that id could be regenerated for machine B. One > this that should be true, however, is that not 2 distinct sessions, whether > from different browser sessions on a single machine or different machines, > should have the same session Id at the same point in time. > > To get a handle on how it 'could' be implemented why not take a look at the > Tomcat source code/documentation and havea look at how it handles sessions ? > http://jakarta.apache.org/tomcat/index.html > > ========================================================================== TOPIC: How to create a excute file http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/453049a84ae975c2 ========================================================================== == 1 of 1 == Date: Sun, Nov 14 2004 8:53 pm From: "HS1" <[EMAIL PROTECTED]> Hello all I want to create an execute file (only one .exe file for Windows) for my project. This project uses some available component such as JFree for creating report or mysql-connector to connect to a mySQL database)... . So when I want to create the file, do I have to add all of those libraries into this file? Thank you for your help S.H1 ========================================================================== TOPIC: old Java compiler http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a0a7bed0e02e6a2a ========================================================================== == 1 of 4 == Date: Sun, Nov 14 2004 8:57 pm From: "Andrei Kouznetsov" <[EMAIL PROTECTED]> just use your favorite javac with switch -target 1.1 -- Andrei Kouznetsov http://uio.dev.java.net Unified I/O for Java http://reader.imagero.com Java image reader http://jgui.imagero.com Java GUI components and utilities == 2 of 4 == Date: Sun, Nov 14 2004 9:08 pm From: Andrew Thompson <[EMAIL PROTECTED]> On Mon, 15 Nov 2004 05:57:07 +0100, Andrei Kouznetsov wrote: > just use your favorite javac with switch -target 1.1 That will enrure the *bytecodes* are readable by the 1.1 VM, but it will happily compile a call to String.split() down to 1.1 bytecodes only to have it fail in a 1.1 VM. To actually check if a class or member was present in a particular release, you need to compile against that rt.jar (or whatever) using the -bootclasspath parameter. Which reminds me.. to the OP. You can check any small self contained piece of code against the MSVM at the on-line compiler. <http://www.physci.org/javac.jsp?bcp=ms> (The URL configures the JOLC to compile for the MSVM) 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: Mon, Nov 15 2004 12:07 am From: "Andy Flowers" <[EMAIL PROTECTED]> Andrew Thompson wrote: > > MS withdrew all support for the MSVM and Sun never supplied it. And a recent court decision means that the MSVM is still supported for a few more years. http://www.microsoft.com/mscorp/java/ says it will be supported until the end of 2007. > If you have an IE that has the MSVM built in, you're in luck though. If not then you can download the MSVM from places such as http://java-virtual-machine.net/download.html (A quick google search should reveal even more), but remember to do a windows update session to update the MSVM with their latest security patches. If you wanr a Java VM for 1.1 then go to http://java.sun.com/products/archive/index.html and download one of their 1.1 versions (1.1.8 should suffice for your needs) == 4 of 4 == Date: Mon, Nov 15 2004 12:51 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> Andy Flowers wrote: > And a recent court decision means that the MSVM is still supported for a few > more years. http://www.microsoft.com/mscorp/java/ says it will be supported > until the end of 2007. For some value of "supported". Or, as MS words it: > The MSJVM is no longer available for distribution from Microsoft and there > will be no enhancements to the MSJVM. I wouldn't exactly call this "support". > If not then you can download the MSVM from places such as > http://java-virtual-machine.net/download.html (A quick google search should > reveal even more), but remember to do a windows update session to update the > MSVM with their latest security patches. Oh sure, in these times of viruses, worms, and trojan horses it is a really "good" idea to get windows software from unknown sources [No, I am not claiming that the stuff from java-virtual-machine.net is not genuine, just that it is not a good idea to get software from unknown sources in general]. /Thomas ========================================================================== TOPIC: Read an XQuery file, substitute a filename for a symbol and save in a string http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8d4544ab1f1507b ========================================================================== == 1 of 2 == Date: Sun, Nov 14 2004 9:01 pm From: Jeff Kish <[EMAIL PROTECTED]> Greetings I'd like to be able to take a filename that represents a text file containing a query for the XQuery language (that means it can have spaces, lt, gt signs, etc. but no binary data). What I expect the file to contain is an XQUERY, and possibly (no guarantee), a place holder that I'd like to replace with a set of fully qualified filenames in a loop, processing the XQuery with each file I have in a String. So for example, my program will have a parameter that specifies a fully qualified file xquery file that looks like this: {-- returns this data: <theElement>include<theAttribute id="pageHeader">include</theAttribute></theElement> --} for $b in document("%1l")//presentation for $a in $b//* where $a[fn:lower-case(@* as xs:string)="pageHeader"] return <theElement> {name($a)} <theAttributes> { $a/@*, name($a)} </theAttributes> </theElement> Another parameter for the program contains a wildcard that will result in a list of fully qualified filenames. And I have a nice little qexo app that will loop through the list of fully qualified filenames, and for each file will: put the data from the xquery into a string substituting the first occurence (if any) of %1 with the current fully qualified filename pass the resulting transformed string to the qexo object that will process the XQuery. Can someone help me out with the best way to read in the file, and do the substitution? I was thinking of FileReader object, and read line by line, but I'm not sure about the string substitution. Something like this which I picked up on the Internet (thank you for the tutorials http://home.cogeco.ca/~ve3ll/jatutorc.htm ): // Create streams FileReader fr = new FileReader (args[0]); BufferedReader br = new BufferedReader(fr); //wrap the basic object String finalOutput = new String(); String buf; // the buffer boolean bSubstituted = false; while ((buf = br.readLine()) != null) { if (!bSubstituted) { if buf contains a '%1' replace it with the filename bSubstituted = true; } finalOutput = finalOutput + buf; } br.close(); bw.close(); Thanks == 2 of 2 == Date: Sun, Nov 14 2004 9:38 pm From: "Chris" <[EMAIL PROTECTED]> "Jeff Kish" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Greetings > > I'd like to be able to take a filename that represents a text file containing a query for the XQuery > language (that means it can have spaces, lt, gt signs, etc. but no binary data). > > What I expect the file to contain is an XQUERY, and possibly (no guarantee), a place holder that I'd > like to replace with a set of fully qualified filenames in a loop, processing the XQuery with each > file I have in a String. <snip> If all you're looking for is search and replace functionality, the String.replaceAll() method will do the trick. ========================================================================== TOPIC: Full Screen Game http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/512b4296a1e5c69f ========================================================================== == 1 of 1 == Date: Sun, Nov 14 2004 9:12 pm From: marcus <[EMAIL PROTECTED]> I decided to reply before reading andrew's responses, so consider this a less friendly enhancement. Mike wrote: > Sup everyone, > I'm still only a scenior spelling, and frankly I don't care > in highshool, but I am attempting to make > a full screen version of the board game Triopoly (Monoply with 3 levels > and a heck of a lot more money going around the table). I am currently > in AP Java AB (AP Java 2) I take this to mean something like "I am taking a course called advanced placement Java . . . " and again I don't care > and have set up most of the needed classes, What info am I supposed to glean from this? How does this help me help you? > and am beginning to debug it in dos. debug what? What is "in dos"? You mean you are running windows 3.1, or opening a dos window in windows XP or really booting to dos from a floppy? And again, I don't care. What version of Java, or whose JVM, or what OS you are using maybe I care if it is relevent to your specific problem. Oh wait, you haven't posted a specific problem. > I know how to set up everything > for a full screen application Now we are getting somewhere. I can find references to a getFullScreenWindow() method in java.awt.GraphicsDevice, so by a *huge* assumption I can get myself to believe you are opening an awt window and drawing on it. > and I was wondering if anyone could give > me pointers on double buffering stratigies and how to create custom > buttons/text boxes/menu/text area graphics . . . Ah, pretty before carefully crafted, thoroughly tested, and fully functional. That's nice. Post in a programmer's newsgroup to get some pointers from real industry professionals about how to make something pretty. I have a teen-age son who is currently in the US Naval Academy, and I can assure you if he displayed logic as vacuous as this during his high school years he would have been thoroughly reamed. Next time, if you need specific help with a specific problem, be sure to check out C.L.J.help. Otherwise, learn to paint if you want pretty. ========================================================================== TOPIC: Distributable libraries? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c8f7365e0f965e0d ========================================================================== == 1 of 2 == Date: Sun, Nov 14 2004 9:12 pm From: Steve Sobol <[EMAIL PROTECTED]> Is there a set of distributable libraries I can package with my Java application that will allow it to run, instead of requiring people to install a JVM? (Much like you can distribute the Visual Basic runtime DLL to allow people to use your compiled VB app) I'm thinking perhaps jvm.dll or libjvm.so along with a handful of other libraries - can this be done? Does Sun approve of doing something like this? -- JustThe.net Internet & New Media Services, http://JustThe.net/ Steven J. Sobol, Geek In Charge / 888.480.4NET (4638) / [EMAIL PROTECTED] PGP Key available from your friendly local key server (0xE3AE35ED) Apple Valley, California Nothing scares me anymore. I have three kids. == 2 of 2 == Date: Sun, Nov 14 2004 9:25 pm From: Chris Smith <[EMAIL PROTECTED]> Steve Sobol wrote: > Is there a set of distributable libraries I can package with my Java > application that will allow it to run, instead of requiring people to install > a > JVM? (Much like you can distribute the Visual Basic runtime DLL to allow > people > to use your compiled VB app) > > I'm thinking perhaps jvm.dll or libjvm.so along with a handful of other > libraries - can this be done? Does Sun approve of doing something like this? The JRE is redistributable, and there is a README.TXT file in the JRE listing those pieces that can be excluded. The remaining pieces must be redistributed as a part of the complete JRE. You are not required to run the JRE installer, and the JRE will work without the installer having been run. If it's important to you, though, that the files be only ".dll" or ".so" files, then you're out of luck. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: Parsing integers http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c9daf0a4f5c7e11e ========================================================================== == 1 of 1 == Date: Sun, Nov 14 2004 9:21 pm From: marcus <[EMAIL PROTECTED]> ptoun, Andrew is too nice. A date (or whatever) entered from the keyboard is not an integer. It is data read from an input stream. The words 'integer' and 'parse' have specific meanings, so it is important that you understand them. Use care if you are using a translating program, because it may choose a word that has more specificity than you intended. So, you must learn the vocabulary in english before you can post effectively. Second, you must be able to clearly conceptionalize what you want to do and be able to express it accurately before you will be able to program it effectively. Posting a vague question here won't get you very far. Get some books and go through the java tutorial on sun's website. Good Luck! ptoum wrote: > I am a novice in Java and I want to create a program that parses > integers (for example dates) that the user writes to the keyboard and > gives an output on a command line. Does anyone know? Thanks a lot! ========================================================================== TOPIC: background image help http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b0ae1fde552f3595 ========================================================================== == 1 of 2 == Date: Sun, Nov 14 2004 9:33 pm From: marcus <[EMAIL PROTECTED]> is this a JComponent? try JComponent.getGraphics() then Graphics.drawImage() Of course you will need to have created a new Image with the gif something like this (from the docs) (java.awt.Toolkit.getImage()) Image src = getImage("doc:///demo/images/duke/T1.gif"); Ann wrote: > I have a tree and the background color is set as follows: > > newContentPane.setOpaque(true); //content panes must be opaque > newContentPane.setBackground(new Color(1.0f, 0.6f, 0.6f)); > > I would like to use a gif file instead of a solid color > as a background image. How to? Or where to look please. > > == 2 of 2 == Date: Sun, Nov 14 2004 9:33 pm From: marcus <[EMAIL PROTECTED]> BTW, what do you mean "I have a tree?" Ann wrote: > I have a tree and the background color is set as follows: > > newContentPane.setOpaque(true); //content panes must be opaque > newContentPane.setBackground(new Color(1.0f, 0.6f, 0.6f)); > > I would like to use a gif file instead of a solid color > as a background image. How to? Or where to look please. > > ========================================================================== TOPIC: default constructor in Java versus C++ http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b0018dff5a806578 ========================================================================== == 1 of 6 == Date: Sun, Nov 14 2004 9:50 pm From: Chris Smith <[EMAIL PROTECTED]> Matt wrote: > I try to compare the default constructor in Java and C++. > Please note that the two languages use that term in different ways. It's an implementation-level concept, and naturally implementation-level concerns will differ when the language is changed. In this case, it's quite by coincidence that the term happens to have a meaning in both languages, and it results in some confusion when the C++ meaning is applied to Java. You seem to be using the C++ definition of "default constructor" below. The C++ definition does not apply in Java. In Java, all creations or objects MUST specify an argument list for the constructor, so there is no "default" in that sense. A "default constructor" in Java, though, generally means a constructor that's generated for you by the compiler. For example, the following class: class A { } has a default constructor, generated automatically by the compiler, which takes no arguments. The following class: class B { public B() { } } is identical in functionality, but it does *not* have a default constructor. Instead, the no-argument constructor is defined quite explicitly. > However, In Java, default constructor means a constructor has > ZERO parameter only. It is true that, in Java, all default constructors have zero parameters. However, it is not true that all zero-parameter constructors are "default", and hence not true that default "means" zero-parameter. > The following will yield compile errors > Student(int age = 10, String name = "Joe") > { //etc... > } > > Any ideas why Java doesn't support that? One of the design goals of Java is to simplify the resolution of syntax. The task of default parameters is easily accomplished by overloading, so there is no need for the redundant mechanism. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 2 of 6 == Date: Sun, Nov 14 2004 10:23 pm From: "Gary Labowitz" <[EMAIL PROTECTED]> "Chris Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] <<snip>> > A "default constructor" in Java, though, generally means a constructor > that's generated for you by the compiler. For example, the following > class: > > class A { } > > has a default constructor, generated automatically by the compiler, > which takes no arguments. The following class: > > class B > { > public B() { } > } > > is identical in functionality, but it does *not* have a default > constructor. Instead, the no-argument constructor is defined quite > explicitly. I don't think so, Chris. In Java, any constructor that takes no parameters is called a default constructor. This could be better checked on comp.lang.java.programmer, however. -- Gary == 3 of 6 == Date: Sun, Nov 14 2004 11:12 pm From: "Tony Morris" <[EMAIL PROTECTED]> > I don't think so, Chris. In Java, any constructor that takes no parameters > is called a default constructor. This is not true. > This could be better checked on comp.lang.java.programmer, however. > -- When did a Usenet forum become the definitive source? Try Java Language Specification Second Edition 8.6.7 Default Constructor. Chris did mention however that class A{} is functionally equivalent to class B{public B(){}}. This is not true. I'll leave it up to you to figure out why (hint: 8.6.7 also). -- Tony Morris http://xdweb.net/~dibblego/ == 4 of 6 == Date: Sun, Nov 14 2004 11:16 pm From: "KiLVaiDeN" <[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 == 5 of 6 == Date: Sun, Nov 14 2004 11:37 pm From: [EMAIL PROTECTED] (Alf P. Steinbach) * Tony Morris: > > > I don't think so, Chris. In Java, any constructor that takes no parameters > > is called a default constructor. > > This is not true. > > > This could be better checked on comp.lang.java.programmer, however. > > -- > > When did a Usenet forum become the definitive source? > Try Java Language Specification Second Edition 8.6.7 Default Constructor. You mean §8.8.7. <url: http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#16823> -- A: Because it messes up the order in which people normally read text. Q: Why is it such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail? == 6 of 6 == Date: Mon, Nov 15 2004 12:03 am From: "Tony Morris" <[EMAIL PROTECTED]> > > Try Java Language Specification Second Edition 8.6.7 Default Constructor. > > You mean §8.8.7. > > <url: > http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#16823> That I do. -- Tony Morris http://xdweb.net/~dibblego/ ========================================================================== TOPIC: J2ME Clie TJ37 http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bddd3f7bc08dbf92 ========================================================================== == 1 of 1 == Date: Sun, Nov 14 2004 9:58 pm From: [EMAIL PROTECTED] (pepperMonkey) Hi, this is my first foray into the J2ME world so please be patient. I own a Clie TJ37 (Palm OS 5.2) and was wondering what J2ME implementations were available? I know of only MIDP4Palm which seems fairly old (Palm OS 3.5+). Is there any newer implementations? There is the Websphere Micro Edition but that seems to only support Palm Pilots and not Clies. Any help would be greatly appreciated. ========================================================================== TOPIC: Difference between JavaServerFaces and JavaServerPages+Swing ? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8aece321c50238bc ========================================================================== == 1 of 1 == Date: Sun, Nov 14 2004 11:24 pm From: [EMAIL PROTECTED] (Arnold Peters) Ok, I read a couple of intros for JavaServerFaces. But I could not figure out: What is the real difference between JavaServerFaces and the good ol' JavaServerPages+Swing Programming ? What can I do with JSF what I cannot with either JSP or Swing components ? Arni ========================================================================== TOPIC: Repainting a image in java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/218e95a0a0ff772 ========================================================================== == 1 of 1 == Date: Mon, Nov 15 2004 12:41 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> Guy wrote: > Now this image disappears whenever I resize the main frame. I managed > to make it draw again using repaint() and running the whole process > again each time the frame resizes, like it is said on many books and > websites. But this is very slow and resource consuming. > Is there a way to just save the image (maybe the Graphics2D object ?) > and redraw it again without all the hassle of constructing it from > scratch ? See the comp.lang.java.gui FAQ (just recently posted). In short, implement a proper paintComponent() method. /Thomas ========================================================================== TOPIC: Using java.util.regex in JDK 1.3 http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2a4390453d4e5927 ========================================================================== == 1 of 1 == Date: Mon, Nov 15 2004 12:47 am From: Christophe Vanfleteren <[EMAIL PROTECTED]> Chris wrote: > We've written an app that depends on the regex capability in JDK 1.4, and > now the app has to run under 1.3. Rather that do a rewrite to use another > regex package, I extracted the java.util.regex.* classes from 1.4 and put > them in their own .jar. If I put that .jar on the classpath, then > everything compiles fine under 1.3. When I try to run the app, though, I > get this error message: > > java.lang.SecurityException: Prohibited package name: java.util.regex > > I suppose I could change the package names in the regex source code and > recompile, but I'd rather not, because then I'd have to distribute this > new jar file, even when deploying under 1.4 or 1.5. > > Any thoughts on how to solve this problem? First of all, what you did was probably against the terms of your license, you just can't take random pieces out of a JRE. Instead of trying to take out the 1.4 regex classes, use another regex package, like one of these: http://jakarta.apache.org/regexp/ http://jakarta.apache.org/oro Porting your code to use one of these shouldn't be too much work. -- Kind regards, Christophe Vanfleteren ========================================================================== TOPIC: JRE 5.0 autoinstallation page? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bb1d843769ea8496 ========================================================================== == 1 of 1 == Date: Mon, Nov 15 2004 12:59 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> Ludovico Settembrini wrote: > Any word on when > > www.java.com/en > > will autoinstall j2re 5.0? I think you have to ask Sun about this, /Thomas ========================================================================== TOPIC: Access Oracle Objects via PLSQL from JDBC http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f049290e884fb671 ========================================================================== == 1 of 1 == Date: Mon, Nov 15 2004 1:31 am From: "Alexey J.1001958768" <[EMAIL PROTECTED]> Hello! How could I retrieve an OUT parameter of type Oracle Object (create type ....) from a PL/SQL procedure via JDBC? Is it possible? In oracle demos I couldn't find a such examples.... Thank you. ========================================================================== TOPIC: memory problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/843591c39a553b18 ========================================================================== == 1 of 1 == Date: Mon, Nov 15 2004 1:17 am From: "JML" <[EMAIL PROTECTED]> Hi, I've got a problem when my java app is running. The app spends all the heap memory. I need some guidelines or techniques to get free memory. I need free memory as much as possible. During the execution time, I launch the garbage collector but it is no enough. Thanks. ======================================================================= 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
