comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Hi , deprecated problem. - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e29f429e26a464e8 * Open Source Embeded Java DB with inverted indexing and search capability - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ca8c7be62eaac43 * Looking for a SIP server in Java - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/db3616eaeab78954 * blanking a java.util.Date in 1.5 - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b61c04b0e8db0fbf * how to write jsp custom tag that can have all kind of jsp elements (not only other tags but also srciplets) in his body - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a1d44605a250db25 * Why can't static methods be overridden? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1f211d387a7676de * JSplitPane. - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3ea0ec20fad5f90 * Undo - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7434631ea0c81ec8 * Obtaining derived classes - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/daa11ba437b8878b * keep the data in the form in session?? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2d54527b509c9988 * map image??? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ec70f963b2ba3e79 * compiling java source - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9ed74ee3ba9401e9 * singleton serialization and weblogic - help! - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/954d905d7b78bc0d * Need a method to see how much memory is used/available on a system (f.ex. a pc). - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f195b8ef8e6afbd4 * How to get jsp and servlet interaction. - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/517cc3bfcef61520 * Exception Handling - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a34b306b81d0e163 * Improving website responsiveness. - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f719ebe188f50463 * paint program - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a58412a811c7bb44 ========================================================================== TOPIC: Hi , deprecated problem. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e29f429e26a464e8 ========================================================================== == 1 of 2 == Date: Wed, Sep 22 2004 4:12 am From: Andrew Thompson <[EMAIL PROTECTED]> On 22 Sep 2004 03:48:43 -0700, Peter wrote: [1] > X-Trace: posting.google.com ... Posts can take a while to filter through to the archive. .. > Here is my code: Yes, we saw the same thing less than an hour ago, and two people (besides JScoobyCed) have offered assistance. Usenet is not an 'instantaneous help-service' Peter, you need to make a post then wait a day or so for replies before you go dashing off another version of the question. Even more so if you are posting through Google [1]. -- Andrew Thompson http://www.PhySci.org/codes/ Web & IT Help http://www.PhySci.org/ Open-source software suite http://www.1point1C.org/ Science & Technology http://www.lensescapes.com/ Images that escape the mundane == 2 of 2 == Date: Wed, Sep 22 2004 4:20 am From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> [EMAIL PROTECTED] (Peter) writes: > C:\>javac PComboBox_ComboPopup.java > Note: PComboBox_ComboPopup.java uses or overrides a deprecated API. > Note: Recompile with -Xlint:deprecation for details. ... > i am using jdk 1.4.2 No, you are not, because the -Xlint option was added in 1.5. ========================================================================== TOPIC: Open Source Embeded Java DB with inverted indexing and search capability http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ca8c7be62eaac43 ========================================================================== == 1 of 1 == Date: Wed, Sep 22 2004 4:15 am From: [EMAIL PROTECTED] (sakthi) Hi, You can store Java Bean objects directly. Build inverted index on any of the bean feilds. Search the index with keywords. Ideal for image, music , book download sites where author and descriptoin can be searched by the site visitors. http://beanindex.sourceforge.net Sakthi. ========================================================================== TOPIC: Looking for a SIP server in Java http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/db3616eaeab78954 ========================================================================== == 1 of 1 == Date: Wed, Sep 22 2004 4:26 am From: [EMAIL PROTECTED] (Thomas K) Hello group I'm doing my midterm project on Ip telephony, so therefore I'm loking for a implementation of a SIP server for windows in Java. Can anybody help with this? Thanks /Thomas ========================================================================== TOPIC: blanking a java.util.Date in 1.5 http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b61c04b0e8db0fbf ========================================================================== == 1 of 2 == Date: Wed, Sep 22 2004 4:44 am From: "John B. Matthews" <[EMAIL PROTECTED]> In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Chris Murphy) wrote: > Thanks for that Paul, but my problem is not with toString(), but with > the date itself (which is actually stored as a number of milliseconds > since some fixed date). Changes to the output of toString() between > 1.4 and 1.5 correctly reflect the fact that something has changed. By > 'something has changed' I suspect that the equals() contract is not > being kept across VM versions. > > A program that I have written stores dates in a database, and these > dates were stored using 1.4. This same program will give completely > different date calculation results whether run in 1.4 or 1.5. This has > nothing to do with how the dates are formatted for toString(). I can > potentially see programs out there that work with dates previously > stored in 1.4 having similar troubles. Is it possible that the trip through the middleware & database is truncating the time portion, say to around midnight? -- John ---- jmatthews at wright dot edu www dot wright dot edu/~john.matthews/ == 2 of 2 == Date: Wed, Sep 22 2004 4:56 am From: Andrew Thompson <[EMAIL PROTECTED]> On Wed, 22 Sep 2004 11:44:02 GMT, John B. Matthews wrote: > John > ---- > jmatthews at wright dot edu > www dot wright dot edu/~john.matthews/ As an side John. Is there any particular reason you use 'address munging' on your internet site URL? [ I find that most bizarre! ] -- 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: how to write jsp custom tag that can have all kind of jsp elements (not only other tags but also srciplets) in his body http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a1d44605a250db25 ========================================================================== == 1 of 2 == Date: Wed, Sep 22 2004 5:25 am From: Lukasz Indyk <[EMAIL PROTECTED]> i want to write jsp custom tag that prints string "begin", then invokes all jsp instructions from it's body (instructions == other tags and scriplets), and then prints string "end". i've tried to write it by extending SimpleTagSupport class, and coding sth like that: public void doStartTag() throws JspException { JspWriter out = getJspContext().getOut(); try{ out.println("begin"); getJspBody().invoke(null); out.println("end"); } catch (IOException e) { throw new JspTagException("RuleFileTd tag exception :" + e.getMessage()); } } the class with above method compiles without errors. this is a body-content tag of my custom tag definition in tld file i use: <body-content>JSP</body-content> but during execution of my jsp page tomcat gives me error saying that body-content cannot be set to JSP while using SimpleTagSupport. what to do now? maybe i should extend other class to write my tag? how to implement a tag that allows other tags and scriplets in his body? == 2 of 2 == Date: Wed, Sep 22 2004 5:43 am From: Andrew Thompson <[EMAIL PROTECTED]> On Wed, 22 Sep 2004 14:25:19 +0200, Lukasz Indyk wrote: > i want to write jsp custom tag .. Please refrain from multi-posting Lukasz. <http://www.physci.org/codes/javafaq.jsp#xpost> -- 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 can't static methods be overridden? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1f211d387a7676de ========================================================================== == 1 of 2 == Date: Wed, Sep 22 2004 5:43 am From: "xarax" <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Quite often I have a hierarchy of classes where > I want a specific accessor method to be > present in all classes. Therefore I specify > it in the base class. But the information > that this function returns only depends on the > actual class, so it should static, shouldn't it? We use the term "method", instead of "function". In addition to all of the other good answers, I'll reply that you may be looking for an abstract method in the abstract base class. The concrete subclass provides that actual "smarts" for the method and it can vary by subclass. A simple-minded example: ========================== public abstract class Polygon { public abstract int area(); public abstract int perimeter(); public Polygon() { super(); } } public class Rectangle extends Polygon { protected final int side1; protected final int side2; public int area() { return side1 * side2; } public int perimeter() { return 2 * (side1 + side2); } public Rectangle(final int theSide1, final int theSide2) { super(); side1 = theSide1; side2 = theSide2; } } public class Square extends Rectangle { public int perimeter() { return 4 * side1; } public Square(final int theSide) { super(theSide,theSide); } } ========================== The area() and perimeter() instance methods are abstract in the base class. The concrete subclasses provide their implementations that are appropriate for their subtype. Anywhere that the client code uses a Polygon, a Rectangle or Square could be the actual type. Anywhere that a Rectangle is used, it could be a Rectangle or a special case of a rectangle called a Square. I suggest using a factory method to instantiate the concrete subtype and return the abstract base type. The factory method could use parameters to determine which actual subtype to create, thus insulating the client code from knowing the actual subtype. -- ---------------------------- Jeffrey D. Smith Farsight Systems Corporation 24 BURLINGTON DRIVE LONGMONT, CO 80501-6906 http://www.farsight-systems.com z/Debug debugs your Systems/C programs running on IBM z/OS for FREE! == 2 of 2 == Date: Wed, Sep 22 2004 6:53 am From: [EMAIL PROTECTED] (Yakov) You can override a method that belongs to a particular instance of the object that represents your class. But your static method belongs to all instances hence you can't override it. Regards, Yakov ========================================================================== TOPIC: JSplitPane. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3ea0ec20fad5f90 ========================================================================== == 1 of 2 == Date: Wed, Sep 22 2004 6:06 am From: "Kalpesh Modha" <[EMAIL PROTECTED]> Thanks. "Babu Kalakrishnan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Kalpesh Modha wrote: >> Hello. >> >> I have a JSplitPane as below. Now currently the right handside is a html >> area. What I want to do is make the right hand side load a JFrame or a >> class. So depending on which branch/left the user selected on the left >> the right class would be loaded on the right hand side. >> >> Can I do that, if so how ? >> > > Your question ( at least one part of it) doesn't make too much sense. How > do you load a "class" into one pane of a JSplitPane ?? Do you mean a > JPanel or something like that ? > > As for loading JFrames, I'm afraid it is not possible. The AWT subsystem > does not allow any Component descending from java.awt.Window to be added > to any other Container. So Windows, Frames and Dialogs must always be only > top level containers. > > BK == 2 of 2 == Date: Wed, Sep 22 2004 6:23 am From: "andreas" <[EMAIL PROTECTED]> >>> Hello. >>> >>> I have a JSplitPane as below. Now currently the right handside is a >>> html area. What I want to do is make the right hand side load a JFrame >>> or a class. So depending on which branch/left the user selected on the >>> left the right class would be loaded on the right hand side. >>> >>> Can I do that, if so how ? >>> >> >> Your question ( at least one part of it) doesn't make too much sense. How >> do you load a "class" into one pane of a JSplitPane ?? Do you mean a >> JPanel or something like that ? >> >> As for loading JFrames, I'm afraid it is not possible. The AWT subsystem >> does not allow any Component descending from java.awt.Window to be added >> to any other Container. So Windows, Frames and Dialogs must always be >> only top level containers. >> >> BK > > why do you need to load a JFrame anyway. just load the jframe.getComponentPane() into your JSplitPane. would make more sense... andreas ========================================================================== TOPIC: Undo http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7434631ea0c81ec8 ========================================================================== == 1 of 1 == Date: Wed, Sep 22 2004 6:40 am From: Thomas Fritsch <[EMAIL PROTECTED]> Thomas Fritsch wrote: > > // Stripped-down example for undo/redoable class: ... > // Implementation of StateEditable is simple again // Implementation od StateEditable is not so simple ;-) > public void storeState(Hashtable savedState) { > if (a != null) > savedState.put("a", a); > savedState.put("b", new Integer(b)); > savedState.put("c", new Float(c)); > //... > } > public void restoreState(Hashtable savedState) { > a = (String) savedState.get("a"); > b = ((Integer) savedState.get("b")).intValue(); > c = ((Double) savedState.get("c")).doubleValue(); > //... > } public void restoreState(Hashtable savedState) { // Be careful, because StateEdit may have optimized // the Hashtable by removing the redundant entries // which didn't change during the edit: if (savedState.containsKey("a")) a = (String) savedState.get("a"); if (savedState.containsKey("b")) b = ((Integer) savedState.get("b")).intValue(); if (savedState.containsKey("c")) c = ((Double) savedState.get("c")).doubleValue(); } ... -- Thomas<dot>Fritsch<squiggle>ops<dot>de ========================================================================== TOPIC: Obtaining derived classes http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/daa11ba437b8878b ========================================================================== == 1 of 1 == Date: Wed, Sep 22 2004 6:24 am From: EjP <[EMAIL PROTECTED]> Owen Jacobson wrote: > On Tue, 21 Sep 2004 22:08:43 -0500, EjP wrote: > > >>Is there a way to get a list of classes derived from a particular base >>class? >> >>Something like >> >> Class c = Class.forName("BaseClass"); >> Class d[] = c.getDerivedClasses(); //I know this doesn't work >> >>Any advice would be appreciated. > > > The concept of "list of derived classes" is very vaguely-defined, and can > change over the course of execution as classes are loaded. What is the > real problem you are trying to solve? > Basically, I'm writing a hardware interface that will perform user-defined operations in response to a set of trigger inputs (it's for a haunted hause I'm putting together in my garage). The actions are defined by writing derived classes based on a particular base class. There's a steering GUI that allows the user to select which action to perform for each of the triggers from a pulldown list, and I want that list to automatically load. The straightforward way is to put all the action classes in a directory and just look there when the program launches, but I was hoping there might be a "cuter" way. I guess not. And yes, this is all overkill for what I'm trying to do, but I was just having some fun. Thanks for the response. -E ========================================================================== TOPIC: keep the data in the form in session?? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2d54527b509c9988 ========================================================================== == 1 of 1 == Date: Wed, Sep 22 2004 7:00 am From: [EMAIL PROTECTED] (Matt) I have MyForm.jsp for the form, and MyAction.jsp that process the request. MyAction.jsp will interact with another system, if it fails, then it will show MyForm.jsp with the data entered by the user again. Everything is in the same browser. In my case, should I keep the data in the session, so that it can go back? Maybe I should use <jsp:forward> tag also? ========================================================================== TOPIC: map image??? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ec70f963b2ba3e79 ========================================================================== == 1 of 2 == Date: Wed, Sep 22 2004 7:43 am From: [EMAIL PROTECTED] (nuria) Is it possible to create image maps in java, i have an image with several parts and i want to have different action listeners for each section. I bascially want to create an image map as you would with an image in a HTMl page. All I really want to know is if this can be done and if yes how Hope you can help == 2 of 2 == Date: Wed, Sep 22 2004 7:49 am From: Michael Borgwardt <[EMAIL PROTECTED]> nuria wrote: > Is it possible to create image maps in java, i have an image with > several parts and i want to have different action listeners for each > section. I bascially want to create an image map as you would with an > image in a HTMl page. > > > All I really want to know is if this can be done and if yes how Of course it can be done. As for how, you'd probably draw the image on a javax.swing.JPanel and register a java.awt.event.MouseListener to react to clicks. ========================================================================== TOPIC: compiling java source http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9ed74ee3ba9401e9 ========================================================================== == 1 of 3 == Date: Wed, Sep 22 2004 7:57 am From: Daniel Sjöblom <[EMAIL PROTECTED]> Andrew Thompson wrote: > On Wed, 22 Sep 2004 09:32:47 +0600, perkal wrote: >>I need to compile a simple java source file from within a java program. > > String args[] = new String[] { options, directory, fileName }; > com.sun.tools.javac.Main.compile(args); > > The javac package is amongst packages that Sun does not publicly > document and recommends developers do not use, as they reserves > the right to change them at any time. (The smart money says they > have no reason to do that though.) But this won't run on a machine with only the runtime installed, or on any VM not made by Sun, no? -- Daniel Sjöblom Remove _NOSPAM to reply by mail == 2 of 3 == Date: Wed, Sep 22 2004 8:13 am From: Andrew Thompson <[EMAIL PROTECTED]> On Wed, 22 Sep 2004 17:57:57 +0300, Daniel Sjöblom wrote: > Andrew Thompson wrote: >> On Wed, 22 Sep 2004 09:32:47 +0600, perkal wrote: >>>I need to compile a simple java source file from within a java program. >> >> String args[] = new String[] { options, directory, fileName }; >> com.sun.tools.javac.Main.compile(args); .. > But this won't run on a machine with only the runtime installed, .. As Tor pointed out, it requires tools.jar. > ..or on any VM not made by Sun, no? Well puhh.. now you're getting exotic! -- 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 == 3 of 3 == Date: Wed, Sep 22 2004 8:18 am From: Michael Borgwardt <[EMAIL PROTECTED]> Daniel Sjöblom wrote: > But this won't run on a machine with only the runtime installed, or on > any VM not made by Sun, no? Indeed. That's why there is JSR 199: http://www.jcp.org/en/jsr/detail?id=199 Orignally planned to be included in Java 1.5/5.0, but unfortunately didn't make it... ========================================================================== TOPIC: singleton serialization and weblogic - help! http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/954d905d7b78bc0d ========================================================================== == 1 of 1 == Date: Wed, Sep 22 2004 7:56 am From: [EMAIL PROTECTED] (Lincoln Marr) hi everyone, I'm trying to serialize a singleton cache object we're using for our website running on weblogic 6.1. I've made sure the singleton class implements serializable, and i've also put the following method in the singleton class (ChartCache.java): private Object readResolve() { return theInstance; //which is of type ChartCache } By the way I'm using jdk 1.3. Basically I've written a jsp to get the current instance of the cache and serialize it to a file. When I invoke another jsp i want it to reinflate the object and place it back into the weblogic jvm so it can once again be accessed as a singleton by all classes in the webapp. At the moment its just not working - the cache object will eventually take over half an hour to create (huge database processing going on) so I want the option, if weblogic falls over, to reinstantiate the cache without having to rebuild it from scratch. The cache will only be refreshed once a day. I'll c&p my jsp code below... ======================= restoreCache.jsp <%@ page import = "java.util.*" %> <%@ page import = "java.io.*" %> <%@ page import = "com.drkw.agencylending.website.chartcache.*" %> <%@ page import = "com.drkw.agencylending.log.Logger" %> <% ChartCache theCache = null; try { String filename = "chartCache.dat"; FileInputStream fis = new FileInputStream(filename); ObjectInputStream in = new ObjectInputStream(fis); theCache = (ChartCache)in.readObject(); in.close(); } catch(Exception e) { Logger.log(e); } %> Resurrected chart cache from file. ======================= saveCache.jsp <%@ page import = "java.util.*" %> <%@ page import = "java.io.*" %> <%@ page import = "com.drkw.agencylending.website.chartcache.*" %> <%@ page import = "com.drkw.agencylending.log.Logger" %> <% ChartCache theCache = ChartCache.getInstance(); String fileName = "chartCache.dat"; try { FileOutputStream fos = new FileOutputStream(fileName); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(theCache); oos.flush(); oos.close(); } catch(Exception e) { Logger.log(e); } %> Wrote cache object to file. ============================ At the moment, a file is getting written but it seems suspiciously small (73 bytes!) for what is a very large object. When I try to load it up again, I get no errors but when I call ChartCache.getInstance() (my singleton) it recreates the cache rather than using the one I've reinflated. ========================================================================== TOPIC: Need a method to see how much memory is used/available on a system (f.ex. a pc). http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f195b8ef8e6afbd4 ========================================================================== == 1 of 1 == Date: Wed, Sep 22 2004 7:56 am From: "John Keyes" <[EMAIL PROTECTED]> Have a look at java.lang.Runtime (http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html) ========================================================================== TOPIC: How to get jsp and servlet interaction. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/517cc3bfcef61520 ========================================================================== == 1 of 1 == Date: Wed, Sep 22 2004 7:55 am From: kaeli <[EMAIL PROTECTED]> In article <[EMAIL PROTECTED]>, burrus1 @swbell.net enlightened us with... >> > and then my jsp code : > I don't use jstl, but I do wonder if this is a typo... > <%@ taglib prefix = "c" uri="http://java.sun.com/jsp/jstl/core" %> > <html><head> > </head><body> > <b><i>My Personal Movie List</b></i><br><br><br> > > <table> > <c:forEach var = "movie" items = "${movieList}"varStatus = > "movieLoopCount"> > Shouldn't there be a space between the quote and varStatus? And isn't there an extra greater-than sign there? Try this: <c:forEach var = "movie" items = "${movieList}" varStatus = "movieLoopCount"> Other than that, I can't help much. Sorry. -- -- ~kaeli~ Practice safe eating - always use condiments. http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace ========================================================================== TOPIC: Exception Handling http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a34b306b81d0e163 ========================================================================== == 1 of 1 == Date: Wed, Sep 22 2004 8:19 am From: [EMAIL PROTECTED] (Steven M. Lewis) I like IllegalStateException as in throw new IllegalStateException("This cannot happen"); if the developer believes it should not be possible to reach a state - in your case some button must be selected - the exception should not be thrown - the code documents the assertion and if the state is reached an runtime exception is thrown. If the developer believes it is possible to reach an bad state it is better to handle it without raising an exception if possible or to invent a good runtime exception describing the problem. I favor custom runtime exceptions because if the developer can handle an issue it is easiest to catch and handle a very specific runtime exception and if the exception is not handled specific exceptions can document the problem better than general exceptions. ========================================================================== TOPIC: Improving website responsiveness. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f719ebe188f50463 ========================================================================== == 1 of 1 == Date: Wed, Sep 22 2004 8:22 am From: Bruce Lewis <[EMAIL PROTECTED]> Rico <[EMAIL PROTECTED]> writes: > All right. The post proper is: > > Would this: > for x=1 to 3000 > select * from table where item = 'x' > > be a lot slower than: > write result of (select * from table) into Hashtable > for x=1 to 3000 > hashtable.get(x) > > The answer, after I took a break: Hell Yes!! Are you really planning on doing something with each row in that order? If so, why store 3000 objects in a data structure? What you really want is select exactly those columns you want in case the table gets altered from table where item between 1 and 3000 order by item Then process each row. And while we're prematurely optimizing, note that if you know your keys are going to be consecutive integers, an array will be faster than a hash table. Good luck finding the real reason why the site is slow. I think your suspicion that thare are other SQL-clueless factors to the slowness is worth pursuing, but you do have to measure. ========================================================================== TOPIC: paint program http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a58412a811c7bb44 ========================================================================== == 1 of 2 == Date: Wed, Sep 22 2004 8:24 am From: C Williams <[EMAIL PROTECTED]> Hi, I am quite new to Java and thought that making a simple painting program would be a good way to get familiar with how to deal with its graphical features. I'm using Swing and can see how to draw solid rectangles, circles, lines, etc. But what I would like to do is implement an airbrush, which I would like to work as fast as possible. Basically, I would like to work with pixels directly: take all of the ones within a radius of a mouse click, blend them with a mask the represents the brush, and then update just those pixels back on the canvas. I'm not sure what sort of component I can draw upon that lets me just loop through its pixels. I've done something fairly similar to this a few years ago (in C++), so I am okay with the concept but just struggling with the implementation in Java. Any help you have would be most appreciated! Thanks, -Casey == 2 of 2 == Date: Wed, Sep 22 2004 8:48 am From: Paul Lutus <[EMAIL PROTECTED]> C Williams wrote: > Hi, > > I am quite new to Java and thought that making a simple painting program > would be a good way to get familiar with how to deal with its graphical > features. I'm using Swing and can see how to draw solid rectangles, > circles, lines, etc. But what I would like to do is implement an > airbrush, which I would like to work as fast as possible. Basically, I > would like to work with pixels directly: take all of the ones within a > radius of a mouse click, blend them with a mask the represents the > brush, and then update just those pixels back on the canvas. > > I'm not sure what sort of component I can draw upon that lets me just > loop through its pixels. For this purpose, you cannot use a preexisting component, you need to so some programming. One approach would be to create a short-period repeating timer that, when it timed out, would find the current mouse cursor position, discover whether the mouse button was down, then if these conditions were true, would: 1. Generate a set of signed random numbers to represent Cartesian coordinates in x and y. 2. Mathematically process the random numbers so they lie in a circle, rather than the square that would naturally be true. 3. Draw points on the drawing surface at the position of the random x,y coordinates offset by the mouse position. The reason for the timer is that, if you hold the mouse over a specific location on the drawing surface, you would want the number of painted dots to increase over time, just as would be true if you held a spray can over a spot on a wall in the real world. -- Paul Lutus http://www.arachnoid.com ======================================================================= 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
