comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Multidimensional hash - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/eb079f5a11951085 * [ANN] Unified I/O for Java 2.1 released - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/37c4c6fdb5dd8971 * Unable to establish a socket connection - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3db1070c05ec0b49 * [REPOST] java.awt.Image problem - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7f984034b7d7f294 * opinion on coding standard - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1f96751a1d317c1a * Web page to build a web page - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ccb4904138d47a5e * Reading lines from a text file using The BufferedReader class - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/233d65fcdc22d9cc * How display Applcation in webbrowser? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/10d5ca1439a6bf65 * Finding Date Difference - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b9df8bc4e9c538dd * Java 1.5 where to get info from ? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3d8a99f29fbf389b * Sun's JMS API Tutorial: just hangs - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ffd2dbf4cfdc3ba9 * JSP compilation time difference? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/71db042e9bc46415 * Beginning EJB - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d49babfdb472b21c * Retrieving data from a hashmap from within a JSP - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e2993b48c4584aed * What the different between form ".this" and ".class"? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc0d4d78310386ca * how to fix the JFrame size? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ebe9bc0e6b94d453 * New String - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/480ebe0f50a46c11 * Generics: how to avoid overloaded methods? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/11b478096ef7c41f ============================================================================== TOPIC: Multidimensional hash http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/eb079f5a11951085 ============================================================================== == 1 of 1 == Date: Fri, Dec 3 2004 1:21 am From: Michael Borgwardt Todd B. wrote: > I would like to create a multidimensional hash such as: > > my %hash{string}{integer}{integer}= double || ""; > > or (less desirable): > > my %hash{integer}{integer}{integer}= double; comp.lang.perl is that way -----> > I have googled and search Sun's (sic) documentation and have not found > any examples. That's because such a thing does not exist, not exactly the way you imagine it. Write a class that has your parameters as fields, implement equals() and hashCode() for it, and use it as a key. Using Generics, you could probably do that in a generic, typesafe way using an array of Object. It might be that the Apache Commons Collections have something like that, but I doub it: http://jakarta.apache.org/commons/collections/ ============================================================================== TOPIC: [ANN] Unified I/O for Java 2.1 released http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/37c4c6fdb5dd8971 ============================================================================== == 1 of 1 == Date: Thurs, Dec 2 2004 11:56 am From: [EMAIL PROTECTED] (Greg Bishop) Can you find the free disk space yet? -G ============================================================================== TOPIC: Unable to establish a socket connection http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3db1070c05ec0b49 ============================================================================== == 1 of 2 == Date: Thurs, Dec 2 2004 3:51 pm From: Steve Horsley S J Rulison wrote: > Before I make this comment I would like to state that I have been > listening to and trying everybody's suggestions and I do appreciate > your help. > > I made an interesting discovery in my continuous Socket Connection > dilemma. I bought a book last week called Java Security Solutions by > Rich and Johennie Helton. There is a chapter in the book pertaining > to the Java Security Manager, which led me to the java security.policy > file (%systemdrive%\Program > Files\Java\jre1.5.0\lib\security\security.policy). I discovered that > if you modify the file by adding the following line to one of the > grant statements, a connection can be established across the network > and the applet will work. > > Grant{ > Permission java.net.SocketPermission "IP Address:port", "connect, > accept"; > } > > This of course is not a solution since it would not be practical to > modify the security.policy file on every client attempting to access > the server but it sounds to me like the problem resides in the > security manager. Like Andrew says, you don't need to do that stuff if your applet is just calling back to the source server. What string do you get if you print getCodeBase.getHost()? "Didn't have much luck" doesn't tell us much. Steve == 2 of 2 == Date: Thurs, Dec 2 2004 1:01 pm From: [EMAIL PROTECTED] (S J Rulison) Before I make this comment I would like to state that I have been listening to and trying everybody's suggestions and I do appreciate your help. I made an interesting discovery in my continuous Socket Connection dilemma. I bought a book last week called Java Security Solutions by Rich and Johennie Helton. There is a chapter in the book pertaining to the Java Security Manager, which led me to the java security.policy file (%systemdrive%\Program Files\Java\jre1.5.0\lib\security\security.policy). I discovered that if you modify the file by adding the following line to one of the grant statements, a connection can be established across the network and the applet will work. Grant{ Permission java.net.SocketPermission "IP Address:port", "connect, accept"; } This of course is not a solution since it would not be practical to modify the security.policy file on every client attempting to access the server but it sounds to me like the problem resides in the security manager. ============================================================================== TOPIC: [REPOST] java.awt.Image problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7f984034b7d7f294 ============================================================================== == 1 of 1 == Date: Thurs, Dec 2 2004 9:06 pm From: Babu Kalakrishnan MaSTeR wrote: >>I think I lost you there. Do you mean to say that the display looks >>damaged even when you force a refresh by doing the above ?? I'd expect >>the display to become trashed as soon as it is updated from the other >>thread, and continue to be that way till something else (like the >>iconizing / restoring) forces it to refresh itself (at which point it >>should display properly). If this is the observed behaviour, that isn't >>very surprising at all. Proper synchronization should fix the issue. >> > > That's exactly what I would expect from a sync issue. Unfortunately it > behaves the opposite way (!). When I redraw the buffer from scratch it > paints correctly and as soon as I refresh it (by scrolling it manually or > forcing repainting in any ither way) it gets corrupted. Also I tried some > extreme synchronization measure like sync the whole methods and didn't work, > it just slowed down insertion of new records. > > Then the most probable cause is that the way you're creating the buffered image is at fault. Very difficult to speculate any further without seeing the code. > >>>>Also I assume you're also ensuring that the paint() method gets called >>> >>>>from the update() method. (i.e. if you're overriding update). >>> >>>I do, the super class implementation clears the screen, causing > > flickering > >>>and it was unnecessary since my ticker repaints the whole area. >>> >> >>This means that the way you're performing double buffering is broken. >>The clearing of the screen is exactly what you *avoid* by using double >>buffering. >> > > Not sure about this last point, I do avoid clearing of the screen by > overriding update in this way: > > // Overrides this method to prevent the superclass to clear the screen at > each repaint. > > public void update(Graphics g) > > { > > paint(g); > > } > > You said in your last post that the super class implementation clears the screen. In standard double-buffered painting implementations , you normally never call the super.paint() (or super.update()) - that's the reason I said that the implementation is broken. By the way about your reluctance/inability to create a smaller example that exhibits the problem : If you are certain that it is only the combination of all those multiple jar files that causes this anomaly, then your problem is far too complicated to find a solution in a newsgroup - you had better hire a consultant to do it for you. Normally, it should be possible to rig up a small example by removing all unnecessary code, and by substituting any complex painting code with simpler ones. (It is also possible that you might even find the cause of your problem when you do this exercise). Yes - it does mean spending a certain amount of time, but you can't expect others to spend time on _your_ problem if you aren't willing to do so yourselves. BK ============================================================================== TOPIC: opinion on coding standard http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1f96751a1d317c1a ============================================================================== == 1 of 1 == Date: Fri, Dec 3 2004 3:39 am From: "Tim Ward" "Michael Borgwardt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > For example, extreme programming strongly discourages "code ownership". As did "egoless programming" and pretty well every other "methodology" invented since the early 1980s. If someone wants to "own" some code and not let anyone else work on it then in approximately 100% of cases this is simply because the code is crap and they don't want anyone to find out. -- Tim Ward Brett Ward Limited - www.brettward.co.uk ============================================================================== TOPIC: Web page to build a web page http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ccb4904138d47a5e ============================================================================== == 1 of 1 == Date: Thurs, Dec 2 2004 1:12 pm From: [EMAIL PROTECTED] (Joe C) Does anyone have any suggestions or examples of creating a web page to allow an end user to design a form. I need to design an application where the end user (administrator) can design a form with standard html components such as text boxes, drop down lists etc. Attach drop down list to database tables, and enter expression for certain fields. Then once the form is saved another user (business) can display the form and fill it in, at which time the expressions would be evaluated based on the data entered. ============================================================================== TOPIC: Reading lines from a text file using The BufferedReader class http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/233d65fcdc22d9cc ============================================================================== == 1 of 3 == Date: Thurs, Dec 2 2004 6:53 pm From: Andrew Thompson On Fri, 03 Dec 2004 01:36:36 GMT, NOBODY wrote: > -stop silently catching exceptions... More on that.. <http://www.physci.org/codes/javafaq.jsp#stacktrace> -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane == 2 of 3 == Date: Thurs, Dec 2 2004 5:17 pm From: [EMAIL PROTECTED] (Bob) i have to make a program that creates a file called input.txt. the user goes into this file and types a list of words in a line on many lines the program is suppose to make a file called output.txt that takes every word from input.txt and displays one per line. words that are made out of four letters get replaced to four stars, ****. i did the program, the only problem is, it will only read the first line of the input.txt file for some reason. Here is my code from the reading of input.txt and writing of output.txt if u can tell me why it won't read the second line in input.txt that owuld be great! public static void readFile () { String word = "", line = ""; BufferedReader input; PrintWriter output; try { input = new BufferedReader (new FileReader ("Input.txt")); output = new PrintWriter (new FileWriter ("Output.txt")); line = input.readLine (); while (line != null) { try { for (int i = 0 ; i < line.length () ; i++) { if (line.charAt (i) == ' ') { if (word.length () == 4) output.println ("****"); else { output.println (word); } word = ""; } else word += line.charAt (i); } if (word.length () == 4) output.println ("****"); else output.println (word); line = input.readLine (); output.close (); } //end try catch (NullPointerException e2) { } } //end while != null } //end try catch (IOException e) { } } thnx a lot guys ;) == 3 of 3 == Date: Thurs, Dec 2 2004 5:43 pm From: Alex Kizub Bob wrote: > i did the program, the only problem is, it will only read the first > line of the input.txt file for some reason. It reads all lines. You only close output too soon. Move this close line outside the while loop. You close it for each line :) Alex Kizub. ============================================================================== TOPIC: How display Applcation in webbrowser? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/10d5ca1439a6bf65 ============================================================================== == 1 of 2 == Date: Fri, Dec 3 2004 1:11 am From: Andrew Thompson On Fri, 3 Dec 2004 16:19:51 +0900, bogolim wrote: > Applet can be displaied by <applet>tag in HTMLdocument, but I don't know how > application .. What application? How big (in Kb) is it? Did you write it? Do you have the source code? >..can be displaied in my homepage. It is easy enough to *launch* an application *from* an applet. <sscce> import java.awt.*; public class LaunchApplet extends java.applet.Applet { public void init() { Frame f = new Frame("Application Frame"); f.setSize( new Dimension(200,200) ); f.setVisible(true); } } </sscce> Is that what you mean? Though applications often do things that are not permitted in the browser environment unless signed. > Please, teach me the way. Please don't act pathetic. This is not an online help-desk, and while most people will 'help when you get stuck', they get tired of 'spoon-feeding' information to a person very quickly. To achieve what you want (if it is practical) you will need to learn a great deal. -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane == 2 of 2 == Date: Thurs, Dec 2 2004 11:19 pm From: "bogolim" Applet can be displaied by <applet>tag in HTMLdocument, but I don't know how application can be displaied in my homepage. Please, teach me the way. ============================================================================== TOPIC: Finding Date Difference http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b9df8bc4e9c538dd ============================================================================== == 1 of 2 == Date: Thurs, Dec 2 2004 12:18 pm From: Andrew Thompson On Thu, 02 Dec 2004 19:44:08 GMT, Mick wrote: > C:\....._jsp.java:35: expected ... expected ..what exactly? The compiler is usually more specific. -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane == 2 of 2 == Date: Thurs, Dec 2 2004 11:44 am From: "Mick" "Andrew Thompson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 02 Dec 2004 18:31:26 GMT, Mick wrote: > > Please refrain form top-posting Mick, I find it nost confusing.. > <http://www.physci.org/codes/javafaq.jsp#netiquette> > > > Why does this not compile?? > > > > Calendar thisCal_1 = Calendar.getInstance(); > > thisDate_1 = new java.util.Date(strStartDate); > > thisCal_1.setTime(thisDate_1); > > That would depend on the compilation errors, which are a lot more > specific than 'not compile' amd actually reference line numbers. > <http://www.physci.org/codes/javafaq.jsp#exact> > > Check especially the links to 'compile time' error messages at > the end of that section. C:\....._jsp.java:35: expected thisCal_1.setTime(thisDate_1); ^ 1 error The 'arrow' is actually under the opening bracket ( Mick > > HTH > > -- > Andrew Thompson > http://www.PhySci.org/codes/ Web & IT Help > http://www.PhySci.org/ Open-source software suite > http://www.1point1C.org/ Science & Technology > http://www.LensEscapes.com/ Images that escape the mundane ============================================================================== TOPIC: Java 1.5 where to get info from ? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3d8a99f29fbf389b ============================================================================== == 1 of 1 == Date: Fri, Dec 3 2004 4:04 am From: Michael Borgwardt Steve Webb wrote: > Hi I've read a little about java 1.5 and the language changes but > there also seems to be a whole load of API changes & additions. Is > there a site that lists not just all the language changes but also all > the other changes that have taken place ? http://java.sun.com/j2se/1.5.0/docs/relnotes/features.html ============================================================================== TOPIC: Sun's JMS API Tutorial: just hangs http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ffd2dbf4cfdc3ba9 ============================================================================== == 1 of 2 == Date: Thurs, Dec 2 2004 1:15 pm From: "TC" One other thing. The orb.properties file has: port=1050 host=localhost Should these be the same on both machines? TC wrote: > Andrew Thompson wrote: > > > On Thu, 02 Dec 2004 20:24:35 GMT, TC wrote: > > > > > ...API tutorial ... > > > > [1] > > > > > I'm not sure what info to add to the post. Let me know and I'll > > > add it. > > > > [1] URL. As well, add an SSCCE. > > <http://www.physci.org/codes/sscce.jsp> > > Er, eh, OK. > > I have a client and a server type setting. Client 1 puts a message > into a queue for client 2 to read out. Client 1 succeeds in sending > the message. Client 2 just hangs out there like it's still waiting. > It's like the two machines do not see each other. If I run the code > for both on one machine, it works. > > (all from command line) > > Client 1 > ======== > c:\j2ee -verbose > > c:\j2eeadmin -addJmsFactory jms/EarthQFC queue -props > url=corbaname=iiop:earth:1050#earth > > Client 2 > ======== > c:\j2ee -verbose > > c:\j2eeadmin -addJmsFactory jms/EarthQFC queue > > Client 1 > ======== > java -Djms.properties=%J2EE_HOME%\config\jms_client.properties > SimpleQueueSender MyQueue 3 > (works fine and says 3 messages sent) > > Client 2 > ======== > java -Djms.properties=%J2EE_HOME%\config\jms_client.properties > SimpleQueueReceiver MyQueue > (just sits and waits like nothing in the queue) == 2 of 2 == Date: Thurs, Dec 2 2004 12:35 pm From: Andrew Thompson On Thu, 02 Dec 2004 20:24:35 GMT, TC wrote: > ...API tutorial ... [1] > I'm not sure what info to add to the post. Let me know and I'll add it. [1] URL. As well, add an SSCCE. <http://www.physci.org/codes/sscce.jsp> -- 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: JSP compilation time difference? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/71db042e9bc46415 ============================================================================== == 1 of 1 == Date: Thurs, Dec 2 2004 6:57 pm From: Andrew Thompson On Fri, 03 Dec 2004 01:46:01 GMT, Alex Kizub wrote: > Always, with cash .. Note 'cache' -> 'storage place, rather than 'cash' -> 'money as coin or notes'. > ..in browser. [ Normally I do not comment on misspellings, but this is a technical matter where a person might get entirely the wrong idea if they looked up 'cash' in a dictionary and tried to relate that to browser behaviour. "What do mean I need to pay my browser?!?" ;-) ] -- 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: Beginning EJB http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d49babfdb472b21c ============================================================================== == 1 of 2 == Date: Fri, Dec 3 2004 1:14 am From: Michael Borgwardt Ann wrote: > I heard a rumor that EJB is now "old hat." Can anyone confirm? As in "nobody cares for it anymore"? Definitely not. There isn't really anything that supersedes it. Quite, the opposite, actually: the new EJB 3.0 spec is considered a big improvement. The thing is that EJBs are not for everyone: they add a lot of overhead (both in development and performance-wise), and most applications don't actually need the "value added" they provide. This has become more common knowledge than it used to be, when EJBs were hyped relentlessly. There are a lot of people who bought into the hpye and were disappointed with the results because EJBs were simply not the right tool for their problem. == 2 of 2 == Date: Thurs, Dec 2 2004 11:52 am From: "Nagu" Hello All, I have interests to pursue career in components development (EJB ). Where do I start. I have good knowledge about JAVA language but not on any other J2EE or J2Se technologies? What are the prerequisites to learn EJB? Thanks Much Nagendra ============================================================================== TOPIC: Retrieving data from a hashmap from within a JSP http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e2993b48c4584aed ============================================================================== == 1 of 1 == Date: Thurs, Dec 2 2004 2:42 pm From: [EMAIL PROTECTED] (kbd) Hello: I can not understand what I have done wrong. I need to test if a key/value pair exists in a hashmap from within a JSP. I though this would be simple. Struts is also involved here, but I do not believe that Struts is causing any problems. The key/values are placed in the hashmap as follows: hMap = new HashMap(20); while ( rs.next() ) { fRoles = new FormRoles(); fRoles.setFormName(rs.getString("FormName")); fRoles.setCreate( ( rs.getInt("C")==1)? true:false ); fRoles.setRead( ( rs.getInt("R")==1)? true:false ); fRoles.setUpdate( ( rs.getInt("U")==1)? true:false ); fRoles.setDelete( ( rs.getInt("D")==1)? true:false ); hMap.put(rs.getString("FormName"), fRoles); } //while user.setFormRoles( hMap); In the above code I place the FormRoles objects into the hashmap with a String as the key. I will be able to retrieve the objects with a String. Ie. if the form name is "manager", get("manager") will return the corresponding FormRole object. Correct?? Here is my JSP: <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="c_rt" uri="http://java.sun.com/jstl/core_rt" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <html> <head> <title>Welcome World!</title> <html:base/> </head> <body bgcolor="white"> <logic:present scope="session" name="user"> <h3>Welcome <bean:write name="user" property="userId"/>!</h3> <br> <bean:write name="user" property="userFName"/> <bean:write name="user" property="userLName"/> </logic:present> <logic:notPresent scope="session" name="user"> <h3>Welcome World!</h3> </logic:notPresent> <html:errors/> <ul> <li><html:link forward="logon">Sign in</html:link></li> <logic:present scope="session" name="user"> <li><html:link forward="logoff">Sign out</html:link></li> <br> <br> <bean:define id="fRoles" name="user" property="frmRoles" type="java.util.HashMap" toScope="page"/> <logic:iterate id="element" name="fRoles"> Key is <bean:write name="element" property="key"/> <br> Value is <bean:write name="element" property="value"/> <br> </logic:iterate> <c:forEach var="element" items="${fRoles}"> <c:out value="Key=${element.key}, Value=${element.value}"/> <br> </c:forEach> fRoles.size() returns <%= fRoles.size() %> <br> fRoles.keySet() returns <%= fRoles.keySet() %> <br> fRoles.containsKey("manager") returns <%= fRoles.containsKey("manager") %> <br> <c:forEach items="${fRoles}" var="item"> <c:if test="${item.key == 'manager'}"> Found manager </c:if> </c:forEach> <c:choose> <c:when test= '<% fRoles.get("manager") != null %> '> Found formRoles manager </c:when> <c:otherwise> NOT Found </c:otherwise> </c:choose> </logic:present> </ul> <img src='struts-power.gif' alt='Powered by Struts'> </body> </html> Here is the resulting page: Welcome BC! B C * Sign in * Sign out Key is country Value is [EMAIL PROTECTED] Key is manager Value is [EMAIL PROTECTED] Key is region Value is [EMAIL PROTECTED] Key is currency Value is [EMAIL PROTECTED] Key is classificationType Value is [EMAIL PROTECTED] Key is managerFundClass Value is [EMAIL PROTECTED] Key is pgsPortfolio Value is [EMAIL PROTECTED] Key is pgsMgrAllocations Value is [EMAIL PROTECTED] Key is pgsPortfolioShareClass Value is [EMAIL PROTECTED] Key is managerFund Value is [EMAIL PROTECTED] Key is classification Value is [EMAIL PROTECTED] Key=country , [EMAIL PROTECTED] Key=manager , [EMAIL PROTECTED] Key=region , [EMAIL PROTECTED] Key=currency , [EMAIL PROTECTED] Key=classificationType , [EMAIL PROTECTED] Key=managerFundClass , [EMAIL PROTECTED] Key=pgsPortfolio , [EMAIL PROTECTED] Key=pgsMgrAllocations , [EMAIL PROTECTED] Key=pgsPortfolioShareClass , [EMAIL PROTECTED] Key=managerFund , [EMAIL PROTECTED] Key=classification , [EMAIL PROTECTED] fRoles.size() returns 11 fRoles.keySet() returns [country , manager , region , currency , classificationType , managerFundClass , pgsPortfolio , pgsMgrAllocations , pgsPortfolioShareClass , managerFund , classification ] fRoles.containsKey("manager") returns false NOT Found This tells me that I have a valid hashmap object. But why, oh why does fRoles.containsKey("manager") return false. I am stumped. Thanks much for looking at this issue. best regard. kd ============================================================================== TOPIC: What the different between form ".this" and ".class"? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc0d4d78310386ca ============================================================================== == 1 of 1 == Date: Thurs, Dec 2 2004 7:30 pm From: "Bruce Sam" Here ".class" not means the class file.For example,in "String.class.toString();".What does the ".class" and ".this" means? ============================================================================== TOPIC: how to fix the JFrame size? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ebe9bc0e6b94d453 ============================================================================== == 1 of 1 == Date: Fri, Dec 3 2004 2:30 am From: [EMAIL PROTECTED] (FET) "nick" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > i want to fix the JFrame size , make it can't resize > > thanks! //set the bounds of the frame setBounds ( x , y , width , height ); setResizable ( false ); ============================================================================== TOPIC: New String http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/480ebe0f50a46c11 ============================================================================== == 1 of 1 == Date: Thurs, Dec 2 2004 12:29 pm From: [EMAIL PROTECTED] (Yamin) "Ann" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... <snip> > > That's a NON-PUBLIC CONSTRUCTOR, and "value" is the char[] the > > current string is based on, which is referred to in the new String, > > not copied. > > > > Which has exactly the consequences I explained. > > 1. the word 'new' is used > 2. the word 'public' is used > Am I still confused? Does 'new' mean 'share'? Does 'public' mean > 'NON-PUBLIC'? The world new just creates a new Object. THis has nothing to do with the underlying char[]. Just walk through a simple example. I will refer to the char array inside String as String.charArray which is of type cher[]; This example is meant to explain the substring issue. Don't nitpick anything else, like static initialization or the resizing of the actual array. Imagine a String class as follows: class String { char charArray[] = null; int offset = 0; int length = 0; ... } when you 'new' a String object...all you do is create these 3 members initialzed as they are shown above. Its the contructor that you call String with that may or may not do special stuff. In the case of the charArray...it is just like an object. It points to something. Assigning one array to the another does NOT create a copy of all the elements. String foo = "Hello World"; //this creates a new String object called foo //foo.charArray = new char[11]; //foo.length = 11; //foo.offset = 0; //the data "Hello World" is copied into foo.charArray String bar = foo.subString(0,5); //this creates a new string object called bar //bar.charArray = foo.charArray //bar.offset = 0; //bar.length = 5; now suppose foo is no longer needed. the actual character array cannot be deleted because bar.charArray points to the same thing. So now, I'm wasting memory. In this case, its a trivial amount. I would never advise anyone to actually take any special action here, unless they're really doing an extreme case. like: String foo = "Hello World. My name is Ann...." //use 5 MB worth of text String bar = foo.subString(0,5); //foo is not used again, but bar is What i would do now instead is String bar = new String( foo.subString(0,5) ); Other than cases like this, its not something you should never think about. On to the other note...when he spoke of NON-PUBLIC constructor, he's referring to the fact that the constructor used by substring is not available to us regular people. Just look up the JAVA api for string. You won't find that constructor there. You can't use that constructor. Yamin ============================================================================== TOPIC: Generics: how to avoid overloaded methods? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/11b478096ef7c41f ============================================================================== == 1 of 1 == Date: Thurs, Dec 2 2004 2:30 pm From: "John C. Bollinger" Michael Borgwardt wrote: > I'm currently using generics quite intensively and have run into a > problem with > the following configuration: > > class DataBase{} > class DataSub extends DataBase{} > > class ControllerBase<D extends DataBase>{ > void method(D d); > } > > class ControllerSub<D extends DataSub> extends ControllerBase<D>{ > void method(D d); > } > > My Problem is I think that, due to type erasure, method() in ControllerSub > does not override method() in ControllerBase, it overloads it, i.e.: > > class ControllerBase{ > void method(DataBase d); > } > > class ControllerSub extends ControllerBase{ > void method(DataSub d); > } For what it's worth, javap confirms your hypothesis. > The result is that client classes that know only about ControllerBase > end up > calling method(DataBase) even when doing it with an instance of DataSub > through an instance of ControllerSub. > Any idea how to avoid this and still keep the type safety Generics > provide as > much as possible? I don't see a way to cause ControllerSub.method(D') to override ControllerBase.method(D) while still exposing the narrower type to ControllerSub.method's body. Perhaps, then, it is useful to fall back on a tried and true typesafe mechanism such as the Visitor pattern (a.k.a. double dispatch). It is conceivable that you could even use the observed overloading behavior in your favour in such a scenario, although I haven't worked out quite how that would work just yet. John Bollinger [EMAIL PROTECTED] ============================================================================== 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
