comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * [OT] Using hobby source code in your job ? - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a60dfe865a7807c4 * Tomcat 5, EL Expressions in jsp:inlcude - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4da7307e1d9d37b9 * Sockets - 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/edecab678cd31cd6 * How to restrict direct access to JSP files, only allow access via servlet? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/514c912d89045a82 * tomcat 3.3.2 and jwsdk1.4 - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6cc9154b641ca49 * ActiveX Container in Java - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/188085b06e48f3d1 * searching strings - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d03e3ab90a0d69cb * Help using String.split(..) - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fca5e4b22d736835 * Java better get a rich thin client, or it will die!!! - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9d0a115aefea785f * math.pow rounding problem - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3e00e118892196bb * Thoughtsworks Job Interview? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/65e47be2d93e5821 * Can Java Programmer Learn C++ Quickly? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7c7a28aa864e41ec * Java method - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7e41087585d0c108 * Casting Object to Array type - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/66c662ceb6d5cf17 ============================================================================== TOPIC: [OT] Using hobby source code in your job ? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a60dfe865a7807c4 ============================================================================== == 1 of 3 == Date: Tues, Dec 7 2004 2:06 am From: "Andrew Koenig" "Mark McIntyre" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Under UK and EU law, they can't do that without asking you to sign a new > contract, and you have no obligation to do so. Furthermore they can't > dismiss you for refusing. Things aren't like that in the USA. == 2 of 3 == Date: Mon, Dec 6 2004 8:56 pm From: Jim P RCollins wrote: > > > Andrew Koenig wrote: > >> "RCollins" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> >> >>> Hmmm ... my company (Raytheon) has a well-defined and documented policy >>> on what constitutes "my time" and "their time". This is contained >>> within the "conflict of interest" company practices, and referenced by >>> the company's "ethics standards" that all employees are required to >>> learn (we are also required to get 'refresher' training in these >>> subjects each year). >> >> >> >>> Some weeks, my job requires me to work considerably more than the >>> standard 40 hours ... but no one there would even *think* about taking >>> my "hobby programming" from me without (a more than generous) >>> compensation. >> >> >> >> If your employer changed their mind about this policy, there wouldn't >> be much you could do about it short of leaving. >> So it's not really your time--it's time that they are letting you have >> at their discretion. >> >> > > Not likely... most U.S. busniness are *not* the evil overlords that most > science-fiction writers would have you believe. > > A modern engineering company (such as Raytheon) tries very hard to keep > it's engineering staff happy and "well fed" with intersting projects. > If I create something "on my own time" that the company wants, they will > truly make me a very generous offer for that product. In 20 years, I > have never heard of the company "comandeering" a hobby project from an > employee. (Although I personally know of several people who earned an > outstanding bonus or 'perk' due to hobby research they were pursueing on > their own.) > That matches with what I would expect from any large company. Formal policies and concepts. But smaller companies - - it might not be the same - - I still feel it is up to how it is handled and what a persons attitude about it is to the company. If the conversations are handled right. But if handled wrong then emotions come into play and anything can happen. Jim P. == 3 of 3 == Date: Tues, Dec 7 2004 5:37 am From: "Ann" "Jim P" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Mark McIntyre wrote: > > > On Mon, 06 Dec 2004 01:10:09 GMT, in comp.lang.c , "Andrew Koenig" > > <[EMAIL PROTECTED]> wrote: > > > >>If your employer changed their mind about this policy, there wouldn't be > >>much you could do about it short of leaving. > > > > > > Under UK and EU law, they can't do that without asking you to sign a new > > contract, and you have no obligation to do so. Furthermore they can't > > dismiss you for refusing. > > > > > >>So it's not really your time--it's time that they are letting you have at > >>their discretion. > > > > > > When you have children, you realise that there is no such concept as "your" > > time..... > > > AH, not quite but you are close on that. I have a great kid that I spend > a lot of time with. Girl friends kid. and we work as a team. really a > bright boy. 9 years old and already learning VB. I got him a book > called Beginning programming for Dummies and he is reading it on his own > and playing on the computer doing code. Asks questions and learns. - I > do not live with his mother. SO a lot is done on his own. He wants to > come over and spend a day watching me program in Delphi. - - I am going > - ah huh. He is a quick learner. Show him once and he has it. and > understands it. - - > > Jim P. Kids are great that way. I started my younger boy at about that age on a Radio Shack Color Computer with built in MS basic. He learned it all himself, was motivated by being able to easily make various graphics games. ============================================================================== TOPIC: Tomcat 5, EL Expressions in jsp:inlcude http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4da7307e1d9d37b9 ============================================================================== == 1 of 2 == Date: Mon, Dec 6 2004 8:53 pm From: MF > It's a JSF issue. > > http://java.sun.com/j2ee/javaserverfaces/faq.html#includes > > > Looks like you will have to do > <f:subview><jsp:include /></f:subview> > Please let me know what you find out! > Nope, I'm already using <f:subview> tags. I still get HTML with unevaluated expressions. == 2 of 2 == Date: Mon, Dec 6 2004 8:16 pm From: The Abrasive Sponge MF wrote: > >> It's a JSF issue. >> >> http://java.sun.com/j2ee/javaserverfaces/faq.html#includes >> >> >> Looks like you will have to do >> <f:subview><jsp:include /></f:subview> >> Please let me know what you find out! >> > Nope, I'm already using <f:subview> tags. I still get HTML with > unevaluated expressions. You got me interested in using jspx. I did the following with something like this. I get some errors with my xhtml right now, but this may be something to consider. P.S. I am using jstl, which may be more useful because the import tag recognized the context path :) <f:subview id="form_subview"><c:import url="form_1.jspf"/></f:subview> ============================================================================== TOPIC: Sockets http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/edecab678cd31cd6 ============================================================================== == 1 of 4 == Date: Tues, Dec 7 2004 3:16 am From: Alex Kizub FunkyKarma wrote: It does matter... FunkyKarma, you are wrong in both your answers. > > But what will be the *content* of the communication? > > C programmers tend to want to just send structs, which is not portable. > It does matter... > > For example java.net.Socket doesn't implement out-of-band communication (at > least not the last time I checked). If your C/C++ app uses that socket > feature then you are screwed - unless you can find and use another Java > socket wrapper than what comes with the JDK. So, you assume that you have to know what language uses yahoo.com to read their web site? Pretty funny! Socket connection is socket connection, doesn't matter how much power you have about it. You know, in assmbler you are even more powerful and can do whatever you want! > > The content doesn't matter. Sending a struct is not a problem. On the > receiving end you just have to know what bytes were written onto the wire. > It doesn't matter at all if those bytes where part of a struct data > structure on the sending side. The "struct" doesn't get sent, but the bytes > that make up the struct does. So, you don't know about big/little endian and all other not important stuff like LF/CR or float mantissa or even bytes 7 bits long? Mainframe or Apple or other systems which you don't know can have a little rest today. Alex Kizub. == 2 of 4 == Date: Tues, Dec 7 2004 2:52 pm From: Ian T Alex Kizub wrote: > >>The content doesn't matter. Sending a struct is not a problem. On the >>receiving end you just have to know what bytes were written onto the wire. >>It doesn't matter at all if those bytes where part of a struct data >>structure on the sending side. The "struct" doesn't get sent, but the bytes >>that make up the struct does. > > > So, you don't know about big/little endian and all other not important stuff Endianess is irrelevant in the byte stream itself, only when you pull apart the byte stream and assign the bytes to primitives or structs do you need to know the endianness. Of course, if you don't know the endianess of the sending application, then you are entirely screwed. > like LF/CR or float mantissa or even bytes 7 bits long? People who send text streams are just sad :( and deserve all the CRLF problems that come their way. There should be a great big warning that comes with TCP/IP. USE BINARY. I would have to check the spec for TCP/IP, but I believe that 7 bit bytes are not part of the specification. If I am wrong, please feel free to post a link. > Mainframe or Apple or other systems which you don't know can have a little > rest > today. Thats nice, because they worked so hard. Ian == 3 of 4 == Date: Mon, Dec 6 2004 10:43 pm From: Chris Smith Steve Sobol <[EMAIL PROTECTED]> wrote: > Teo wrote: > > > Could a program written in Java communicate easily using the sockets with > > another program written in VC++ ? > > If you're communicating with sockets, it doesn't matter if the two programs > are > written in different languages. Steve's answer is right. I will, however, caution you against a problem that's often encountered here. When interacting with sockets in C or C++, it's very important to pay attention to byte order. Frequently we'll see questions from someone who's trying to do this and has forgotten to convert outgoing data to network byte order. If the host platform is little-endian (e.g., Intel) then the result appears to be garbage. This is a tricky bug because it doesn't appear if both sides of the socket are buggy -- the errors cancel themselves out. However, even in pure C++ it's quite dangerous, and likely to cause problems when communicating between two different hardware platforms (e.g., Sparc, whose host byte order differs from that of Intel). In BSD sockets, you'd want to pay attention to the functions called htonl, htons, ntohl, and ntohs. I haven't done socket programming in Windows, but my understanding is that Windows is a loose clone of BSD sockets, and these should work. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 4 of 4 == Date: Mon, Dec 6 2004 10:35 pm From: Steve Sobol Chris Smith wrote: > In BSD sockets, you'd want to pay attention to the functions called > htonl, htons, ntohl, and ntohs. I haven't done socket programming in > Windows, but my understanding is that Windows is a loose clone of BSD > sockets, and these should work. More than a loose clone - Windows retains most of the functionality of BSD sockets and adds some OS-specific functionality on top of that. In general, any software using BSD sockets should be easy to port to Winsock. Of note: In the functions named by Chris, "h" stands for "host" and "n" stands for "network." htonl and htons reformat values between "host" (OS-specific) and "network" (non-OS-specific) byte ordering and the other two functions convert the other way. -- 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. ============================================================================== TOPIC: How to restrict direct access to JSP files, only allow access via servlet? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/514c912d89045a82 ============================================================================== == 1 of 1 == Date: Mon, Dec 6 2004 7:54 pm From: [EMAIL PROTECTED] (Anan) How to restrict direct access to JSP files, but allow access only via servlet? Is it possible via .htaccess? If so, e.g. of a snippet on how to do it? Any other ways? Thanks. ============================================================================== TOPIC: tomcat 3.3.2 and jwsdk1.4 http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6cc9154b641ca49 ============================================================================== == 1 of 1 == Date: Mon, Dec 6 2004 8:01 pm From: "srini" Are there any compatibility issues?? I have a webapplication which does a lot of XML Processing. I used the EA from JAXB and am working on upgrading to the latest version. Everything compiles fine, but when i start my application, at some random stage, the page stops loading, but i dont see the webserver stopped due to any memory issues or anything. No errors in the logs either. My application has Older XML Libraries too. Is the conflict causing the issues. I am kind of stuck right now.. ============================================================================== TOPIC: ActiveX Container in Java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/188085b06e48f3d1 ============================================================================== == 1 of 1 == Date: Tues, Dec 7 2004 12:13 pm From: Dan [EMAIL PROTECTED] wrote: > Dan wrote: > >>Hi everyone, >>I've been looking all over the place for an ActiveX Container in > > Java. > >>If I cant find one I'll write one but I dont know where how. I know > > that > >>using the JavaBeans to COM bridge from sun I am able to have my >>JavaBeans run in any ActiveX container but not the other way around. > > I > >>was hoping that someone could help me out with this. >> >>Has anyone seen anywhere an ActiveX container written in Java? If not > > >>does anyone know how I would write my own container if it is > > possible. > > > At the risk of stating the obvious, I suspect you'll need to use > JNI (Java Native Interface). Naturally your Java will no longer be > platform neutral, but then again I suppose you abandoned any notions > of cross-platform-ability when you elected to use ActiveX. ;-) > http://java.sun.com/j2se/1.4.2/docs/guide/jni/ > > > -FISH- ><> > To be honest I dont know a lot about ActiveX, are you saying that ActiveX is a windows only technology? (i know this has nothing to do with this newsgroup, but it does follow on in this thread) So do you know what happens with Microsoft Work for Mac? I know microsoft have got Word for Mac, but does that mean that the mac version isnt and ActiveX control at all? Any ideas how I would do the same thing on a mac? Im trying to embed Word within my Java Application. Alternatively if I could find a class that allows viewing of a word document that would be sufficient for my needs. Can anyone help me with this? By the way, my thanks goes out to both of the replies so far. Daniel ============================================================================== TOPIC: searching strings http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d03e3ab90a0d69cb ============================================================================== == 1 of 2 == Date: Mon, Dec 6 2004 9:10 pm From: Anzime Scott Lopez wrote: > Look into regular expressions. There are good books on how to do this and > it may greatly simplify your task. > > "burchill" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>I am trying to write a kind of parser program, it is supposed to analyse >>a guitar tab file (just a plain txt file). It should extract any chord >>names in the tab file by trying match any text in the tab file with any >>text in a list of chords in (another seperate file); >> >>So far I have loaded both files into string variables and am trying to >>search them using the regionMatches string method. >> >>The chords (a list of all chords) file is in this format... >> >>466644 Absus >>466644 Absus4 >>466644 G#sus >>466644 G#sus4 >>545445 A11+ >>545445 A9(#11) >>545555 A7(#10) >>545555 A7-10 >>557585 D7sus >>557585 D7sus4 >>and so on... >> >>The numbers aren't important (they represent the fingering to play that >>chord). My main problem is that as you can see the chord names can vary >>in length (can be anything from 1 character up to 9). >> >>I am trying to write an algoritm that will take each chord name from the >>chord string and then search for it in the tab string. Each chord name >>starts on the 9th charcter on each line (including spaces as >>chararcters) but they don't all end at the same character on each line. >> >>Is there a way I can create a substring like this... >> >>tab.subSTring(8, end of line); >> >>Can I use the new line \n as a character to search for ? >> >>Any help appreciated. >> >>-- >>Eps >> e.g. String tab = "466644 Absus"; String chordName = tab.substring( 8, tab.length() ); -- Regards, Anzime == 2 of 2 == Date: Tues, Dec 7 2004 11:26 am From: Babu Kalakrishnan burchill wrote: > I am trying to write a kind of parser program, it is supposed to analyse > a guitar tab file (just a plain txt file). It should extract any chord > names in the tab file by trying match any text in the tab file with any > text in a list of chords in (another seperate file); > > So far I have loaded both files into string variables and am trying to > search them using the regionMatches string method. > Instead of reading the list file as a single string and trying to split it using a StringTokenizer as suggested, it would probably be easier to use a BufferedReader and use its readLine method to read individual lines into a List. > The chords (a list of all chords) file is in this format... > > 466644 Absus > 466644 Absus4 > 466644 G#sus > 466644 G#sus4 > 545445 A11+ > 545445 A9(#11) > 545555 A7(#10) > 545555 A7-10 > 557585 D7sus > 557585 D7sus4 > and so on... > > The numbers aren't important (they represent the fingering to play that > chord). My main problem is that as you can see the chord names can vary > in length (can be anything from 1 character up to 9). > > I am trying to write an algoritm that will take each chord name from the > chord string and then search for it in the tab string. Each chord name > starts on the 9th charcter on each line (including spaces as > chararcters) but they don't all end at the same character on each line. > > Is there a way I can create a substring like this... > > tab.subSTring(8, end of line); > > Can I use the new line \n as a character to search for ? > Once you have each line as a separate string, s.subString(8) will give you everything from index 8 (Character in position 9) onwards. You don't really need to use the 2 argument variant of the substring method and provide s.length() as the second argument. BK ============================================================================== TOPIC: Help using String.split(..) http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fca5e4b22d736835 ============================================================================== == 1 of 3 == Date: Mon, Dec 6 2004 10:43 pm From: Chris Smith Andrew Thompson <[EMAIL PROTECTED]> wrote: > Hi. Could you post questions of this nature to comp.lang.java.help * > rather than c.l.j.programmer in future? > > * <http://www.physci.org/codes/javafaq.jsp#cljh> Andrew, I'd appreciate it if you don't represent your own irritability toward easy questions as an accepted behavior of this newsgroup. The fact is that there's no clear definition of an "advanced" technical question, as this thread demonstrates. Have you appointed yourself as the judge? -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 2 of 3 == Date: Mon, Dec 6 2004 10:43 pm From: Chris Smith Ike <[EMAIL PROTECTED]> wrote: > Backslashes are escaped...so I think you want to use: > String[] sa=s.split("[\\\\]"); //4 backslashes > -or maybe even- > String[] sa=s.split("[\\\\\\]"); //6 backslashes > > try them both - one should work. You want four backslashes. Rather than programming by trial and error, it's nice to understand why something is required. Trial and error eventually fails you and causes indeterminate bugs to pop up for your customers; not a good thing. In this case, it's because Java String literals require backslashes to be escaped, and regular expressions also require the same thing. So the literal "[\\\\]" is actually only four characters long: [, \, \, and ] in that order. This sequence of characters is then passed to the regexp engine, which interprets the first backslash as an escape, so that the pattern matches a backslash character. An interesting implication is that if you were reading patterns from a text file instead of writing them in String literals, then the second level of encoding would not be necessary, so you would just write [\\] instead of [\\\\]. Note that the character class is also unnecessary, so you could have written the following instead of the code above: String[] sa = s.split("\\\\"); -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 3 of 3 == Date: Tues, Dec 7 2004 7:01 am From: Andrew Thompson On Mon, 6 Dec 2004 22:43:09 -0700, Chris Smith wrote: > Andrew Thompson <[EMAIL PROTECTED]> wrote: >> Hi. Could you post questions of this nature to comp.lang.java.help * >> rather than c.l.j.programmer in future? >> >> * <http://www.physci.org/codes/javafaq.jsp#cljh> > > Andrew, I'd appreciate it if you don't represent your own irritability > toward easy questions as an accepted behavior of this newsgroup. Just out of curiosity, you judge this as 'irritable'? "Hi. Could you post questions of this nature to comp.lang.java.help * rather than c.l.j.programmer in future?" > Have you appointed yourself as the judge? ditto? -- 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 better get a rich thin client, or it will die!!! http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9d0a115aefea785f ============================================================================== == 1 of 2 == Date: Tues, Dec 7 2004 5:44 am From: "Ann" "Keith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > Could some hot shot java programmer quickly come up with a light weight > java framework for creating rich thin web clients.... or the end will > be near for java... > > Flash is leap frogging java (in some ways) > Flash is expensive. == 2 of 2 == Date: Mon, Dec 6 2004 9:40 pm From: "Keith" Hello, Could some hot shot java programmer quickly come up with a light weight java framework for creating rich thin web clients.... or the end will be near for java... Flash is leap frogging java (in some ways) K ============================================================================== TOPIC: math.pow rounding problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3e00e118892196bb ============================================================================== == 1 of 1 == Date: Mon, Dec 6 2004 10:59 pm From: Chris Smith Chris Uppal <[EMAIL PROTECTED]> wrote: > answer is "wrong", and Chris's option (a) holds. However I wouldn't follow > him > in calling pow() "broken" since it is actually returning the /second/ closest > double to the correct answer (the one just above rather than the one just > below), and that is acceptable according the contract of pow() since it is > within one "ulp" of the mathematically correct answer. That's the answer I was missing. I should have read the API docs before asking, I suppose, but I just assumed that I already knew what they said. Turns out I didn't. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ============================================================================== TOPIC: Thoughtsworks Job Interview? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/65e47be2d93e5821 ============================================================================== == 1 of 1 == Date: Tues, Dec 7 2004 5:50 am From: "Ann" > We used coding tests ("Programmer Aptitude Test") at IBM many years ago. It > was actually pretty simple and tested logical thinking. However, it ran into > legal problems. A test used to select or reject candidates must be shown to > be predictive of the work to be done; i.e. does the outcome of the test > actually reflect the ability of the candidate to do the actual work? Unless > there is some formal proof, the test can be deemed predujicial and > restrictive. There must have been some bad hiring experiences in the past of the large company I worked for in the 1980s. We were told to not ask any question to a candidate that could be construed as a test of any kind. We could talk about their experience, education, and what they might be interested in. ============================================================================== TOPIC: Can Java Programmer Learn C++ Quickly? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7c7a28aa864e41ec ============================================================================== == 1 of 2 == Date: Tues, Dec 7 2004 1:04 am From: "Hal Rosser" "Rhino" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I realize that this is not entirely a Java question but I am hoping that > some of the people reading this newsgroup are Java programmers who went on > to learn C++. > > I am giving some thought to applying for some jobs that want people with > Java and C++ experience. I have been writing Java for several years and am > fluent enough that I don't have to post questions here very often. I have no > real C++ experience and not much C experience for that matter. > > However, the core Java statements are "borrowed" from C and C++ has often > been called "C with classes". It seems to me that it shouldn't take very > long to get up to speed on C++ if I am already fluent with Java and have at > least some knowledge of C. Then again, I understand that Java and C++ use > classes a bit differently; for instance C++ allows multiple inheritance > while Java allows only single inheritance but allows for multiple interfaces > as compensation. I'm not sure how long it would take to get fluent with > multiple inheritance after several years with Java. > > I'd be very curious to know how long it took people here who were fluent in > Java to get fairly fluent in C++ if they started with approximately the same > skills I have today. > I had a couple of years of Java behind me (and no C++), then went back to school for a MS degree, and had to take a 'Data Structures' class to qualify for the Masters program. The instructor chose C++ for the course. My Java background saved me. The syntax is similar and OO concepts are the same (for the most part). Watch out for pointer arithmetic and templates. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.799 / Virus Database: 543 - Release Date: 11/20/2004 == 2 of 2 == Date: Mon, Dec 6 2004 11:29 pm From: Phil Staite In a word, no... not quickly. That is, while you may be able to pick up on what existing C++ programs are doing fairly quickly, authoring your own OO programs from scratch in C++ is, well, different. Some of it is just different syntax, from minor to maddening... Like where you put [] in array declarations. Or the notion of separate header and source files. Or C++'s automatic (stack) based objects without new... Some of it is just fundamental differences in tool sets. Someone used to a nice slick GUI based IDE in Java will struggle with command line gcc ;-) Similarly someone coming from say a Borland or MS C++ IDE to a raw javac command line would struggle... You'll miss many of the things that are built in to Java such as GUI support, network IO, threading, and synchronization. To do those in C++ you'll have to learn platform specific APIs. (posix standards help some, where supported of course) You'll struggle with STL, while whole books have been written on C++ the language, whole other books are devoted just to the STL portion. As others have noted, you'll struggle with the power and peril of C++ - it not only makes it possible to shoot yourself in the foot, it loads and cocks the gun for you too. :-( Seriously though, some of the automatic conversions and conventions in C++ will drive you nuts, little things like integer types auto-converting to bool (oh yeah, boolean in java!) Or C++'s rather casual attitude about catching exceptions. Or that you get a choice in how to catch exceptions... If you're really adventureous you'll try fun things like multiple inheritence...and begin to appreciate Java's interface idiom... Speaking of idioms... There's a whole different universe of C++ idioms (at least 99% different from Java idioms) Then there's the wonderful world of debugging...memory leaks, stray pointers, uninitialized pointers... Oh, and the funny little thing that in C++ base class constructors get called first, always... And the whole virtual/non-virtual function call thing... Wait till you first bump into trying to make a virtual function call from a constructor or destructor... Or when you first learn about overloaded functions, and the dreaded "xxx hides function xxx declared in ..." warning... So while you may be able to start reading/writing C++ fairly quickly, it generally will take a long time to become well versed in it. By long time I mean a year to three would not be unusual. I've been doing C++ since the dark ages, about 15 years. Thanks to the ongoing efforts of the standardization committee and the slow pace of the tools catching up to said standard... even us long time veterans still bump into new/odd things. Of course, that's nothing new to Java programmers, you (we, I do Java too) have been dealing with a much more rapidly evolving and changing language. I'm not trying to discourage you. In fact, I'd encourage you or anyone else to learn at least a couple of languages. I believe it gives you a much better perspective on the overall process of programming. I just want you to go into this with an appreciation of what you're getting in to. That way you're less likely to get frustrated and give up. There is light/hope! ============================================================================== TOPIC: Java method http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7e41087585d0c108 ============================================================================== == 1 of 1 == Date: Tues, Dec 7 2004 6:54 am From: Andrew Thompson On Mon, 6 Dec 2004 18:55:34 -0600, Ryan Stewart wrote: > You have > now started three threads concerning the same topic. There seems to be a problem with Google postings, if this one fits the pattern, - the OP is using Google Groups beta - The message on post read 'could not post' - The OP pressed 'back' then reposted it (twice, presumably) -- 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: Casting Object to Array type http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/66c662ceb6d5cf17 ============================================================================== == 1 of 1 == Date: Mon, Dec 6 2004 11:15 pm From: "Mike Schilling" "Nikolaus Rumm" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I have to write a generic equality-check method that can handle > objects, arrays of primitives and arrays of objects. Something like... > > public void isEqual(Object aFirstValue, Object aSecondValue) { > ... > boolean isArray = aFirstValue.getClass().isArray(); > if (isArray) { > return Arrays.equals(aFirstValue, aSecondValue); // ERROR: type > cast missing > } > } > > My problem is that I have to cast the Object argument to an array type > so that the Java compiler recognizes that I don't want to call > Arrays.equals(Object), but Arrays.equals(Array1, Array2). > > I could cast the argument to Object[], but that wouldn't work with > primitive objects (i.e. byte[]). Of course I could do it the stupid > way and have a big if-then-else statement for all possible primitive > arrays, but thats beyond my reputation. Reputation? > > Is there any elegant way to solve this problem ? No. Object[] and the 8 varieties of scalar[] are all unrelated types (e.g. int[] is *not* a subclass or superclass of short[] ), and there's no way to treat them generically. ============================================================================== You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer" group. To post to this group, send email to [EMAIL PROTECTED] or visit http://groups-beta.google.com/group/comp.lang.java.programmer To unsubscribe from this group, send email to [EMAIL PROTECTED] To change the way you get mail from this group, visit: http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe To report abuse, send email explaining the problem to [EMAIL PROTECTED] ============================================================================== Google Groups: http://groups-beta.google.com
