comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * JMF usage question - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/aad921bc1cea5088 * viva questions - any ideas? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5ea074c24d5897ac * Java Sound API adjust playback speed? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fd4cf8ac5f8c6b76 * simplifying use of properties - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c8ec2d768fef49b3 * local disk based JDBC implementation - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3bcd34f5eb202fef * How do you report a JIT crash bug? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6e12e8e3c39c7cc4 * Is JCA approriate? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/deed8cd23edeab7d * JBoss and Xalan problem ... - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fb254078872725c2 * Distributed Transaction Driver - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c8fe437fa1eba9bf * Structuring JUnit tests for large package structures? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a4ee9978ce4598d * regex replace \\ by \ - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9f662bcf0fda45f7 * Developing MIDlet for PDAs and cell phones - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d0109d66581670e * Embed a java-compiler in java. - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6d2a97cca8f943 * Java application developped under Linux running ridiculously slow under Windows - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/accd6c66f1db2bc9 * convert RSA keys - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/136546fb9c297e9a * Excellent eBook for UML JAVA - 3 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/78a843129c92e6a * "Could not find main-class" - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/631c41f6c0ad1a67 * why this Applet fails - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f1a64e18e89e48c8 * Passing Servlet Context to a non servlet object. - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ea7f86915490db6b ========================================================================== TOPIC: JMF usage question http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/aad921bc1cea5088 ========================================================================== == 1 of 2 == Date: Wed, Nov 3 2004 1:12 pm From: [EMAIL PROTECTED] (Ted Holden) I've ended up with a situation which positively requires Java, which I have very little experience with, and am basically trying to have one or more other controls in a browser applet which uses the java media player and JMF. I've tried to simply add a TextArea widget next to the media player in one of the standard examples they provide, but all that comes up is the media player. I'd appreciate it if anybody could tell me what I'm doing wrong here: import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.lang.String; import java.net.URL; import java.net.MalformedURLException; import java.io.IOException; import java.util.Properties; import javax.media.*; import java.awt.TextArea; public class SimplePlayerApplet extends Applet implements ControllerListener { // media Player Player player = null; // component in which video is playing Component visualComponent = null; // controls gain, position, start, stop Component controlComponent = null; // displays progress during download Component progressBar = null; boolean firstTime = true; long CachingSize = 0L; Panel panel1 = null; TextArea textarea1 = null; int controlPanelHeight = 0; int videoWidth = 0; int videoHeight = 0; public SimplePlayerApplet() { super(); init(); } public void init() { //$ System.out.println("Applet.init() is called"); setLayout(null); this.setSize(900, 900); setBackground(Color.white); panel1 = new Panel(); panel1.setLayout( null ); add(panel1); panel1.setBounds(0, 0, 350, 350); textarea1 = new TextArea(); add(textarea1); textarea1.setBounds(500,0,150,150); // input file name from html param String mediaFile = null; // URL for our media file MediaLocator mrl = null; URL url = null; // Get the media filename info. // The applet tag should contain the path to the // source media file, relative to the html page. if ((mediaFile = getParameter("FILE")) == null) Fatal("Invalid media file parameter"); try { url = new URL(getDocumentBase(), mediaFile); mediaFile = url.toExternalForm(); } catch (MalformedURLException mue) { } try { // Create a media locator from the file name if ((mrl = new MediaLocator(mediaFile)) == null) Fatal("Can't build URL for " + mediaFile); try { player = Manager.createPlayer(mrl); } catch (NoPlayerException e) { System.out.println(e); Fatal("Could not create player for " + mrl); } // Add ourselves as a listener for a player's events // player.addControllerListener(this); } catch (MalformedURLException e) { Fatal("Invalid media file URL!"); } catch (IOException e) { Fatal("IO exception creating player for " + mrl); } } public void start() { //$ System.out.println("Applet.start() is called"); // Call start() to prefetch and start the player. if (player != null) player.start(); } /** * Stop media file playback and release resource before * leaving the page. */ public void stop() { //$ System.out.println("Applet.stop() is called"); if (player != null) { player.stop(); player.deallocate(); } } public void destroy() { //$ System.out.println("Applet.destroy() is called"); player.close(); } /** * This controllerUpdate function must be defined in order to * implement a ControllerListener interface. This * function will be called whenever there is a media event */ public synchronized void controllerUpdate(ControllerEvent event) { // If we're getting messages from a dead player, // just leave if (player == null) return; // When the player is Realized, get the visual // and control components and add them to the Applet if (event instanceof RealizeCompleteEvent) { // if (progressBar != null) { // panel1.remove(progressBar); // progressBar = null; // } int width = 320; int height = 0; if (controlComponent == null) if (( controlComponent = player.getControlPanelComponent()) != null) { controlPanelHeight = controlComponent.getPreferredSize().height; panel1.add(controlComponent); height += controlPanelHeight; } if (visualComponent == null) if (( visualComponent = player.getVisualComponent())!= null) { panel1.add(visualComponent); Dimension videoSize = visualComponent.getPreferredSize(); videoWidth = videoSize.width; videoHeight = videoSize.height; width = videoWidth; height += videoHeight; visualComponent.setBounds(0, 0, videoWidth, videoHeight); } panel1.setBounds(0, 0, width, height); if (controlComponent != null) { controlComponent.setBounds(0, videoHeight, width, controlPanelHeight); controlComponent.invalidate(); } } else if (event instanceof CachingControlEvent) { if (player.getState() > Controller.Realizing) return; // Put a progress bar up when downloading starts, // take it down when downloading ends. CachingControlEvent e = (CachingControlEvent) event; CachingControl cc = e.getCachingControl(); // Add the bar if not already there ... if (progressBar == null) { if ((progressBar = cc.getControlComponent()) != null) { panel1.add(progressBar); panel1.setSize(progressBar.getPreferredSize()); validate(); } } } else if (event instanceof EndOfMediaEvent) { // We've reached the end of the media; rewind and // start over player.setMediaTime(new Time(0)); player.start(); } else if (event instanceof ControllerErrorEvent) { // Tell TypicalPlayerApplet.start() to call it a day player = null; Fatal(((ControllerErrorEvent)event).getMessage()); } else if (event instanceof ControllerClosedEvent) { panel1.removeAll(); } } void Fatal (String s) { // Applications will make various choices about what // to do here. We print a message System.err.println("FATAL ERROR: " + s); throw new Error(s); // Invoke the uncaught exception // handler System.exit() is another // choice. } } == 2 of 2 == Date: Wed, Nov 3 2004 6:40 pm From: Andrew Thompson <[EMAIL PROTECTED]> On Wed, 03 Nov 2004 21:12:40 GMT, Ted Holden wrote: > I've ended up with a situation which positively requires Java, If that requirement is 'x-plat', you may get some nasty surprises when using JMF. Some of it is not (x-plat). >..which I > have very little experience with, Best group for (generally) Java beginners is described here <http://www.physci.org/codes/javafaq.jsp#cljh> >..and am basically trying to have one > or more other controls in a browser applet which uses the java media > player and JMF. You provided an example, but your example also requires JMF (which is secondary to this lay out problem), and I was not able to compile it. >..I've tried to simply add a TextArea widget next to > the media player in one of the standard examples they provide, but all > that comes up is the media player. You should substitute the player for something simple like a button while you sort the lay out problem. >..I'd appreciate it if anybody could > tell me what I'm doing wrong here: For the reasons above, not immediately, but I will offer some tips on preparing examples.. <http://www.physci.org/codes/sscce.jsp> And the Sun lay out tutorial... <http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html> If you cannot solve the problem by doing the latter, have a close look over the document on preparing examples. You should be able to provide a simpler statement of the lay out problem, and probably in less that 50 lines of code (as opposed to over 200). HTH -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.LensEscapes.com/ Images that escape the mundane ========================================================================== TOPIC: viva questions - any ideas? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5ea074c24d5897ac ========================================================================== == 1 of 1 == Date: Wed, Nov 3 2004 1:45 pm From: Michael Borgwardt <[EMAIL PROTECTED]> Madhur Ahuja wrote: > As regard of sun's jvm, i have found that it uses > *reference counting collectors* algorithm to find out unused > objects. No. This is wrong. > Q. What are the disadvantages of Swing over AWT? > A. Might be little slow. Not necessarily. The main disadvantage (as people seem to see it) is that it's not available until Java 1.2 and thus cannot be used in applets that are supposed to run in the outdated Microsoft JVM. > Q. What are the major changes in java from versions 1.1,1.2,1.3,1.4 > A. Although the answer of this question is best found on the Sun's site. > My instructor told that he was interested in the version groups of java. > For ex, 1.1-1.2 is regarded as similar java version while 1.3-1.4 is > regarded as another equal java version. Has anyone ideas on this? That doesn't make sense. The difference between 1.1 and 1.2 is much, MUCH bigger than between 1.2 and 1.3. > Q. There is a famous trick in java programming to prevent the > decompilation of your .class files(may be not successful). > what is that trick? Not giving the .class files away. ========================================================================== TOPIC: Java Sound API adjust playback speed? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fd4cf8ac5f8c6b76 ========================================================================== == 1 of 2 == Date: Wed, Nov 3 2004 1:50 pm From: [EMAIL PROTECTED] (Mike) In Windows media/other audio apps you can adjust the playback speed of an audio file while MAINTAINING pitch. Was wondering how to do this with java sound. found: SampleRateControl by searching, but as far as I can understand, this will only alter the PITCH and SPEED at the same time. Just want to control speed, maintain PITCH. Thank you == 2 of 2 == Date: Wed, Nov 3 2004 4:02 pm From: "Boudewijn Dijkstra" <[EMAIL PROTECTED]> "Mike" <[EMAIL PROTECTED]> schreef in bericht news:[EMAIL PROTECTED] > In Windows media/other audio apps you can adjust the playback speed of > an audio file while MAINTAINING pitch. > > Was wondering how to do this with java sound. > > found: > SampleRateControl > > by searching, but as far as I can understand, this will only alter the > PITCH and SPEED at the same time. Just want to control speed, > maintain PITCH. I'm afraid you'll have to this manually by calculating a band shift in the frequency domain after increasing the speed+pitch. ========================================================================== TOPIC: simplifying use of properties http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c8ec2d768fef49b3 ========================================================================== == 1 of 2 == Date: Wed, Nov 3 2004 1:54 pm From: "Hal Rosser" <[EMAIL PROTECTED]> "kartik" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Currently, use of (JavaBeans) properties requires manual calls to > getter & setter methods. Wouldn't it be better to extend the language > so that an expression "object.foo" (without a '()'), in the absence of > a field named foo, is treated as equivalent to a call to a > getter/setter method (depending on whether the property is being read > or written). > > I feel it would be better to do this *not* by a compile-time > transformation but by changing the spec of the getfield & putfield > instructions to invoke a getter/setter method when there is no > matching field. Then, classes can replace fields with properties (or > vice-versa) without hurting binary compatibility (for clients who > access the fields/properties using the "object.foo" syntax). > > Maybe static properties should also be allowed. > > Any comments? Thank you. you can do that by declaring the properties public - but then other classes would have access - but you don't want that. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.781 / Virus Database: 527 - Release Date: 10/21/2004 == 2 of 2 == Date: Wed, Nov 3 2004 3:09 pm From: "Stefan Schulz" <[EMAIL PROTECTED]> On 3 Nov 2004 00:47:10 -0800, kartik <[EMAIL PROTECTED]> wrote: > I feel it would be better to do this *not* by a compile-time > transformation but by changing the spec of the getfield & putfield > instructions to invoke a getter/setter method when there is no > matching field. Then, classes can replace fields with properties (or > vice-versa) without hurting binary compatibility (for clients who > access the fields/properties using the "object.foo" syntax). What if the property is not directly (or at all) backed by any field? -- Whom the gods wish to destroy they first call promising. ========================================================================== TOPIC: local disk based JDBC implementation http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3bcd34f5eb202fef ========================================================================== == 1 of 1 == Date: Wed, Nov 3 2004 2:17 pm From: Lee Fesperman <[EMAIL PROTECTED]> Alex Hunsley wrote: > > I'm looking for local disk storage based JDBC implementations (i.e. one > that stores the database in files on disk, the exact format isn't important) > > I've found a few already: > > ... > > Just wondering if anyone is using or knows of any more that I've missed > from my above list! Take a look at FirstSQL/J (commercial), see my sig. -- Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com) ============================================================== * The Ultimate DBMS is here! * FirstSQL/J Object/Relational DBMS (http://www.firstsql.com) ========================================================================== TOPIC: How do you report a JIT crash bug? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6e12e8e3c39c7cc4 ========================================================================== == 1 of 1 == Date: Wed, Nov 3 2004 2:16 pm From: "Andy Flowers" <[EMAIL PROTECTED]> Got take a look at http://developer.java.sun.com/servlet/SessionServlet?url=/developer/bugParade/index.jshtml You will probably have to sign up, unless you already have an account, but it's free. "Mickey Segal" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Internet Explorer 6 on Windows XP running Java 1.5 crashed and left a log > file on my desktop. The log begins: > # > # An unexpected error has been detected by HotSpot Virtual Machine: > # > # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c9010f3, pid=1312, > tid=3304 > > Is there something one can do with these files? This crash occurred with > a > very large Java applet and it is unlikely that Sun will want to look > through > tens of thousands of lines of code. > > ========================================================================== TOPIC: Is JCA approriate? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/deed8cd23edeab7d ========================================================================== == 1 of 1 == Date: Wed, Nov 3 2004 2:42 pm From: Lee Fesperman <[EMAIL PROTECTED]> Reinf wrote: > > Hello group, > I am working on a data broadcasting system(in java) which communicates with > one physical broadcast card via JNI. The system itself is composed of > several EJBs and a web interface. And now we are redesigning the system in > order to work with more than one broadcast card, which involves the > management of multiple hardware resource. > My colleague suggestted the use of JCA(j2ee connector architecture), and > his reason is that JCA includes features like Transaction processing, resource > pool and etc, though it might sounds differrent from what Sun suggested. > > Do you think JCA is really approriate for this purpose? And your reasons > please. > Thank you The interface you're describing sounds like a device driver style interface. JCA is apparently intended for complex backend software systems, listing database servers, application packages like CRM/ERP and messaging systems. JCA might be overkill for your situation, but I do think it could be possibility. It is a fairly complicated API, so the question is -- is it worth the effort? Note: Though JCA provides a standardized transaction interface for container sofware (like, application servers), your software will need to handle the actual transaction processing. JCA also supports distributed transactions, but you must provide the XA implementation as a resource manager. My JDJ article on JCA might help you make your decision: http://sys-con.com/story/?storyid=46283&de=1. -- Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com) ============================================================== * The Ultimate DBMS is here! * FirstSQL/J Object/Relational DBMS (http://www.firstsql.com) ========================================================================== TOPIC: JBoss and Xalan problem ... http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fb254078872725c2 ========================================================================== == 1 of 2 == Date: Wed, Nov 3 2004 2:48 pm From: [EMAIL PROTECTED] (Elpecek) "John C. Bollinger" wrote in message > Have you considered fixing your broken stylesheet? It apparently does > not declare the "xsl" namespace prefix before using it. The fact that > some XML / XSLT systems may handle it without reporting an error does > not necessarily mean that it isn't, in fact, in error. This is the header from my stylesheet: -----=8--------------- <?xml version="1.0" encoding="ISO-8859-2"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> -----=8--------------- The exception which I get concerns default namespace (without prefix). Moreover, the stylesheet works under JDK 1.4.2 after removal of all "xsl:number" commands. But it's not the solution :-( I guess the point is to force JBoss to use different xalan instances for every application context (loaded through different class loaders). AFAIK JBoss uses flat loading model by default. Unfortunately I'm total newbie in configuration topics.... Thanks, Tomek == 2 of 2 == Date: Wed, Nov 3 2004 3:13 pm From: "John C. Bollinger" <[EMAIL PROTECTED]> Elpecek wrote: > "John C. Bollinger" wrote in message > >>Have you considered fixing your broken stylesheet? It apparently does >>not declare the "xsl" namespace prefix before using it. The fact that >>some XML / XSLT systems may handle it without reporting an error does >>not necessarily mean that it isn't, in fact, in error. > > > This is the header from my stylesheet: > -----=8--------------- > > <?xml version="1.0" encoding="ISO-8859-2"?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > > -----=8--------------- > The exception which I get concerns default namespace (without prefix). > Moreover, the stylesheet works under JDK 1.4.2 after removal of all > "xsl:number" commands. But it's not the solution :-( It seems I missed a bit on my earlier guess (sorry), but I'll stand by my position that your stylesheet is more likely buggy than is any particular Xalan or J2SDK release. If you want real help, though, then you'll need to show some code. In this case, a complete XSLT document that causes the problem you have observed would probably be a good start. The full exception message and stack trace would be helpful too. > I guess the point is to force JBoss to use different xalan instances > for every application context (loaded through different class > loaders). AFAIK JBoss uses flat loading model by default. > Unfortunately I'm total newbie in configuration topics.... I reiterate: the solution is to fix the stylesheet. I require *much* more evidence before I'll believe that the XSLT implementation in J2SDK 1.4.2_06 is buggy, but I have no trouble believing that it might be *pickier* than the one in 1.4.1. John Bollinger [EMAIL PROTECTED] ========================================================================== TOPIC: Distributed Transaction Driver http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c8fe437fa1eba9bf ========================================================================== == 1 of 1 == Date: Wed, Nov 3 2004 3:28 pm From: Lee Fesperman <[EMAIL PROTECTED]> Paolo wrote: > > I've written a driver which accesses a database like system. I'd like > to enable the driver so that it can participate in a distributed > transaction, but I'm a little overwhelmed by the complexity of the JTA > specification. Are there any resources out there that aid in > implementing this type of transactional driver? I don't think that > I'll be running my code in any sort of application server. So, if > anyone can point me to information about how the application server is > involved in the process of executing a distributed transaction, that > would be great too. I don't know any additional resources other than the main XA spec (http://www.opengroup.org/public/pubs/catalog/c193.htm). You do know that you only need to implement the XAResource interface (javax.transaction.xa.XAResource) for XA support in the resource adapter/manager, right? Of course this is not easy. Oracle is not compliant with JTA (see the current thread -- "Oracle JDBC XA question"), and I don't believe MS/SqlServer is either. MySQL doesn't even support it. The JTA spec does provide information on the requirements and actions of the application server in distributed transactions. BTW, one of those requirements is to interface with the Transaction Manager. You might consider running under a container to let it handle those aspects. -- Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com) ============================================================== * The Ultimate DBMS is here! * FirstSQL/J Object/Relational DBMS (http://www.firstsql.com) ========================================================================== TOPIC: Structuring JUnit tests for large package structures? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a4ee9978ce4598d ========================================================================== == 1 of 1 == Date: Wed, Nov 3 2004 3:32 pm From: Stephen Riehm <[EMAIL PROTECTED]> Oliver Nautsch wrote: > Stephen Riehm <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... >>Is there a neat way of recursively grouping suites of TestSuites (I >>tried subclassing TestSuite, but with little success) or is JUnit >>limited to a single TestSuite of TestCases? Have I missed something obvious? > yes it is possible. > > Let's say you have the following suites. AllTests in root is the > top-level testsuite which should include suites in the subdirectories. > > Then: > > org.huhu.root.AllTests.java > org.huhu.root.subdir1.AllTests.java > org.huhu.root.subdir2.AllTests.java > > In org.huhu.root.AllTests.java > > ... > public static Test suite() { > TestSuite suite = new TestSuite("Test for org.huhu.root"); > suite.addTest(org.huhu.root.subdir1.AllTests.suite()); > suite.addTest(org.huhu.root.subdir2.AllTests.suite()); > return suite; > } > ... OK, so then I would only need to add the new classes to the AllTests in their directory. Thanks! Steve ========================================================================== TOPIC: regex replace \\ by \ http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9f662bcf0fda45f7 ========================================================================== == 1 of 1 == Date: Wed, Nov 3 2004 4:00 pm From: Alan Moore <[EMAIL PROTECTED]> On 3 Nov 2004 03:10:07 -0800, [EMAIL PROTECTED] (Stephan Ehlert) wrote: > Hi, > > I have a problem with java.regex. In a given String \\ has to be replaced by \ > > My code leads to the following exception: > java.lang.StringIndexOutOfBoundsException: String index out of range: 1 > at java.lang.String.charAt(String.java:444) > at java.util.regex.Matcher.appendReplacement(Matcher.java:551) > > > This is my code: > ... > Pattern p = Pattern.compile("\\\\"); > Matcher m = p.matcher(s); > StringBuffer sb = new StringBuffer(); > boolean result = m.find(); > while(result) { > m.appendReplacement(sb, "\\"); > result = m.find(); > } > m.appendTail(sb); > System.out.println(sb.toString()); > ... The backslash character is special in both the regex and the replacement string, so it has to be double escaped in both places. That means, for every single backslash you want to match or insert, you have to put *four* backslashes in the regex or replacement string. Thus is born this monster: str = str.replaceAll("\\\\\\\\", "\\\\"); As John said, this is equivalent to what you're doing with the appendXXX methods, as is jAnO!'s approach. It's just that neither of them used enough backslashes. ========================================================================== TOPIC: Developing MIDlet for PDAs and cell phones http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5d0109d66581670e ========================================================================== == 1 of 1 == Date: Wed, Nov 3 2004 4:32 am From: "Darryl L. Pierce" <[EMAIL PROTECTED]> Rhino wrote: > I get it; no MIDP 3 in the near future ;-) But what *is* the method by > which new functionality will be made possible in PDAs? Surely no one > seriously imagines that no new requirements or facilities will ever be > wanted. > > For example, if the hardware that could support voice-activated > applications became sufficiently inexpensive that they could be added to > PDAs at a reasonably small cost, how would the software to support > voice-activated components be provided for in PDA software development? Optional APIs for J2ME. Things like the Bluetooth APIs, the PIM APIs (formerly the PDA Profile), Location APIs, etc. And vendors are always able to add proprietary Java APIs to their MIDP environment. The only restriction is that, if a JSR exists that covers that area, they have to provide the standard APIs as well. <snip> -- /** * @author Darryl L. Pierce <[EMAIL PROTECTED]> * @see The Infobahn Offramp <http://mcpierce.multiply.com> * @quote "Lobby, lobby, lobby, lobby, lobby, lobby..." - Adrian Monk */ ========================================================================== TOPIC: Embed a java-compiler in java. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6d2a97cca8f943 ========================================================================== == 1 of 1 == Date: Wed, Nov 3 2004 4:37 pm From: Alex Kizub <[EMAIL PROTECTED]> > I'm looking for a (hopefully open-source) java-compiler Kiev compiler - http://www.forestro.com/kiev/ ========================================================================== TOPIC: Java application developped under Linux running ridiculously slow under Windows http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/accd6c66f1db2bc9 ========================================================================== == 1 of 1 == Date: Wed, Nov 3 2004 4:36 pm From: "hshdude" <[EMAIL PROTECTED]> I owe this thread a message about the outcome. After printing out GC messages and giving the process more heap space than it could possibly need, and not seeing any change in speed, I traced down the bottleneck by hand (still hoping I could avoid having to get a profiler). As it turns out, for each simulated object (the application I'm talking about is a generic simulation of of whatever things you want simulated), a message-passing routine was called once per update cycle, sending a message to an optional software agent. When not running the agent simultaneously, an exception is thrown and ignored. So to make a long story short, throwing that exception (or realizing that the recipient agent is not alive) takes neglicable time under Linux, but an entire second under Windows... I simply threw out the message-passing code as we don't need the agent for our Windows version of the application. Sorry the solution wasn't more general so that other people could have profited from it as well. Thanks to everyone for their input!! Arnold "Tim Jowers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED] (Matthias Ernst) wrote in message news:<[EMAIL PROTECTED]>... > > "hshdude" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > > > "Michael Borgwardt" <[EMAIL PROTECTED]> wrote in message > > > news:[EMAIL PROTECTED] > > > > > > There are programs called profilers that tell you exactly where an > > application > > > > spends its time. Get one of these and use it. > > > > > > Thanks, I'll look into that! > > > > While in the end the output may be very nice, I always find profilers > > a little difficult to set up. I mostly use poor man's sampling: hit > > CTRL-break (Windows) / CTRL-Backslash (UNIX) repeatedly to get some > > thread dumps (with many threads, these will be long). Often it's easy > > to tell where the bottleneck is. If you still have no idea after a > > minute, then go get a profiler ... > > > > Matthias > > bongo, please let us know what you find out. The Java app I use at > work on Windows runs unacceptably slow. Pretty sure it is Windows as > the CPU sits pegged (dual 2.8GHz Dell). Windows seems to have become > slower and slower over the last several years. ========================================================================== TOPIC: convert RSA keys http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/136546fb9c297e9a ========================================================================== == 1 of 1 == Date: Wed, Nov 3 2004 6:14 pm From: "CP" <[EMAIL PROTECTED]> Hi all, I'm writing a client and server application. For the security purpose, i'm using RSA encryption and decryption in C at the client side, whereas the encrytion was wrinting in Java at server side. My problem here is, at client side i've created a pair of RSA public and private key in unsigned char[] format. But in java for cipher RSA, all the public and private key are in object format. How can i convert the existing keys in unsigned char[] to java object. Hope anyone can help. Thanks in advance! Chiew peng ========================================================================== TOPIC: Excellent eBook for UML JAVA http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/78a843129c92e6a ========================================================================== == 1 of 3 == Date: Wed, Nov 3 2004 6:23 pm From: "David Boncasio" <[EMAIL PROTECTED]> Hi All, I have been searching for a good book for UML, finally I found an excellent eBook in PDF format at http://www.JavaSoft.8k.com , There also I found another eBook called SCEA Complete KIT for Sun Certified Enterprise Architect exam. I got both of them and read well, I passed SCEA with 93% score. This is an excellent product( http://www.JavaSoft.8k.com ) for those who are preparing for Sun's SCEA, or IBM's UML certification. It also very useful for learning UML in Quick and Easy process. Thanks, David .............................. == 2 of 3 == Date: Wed, Nov 3 2004 6:23 pm From: "David Boncasio" <[EMAIL PROTECTED]> Hi All, I have been searching for a good book for UML, finally I found an excellent eBook in PDF format at http://www.JavaSoft.8k.com , There also I found another eBook called SCEA Complete KIT for Sun Certified Enterprise Architect exam. I got both of them and read well, I passed SCEA with 93% score. This is an excellent product( http://www.JavaSoft.8k.com ) for those who are preparing for Sun's SCEA, or IBM's UML certification. It also very useful for learning UML in Quick and Easy process. Thanks, David .............................. == 3 of 3 == Date: Wed, Nov 3 2004 6:24 pm From: "David Boncasio" <[EMAIL PROTECTED]> Hi All, I have been searching for a good book for UML, finally I found an excellent eBook in PDF format at http://www.JavaSoft.8k.com , There also I found another eBook called SCEA Complete KIT for Sun Certified Enterprise Architect exam. I got both of them and read well, I passed SCEA with 93% score. This is an excellent product( http://www.JavaSoft.8k.com ) for those who are preparing for Sun's SCEA, or IBM's UML certification. It also very useful for learning UML in Quick and Easy process. Thanks, David .............................. ========================================================================== TOPIC: "Could not find main-class" http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/631c41f6c0ad1a67 ========================================================================== == 1 of 1 == Date: Wed, Nov 3 2004 6:50 pm From: Andrew Thompson <[EMAIL PROTECTED]> On Wed, 03 Nov 2004 17:55:00 +0000, Tarlika Elisabeth Schmitz wrote: > I just looked through the the Roxes JNLP Ant task documentation ... Aha! I am a little perturbed that this is not in Sun's own docs.. It makes me wonder if they do 'not support' this functionality that they reserve-the-right-to-change-at-any-time *. * Pure speculation on my part > You learn something new every day. It would be boring otherwise. :-) Thanks for getting back to us. -- 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: why this Applet fails http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f1a64e18e89e48c8 ========================================================================== == 1 of 1 == Date: Wed, Nov 3 2004 6:53 pm From: Andrew Thompson <[EMAIL PROTECTED]> On Wed, 3 Nov 2004 23:47:22 +0530, Madhur Ahuja wrote: > Thanks, the problem was that I was using the old class file. Yes, applet testing is a pain with 'class caching' and all. Have you figured how to flush the cache of classes? > My Bad. Thanks ! You're welcome. -- 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: Passing Servlet Context to a non servlet object. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ea7f86915490db6b ========================================================================== == 1 of 1 == Date: Wed, Nov 3 2004 6:54 pm From: [EMAIL PROTECTED] (Alex Kay) [EMAIL PROTECTED] (Andrew Purser) wrote in message news:<[EMAIL PROTECTED]>... > As you can tell by my subject line I am fairly new to java and > servlets. > > I was hoping I could get some feed back as to the merits / problems / > suggestions of other ways to do it for the code skeleton below. > > Basically I have created a Something java class that I want to call > from a servlet. It is common to call other classes from servlets. That is one of the most powerful things in servlets, you have full access to everything in Java. > The catch is I want the Something java class to > include Jsps depending on various things. The only way I can see to do > this if for my servlet to pass the ServletContext, HttpRequest and > HttpResponse to the class. I get the feeling this may be a bad thing > to do. Can someone enlighten me? Instead of passing the ServletContext you can just get it via 'request':- RequestDispatcher rd = request.getRequestDispatcher ("blah.jsp"); rd.include(...); Servlets/YourClasses/JSPs/Filters/Taglibs can inter-operate quite well but under some conditions you can end up making a recursive call. The thing you include is included again and again. Cute to see but not useful ;-) A more common approach is to *set* something in a scope variable from say your servlet (or classes it calls). Like this:- synchronized (session) { session.setAttribute("blah", myBlahObject); } Then from some other place you would simply getAttribute("blah") and do with it as you wish. Cheers. Alex Kay. > > Cheers, > > Andrew. > > > > Code outline : > > public class Something { > > public void buildPage(ServletContext context, > HttpServletRequest req, > HttpServletResponse res) { > // do various bits and pieces to work out what page > // to include. > > context.getRequestDispatcher(jspToInlucde).include(req,res); > > } > > } > > public class MyServlet extends HttpServlet { > > doPost() { > Something.buildPage(context,request,response); > } > } ======================================================================= 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
