comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * A question of reading api document - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1c6d046830d875c * [ANN] Imagero Reader 1.61 - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/46fa69d47a7c536f * JMX: - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6403103eb5b85b96 * [REPOST] java.awt.Image problem - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7f984034b7d7f294 * How to make Java web start doesn't pop up security setting - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2dfbc9e55f809ea4 * please recommend a design pattern book in java - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/99dfc42b6357856 * Application in sandbox - 5 messages, 4 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/821eb31df84b5c4a * Reproducing du/ls in Java - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3b6930f360088c78 * Correct Semaphore Implementation in Java - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8259aec1ceed4f8f * JBoss to go closed source? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a8dda54906ca8df * Advanced question about generics - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/70947db3058ccce1 * How to suppress final 0 with DecimalFormat? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c25b4efdb9f3c1f3 * java web start can run console app? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a49fe32937c92583 * Synchronized block is accessed by other jsps - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e19df43edcc6f04f * Ejb: best way to implement an update method with BMP - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2fadf7c755facb41 ============================================================================== TOPIC: A question of reading api document http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1c6d046830d875c ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 5:14 am From: [EMAIL PROTECTED] (mike) regards: Thank you for replying. The api document of jtidy http://sourceforge.net/projects/jtidy Thank you. May god be with you all.^_^ ============================================================================== TOPIC: [ANN] Imagero Reader 1.61 http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/46fa69d47a7c536f ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 4:31 pm From: "Andrei Kouznetsov" Imagero Reader is in Java written library for reading of image files. Supported file types are: *** BMP, GIF, TIFF, PNG, JNG, MNG, JPEG, PSD, PBM, PGM ,PPM Supported RAW files: *** MRW, CRW*#, NEF*, DCR* * Full resolution image can't be yet read, but thumbnail, preview and some metadata can be read. # Preview image(s) in JPEG format can be extracted. Imagero Reader can read thumbnails and metadata (IPTC, EXIF and XMP) from those formats and THM files. Imagero Reader defines simple Interface ImageReader to read image files. ImageReader interface allows to get image width and height, image count contained in file, define area to read, add ProgressListener and choose image channel to read. ** new ** Imagero Reader can read scaled version of image (see tutorial). Imagero Reader is free for non-commercial use. What's new in Version 1.61: *** Support for MRW (Minolta RAW) files was added. Currently Bilinear interpolation was implemented (Laplacian interpolation planned). Who want to use his own demosaicing method can get image with unprocessed data. -- Andrei Kouznetsov http://uio.dev.java.net Unified I/O for Java http://reader.imagero.com Java image reader http://jgui.imagero.com Java GUI components and utilities ============================================================================== TOPIC: JMX: http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6403103eb5b85b96 ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 6:00 am From: [EMAIL PROTECTED] (JavaJMX) Is it possible to switch off and then switch on monitoring a component, at runtime? If so is it necessary for the server to be restarted? I ask since, i am trying to develop and monitor, where in i should have the possibility to swith off and then switch on monitoring a component at will. Thanks. -PR ============================================================================== TOPIC: [REPOST] java.awt.Image problem http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7f984034b7d7f294 ============================================================================== == 1 of 2 == Date: Mon, Nov 29 2004 1:19 pm From: bugbear MaSTeR wrote: > The problem is quite straighforward: > I am double buffering an image which represents an horizontal table, as you > might expect this could get really wide. If the table changes (row deleted > or added) I redraw the buffer otherwise I only draw the image that's in the > buffer. Looks like you've got some kind of race condition between altering your buffer, and copying from your buffer to the user's view of stuff. If it *is* a race, wether you get your desired (as opposed to "correct") behaviour is just a fluke of timing, and could depend on ... virtually anything. I'd check your events and threads carefully to be sure you're using all the API's correctly. BugBear == 2 of 2 == Date: Mon, Nov 29 2004 2:20 pm From: "MaSTeR" "bugbear" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > MaSTeR wrote: > > The problem is quite straighforward: > > I am double buffering an image which represents an horizontal table, as you > > might expect this could get really wide. If the table changes (row deleted > > or added) I redraw the buffer otherwise I only draw the image that's in the > > buffer. > > > Looks like you've got some kind of race condition between > altering your buffer, and copying from your buffer > to the user's view of stuff. > > If it *is* a race, wether you get your desired (as opposed > to "correct") behaviour is just a fluke of timing, and > could depend on ... virtually anything. > > I'd check your events and threads carefully to be sure > you're using all the API's correctly. > > BugBear Than's what I thought at first, but I ensure you there are no threading issues. Nevertheless it works perfectly on any given VM execept SUN's. Plus, it goes funny only when the number of element is greater than a threshold and hence the image gets wider. If I set it up to show like 10 elements the problem doesn't appear. I will triple check my code for racing conditions, but I've kinda lost the hope and will start thinking about a kludge (like an array of smaller images). Thanks for your reply BugBear. ============================================================================== TOPIC: How to make Java web start doesn't pop up security setting http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2dfbc9e55f809ea4 ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 7:33 am From: [EMAIL PROTECTED] (Matt) Everytime when we first launched Java web start, it will pop up a security setting dialog box. I heard there are some way to disable it. Any ideas? Please advise. thanks!! ============================================================================== TOPIC: please recommend a design pattern book in java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/99dfc42b6357856 ============================================================================== == 1 of 2 == Date: Mon, Nov 29 2004 1:37 pm From: TechBookReport metfan wrote: > I searched Amazon and it came out a list, could you please recommend > one, which one is of the best for a mid-level programmer? Thanks. > > 1) Design Patterns Java Workbook by Steven John Metsker > 2) Applied Java Patterns by Stephen A. Stelting > 3) Java Design Patterns: A Tutorial by James William Cooper > 4) Patterns in Java: A Catalog of Reusable Design Patterns Illustrated > with UML, 2nd Edition, Volume 1 by Mark Grand > 5) Java Design: Objects, UML, and Process by Kirk Knoernschild > 6) Object-Oriented Software Engineering: Using UML, Patterns and Java, > Second Edition by Bernd Bruegge > 7) Software Architecture Design Patterns in Java by Partha Kuchana I'm reading 'Design Patterns Explained: A New Perspective on Object-Oriented Design by Alan Shalloway and James J. Trott' (http://www.amazon.co.uk/exec/obidos/ASIN/0321247140/454/202-5176811-2159833). It's very good, easy to understand, clearly explained examples and Java code to illustrate the examples. Pan ========================================= TechBookReport http://www.techbookreport.com == 2 of 2 == Date: Mon, Nov 29 2004 3:10 pm From: Thomas Weidenfeller metfan wrote: > I searched Amazon and it came out a list, could you please recommend > one, which one is of the best for a mid-level programmer? Thanks. Why not start with the classic: Gamma, Helm, Johnson, Vlissides: Design Patterns. Elements of Reusable Object-Oriented Software. /Thomas -- ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq ============================================================================== TOPIC: Application in sandbox http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/821eb31df84b5c4a ============================================================================== == 1 of 5 == Date: Mon, Nov 29 2004 10:02 am From: Sudsy Tim Tyler wrote: > Jean Lutrin <[EMAIL PROTECTED]> wrote or quoted: > > >>As I already said, I belong to this very small (and not very >>vocal) minority that happens to think that Un*x + Java is a >>wonderfull setup for a developer (most Java developer use Windows >>and most Un*x users have a grip with Java not being true >>Open Source Software). > > > IMO, they have a good point. > > The fact that Java is proprietary, commercial software is its > biggest weakness - in my book. > > Nobody in their right mind wants to build their house on land > owned by someone else. Guess what? The government can exercise their right of "eminent domain" and take your land anyway. So your analogy is either very good or very bad, depending on your point of view. :-) -- Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development. == 2 of 5 == Date: Mon, Nov 29 2004 3:41 pm From: Thomas Weidenfeller Jean Lutrin wrote: > As I already said, I belong to this very small (and not very > vocal) minority that happens to think that Un*x + Java is a > wonderfull setup for a developer (most Java developer use Windows > and most Un*x users have a grip with Java not being true > Open Source Software). You are mixing Linux programmers/FOSS religion and Unix programmers. From my observation, the grips of Unix programmers (not Linux programmers) with Java are often just the typical Java problems (slow startup, lack of desktop integration, etc.). Some, like slow VM ,startup are particular annoying on Unix, when e.g. writing tools, because people are used to small, quick starting tools like grep, awk, sed, etc. And it is just not acceptable having to wait a few seconds for a simple text filter to start up. In addition, Java is not very well suited for system programming in general, but a lot of Unix programming is system programming. A lot of Unix system calls and library functions are only accessible via JNI code, which makes system programming with Java annoying. This is not only a problem for system programs, but also for end-user applications, where you often have to re-invent the wheel. Which is particular annoying when you know Unix well enough to know that there is a standard API, but you just can't get access to it from Java in a straight forward way. It gets really annoying if you have to communicate in some way with existing Unix applications, and have no choice over the communication mechanism. I am just having such a problem. I have to talk via TI-REC with FDR messages to an existing application. This will definitely become a C or a C++ application. It is just so much simpler to run the existing *.x XDR definitions through rpcgen to get C headers and stubs than trying to get a working Java API for that on (oh, I am sure there is one, but I don't have the time to search for one, and figure out all its shortcomings). I know I will have to pay a price for using C (no standard collections, memory leaks, dangling pointers, the full show ...), but it still seems like the smaller risk in the particular case. /Thomas -- ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq == 3 of 5 == Date: Mon, Nov 29 2004 4:03 pm From: [EMAIL PROTECTED] (Bent C Dalager) In article <[EMAIL PROTECTED]>, Tim Tyler <[EMAIL PROTECTED]> wrote: >Hi. > >I have an application (in a Jar file) which I don't trust - and would >like to run securely - in a sandbox. > >Does anyone know the easiest way? If you just want to run it once to test it, you might change the java.security file (I think that's the name) to have the default permissions be the most strict set possible. I think you just remove most of the lines in the "grant {}" block. Of course, then _all_ the apps you run will get no permissions, but for a one-off test changing the file back again afterwards should work :-) Cheers Bent D -- Bent Dalager - [EMAIL PROTECTED] - http://www.pvv.org/~bcd powered by emacs == 4 of 5 == Date: Mon, Nov 29 2004 8:13 am From: [EMAIL PROTECTED] (Bent C Dalager) In article <[EMAIL PROTECTED]>, Steve Sobol <[EMAIL PROTECTED]> wrote: > >Come on... yes, technically Java *is* a commercial product, however... >Proprietary? How can you say it's proprietary when the source code is sitting >on the Web downloadable by anyone? It is proprietary because it is owned by Sun and noone else is allowed to touch it(*) unless Sun give their permission. The fact that you can actually _see_ it doesn't change this. (*) - Well, you might be allowed to touch it if you do so only in the confines of your own home and don't use the resulting code for anything beyond personal use but I would consult a lawyer before trying even that :-) Cheers Bent D -- Bent Dalager - [EMAIL PROTECTED] - http://www.pvv.org/~bcd powered by emacs == 5 of 5 == Date: Mon, Nov 29 2004 8:05 am From: Steve Sobol Tim Tyler wrote: > Jean Lutrin <[EMAIL PROTECTED]> wrote or quoted: > > >>As I already said, I belong to this very small (and not very >>vocal) minority that happens to think that Un*x + Java is a >>wonderfull setup for a developer (most Java developer use Windows >>and most Un*x users have a grip with Java not being true >>Open Source Software). > > > IMO, they have a good point. > > The fact that Java is proprietary, commercial software is its > biggest weakness - in my book. You're right. We should all use .NET because it's open source. Come on... yes, technically Java *is* a commercial product, however... Proprietary? How can you say it's proprietary when the source code is sitting on the Web downloadable by anyone? -- JustThe.net Internet & New Media Services, http://JustThe.net/ Steven J. Sobol, Geek In Charge / 888.480.4NET (4638) / [EMAIL PROTECTED] PGP Key available from your friendly local key server (0xE3AE35ED) Apple Valley, California Nothing scares me anymore. I have three kids. ============================================================================== TOPIC: Reproducing du/ls in Java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3b6930f360088c78 ============================================================================== == 1 of 3 == Date: Mon, Nov 29 2004 4:08 pm From: Gordon Beaton On Mon, 29 Nov 2004 09:31:32 -0500, Sudsy wrote: > Oreo wrote: >> The length of a UNIX directory is not zero, and the size of >> symbolic link is the length of the filename that it points to. > > WRONG! Take a look at this output from a Linux system: > $ ls -l /bin/sh > lrwxrwxrwx 1 root root 4 Oct 26 13:43 /bin/sh -> bash > > That's showing a file size of 4 bytes. It's most empatically NOT > the size of /bin/bash. Well, he did say the length of the filename, not the length of the file... It might also be worth pointing out that some linux filesystems can store symlinks in the inode itself without requiring a separate data block. These are called "fast symlinks" and ls will show you their size just as if a data block had been allocated to hold the filename. To the OP: most file operations provided by the operating system act on the link target, not the link itself, and that's what Java provides. However ls uses lstat() to get the size of the symlink itself, but will show the size of the link target if you specify -L. /gordon -- [ do not email me copies of your followups ] g o r d o n + n e w s @ b a l d e r 1 3 . s e == 2 of 3 == Date: Mon, Nov 29 2004 9:31 am From: Sudsy Oreo wrote: <snip> > When compared to the output of ls, the File.length() method will not > return the proper length of directories (whether on a FAT or reiserfs > file system) or a symbolic link in UNIX. The length of a UNIX > directory is not zero, and the size of symbolic link is the length of > the filename that it points to. WRONG! Take a look at this output from a Linux system: $ ls -l /bin/sh lrwxrwxrwx 1 root root 4 Oct 26 13:43 /bin/sh -> bash That's showing a file size of 4 bytes. It's most empatically NOT the size of /bin/bash. As for the correct size of directories, I tested out the following very simple code and it returned the same value as what ls returned (not surprising, as it's just mapping to a stat(2) system call under the covers), namely 5120 bytes. import java.io.*; public class DirUsage { public static void main( String args[] ) { File f = new File( "." ); System.out.println( "Size = " + f.length() ); } } -- Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development. == 3 of 3 == Date: Mon, Nov 29 2004 4:46 pm From: "Ann" "Oreo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi there, > > I am writing an application that needs to compute the exact size of a > file. I need for this function to work in Windows and UNIX. > > One of my issues is that the length() method provided by the File > class does not return the exact size for all files. > > The essence of my problem is that I cannot properly compute the size > of a directory or symbolic links in UNIX properly. > > File.class() returns 0 for the size of directories regardless of OS. > This appears to be correct on Windows (right-click -> properties on an > empty directory in Windows). However this seems to be incorrect > according to Linux. > > When compared to the output of ls, the File.length() method will not > return the proper length of directories (whether on a FAT or reiserfs > file system) or a symbolic link in UNIX. The length of a UNIX > directory is not zero, and the size of symbolic link is the length of > the filename that it points to. > > When the windows partition is mounted in Linux, the size of the > directories on the windows partition are reported as being 4096 by > file system utilities ls and du. This contrasts the value of zero > reported by the Microsoft 98 Windows Explorer. > > Detailed examples of my problem can be found at the following thread: > http://forum.java.sun.com/thread.jspa?threadID=574755 > > How can I compute a function that will be able to compute the size of > any file under any operating system? > > I would like to avoid his path: > 1. Determine if the class is being run in Windows or UNIX > 2. If running in UNIX, > a. If a directory of symbolic link: execute : du -sb [file] > | awk '{print $1}' > or ls -al [file ] | awk ' { print $5 }' > b. Otherwise: File.length() > 3. If running Windows, simply class File.length() (?) > > > By taking this route I need to perform an if() statement every time > the size of any file is being computed, and also execute an expensive > command for some special cases (when the file is a directory of link). > The expensive commands will be common, and I would like to avoid > having to do that. > > - Oreo What about the "master file table" ? And, since there is extra overhead in a directory, do you want to assign a fraction of that overhead to your filesize too? ============================================================================== TOPIC: Correct Semaphore Implementation in Java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8259aec1ceed4f8f ============================================================================== == 1 of 2 == Date: Mon, Nov 29 2004 4:10 pm From: Andrea Desole > I'm not clear on what you're saying here. One *can* come up with > invariants such as this one: > > current value of semaphore = > initial value + number of completed V operations - > number of completed P operations true, but you can't see who is calling v and who is calling p. In the case of a resource, everyone should call once p to get the resource and once v to release it. In the case of a producer/consumer, someone can call only p and someone can call only v. > > which might be helpful in figuring out whether things "come out even", > so to speak. If I had a few more brain cycles to spend on this, maybe > I could write a (correct) similar invariant involving number of > processes waiting/suspended, and that might be helpful in thinking > about whether a particular use of semaphores would lead to deadlock. > > >>And I don't think there are different constructs for >>these two different situations. And I would be glad to know if there are. > > > Not clear what you're saying here either! > referring to what said above, what I mean is that there is a slight difference between using a semaphore in the producer/consumer case, and using a semaphore in the resource control case. Although in theory you can use a general semaphore, it might be nice to have two different semaphore types, since they are used differently and they have different constraints. But it's just an idea. == 2 of 2 == Date: Mon, Nov 29 2004 2:29 pm From: [EMAIL PROTECTED] In article <[EMAIL PROTECTED]>, Andrea Desole <[EMAIL PROTECTED]> wrote: > >> >> Well .... But semaphores are a rather general synchronization >> mechanism that can be used for things other than "acquire a resource >> / release the resource." An example is a producer/consumer setup, >> where you have one thread "producing" things and putting them in a >> shared buffer, and another thread "consuming" them. A reasonable way >> to make the consumer wait if there is nothing to consume is by using >> a semaphore, with the producer doing "V" operations and the consumer >> doing "P" operations. > >I think in general you are right. Still, often semaphores are intended >as resource control mechanism (see for example >http://mindprod.com/jgloss/semaphore.html ). Usually I find Roedy's stuff clear and helpful. The above-mentioned page is an exception -- "setting" semaphores seems imprecise (does he mean performing a V/up operation?), and I'm skeptical about the claim that semaphores are a generalization of monitors -- I'd have said it was more the other way around. But a quick Google search isn't finding anything I like much better .... >In this case you shouldn't >theoretically check, because the clients of the semaphore are >"perfectly" calling P and V an even number of times, but practically it > would be better. I'm not clear on what you're saying here. One *can* come up with invariants such as this one: current value of semaphore = initial value + number of completed V operations - number of completed P operations which might be helpful in figuring out whether things "come out even", so to speak. If I had a few more brain cycles to spend on this, maybe I could write a (correct) similar invariant involving number of processes waiting/suspended, and that might be helpful in thinking about whether a particular use of semaphores would lead to deadlock. >And I don't think there are different constructs for >these two different situations. And I would be glad to know if there are. Not clear what you're saying here either! -- | B. L. Massingill | ObDisclaimer: I don't speak for my employers; they return the favor. ============================================================================== TOPIC: JBoss to go closed source? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a8dda54906ca8df ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 5:50 am From: [EMAIL PROTECTED] (Cindi Jenkins) The issue is whether is it legal for a company to change licensing in situations where the community has contributed time, energy and code. Should JBoss be allowed to change their license and not provide compensation for those who have contributed in the past? ============================================================================== TOPIC: Advanced question about generics http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/70947db3058ccce1 ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 3:13 pm From: Michal Kleczek Adam Jenkins wrote: > Michal Kleczek <[EMAIL PROTECTED]> wrote in message news:<[EMAIL > PROTECTED]>... > >>Hi, >>actually it is the same as the original solution - but more verbose. >>To avoid wiriting "MyConnection" twice you should use a static generic >>method: > > [snip] > >>Client code: >> >>Server<MyConnection> s = Server.create(MyConnection.class); > > > I still count two "MyConnection"s in that statement, so I'm not sure > what you've gained. Hi, It's still better than three in this statement: Server<MyConnection> s = new Server<MyConnection>(MyConnection.class>; Michal ============================================================================== TOPIC: How to suppress final 0 with DecimalFormat? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c25b4efdb9f3c1f3 ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 1:42 pm From: "Adam Lipscombe" Folks, I need to output a blank if a double is 0.0; If I use DecimalFormat to format a zero double I get a single "0" output. i.e. double d = 0.0; DecimalFormat dF = new DecimalFormat("#.##"); System.out.println(dF.format(d)); gives "0". How do I get rid of the zero? TIA -Adam ============================================================================== TOPIC: java web start can run console app? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a49fe32937c92583 ============================================================================== == 1 of 2 == Date: Mon, Nov 29 2004 4:19 pm From: [EMAIL PROTECTED] (Bent C Dalager) In article <[EMAIL PROTECTED]>, Matt <[EMAIL PROTECTED]> wrote: >java web start can only runs swing/awt applications? but not console >applications? I put console application as java web start application, >and it doesn't work and no error at all. If your app works by accessing the console, then at the very least you need to open the web start console to see any output from it. If the app needs to do file access or similarly security-restricted operations, then it needs to be signed and request all-permissions from the web start runtime. Or else be rewritten to use the JNLP services. Cheers Bent D -- Bent Dalager - [EMAIL PROTECTED] - http://www.pvv.org/~bcd powered by emacs == 2 of 2 == Date: Mon, Nov 29 2004 4:11 pm From: Andrew Thompson On 29 Nov 2004 07:16:02 -0800, Matt wrote: > java web start can only runs swing/awt applications? but not console > applications? I put console application as java web start application, > and it doesn't work and no error at all. I am not sure whether JWS can be used for non-GUI'd apps,, but then, JWS will run apps. with no console. Are you *sure* it does not run? Try creating a file in a JWS non-GUI app. and see if it exists after you have launched it. -- 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: Synchronized block is accessed by other jsps http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e19df43edcc6f04f ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 12:04 pm From: "John C. Bollinger" biswa wrote: > I have a synchronized block where i am creating a temp table and > deleting it in the same method after processing. I ve to make it a > synchronized to avoid other requests from accessing the temp table > while the other request is processing. I'm not sure what you mean by "creating" a temp variable. Are you talking about a JSP scripting variable? In that case you should be using a request-scope, or perhaps even a page-scope variable instead of a session- or application-scope variable. That will eliminate any need to synchronize. Or are you talking about a Java variable in scriptlet code? In that case make it a local variable by declaring it in normal scriptlet code ( e.g. <% int localVariable = 0; %> ) instead of a an instance variable, which is what you get by using a JSP declaration (e.g, <%! ... %>). That will also remove any need to synchronize. John Bollinger [EMAIL PROTECTED] ============================================================================== TOPIC: Ejb: best way to implement an update method with BMP http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2fadf7c755facb41 ============================================================================== == 1 of 1 == Date: Mon, Nov 29 2004 7:52 am From: Andrea Desole Sudsy wrote: > Andrea Desole wrote: > >> I see. On the other side, I might want to call my setter without >> changing the database. For example, if I call setA without setB, I >> might leave the database in an inconsistent state. Not to mention the >> performance, of course. >> There would be no point otherwise in having the possibility to >> configure the transaction type for every method > > <snip> > > Not to be condescending, but you /really/ should do some more reading on > some of the basic concepts, particularly transactions. If you specify a > transaction-type of Required then a new transaction is started only if > the client isn't ALREADY in a transaction. > The usual way of doing things is to incorporate the business login in a > stateless session bean which has methods specified with a transaction-type > of Required. The entity EJBs can then utilize the same transaction as the > SLSB. If any of the updates fail then the entire transaction is rolled- > back, satisfying ACID requirements. > You had to figure that the J2EE architects would have addressed these > kinds of issues, right? > Right. Which is the reason why I find the entire thing a bit strange. This is one of the things about EJBs I don't understand, like the question about the n+1 accesses for n beans I posted a while ago. If the book you mentioned is able to give some good answers i will be glad to read it. I have two books here, plus the tutorial and the documentation, and supposing I understand correctly how things work (which I am not always believing), I absolutely don't understand the reason. Also, the solution with the extra session bean is not bad, but it adds an extra layer of complexity (the bean), which is not really needed. Actually, as far as I know, there is a pattern that says the code should look like: MyBeanData data = new MyBeanData(); data.setA( a ); data.setB( b ); myBean.update( data ); which is also okay, and it's so far my favourite solution, but it involves an extra object. For nothing. I would like to show again what for me is the best solution: myBean.setA( a ); // here no transaction (transaction type is supports or even never) myBean.setB( b ); // here no transaction either myBean.update(); // here transaction/rollback using the members previously set Sorry to argue, I agree that I should read more (which is what I'm doing), but I'm a bit surprised to see that such a simple solution can't be implemented. ============================================================================== 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
