comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Socket problem -- response slow for host with domain (on SunOS5.8) - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfb84c34caf0c9e9 * Need a method for detecting when files are written to a directory - 7 messages, 6 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d1293173b48ccf65 * Setting Command Prompt Window Size programmatically - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2731912d7499ef51 * Help with date conversion - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1de63360e87e2da0 * code optmization - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1b784382e7cbb306 * Simple multiuser java database - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/76285f28cb4423bf * Preventing multiple instance standalone desktop gui applications - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/afa857e018f3780 * Thread synchronization - 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/172837b7b0667fd1 * how can C program calls Java? Thanks - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/919552d936d443f9 * cost of unused import statement - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7541f77bd3a07e9e * Garbage collector question - 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/793ab88313c687f9 * Iteration over sets - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2464f0c85c8b717f * What are you using for your 3 tier java system? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dcf667150f7f4fcd * Question about EJB's - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2d4a780fe530c2ba ========================================================================== TOPIC: Socket problem -- response slow for host with domain (on SunOS5.8) http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfb84c34caf0c9e9 ========================================================================== == 1 of 3 == Date: Fri, Sep 24 2004 3:10 pm From: Sudsy <[EMAIL PROTECTED]> Nishi Bhonsle wrote: <snip> > I think, even though the sysadmin does not open the connections to port 25, they > should > be dropping packets instead of rejecting them .ie. If I run the same telnet command on > my windows box, I get the following returned pretty quickly > C:\>telnet yahoo.com 25 > Connecting To yahoo.com...Could not open a connection to host on port 25 : Connect > failed > > If I get such a response from the solaris box, that would help too. > > What do you think? I think you haven't been around long enough! The port is operating in "stealth" mode. Incoming SYN packets which don't pass the filters are simply "dropped on the floor" as opposed to being rejected. That way, a port scanner can't tell whether or not there's actually service on the port. If there weren't so many yahoos trying to find open relays... :-( Seriously, this is completely acceptable behaviour. == 2 of 3 == Date: Fri, Sep 24 2004 4:45 pm From: Nishi Bhonsle <[EMAIL PROTECTED]> Sudsy wrote: > Nishi Bhonsle wrote: > <snip> > > I think, even though the sysadmin does not open the connections to port 25, they > > should > > be dropping packets instead of rejecting them .ie. If I run the same > telnet command on > > my windows box, I get the following returned pretty quickly > > C:\>telnet yahoo.com 25 > > Connecting To yahoo.com...Could not open a connection to host on port 25 : Connect > > failed > > > > If I get such a response from the solaris box, that would help too. > > > > What do you think? > > I think you haven't been around long enough! The port is operating in > "stealth" mode. Incoming SYN packets which don't pass the filters are > simply "dropped on the floor" as opposed to being rejected. That way, > a port scanner can't tell whether or not there's actually service on > the port. > If there weren't so many yahoos trying to find open relays... :-( > Seriously, this is completely acceptable behaviour. If this cannot be resolved and the reason for opening a socket connection on port 25 was to check whether the host supplied is a valid SMTP Server or not, can I optionally use the Java Mail API to do the same thing in the following way -- import java.util.Properties; import javax.mail.*; import javax.mail.internet.*; public class SmtpConnection { public static void main (String args[]) throws Exception { String host = args[0]; // Get system properties Properties props = System.getProperties(); // Setup mail server props.put("mail.smtp.host", host); //host supplied through the application UI // Get session Session session = Session.getInstance(props, null); // Define transport Transport transport = session.getTransport("smtp"); try { transport.connect(host, "", ""); // if connection is successful then, the host supplied from the UI is a valid SMTP server host. } catch(AuthenticationFailedException afe) { System.out.println("For Authentication Failures"); } catch(MessagingException me) { System.out.println("For Other Failures"); } catch(IlegalStateException ise) { System.out.println("If service is already connected"); } } } == 3 of 3 == Date: Fri, Sep 24 2004 7:43 pm From: Sudsy <[EMAIL PROTECTED]> Nishi Bhonsle wrote: <snip> > If this cannot be resolved and the reason for opening a socket connection on port 25 > was to check whether the host supplied is a valid SMTP Server or not, can I optionally > use the Java Mail API to do the same thing in the following way -- <snip> Not necessarily. If the destination is filtering based on source IP address (a common approach) then you'll never get to the point of validation failure; the packets end up on the floor. The fact is that system administrators (myself included, BTW) have had to "harden" their systems in order to preclude abuse. You'll find that many SMTP daemons don't even support the VERIFY (VRFY) command in RFC-821 since it was used by spammers to "scan" for valid users within a domain (not far removed from "brute force" or dictionary methods for password cracking). The questions you're posing are the same as those of people who would abuse the system. I'm not for a moment suggesting that's your intent but it wouldn't be very smart to provide ammunition to those who want to subvert the system for their own aims, would it? So now that you realize that your stated goal is unattainable, what are you going to do instead? There are no definitive solutions, I'm afraid. Darn those miscreants! >:-( ========================================================================== TOPIC: Need a method for detecting when files are written to a directory http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d1293173b48ccf65 ========================================================================== == 1 of 7 == Date: Fri, Sep 24 2004 3:12 pm From: Michael Borgwardt <[EMAIL PROTECTED]> Elliott wrote: > Perhaps someone can help a relatively new Java programmer. I am > writing an application that sits in a network and processes files when > they are written to a designated directory. I am wondering if there > is some elegant way to do this. I realize I can create a loop in > which the process sleeps for say, five seconds and then checks to see > if a directory has a file in it and then performs an action > appropriately. However, I wonder if there is a better way to do > this. If there is some way that a file being written to a designated > directory triggers some kind of event that wakes my program up to > begin processing, that would be better, but how does one do this? This is possible on some operating systems, but only through very OS-specific APIs, so you'd have to use JNI. == 2 of 7 == Date: Fri, Sep 24 2004 4:10 pm From: "Will Hartung" <[EMAIL PROTECTED]> "Elliott" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all: > > Perhaps someone can help a relatively new Java programmer. I am > writing an application that sits in a network and processes files when > they are written to a designated directory. I am wondering if there > is some elegant way to do this. I realize I can create a loop in > which the process sleeps for say, five seconds and then checks to see > if a directory has a file in it and then performs an action > appropriately. However, I wonder if there is a better way to do > this. If there is some way that a file being written to a designated > directory triggers some kind of event that wakes my program up to > begin processing, that would be better, but how does one do this? Nothing portable. Your best bet is to regularly take a directory snapshot and check last modification times for the files. Compare those times to your last snapshot. Any files that haven't changed for "some threshold" can be considered closed and safe to be moved, otherwise they may still be filling up, for the file will appear in the directory before it's actually done being written (which could be Bad). We do just this using Unix commands, checking an input directory every minute, and moving those that haven't changed in that minute to a staging directory (since same filesystem moves are atomic), and then we have another process that acts on all the files in the staging directory knowing that they're safe files to work with. Regards, Will Hartung ([EMAIL PROTECTED]) == 3 of 7 == Date: Fri, Sep 24 2004 4:32 pm From: Sudsy <[EMAIL PROTECTED]> Elliott wrote: > Hi all: > > Perhaps someone can help a relatively new Java programmer. I am > writing an application that sits in a network and processes files when > they are written to a designated directory. I am wondering if there > is some elegant way to do this. I realize I can create a loop in > which the process sleeps for say, five seconds and then checks to see > if a directory has a file in it and then performs an action > appropriately. However, I wonder if there is a better way to do > this. If there is some way that a file being written to a designated > directory triggers some kind of event that wakes my program up to > begin processing, that would be better, but how does one do this? Ya know, this is the kind of application for which JMS is ideally suited. Your client creates the file then sends a notification on a queue which drives invocation of onMessage on a regular client or Message Driven Bean which then processes the file. Just an idea, after all it does address "asynchronous" processing with loose-coupling. == 4 of 7 == Date: Fri, Sep 24 2004 6:14 pm From: "David Hilsee" <[EMAIL PROTECTED]> "Sudsy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Elliott wrote: > > Hi all: > > > > Perhaps someone can help a relatively new Java programmer. I am > > writing an application that sits in a network and processes files when > > they are written to a designated directory. I am wondering if there > > is some elegant way to do this. I realize I can create a loop in > > which the process sleeps for say, five seconds and then checks to see > > if a directory has a file in it and then performs an action > > appropriately. However, I wonder if there is a better way to do > > this. If there is some way that a file being written to a designated > > directory triggers some kind of event that wakes my program up to > > begin processing, that would be better, but how does one do this? > > Ya know, this is the kind of application for which JMS is ideally > suited. Your client creates the file then sends a notification on > a queue which drives invocation of onMessage on a regular client > or Message Driven Bean which then processes the file. > Just an idea, after all it does address "asynchronous" processing > with loose-coupling. Bonus points if the file can be eliminated altogether by placing its contents in the message. -- David Hilsee == 5 of 7 == Date: Fri, Sep 24 2004 7:27 pm From: Sudsy <[EMAIL PROTECTED]> David Hilsee wrote: > "Sudsy" <[EMAIL PROTECTED]> wrote in message <snip> >>Ya know, this is the kind of application for which JMS is ideally >>suited. Your client creates the file then sends a notification on >>a queue which drives invocation of onMessage on a regular client >>or Message Driven Bean which then processes the file. >>Just an idea, after all it does address "asynchronous" processing >>with loose-coupling. > > Bonus points if the file can be eliminated altogether by placing its > contents in the message. David, I agree with one proviso: large files shouldn't be queued, IMHO. If you're talking in the range of a few to a few tens of kilobytes then I'm in complete agreement. I actually almost suggested it my- self! ;-) But when you start talking about MBs... Glad to see that we're both on the same track. It's an elegant solution to a recurring problem. Not universal perhaps, but worthy of consideration. That's the only reason I suggested it in the first place. As I always say, "why reinvent the wheel?". == 6 of 7 == Date: Fri, Sep 24 2004 8:52 pm From: [EMAIL PROTECTED] (Albretch) you may as well, very easily, concieve a file sytem type of functionality yourself in a Java-based portable way, by designing a FAT kind of table in a database and coordinating the transfer of files to the directory through a method that checks this table . . . Most DBMSs (many of them open source/free) have triggers, too . . . == 7 of 7 == Date: Fri, Sep 24 2004 9:39 pm From: Chris Smith <[EMAIL PROTECTED]> Sudsy wrote: > Ya know, this is the kind of application for which JMS is ideally > suited. Your client creates the file then sends a notification on > a queue which drives invocation of onMessage on a regular client > or Message Driven Bean which then processes the file. > Just an idea, after all it does address "asynchronous" processing > with loose-coupling. Maybe... if there are a dozen other things that work out in favor of JMS as well. For example, asking clients to send a message to a JMS bean is far more complex than asking them to drop a file into a directory. One can be done by hand by a human being, while the other requires software. One can be done by zillions of document-oriented programs including such things as Microsoft Word, while the other requires using your own proprietary software. Not to mention that you've just introduced an application server to the architecture. A migration from a simple architecture like the OP proposed to something with JMS and message-driven beans ought to be guided by something stronger than a distaste for polling. In any case, I'm getting more and more tired of seeing people who were hired to find the best way to do something default to an EJB solution that is an order of magnitude more complex than needed, just because that's what they are familiar with. I'm afraid that this reply, taken at face value, encourages this. -- www.designacourse.com The Easiest Way to Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: Setting Command Prompt Window Size programmatically http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2731912d7499ef51 ========================================================================== == 1 of 2 == Date: Fri, Sep 24 2004 3:15 pm From: "Boudewijn Dijkstra" <[EMAIL PROTECTED]> "John Davison" <[EMAIL PROTECTED]> schreef in bericht news:[EMAIL PROTECTED] > Dino Buljubasic wrote: > > > Hi, > > > > How can I set the Command Prompt window size programmatically in Java. > > I am quite new in Java, but would like to be able to set the size of > > Command Prompt (Windows OS) window when main starts before doing > > anything else. > > > > Thank you > > You cannot, not in Java. Inside the normal command shell, you can use c:\windows\system32\cmd.exe /c mode con cols=80 lines=50 == 2 of 2 == Date: Fri, Sep 24 2004 7:23 pm From: "Rob D" <[EMAIL PROTECTED]> java.lang.Runtime.exec(String) "Dino Buljubasic" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > How can I set the Command Prompt window size programmatically in Java. > I am quite new in Java, but would like to be able to set the size of > Command Prompt (Windows OS) window when main starts before doing > anything else. > > Thank you ========================================================================== TOPIC: Help with date conversion http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1de63360e87e2da0 ========================================================================== == 1 of 1 == Date: Fri, Sep 24 2004 3:16 pm From: "Boudewijn Dijkstra" <[EMAIL PROTECTED]> "Jack" <[EMAIL PROTECTED]> schreef in bericht news:[EMAIL PROTECTED] > > How to convert: > > yyyy-MM-ddThh:mm:ss.sTZD > > to > > yyyy-MM-dd HH:mm:ss dateStr.substring(0, dateStr.lastIndexOf('.')) ========================================================================== TOPIC: code optmization http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1b784382e7cbb306 ========================================================================== == 1 of 1 == Date: Fri, Sep 24 2004 3:28 pm From: [EMAIL PROTECTED] (mank) 1. public static String getData(String var,float mFactor) { if (var == null || var.trim().length() == 0) { return null; } try { Pattern pattern = PatternManager.getDollarAmountPattern(); if (pattern==null) return var; PatternMatcher matcher = new Perl5Matcher(); if (matcher.contains(var, pattern)) { MatchResult result = matcher.getMatch(); var = result.group(2); if (result.group(2) == null || result.group(2).trim().length() < 1) return var; else { copay=String.valueOf(Math.round(Float.parseFloat(var)*mFactor)); } if (result.group(1) != null && result.group(1).trim().length() > 0) { return result.group(1) + var; } else if (result.group(3) != null && result.group(3).trim().length() > 0) { return result.group(2) + result.group(3); } else { return "$" + result.group(2); }}} catch (NumberFormatException ex) {} return copay; } 2. result.group(1/2/3) is a method used to extract the part of the input pattern. It is a standard method of jakarta ORO (pattern matching).. 3.My question was which is a better coding style if I have to call a method thrice then should I use a temporary variable as is done in your solution? Thanks Chris Smith <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > mank wrote: > > Following java code is executed many multiple times in my program. > > Any ideas to optmize it? > > A number of people have taken guesses so far. You need to provide more > information, though, to get a good answer. For example, what is 'var'? > We don't even see a declaration. Will assumed it's a local variable, > while others assumed it's a field. If it is a field, then Will's advice > is dead wrong. Maybe it's time you gave more information. ========================================================================== TOPIC: Simple multiuser java database http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/76285f28cb4423bf ========================================================================== == 1 of 1 == Date: Fri, Sep 24 2004 4:04 pm From: "Will Hartung" <[EMAIL PROTECTED]> "Robert" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The current array read write process is very simple. The first loop > generates character strings which are appended to an array. At the > end of the loop, I call the read method whichs starts at the top of > the array, reads a line and flags it read and passes that value back > to the loop which may generate more data which gets sent to the write > method. The write method starts at the top of the array and writes > over any record flagged as read or gets appended to the bottom. The > order is not important since all records must be processed. Sounds like a distributed queue. > I am looking for a class with simple methods that write to a remote > file or database so I can replace the single user array I'm using now. > I do not want to use jdbc. The data source can be another class, an > embedded database such as Berkely or even an executable as long as it > is easy to configure and doesn't require the investment of time that a > sql server would. Here's the simplest solution I could think of: It's a brain dead Servlet that takes its commands from the URL. It has 3 commands: add next reset Add takes the argument and adds it to its internal queue. Next returns the next item from the queue. If the queue is empty, it returns the String "*EOL*". Reset zeroes the queue. The list is kept in memory within the Servlet container, and you lose all your data when you reset the server. The calls are synchronized, so there shouldn't be any race conditions. --------- package pkg; import java.io.IOException; import java.io.PrintWriter; import java.util.LinkedList; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Server extends HttpServlet { LinkedList queue = new LinkedList(); public void init() { System.out.println("Servlet init."); } public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); String next = request.getParameter("next"); String add = request.getParameter("add"); String reset = request.getParameter("reset"); if (next != null) { Object top = "*EOL*"; synchronized(this) { if (queue.size() > 0) { top = queue.removeFirst(); } } response.getWriter().println(top); } if (add != null) { synchronized(this) { queue.add(add); } response.getWriter().println("OK"); } if (reset != null) { synchronized(this) { queue = new LinkedList(); } response.getWriter().println("OK"); } } } And here's a simple test client. package pkg; import java.net.*; import java.io.*; public class TestClient { public static String host = "localhost"; public static int port = 8080; public static String baseURL = "/server/items"; public static void main(String args[]) throws Exception { for (int i = 0; i < 50; i++) { addItem("" + i); } // Get more than we put in to demonstrate *EOL* for (int i = 0; i < 53; i++) { System.out.println(getItem()); } } public static void addItem(String item) throws Exception { String encodedItem = URLEncoder.encode(item, "UTF-8"); URL url = new URL("http", host, port, baseURL + "?add=" + encodedItem); Object o = url.getContent(); } public static String getItem() throws Exception { URL url = new URL("http", host, port, baseURL + "?next"); BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); String s = br.readLine(); return s; } } Now, as you can imagine, this was hacked out very quickly. What are the downsides of this technique? Well, for one, it probably tears the socket up and down for each call to the server, but playing with the URLConnection, fiddling with Keep-Alive and reusing a single connection directly may well eliminate that. It's a bit excessive for sending a string back and forth in terms of overhead. That's the price you pay for an application specific protocol layered on top of a general purpose protocol. However, it is brain dead to set up. Get a binary install of Tomcat, and plop it anyplace convenient on most any machine on the planet. You can email me and I'll send you a zip of the entire build tree (4 files -- build.xml, web.xml, Server.java, TestClient.java). Install Ant to build it. And if your compute time is your bottleneck, this technique is essentially "free". It's also as customizable as you want it to be. You get to run down the slippery slope of creating your own application protocol. You can add persistence if you like, whatever. Read up on the Servlet spec to fill in the blanks. All said, I think JDBC and a RDBMS is a better solution, but if all you need is what you specified, then this will do just that. Like I said, if you want the build tree for the webapp, then you need just add Tomcat and Ant and you're on your way to server bliss. Good Luck! Regards, Will Hartung ([EMAIL PROTECTED]) ========================================================================== TOPIC: Preventing multiple instance standalone desktop gui applications http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/afa857e018f3780 ========================================================================== == 1 of 1 == Date: Fri, Sep 24 2004 3:47 pm From: steve <[EMAIL PROTECTED]> On Thu, 23 Sep 2004 22:39:14 +0800, Kent Yang wrote (in article <[EMAIL PROTECTED]>): > I need to have only one instance of a Desktop GUI application running. > What is the best way to do this? The only answer I can find > searching throught the archives was to use a socket. Is this the best > way? > > I thought about using rmi (registry) and binding a unique name however > the problem is if the appliction start the registry, when it exits, it > takes the registry down with it. > > Is there a cleaner way to do this. I've seen this in several IDE(s) > Eclipse and JBuilder. How is it done in those apps? > > Thanks in advance, > > Kent use a small server program. open a port. ( less than 20 lines of code) when you launch your app , check if you get an answer on the port, if so there is already an app running. if not then launch a small server. DO NOT use a flag file, if your app crashes or the disk gets corrupted, all sorts of things can happen. ( i have tired many different forms of flag files etc, but there is always one user who manages to beat the system, or corrupt it) With the server method, it always cleans up on the JVM exit, same with a crash. JustOne StartTracker = new JustOne(); if (StartTracker.doit() == false) { try { ........ program call routines } } else //it is already running so exit StartTracker.stopTask(); System.exit(1); } package SimpleServer; import java.io.*; import java.net.*; //this package starts a java server listening on port 8181 //it does this to stop the java program from being launched more than once // as the user only needs 1 copy running, also it causes client memory issues. if //more than 1 copy of the program is running public class SimpleServer extends Thread { public static final int port = 8181; ServerSocket serverSocket = null; Socket clientSocket = null; public void run() { try { // Create the server socket serverSocket = new ServerSocket(port, 1); while (true) { // Wait for a connection clientSocket = serverSocket.accept(); // System.out.println("*** Got a connection! "); clientSocket.close(); } } catch (IOException ioe) { System.out.println("Error in SimpleServer: " + ioe); System.exit(0); // we can do nothing else } } } package Server; import SimpleServer.*; import java.io.*; import java.net.*; //we have not started the error logger yet, ( we cannot, in case there is a second instance running //therefore we have to rely on the normal system errror caller public class JustOne { SimpleServer sds = null; boolean keepRunning = true; private boolean status = true; //say it is already running private Runnable r = null; //this is to be called when the program finally exits. public void stopTask() { keepRunning = false; } public boolean doit() { status = false; // say it is only the first copy try { Socket clientSocket = new Socket("localhost", SimpleServer.port); status = true; } catch (Exception e) { //this starts a new thread before the modal r = new Runnable() { public void run() { newServer(); } }; new Thread(r).start(); status = false; // say it is only the first copy } // finally { return status; // } } public void newServer() { sds = new SimpleServer(); sds.start(); while (keepRunning == true) { try { // System.out.print("."); Thread.sleep(5 * 60); } catch (Exception e) { e.printStackTrace(); System.exit(0); // we can do nothing else } } } } ========================================================================== TOPIC: Thread synchronization http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/172837b7b0667fd1 ========================================================================== == 1 of 3 == Date: Fri, Sep 24 2004 5:15 pm From: Lee Fesperman <[EMAIL PROTECTED]> Thomas G. Marshall wrote: > > Lee Fesperman coughed up: > > Thomas G. Marshall wrote: > >> > > > > [ Rant Snipped ] > > > > Yeah, right. You want to invent your own terminology and concepts and > > then argue vehemently (against all comers) that we must accept it on > > your terms. You're doing this on other threads as well. > > ...[rip]... > > Funny how you didn't answer the points in my post. I've shown you to be > incorrect, and shown you to be dishonestly representing quotes. > > No wonder you say "yeah right", and snip it all away. It's ironic that you demand responses since you've consistently refused to speak to my previous on-topic replies, being content to just parody my words. Anyway, your point was that it is eminently reasonable to invent new terminology even though good terminology already exists in common usage. That is simply a bad idea, and I spoke to that point. Note: If you are searching for a phrase that includes both blocks and methods, try: "synchronized method/block". It even uses the common keyword. Back on topic... Another of your inventions is the concept: "[Synchronization is for] protecting code from concurrent execution." That is ill-formed, incomplete. Synchronization is for protecting shared 'state' from concurrent access/change. You have not established a single counter argument to that assertion. BTW, are you aware that synchronization implementation in the JVM involves erecting memory barriers? Why do you think that is true? > You were the first to use insulting terminology, and now that you've shown > to be a fool, you cannot stand it. I made disparaging comments about your words (not about you!) after you began ridiculing mine, indulging in ad hominem. We shall see whose ideas are foolish. -- Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com) ============================================================== * The Ultimate DBMS is here! * FirstSQL/J Object/Relational DBMS (http://www.firstsql.com) == 2 of 3 == Date: Fri, Sep 24 2004 9:33 pm From: "Thomas G. Marshall" <[EMAIL PROTECTED]> Lee Fesperman coughed up: ...[rip]... > I made disparaging comments about your words (not about you!) after > you began ridiculing mine, indulging in ad hominem. "after" ? You began turning this ugly right here: http://groups.google.com/groups?q=g:thl1022868560d&dq=&hl=en&lr=lang_en&ie=UTF-8&c2coff=1&safe=off&selm=413919A6.1620%40ix.netcom.com ...[rip]... -- Everythinginlifeisrealative.Apingpongballseemssmalluntilsomeoneramsitupyourn ose. == 3 of 3 == Date: Fri, Sep 24 2004 9:47 pm From: "Thomas G. Marshall" <[EMAIL PROTECTED]> Lee Fesperman coughed up: ...[rip]... Ok, enough. My turn to snip it all away. Lee, I'm going to assume that you're a bright guy. I'm also going to assume that you're not a bad guy, and that we just somehow got off on the wrong foot. That being said, I'm as tired of this as you probably are. So I'm done here. And I wish you well. -- Everythinginlifeisrealative.Apingpongballseemssmalluntilsomeoneramsitupyourn ose. ========================================================================== TOPIC: how can C program calls Java? Thanks http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/919552d936d443f9 ========================================================================== == 1 of 2 == Date: Fri, Sep 24 2004 6:18 pm From: "Tony Morris" <[EMAIL PROTECTED]> JNI can achieve both calls to C from Java and vice-versa as per OP requirements. -- Tony Morris http://www.xdweb.net/~dibblego == 2 of 2 == Date: Fri, Sep 24 2004 6:22 pm From: "David Hilsee" <[EMAIL PROTECTED]> "John Davison" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Shuo Yang wrote: > > > Hi folks, > > How can a C program call a Java program? Is there any reference on > > that point? I need some help on this issue, thanks. > > If you're asking how to start a Java program from a C program, then you > should ask comp.lang.c - they might give you trouble since that problem > is really OS dependant. It's just a matter of running the java.exe (or > java) program with the correct arguments. <snip> JNI might be a better option here, depending on what you're doing. It's generally more powerful (and possibly more efficient) than launching java.exe as a separate process. -- David Hilsee ========================================================================== TOPIC: cost of unused import statement http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7541f77bd3a07e9e ========================================================================== == 1 of 1 == Date: Fri, Sep 24 2004 6:21 pm From: "Tony Morris" <[EMAIL PROTECTED]> Yes. It will impact compile-time performance. It will also impact the performance of code maintainers since readability is reduced a little. Runtime performance is not impacted. http://www.xdweb.net/~dibblego/java/faq/answers.html#q36 -- Tony Morris http://xdweb.net/~dibblego/ ========================================================================== TOPIC: Garbage collector question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/793ab88313c687f9 ========================================================================== == 1 of 2 == Date: Fri, Sep 24 2004 7:26 pm From: "Vincent Cantin" <[EMAIL PROTECTED]> > Object yourObject = weakReference.get(); > if(yourObject != null) System.out.println("Yes, your object is > reachable at this very moment, > and at least as long as 'yourObject' variable refers it "); No .. this means weakly reachable, and *perhaps* no longer simply reachable. == 2 of 2 == Date: Fri, Sep 24 2004 7:27 pm From: "Vincent Cantin" <[EMAIL PROTECTED]> > ... There is no way in Java to force the VM to do a full garbage collection and > check that, although System.gc suggests that it try. Thank you. Vincent ========================================================================== TOPIC: Iteration over sets http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2464f0c85c8b717f ========================================================================== == 1 of 1 == Date: Fri, Sep 24 2004 8:47 pm From: Swarat Chaudhuri <[EMAIL PROTECTED]> Hi everyone, I am encountering concurrent modification exceptions while using the class "Iterator" to iterate over a Java "HashSet". I kind of know *why* I am getting them, but cannot quite figure out a strategy that would let me avoid them. And assistance from experienced people always being wonderful... I have a set S over which I would like to iterate. While iterating, in certain cases, I want to add elements to the set. I would like the iterator to treat these new elements as if they have not been seen so far. However, doing so seems to guarantee that concurrent modification exception will be thrown. So the question is, is there a way to achieve what I want to do? Without needing to restart the iteration every time an "update" occurs? I am willing to use a list instead of a set. But, for efficiency reasons, I also want fast membership queries. So my second question: does anyone know of an implementation of the List interface with a "contains" method of sublinear complexity? Thanks in advance, Swarat ========================================================================== TOPIC: What are you using for your 3 tier java system? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dcf667150f7f4fcd ========================================================================== == 1 of 1 == Date: Fri, Sep 24 2004 9:09 pm From: [EMAIL PROTECTED] (keith edward) Hello, What is everyone using to build 3 tier java systems? Swing client that talk with servlets/Ejb's?? Via RMI? I am looking for a bite size (yet complete) example of a java 3 tier system... anyone have any examples? I need a swing client that is able to display master detail data, and allow updates/deletes/inserts, etc... How is date validation, and error presentation done? Any and all info appreciated! Keith ========================================================================== TOPIC: Question about EJB's http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2d4a780fe530c2ba ========================================================================== == 1 of 1 == Date: Fri, Sep 24 2004 9:14 pm From: [EMAIL PROTECTED] (Anonymous) Hi I recently used websphere to make a few ejb's. I have a couple of questions... does one ejb object represent one record? how would you get an existing record in a table, and retreive it into the ejb? say you want to select name from products where supplierid=1. how would you do that with an ejb? now that I know how to make ejbs, where would I find stuff on the internet that shows how to use them for querys/updates etc? Regards, Robbie ======================================================================= You received this message because you are subscribed to the Google Groups "comp.lang.java.programmer". comp.lang.java.programmer [EMAIL PROTECTED] Change your subscription type & other preferences: * click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe Report abuse: * send email explaining the problem to [EMAIL PROTECTED] Unsubscribe: * click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe ======================================================================= Google Groups: http://groups-beta.google.com
