comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Serial Port problem - 5 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1579f4366502d6e6 * Would like a preprocessor. - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f8d589c27ece424e * Rmi Unicastref on a ipv4/ipv6 system - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/78e5903b997519ac * Thread synchronization problem - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/51dbef92f81ca351 * handling package dependencies in jbuilder - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/91d3bfb0f223dfe7 * Message Transfer b/w Objects - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/746f43506361d9c7 * Print Services - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8828d55a69cc2e25 * Self-Mutation with Strategy Object - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7667c4e1519c515 * solution to the dinning philosopher problem - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3546a4e2a64af1af * ODBC Java Firebird - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4bd89240060c298f * Question to experienced java developers - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/821bea335295193e * WANTED: SOFTWARE INVENTIONS - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/31f204232b3af08 * JDK exec 1.3 vs 1.4 - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b0045fd477d34360 * Thread synchronization - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/172837b7b0667fd1 * Trampoline code again - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/74192ce76bbb47dc * sprintf - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/488e725956316480 ========================================================================== TOPIC: Serial Port problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1579f4366502d6e6 ========================================================================== == 1 of 5 == Date: Thurs, Sep 2 2004 12:20 pm From: "<- Chameleon ->" <[EMAIL PROTECTED]> "Paul Lutus" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > - Chameleon - wrote: > > > Enumeration portList = CommPortIdentifier.getPortIdentifiers(); > > > > this command returns an empty Enumeration. Why? > > Probably because of the rest of your code, which you don't show > the version of Java, which you don't name latest > the installation of the JAvCommAPI, which you don't describe latest > or your system, which you don't describe fully. I try to communicate with modem in COM1 ("ATDT123456789") > Are the ports activated in BIOS? yes > How did you install the JavaCommAPI? from Sun's readme.html. It works fine, but it does not recognize any port. > Where > is the rest of the code that handles the serial ports? ----------------- void function() { try { Enumeration portList = CommPortIdentifier.getPortIdentifiers(); CommPortIdentifier potId = CommPortIdentifier.getPortIdentifier("COM1"); // exception while (portList.hasMoreElements()) { // never true CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement(); // never run .......................... } } catch(Exception ex) { } } == 2 of 5 == Date: Thurs, Sep 2 2004 12:50 pm From: "nik[no-spam]cross" <"nik[no-spam]cross"@wet-wired.com> <- Chameleon -> wrote: > Enumeration portList = CommPortIdentifier.getPortIdentifiers(); > > this command returns an empty Enumeration. Why? > > My system is PC with WinXP. > I have 1 parallel and 2 serial ports > > As a first thought, have you initialized the comm driver. I forgot and couldn't see any ports until I used this: String driverName = "com.sun.comm.Win32Driver"; try{ CommDriver commdriver = (CommDriver)Class.forName(driverName).newInstance(); commdriver.initialize(); } catch (Exception e2) { e2.printStackTrace(); } If this doesn't help maybe you could post your code. == 3 of 5 == Date: Thurs, Sep 2 2004 12:31 pm From: "William Brogden" <[EMAIL PROTECTED]> On Thu, 2 Sep 2004 17:16:51 +0300, <- Chameleon -> <[EMAIL PROTECTED]> wrote: > Enumeration portList = CommPortIdentifier.getPortIdentifiers(); > > this command returns an empty Enumeration. Why? > > My system is PC with WinXP. > I have 1 parallel and 2 serial ports > > The usual reason is that your JVM is not finding the javax.comm.properties file. As I recall, it should be in JAVA_HOME/lib Bill -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/ == 4 of 5 == Date: Thurs, Sep 2 2004 3:26 pm From: "<- Chameleon ->" <[EMAIL PROTECTED]> > > Enumeration portList = CommPortIdentifier.getPortIdentifiers(); > > > > this command returns an empty Enumeration. Why? > > > > My system is PC with WinXP. > > I have 1 parallel and 2 serial ports > > > > > As a first thought, have you initialized the comm driver. > I forgot and couldn't see any ports until I used this: > > String driverName = "com.sun.comm.Win32Driver"; > try{ > CommDriver commdriver = > (CommDriver)Class.forName(driverName).newInstance(); > commdriver.initialize(); > } > catch (Exception e2) > { > e2.printStackTrace(); > } > > If this doesn't help maybe you could post your code. I have javax.comm.properties file inside <java dir>\lib directory and this file have this line inside: ------------- Driver=com.sun.comm.Win32Driver ------------- Your code works and thankyou, but why I must load dynamically this driver? If I want to run this code in Linux or other platform? Thanks again! == 5 of 5 == Date: Thurs, Sep 2 2004 7:05 pm From: JScoobyCed <[EMAIL PROTECTED]> <- Chameleon -> wrote: > ------------- > Your code works and thankyou, but why I must load dynamically this driver? > If I want to run this code in Linux or other platform? > > Thanks again! > Err... JavaCOM API is using a native library: win32comm.dll on Win plateforms, and something I don't rememeber .so on Solaris. For Linux and MacOS X (and actually also Win), you need the RXTX port of the JavaCOM API AND the solaris .so library. I have successfully used this port on RedHat, MacOS 10.2 and 10.3. http://users.frii.com/~jarvi/rxtx/download.html There are other ports, but I never tested them. -- JScoobyCed What about a JScooby snack Shaggy ? ... Shaggy ?! ========================================================================== TOPIC: Would like a preprocessor. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f8d589c27ece424e ========================================================================== == 1 of 2 == Date: Thurs, Sep 2 2004 12:31 pm From: [EMAIL PROTECTED] (Bent C Dalager) In article <[EMAIL PROTECTED]>, Paul Lutus <[EMAIL PROTECTED]> wrote: > >My point is that an ideal compiler will produce the same object file >(trivial reorderings aside) regardless of which of the legal syntax choices >the programmer makes in designing a specific algorithm. Same speed, same >size, or whatever trait was regarded as most important. What you seem to be saying, then, is that an ideal compiler will always produce the exact same output for a given problem and that if we ignore all other possible outputs that yield the same performance, there is one and only one specific output such a compiler can yield. Of course, I then understand "trivial reordering" to mean "a difference that doesn't impact on performance". If you have a different definition of "trivial reordering" in mind it would help if you described it. On its own it is a very vague term. If this is the case, however, then your statement isn't really of much interest. It's basically a bit like saying "Ford is the only car company in the world, given that we ignore everyone else who makes cars". Cheers Bent D -- Bent Dalager - [EMAIL PROTECTED] - http://www.pvv.org/~bcd powered by emacs == 2 of 2 == Date: Thurs, Sep 2 2004 1:06 pm From: "Liz" <[EMAIL PROTECTED]> "Paul Lutus" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Christopher Barber wrote: > > / ... > > >> Did you read what I said? Did you try to find out whether it is so? By > >> definition, an efficient compiler will create an optimal object file > >> regardless of the legal source syntax required to create it. > > > > But the compiler still cannot ignore the real semantic differences between > > try/throw and break/continue. > > That would produce different algorithms, so you in fact did not read what I > said. > > You are missing a very fundamental point. > > 1. The only way to justify goto, break, continue, et al.. is to show that > these constructs create the same logic, the same algorithm, as the more > structured alternatives. I think the GOTO maps into a JMP instruction ;-) > If, on the other hand, these methods changed the > basic algorithm, rather than merely the style of the source file, they > would be immediately disallowed, because the point -- design of a specific > algorithm with a specific outcome -- would be undermined. > > 2. Given all of (1) above, and given that the algorithm is the same in all > syntactically acceptable styles of programming it, an optimal compiler will > produce the same object code file for all the variations. > > > The designers of Java intended try/throw to > > be used for "exceptional" conditions, not regular control flow, and most > > compiler > > writers only try to optimize for the case in which no exception is thrown. > > I think if you actually do the measurement on this "efficient compiler" > > you speak of, you will almost certianly find that there is indeed a > > performance difference. > > Not for an optimally efficient compiler, unless two different algorithms > were intended. Surely you see this -- for each algorithm, there is ONE > optimal object file, just as there is ONE optimal outcome for each > Traveling Salesman problem. > > -- > Paul Lutus > http://www.arachnoid.com > ========================================================================== TOPIC: Rmi Unicastref on a ipv4/ipv6 system http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/78e5903b997519ac ========================================================================== == 1 of 1 == Date: Thurs, Sep 2 2004 12:38 pm From: [EMAIL PROTECTED] (Ben) Has anyone been able to get an RMI object to work on ipv6 and ipv4 at the same time? I have a server, 'middle' which runs ipv4 and ipv6. When I start up my RMI server on 'middle', the object binds into the registry and advertises the address "192.168.1.36" in the UnicastRef. When I jump onto my ipv4-only Windows box, I can access the object just fine. When I switch to my ipv6-only Linux box (not running anything ipv4!), the RMI client application is able to retrieve the RMI Server object from the registry on 'middle', but any subsequent invokation on that RemoteRef fail, because the Remote Reference that 'middle' returned said that the address is "192.168.1.136". I was able to verify this behavior using an ethernet sniffer (tcpdump) on 'middle'. I switched things around and ran the RMI Server on the ipv6-only box, and then ran the client on 'middle' and it all worked fine. Since the RMI Server had started on the ipv6-only server, the only available IP address was the ipv6 address. Thus, when the RMI client running on 'middle' retrieved the RemoteRef from the ipv6-only box, the RemoteRef contained the ipv6 address. So, the big question: how to I get a Remote object to bind in the registry and make it so that it'll work with ipv4 users and ipv6 uers? It doesn't seem that a RemoteRef can contain more than one "address" - and if that's the case, then I guess I'm severely hosed... Thanks! --Ben ========================================================================== TOPIC: Thread synchronization problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/51dbef92f81ca351 ========================================================================== == 1 of 1 == Date: Thurs, Sep 2 2004 12:53 pm From: "John C. Bollinger" <[EMAIL PROTECTED]> Vincent Lascaux wrote: >>In that case, your original download() method must not invoke the other >>methods of Data. Such an implementation is by definition incorrect. >>Once you fix that issue, you should not have a synchronization problem, >>but there may still be a better design. > > > My data object is a table that maintains several objects itself. I download > object by object and call a add(Object) method. This method has to be public > so that the Data object can be modified by the user of the class. It also > checks that the object added is valid (one of the rules for example is that > no two objects must have the same "name" (a property of the object)). I want > to reuse this add function (I dont want to copy and paste the body of the > function in my download method :^p ) Then it IS the case that Data's methods may meaningfully be invoked on a Data that is not fully loaded, at least sometimes. You denied that before. In any event, a solution along the lines I suggested may still be suitable. John Bollinger [EMAIL PROTECTED] ========================================================================== TOPIC: handling package dependencies in jbuilder http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/91d3bfb0f223dfe7 ========================================================================== == 1 of 2 == Date: Thurs, Sep 2 2004 1:25 pm From: [EMAIL PROTECTED] (ian ward) I want to have a look at an open source package which I have downloaded; xml-rpc as it happens. Creating a small project in jbuilder I need of course to be able to import the package. In the project properties I have tried to create a library where the project can find the package but jbuilder tells me it is unable to create the dependencies. As a result, even though the editor can see the package when prompting me for the import statement, instantiating a class from the package won't work as the class is not recognised. After looking at various threads in various groups, I know that problems with jbuilder and dependencies have come up in the past, but only similar and not the same - and I'm not very good at reading between the lines! thanks in advance == 2 of 2 == Date: Thurs, Sep 2 2004 2:23 pm From: kaeli <[EMAIL PROTECTED]> In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] enlightened us with... > I want to have a look at an open source package which I have > downloaded; xml-rpc as it happens. Creating a small project in > jbuilder I need of course to be able to import the package. In the > project properties I have tried to create a library where the project > can find the package but jbuilder tells me it is unable to create the > dependencies. As a result, even though the editor can see the package > when prompting me for the import statement, instantiating a class from > the package won't work as the class is not recognised. > > After looking at various threads in various groups, I know that > problems with jbuilder and dependencies have come up in the past, but > only similar and not the same - and I'm not very good at reading > between the lines! > > thanks in advance > I have to import oracle drivers for mine. This is what I did... 1. Make a project. 2. Project => Default project properties 3. Click on Required Libraries tab 4. Click on Add button 5. Click on New button to define a new library 5. For the Name, I put "Oracle drivers" (you put in your own) 6. For the Location, I choose User Home. (you choose what you want) Note that this is the location of the to-be-created library, NOT the location of the files you're importing. 7. Click the Add button next to the Library Paths box. Choose the file (jar or zip or whatever). 8. Click the okay button at the bottom. After that, you can use that library again in another project just by doing steps 1,2,3 and adding the defined library to stuff. Hope this was what you meant... -- -- ~kaeli~ When you choke a smurf, what color does it turn? http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace ========================================================================== TOPIC: Message Transfer b/w Objects http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/746f43506361d9c7 ========================================================================== == 1 of 2 == Date: Thurs, Sep 2 2004 1:47 pm From: [EMAIL PROTECTED] (Shravan Kumar Durvasula) Hi all: Here (http://www.erc.msstate.edu/~shravan/Hierarchy_files/slide0001.htm) is the hierarchy of the Java Swing application i want to develop. I have a "MainFrame" which has three panels (A, B and C). Those panels have sub panels ((A1, A2) (B1, B2) (C1, C2)). I have objects (which i am actually planning to implement as independent pluggable components using the "Observer" pattern) on these sub panels. Now let us say an event happens on "Obj O1" (changes state) and this should trigger a change on "Obj O10" and "Obj O12". What is the best way to implement this? I mean .. how can we transfer a message from an object somewhere in the tree to another object somewhere else in the tree? Because i am implementing object O1 as pluggable component (using Observer pattern), i can add O10 and O12 as listeners (Observers) to it. But, how can i get the reference of O10 and O12 in the panel A1? Could anyone please advice? Thanks a lot in advance, Shravan == 2 of 2 == Date: Thurs, Sep 2 2004 3:09 pm From: "David Hilsee" <[EMAIL PROTECTED]> "Shravan Kumar Durvasula" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all: > > Here (http://www.erc.msstate.edu/~shravan/Hierarchy_files/slide0001.htm) > is the hierarchy of the Java Swing application i want to develop. I > have a "MainFrame" which has three panels (A, B and C). Those panels > have sub panels ((A1, A2) (B1, B2) (C1, C2)). I have objects (which i > am actually planning to implement as independent pluggable components > using the "Observer" pattern) on these sub panels. > > Now let us say an event happens on "Obj O1" (changes state) and this > should trigger a change on "Obj O10" and "Obj O12". What is the best > way to implement this? I mean .. how can we transfer a message from an > object somewhere in the tree to another object somewhere else in the > tree? Because i am implementing object O1 as pluggable component > (using Observer pattern), i can add O10 and O12 as listeners > (Observers) to it. But, how can i get the reference of O10 and O12 in > the panel A1? > > Could anyone please advice? Have you considered making the Main frame a mediator, or creating a mediator at the main frame level? You could just have it listen for changes in the O1's state and have it modify O10 and O12. This seems to be the common approach for GUIs. -- David Hilsee ========================================================================== TOPIC: Print Services http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8828d55a69cc2e25 ========================================================================== == 1 of 1 == Date: Thurs, Sep 2 2004 2:10 pm From: [EMAIL PROTECTED] (Tim) I'm trying to use the Java 1.4 Print Services API for Printing, but I'm having an issue getting the PageRanges class to populate based on changes the user makes when the Print Dialog is shown. In the code below, I verified that PageRanges is a supported Attribute Category, But When I try to get the category from teh PrintService or the PrintJobAttributeSet I get Null. Has anyone had the same problem or do you know what I am doing wrong? I also tried a number of different DocFlavors but with no luck. Thanks, Tim public void print() { PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet(); DocFlavor flavor = DocFlavor.BYTE_ARRAY.JPEG; PrintService printService[] = PrintServiceLookup.lookupPrintServices(flavor,pras); PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService(); int upperBound = 20; PageRanges pr = new PageRanges(1,upperBound); pras.add(pr); PrintService service = ServiceUI.printDialog(null,200,200,printService,printService[0],flavor,pras); if (service != null) { Class[] c = service.getSupportedAttributeCategories(); PrintServiceAttributeSet p = service.getAttributes(); DocPrintJob job = service.createPrintJob(); PrintJobAttributeSet pjas = job.getAttributes(); ========================================================================== TOPIC: Self-Mutation with Strategy Object http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7667c4e1519c515 ========================================================================== == 1 of 1 == Date: Thurs, Sep 2 2004 2:12 pm From: Michiel Konstapel <[EMAIL PROTECTED]> > But question is: Is it safe? It seems that, where the code is marked > with a comment, the currently executing strategy is no longer referred > to by mStrategy, and so could possibly be garbage collected? Not to worry... > Or is this perfectly legal, because the collector will not collect an > object which is still executing code? ... because this is indeed the case :) Well, objects don't exactly execute code, threads do, but let's not nitpick. HTH, Michiel ========================================================================== TOPIC: solution to the dinning philosopher problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3546a4e2a64af1af ========================================================================== == 1 of 2 == Date: Thurs, Sep 2 2004 3:13 pm From: steve <[EMAIL PROTECTED]> On Fri, 3 Sep 2004 02:32:57 +0800, Yan Zhou wrote (in article <[EMAIL PROTECTED]>): > Hi there, > > I have code a program that solves the dinning philosopher problem. But there > is still room to improve. > > My solution is to acquire both forks at any given time. If a philosopher > first gets the left fork, and then tries to get the right fork, that may > risk starvation. > > The current solution locks on the list object (which contains all fork > objects). Thus, only one philosopher can acquire two forks at any given > time, and multiple philosophers can eat at the same time. Once a philosopher > acquires the forks, they are removed from the list; and philosopher returns > the forks to the list after he finished eating. > > I would like to enhance the program so that multiple philosophers can get > the forks at the same time. And I still want to ensure that a philosopher > always get two forks at once. This is more difficult because I can no longer > lock on the list object which contains forks since multiple phiolosophers > must be allowed to remove/add forks to the list. I do not have an elegant > solution for this. > > Any suggestion? > Yan > > so in your country you eat with 2 forks do you? this solution has been posted on suns website, but there they eat with chopsticks. sounds like homework. == 2 of 2 == Date: Thurs, Sep 2 2004 4:33 pm From: [EMAIL PROTECTED] (Mark A. Washburn) "Yan Zhou" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Hi there, > > I have code a program that solves the dinning philosopher problem. But there > is still room to improve. > > My solution is to acquire both forks at any given time. If a philosopher > first gets the left fork, and then tries to get the right fork, that may > risk starvation. > > The current solution locks on the list object (which contains all fork > objects). Thus, only one philosopher can acquire two forks at any given > time, and multiple philosophers can eat at the same time. Once a philosopher > acquires the forks, they are removed from the list; and philosopher returns > the forks to the list after he finished eating. > > I would like to enhance the program so that multiple philosophers can get > the forks at the same time. And I still want to ensure that a philosopher > always get two forks at once. This is more difficult because I can no longer > lock on the list object which contains forks since multiple phiolosophers > must be allowed to remove/add forks to the list. I do not have an elegant > solution for this. > > Any suggestion? > Yan JCSP demonstrates an exemplary method for multiple philosophers problem. http://www.cs.ukc.ac.uk/projects/ofa/jcsp/ maw ========================================================================== TOPIC: ODBC Java Firebird http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4bd89240060c298f ========================================================================== == 1 of 1 == Date: Thurs, Sep 2 2004 4:00 pm From: [EMAIL PROTECTED] (Fernando Grassi) Olá... gostaria de saber se alguém poderia me ajudar.. Estou interessado em saber como devo fazer para acessar o Banco de Dados Firebird, no windows, via driver ODBC. Baixei o XTG. Alguém pode me ajudar? Obrigado ========================================================================== TOPIC: Question to experienced java developers http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/821bea335295193e ========================================================================== == 1 of 1 == Date: Thurs, Sep 2 2004 4:11 pm From: "Marty U." <[EMAIL PROTECTED]> This question may seem weird, and yes I am looking for a biased response. I am a C# ASP.Net developer but I am looking to become more experienced in Java. I did not post this on the java.help group because I want the response of experienced java developers. As a Java developer what do you feel is better in Java (Web Focus) then C# ASP.Net. I know C# so I am wanting to see the view from someone who can hold a good argument if they were provoked in discussion. I have had great success with this approach in the past to help me determine if my time is worth the change to a new language and set of technologies. Thanks Marty U. ========================================================================== TOPIC: WANTED: SOFTWARE INVENTIONS http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/31f204232b3af08 ========================================================================== == 1 of 1 == Date: Thurs, Sep 2 2004 4:52 pm From: "Larry Barowski" <larrybarATengDOTauburnDOTeduANDthatISall> "Paul Lutus" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Joona I Palaste wrote: > / ... > >> It has become clear that this person is simply mental. There's no other > >> word for his behavior. > > > > By "mental", you mean "mentally unstable", "mentally disturbed", > > "insane" or "just plain ga-ga"? > > This use of the word "mental", correctly meaning "pertaining to the > > mind", is annoying me. > > In American slang, its meaning is clear (deranged), and I understand your > frustration with the use of an apparently neutral term to mean something > specific. > > You may or may not know this, but Americans have as many slang terms for > "crazy" as a typical culture has for "drunk." Strange as it may sound, even > the word "postal" has been known to be applied in this context. I believe the origin of this use of "mental" is Scottish, though it has certainly spread to America. ========================================================================== TOPIC: JDK exec 1.3 vs 1.4 http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b0045fd477d34360 ========================================================================== == 1 of 1 == Date: Thurs, Sep 2 2004 5:31 pm From: "John B. Matthews" <[EMAIL PROTECTED]> In article <[EMAIL PROTECTED]>, "André Hurschler" <[EMAIL PROTECTED]> wrote: > > Maybe this has nothing to do with Java. All your routine is doing is > waiting > > for the process to finish. You may want to look into resource issues at > the > > system level, to see if the problem lies elsewhere. > > > > Paul Lutus > > Hello Paul > > hmmm Maybe, but I had tested under 1.3 and 1.4 and it was reproducibly. Does the (import?) command you send execute correcly from an interactive shell? Same user? Same quotas? Same ulimits? John ---- jmatthews at wright dot edu www dot wright dot edu/~john.matthews/ ========================================================================== TOPIC: Thread synchronization http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/172837b7b0667fd1 ========================================================================== == 1 of 1 == Date: Thurs, Sep 2 2004 6:24 pm From: Lee Fesperman <[EMAIL PROTECTED]> Chris Uppal wrote: > > Thomas G. Marshall wrote: > > > It is not the object in total that is protected. It is a section of code > > that you specifically force blockage into. If you instruct people to > > think that synchronization is protecting objects, then you are misleading > > them horribly. The bottom line is not that they are objects. The bottom > > line is that a section of executable code is protected from re-entrance > > by another thread. > > I disagree with this completely. > > First off, it is not -- no matter what your stance on OO, or even whether you > are using an OO language -- code that is being protected, it is /state/. There > are one or more variables whose values must be "managed" to allow correct > concurrent access. So at minimum it is misleading to talk of protecting code, > you should be talking about protecting data. Agreed, except that you should say 'shared' state. Shared state is shared references and class and instance variables (but not local variables). Local variables can't be shared with other threads. Protecting code is the wrong concept. Perhaps it comes from the term, "critical section". Basically, you only synchronize threads because they are accessing shared state ... and you want to *protect data* against simultaneous access. > Now in the OO world (and I'll accept, that Java is OO in this matter), > data/state is normally bunched into semantically coherent units called objects. > So the most natural thing to do is to manage concurrency at the level of the > overall state of one object. In that case we are clearly using synchronisation > to protect the (state of) the object. Just as Eric says. And the normal way > to express that is with code synchronised on 'this' -- synchronised methods for > instance. Yes, saying that synchronization is for protecting objects is also misleading. It could be part of an object -- it could be a loose confederation of several primitive variables spread across multiple objects. > Now in some cases, the state that needs to be protected will be either > distributed across more than one object, or be less than the entire state of an > object. Such cases are rare -- as you'd expect because the object is (or > should be) expressing a semantically coherent unit of state, and the protection > will normally be expected to follow the same boundaries, precisely /because/ it > is protecting semantic coherence. Still, such cases do occur, and in those > cases, and /only/ in those cases, your more "advanced" technique of using a > lock object is appropriate. Not quite. There are other cases where a separate 'monitor' is appropriate, but I agree that it should be subject object in most cases. > BTW, I don't think "lock" is a good name for a lock object. For the reasons > given above, it is misleading to use it to protect exactly the state of 'this'. > > So either it is being used as a shared lock -- to act as a "channel" whereby > two or more objects can maintain some semantic interdependency. In such cases, > I would submit that "sharedLock" is the minimum meaningful name. OTOH, you may > have an object that only needs to protect some of its state. I generally use "monitor" as part of name for these. -- Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com) ============================================================== * The Ultimate DBMS is here! * FirstSQL/J Object/Relational DBMS (http://www.firstsql.com) ========================================================================== TOPIC: Trampoline code again http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/74192ce76bbb47dc ========================================================================== == 1 of 1 == Date: Thurs, Sep 2 2004 2:28 pm From: Covington Bradshaw <[EMAIL PROTECTED]> First please do not make trampoline jokes, because when I was 5, I fell from my brother's bed after happily jumping and since I am in a wheel chair. I am looking for a trampoline jsp or servlet. Explanation: something like ... http://blablabla/trampoline.jsp?jump="http://albalbalbalb/page.html" Then show the page.html of someone else albalbalbalb Web site in a frame of my blablabla Web site or something like that. Got it? JspWriter out = pageContext.getOut(); URL url; int responseCode = 0; HttpURLConnection connection = null; InputStream input; BufferedReader dataInput; try { jumpTo = URLDecoder.decode(subcontext); url = new URL(jumpTo); connection = (HttpURLConnection) url.openConnection(); responseCode = connection.getResponseCode(); } catch (Exception ex) {} try { input = connection.getInputStream(); dataInput = new BufferedReader(new InputStreamReader(input)); while ((line = dataInput.readLine()) != null) { out.println(line); } ... How do I handle links to images etc...? Any code example? Thanks, I have to stop typing now and I must go to take a bath. ========================================================================== TOPIC: sprintf http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/488e725956316480 ========================================================================== == 1 of 1 == Date: Thurs, Sep 2 2004 6:40 pm From: shea martin <[EMAIL PROTECTED]> Tor Iver Wilhelmsen wrote: > shea martin <[EMAIL PROTECTED]> writes: > > >>I know all about the bad things that sprintf in C/C++ can cause. My >>question is, is there a way in java to achieve similar results? > > > Yes, if you use 1.5: > > http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html perfect. ~S ======================================================================= 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/prefs 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 ------------------------ Yahoo! Groups Sponsor --------------------~--> Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar. Now with Pop-Up Blocker. Get it for free! http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/BCfwlB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/kumpulan/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
