comp.lang.java.programmer http://groups-beta.google.com/group/comp.lang.java.programmer [EMAIL PROTECTED]
Today's topics: * Font selection dialog - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3828c43244e7a4b0 * Need as much help as possible - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7c8e64b34d7154d8 * Graphs and identifying adjacent nodes - 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bed75947f1fe79c * Basic Java (was Re: I wrote my own Java in BASIC ! ! !) - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/29ec22b23b7d5d6d * Problem with ant javac task not finding interface dependence - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/16a880cc5daeb7d7 * multiple jar generation with eclipse? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/396001d421144eb8 * Displaying blank JLabel Icon. - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8787f391c42b6a42 * Which way is more efficient - comparing strings of different letter casing - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3acc767a96f24a10 * Hardware spec published? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/de3a1ca8e469825c * Search for byte pattern in a binary file. - 5 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc671002cbe38f70 * JDK 1.5 is slow in some machines ??? - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/56534cc98d3eba3e * SWT Thread Problems - 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4f533466141f7bf6 * FTPClient slow on laptops - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b8a0832b81e3518d * CORBA or some other methodology? - 3 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a7b217bf697c503b * Is "String s = "abc";" equal to "String s = new String("abc");"? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/57b8aacdcf136f3f * Looking for co-op, internship or volunteer java programmer. - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/392330321f8c5f4d * How to use javamail with Lotus Server? - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e30cbaaebd76bf67 * explanations about the Decorator design pattern - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cdc793ab3b8e63d7 * clarification about login logic in a Webapp using Struts - 1 messages, 1 author http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6107ee79d477edec ========================================================================== TOPIC: Font selection dialog http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3828c43244e7a4b0 ========================================================================== == 1 of 2 == Date: Thurs, Nov 18 2004 7:13 am From: "Ike" <[EMAIL PROTECTED]> Anyone aware of code for a JDialog for Font selection ? This is not incorporated into 1.4.x or higher, is it? Thanks, Ike == 2 of 2 == Date: Thurs, Nov 18 2004 8:13 am From: Chris Smith <[EMAIL PROTECTED]> Ike <[EMAIL PROTECTED]> wrote: > Anyone aware of code for a JDialog for Font selection ? This is not > incorporated into 1.4.x or higher, is it? Thanks, Ike To answer your second question, no it does not exist in the standard JDK. I'm not aware of anything widely available, but I haven't looked either. Hopefully someone else can help you find an existing font dialog class to use. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: Need as much help as possible http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7c8e64b34d7154d8 ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 7:22 am From: "Virgil Green" <[EMAIL PROTECTED]> "Chinnmaya Murali" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Thomas G. Marshall" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > > Collin coughed up: > > > Ann wrote: > > >> "WCU_Student3456" <[EMAIL PROTECTED]> wrote in message > > >> > > news:[EMAIL PROTECTED] > > >> > > >>> hey i'm new to the java scene and i have a major assignment due for > > >>> class on the 12th of nov. I need help with a program that has a > > >>> point class...a driver and a circle class. the program is suppost > > >>> to display info about > > >> > > >> the > > >> > > >>> circle...if anyone is interested or has pitty...college students > > >>> love pitty..please respond and i will try to send the assignment to > > >>> you...i have it scanned on adobe... > > >>> > > >>> thanks ever so much > > >> > > >> > > >> Why not outsource it to another country, grab a phone book. You can > > >> probably get all your course work done there not just java. > > >> > > >> > > > > > > I'll do it for 50,000 USD; that's dicounted for first-timers. > > > > Now all that's missing is for some Indian to pipe up and quote 10,000 USD > > for it. > > isn't that offensive to people belonging to a particular country? yes, > i belong to India. Only if you choose to be offended by it. Underbids by Indian companies are a fact... aren't they? - Virgil ========================================================================== TOPIC: Graphs and identifying adjacent nodes http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bed75947f1fe79c ========================================================================== == 1 of 3 == Date: Thurs, Nov 18 2004 7:29 am From: [EMAIL PROTECTED] (vee dub) Hi I have an applet which has a graph that has a central node (root) from this comes 5 child nodes which also act as parents to 5 more child nodes (leafs) each. Initially I want only the root node and its immediate children visible (those attached direct to the root node). If one of these children is clicked then I want only the nodes directly connected to the clicked node (its children and the root node) to be viewable, but all other nodes to be invisible (change color to same as background). The best way I see to do this is the determine which nodes are within one edge (vertice) of the clicked node and make them visible while all other nodes (either two or more edges away from clicked node) become the same color as the background and therefore invisible. Does anyone know how to measure how many edges one node is from another node to do this. I have included my java and html code so far below. Thanks ********************* JAVA ************************* import java.util.*; import java.awt.*; import java.applet.*; import java.awt.event.*; //create the class 'Node' and its variables x,y,dx,dy,fixed and lbl class Node{ double x; double y; double dx; double dy; boolean fixed; boolean hide; String lbl; String color; } //create class 'Edge' and declare its variables from, to and len class Edge { int from; int to; double len; } //create the class 'GraphPanel' which is a subclass of the superclass Panel//creates an interface to runnable, mouselistener etc//creates variables, arrays and calls relaxer thread? class GraphPanel extends Panel implements Runnable, MouseListener, MouseMotionListener { Graph graph; //creates an integer variable call nnodes (holds total number of nodes) int nnodes; //creates an array of 100 node objects called 'nodes' Node nodes[] = new Node[100]; //creates an integer variable call nnodes (holds total number of nodes) int nedges; //creates an array of 200 edge objects called 'edges' Edge edges[] = new Edge[200]; //references a thread call relaxer Thread relaxer; //sets mouse listener to the grap GraphPanel(Graph graph) { this.graph = graph; addMouseListener(this); } //finds node by searching for them by name (lbl) int findNode(String lbl) { //scans array of nodes and returns index number or match for (int i = 0 ; i < nnodes ; i++) { if (nodes[i].lbl.equals(lbl)) { return i; } } //calls addNode function using lbl arguement return addNode(lbl); } int addNode(String lbl) { Node n = new Node(); //n.setColor(java.awt.Color.blue); //Color(0, 0, 0); n.x = 10 + 380*Math.random(); n.y = 10 + 380*Math.random(); n.lbl = lbl; //n.hide = true; nodes[nnodes] = n; return nnodes++; } void addEdge(String from, String to, int len) { //new edge of type Edge Edge e = new Edge(); //use findnode method to locate endpoints by node name give in arguements e.from = findNode(from); e.to = findNode(to); e.len = len; edges[nedges++] = e; } public void run() { Thread me = Thread.currentThread(); while (relaxer == me) { relax(); //if (random && (Math.random() < 0.03)) { if (Math.random() < 0.03) { Node n = nodes[(int)(Math.random() * nnodes)]; if (!n.fixed) { n.x += 100*Math.random() - 50; n.y += 100*Math.random() - 50; } } try { Thread.sleep(100); } catch (InterruptedException e) { break; } } } synchronized void relax() { for (int i = 0 ; i < nedges ; i++) { Edge e = edges[i]; double vx = nodes[e.to].x - nodes[e.from].x; double vy = nodes[e.to].y - nodes[e.from].y; double len = Math.sqrt(vx * vx + vy * vy); len = (len == 0) ? .0001 : len; double f = (edges[i].len - len) / (len * 3); double dx = f * vx; double dy = f * vy; nodes[e.to].dx += dx; nodes[e.to].dy += dy; nodes[e.from].dx += -dx; nodes[e.from].dy += -dy; } for (int i = 0 ; i < nnodes ; i++) { Node n1 = nodes[i]; double dx = 0; double dy = 0; for (int j = 0 ; j < nnodes ; j++) { if (i == j) { continue; } Node n2 = nodes[j]; double vx = n1.x - n2.x; double vy = n1.y - n2.y; double len = vx * vx + vy * vy; if (len == 0) { dx += Math.random(); dy += Math.random(); } else if (len < 100*100) { dx += vx / len; dy += vy / len; } } double dlen = dx * dx + dy * dy; if (dlen > 0) { dlen = Math.sqrt(dlen) / 2; n1.dx += dx / dlen; n1.dy += dy / dlen; } } Dimension d = getSize(); for (int i = 0 ; i < nnodes ; i++) { Node n = nodes[i]; if (!n.fixed) { n.x += Math.max(-5, Math.min(5, n.dx)); n.y += Math.max(-5, Math.min(5, n.dy)); } if (n.x < 0) { n.x = 0; } else if (n.x > d.width) { n.x = d.width; } if (n.y < 0) { n.y = 0; } else if (n.y > d.height) { n.y = d.height; } n.dx /= 2; n.dy /= 2; } repaint(); } Node pick; boolean pickfixed; Image offscreen; Dimension offscreensize; Graphics offgraphics; //fixedcolor sets color of central node final Color fixedColor = Color.white; //color of node when clicked final Color selectColor = Color.blue; final Color edgeColor = Color.gray; //set color of node fill final Color nodeColor = Color.yellow; //final Color nodeColor = new Color(250, 220, 100); -----this line was replaced by the lien above //new color type created to hide nodes on red background final Color hideColor = Color.red; //sets the colors of edges (edges change colors as they move around) - next 3 lines final Color arcColor1 = Color.yellow; final Color arcColor2 = Color.green; final Color arcColor3 = Color.black; //paintnode method gives color and appearance to each nodes public void paintNodeorg(Graphics g, Node n, FontMetrics fm) { int x = (int)n.x; int y = (int)n.y; //sets color for rectangle fill dependent on whether node is fixed or not g.setColor((n == pick) ? selectColor : (n.fixed ? fixedColor : (n.hide ? hideColor : nodeColor))); //g.setColor((n == pick) ? selectColor : (n.fixed ? fixedColor : nodeColor));-------this line was replaced by above //length of box of node int w = fm.stringWidth(n.lbl) + 10; //height of nodes int h = fm.getHeight() + 4; //location of rectangle fill - offset g.fillRect(x - w/2, y - h / 2, w, h); //changes color of text in nodes and node outline g.setColor(Color.red); //offset of text and rectangle fill g.drawRect(x - w/2, y - h / 2, w-1, h-1); //offset of text only g.drawString(n.lbl, x - (w-10)/2, (y - (h-4)/2) + fm.getAscent()); } public void paintNode(Graphics g, Node n, FontMetrics fm) { int x = (int)n.x; int y = (int)n.y; //sets color for rectangle fill dependent on whether node is fixed or not g.setColor(Color.green); //g.setColor((n == pick) ? selectColor : (n.fixed ? fixedColor : nodeColor));-------this line was replaced by above //length of box of node int w = fm.stringWidth(n.lbl) + 10; //height of nodes int h = fm.getHeight() + 4; //location of rectangle fill - offset g.fillRect(x - w/2, y - h / 2, w, h); //changes color of text in nodes and node outline g.setColor(Color.red); //offset of text and rectangle fill g.drawRect(x - w/2, y - h / 2, w-1, h-1); //offset of text only g.drawString(n.lbl, x - (w-10)/2, (y - (h-4)/2) + fm.getAscent()); } public synchronized void update(Graphics g) { Dimension d = getSize(); if ((offscreen == null) || (d.width != offscreensize.width) || (d.height != offscreensize.height)) { offscreen = createImage(d.width, d.height); offscreensize = d; if (offgraphics != null) { offgraphics.dispose(); } offgraphics = offscreen.getGraphics(); offgraphics.setFont(getFont()); } offgraphics.setColor(getBackground()); offgraphics.fillRect(0, 0, d.width, d.height); for (int i = 0 ; i < nedges ; i++) { Edge e = edges[i]; int x1 = (int)nodes[e.from].x; int y1 = (int)nodes[e.from].y; int x2 = (int)nodes[e.to].x; int y2 = (int)nodes[e.to].y; int len = (int)Math.abs(Math.sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)) - e.len); //sets edge color dependent on length of edge at any point offgraphics.setColor((len < 10) ? arcColor1 : (len < 20 ? arcColor2 : arcColor3)) ; offgraphics.drawLine(x1, y1, x2, y2); } FontMetrics fm = offgraphics.getFontMetrics(); for (int i = 0 ; i < nnodes ; i++) { paintNode(offgraphics, nodes[i], fm); } g.drawImage(offscreen, 0, 0, null); } //1.1 event handling public void mouseClicked(MouseEvent e) { } public void mousePressed(MouseEvent e) { addMouseMotionListener(this); double bestdist = Double.MAX_VALUE; int x = e.getX(); int y = e.getY(); for (int i = 0 ; i < nnodes ; i++) { Node n = nodes[i]; double dist = (n.x - x) * (n.x - x) + (n.y - y) * (n.y - y); if (dist < bestdist) { pick = n; bestdist = dist; } } pickfixed = pick.fixed; pick.fixed = true; pick.x = x; pick.y = y; repaint(); e.consume(); } public void mouseReleased(MouseEvent e) { removeMouseMotionListener(this); if (pick != null) { pick.x = e.getX(); pick.y = e.getY(); pick.fixed = pickfixed; pick = null; } repaint(); e.consume(); } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mouseDragged(MouseEvent e) { pick.x = e.getX(); pick.y = e.getY(); repaint(); e.consume(); } public void mouseMoved(MouseEvent e) { } public void start() { relaxer = new Thread(this); relaxer.start(); } public void stop() { relaxer = null; } } public class Graph extends Applet implements ActionListener, ItemListener { GraphPanel panel; Panel controlPanel; public void init() { setLayout(new BorderLayout()); //creates applet panel panel = new GraphPanel(this); add("Center", panel); controlPanel = new Panel(); setBackground(Color.red); //imports data from html params tags String edges = getParameter("edges"); // uses stringtokenizer to create token t by splitting edges param by , delimter and then testing of param still has more tokens to continue with for (StringTokenizer t = new StringTokenizer(edges, ",") ; t.hasMoreTokens() ; ) { //places value of next tohen into str eg str = The_World-Europe/90 String str = t.nextToken(); //places index number (location) of - into variable i (0=first index) int i = str.indexOf('-'); //if - exists any except first postion if (i > 0) { //len = 50 int len = 50; //places index number of / into variable j (0 = first index) int j = str.indexOf('/'); //if / exists anywhere except first position (0) if (j > 0) { //len gets value given after / in params from webpage len = Integer.valueOf(str.substring(j+1)).intValue(); //str gets the value of the section of str between 0 and location of / //so therefore str = North_America-New York for example str = str.substring(0, j); } //calls addedge (above) method from panel class with the arguements that //identify what element of string to use (String from, String to, int len) panel.addEdge(str.substring(0,i), str.substring(i+1), len); } } //get size of applet panel and put variable 'd' Dimension d = getSize(); //gets value of centre from html parameters String center = getParameter("center"); if (center != null){ Node n = panel.nodes[panel.findNode(center)]; //sets location of centre node as half width and half height of panel n.x = d.width / 2; n.y = d.height / 2; n.fixed = true; } } public void destroy() { remove(panel); remove(controlPanel); } public void start() { panel.start(); } public void stop() { panel.stop(); } public void actionPerformed(ActionEvent e) { Object src = e.getSource(); } public void itemStateChanged(ItemEvent e) { Object src = e.getSource(); boolean on = e.getStateChange() == ItemEvent.SELECTED; } //collect data from html parameters and place into nested array info[][] public String[][] getParameterInfo() { String[][] info = { //parameter name, kind of value, description {"edges", "delimited string", "A comma-delimited list of all the edges. It takes the form of 'C-N1,C-N2,C-N3,C-NX,N1-N2/M12,N2-N3/M23,N3-NX/M3X,...' where C is the name of center node (see 'center' parameter) and NX is a node attached to the center node. For the edges connecting nodes to eachother (and not to the center node) you may (optionally) specify a length MXY separated from the edge name by a forward slash."}, {"center", "string", "The name of the center node."} }; return info; } } **************END JAVA******************* **************HTML********************* <html> <head> <title>The World</title> </head> <body bgcolor=red > <object codebase="." code="Graph.class" width=400 height=400> <param name=edges value="The_World-Europe/90, Europe-Moscow/40, Europe-Paris/40, Europe-London/40, Europe-Rome/40, The_World-Asia/90, Asia-New Delhi/40, Asia-Beijing/40, Asia-Jakarta/40, Asia-Manila/40, Asia-Hong Kong/40, Asia-Tokyo/40, The_World-North_America/90, North_America-Los Angeles/40, North_America-Chicago/40, North_America-New York/40, North_America-San Francisco/40, North_America-Honolulu/40, North_America-Washington/40, The_World-South_America/90, South_America-Lima/40, South_America-Santiago/40, South_America-Rio De Janeiro/40, The_World-Africa/90, Africa-Cairo/40, Africa-Capetown/40, Africa-Cape Town/40, The_World-Australasia/90, Australasia-Sydney/40, Australasia-Melbourne/40, Australasia-Perth/40, Australasia-Auckland/40"> <param name=center value="The_World"> alt="Your browser probably doesn't understand the <OBJECT> tag so it isn't running the applet or perhaps you need a Java Plugin" Your browser is completely ignoring the <OBJECT> tag! </object> <hr> </body> </html> == 2 of 3 == Date: Thurs, Nov 18 2004 8:10 am From: Chris Smith <[EMAIL PROTECTED]> vee dub <[EMAIL PROTECTED]> wrote: > The best way I see to do this is the > determine which nodes are within one edge (vertice) of the clicked > node and make them visible while all other nodes (either two or more > edges away from clicked node) become the same color as the background > and therefore invisible. Does anyone know how to measure how many > edges one node is from another node to do this. Measuring the number of edges of distance is more difficult than merely finding adjacent nodes. That is, a distance of one edge is much easier to identify than a longer distance. Given your data structures, finding adjacent nodes should be done with a simple loop through your array of edges. There is no better way. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 3 of 3 == Date: Thurs, Nov 18 2004 9:02 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> vee dub wrote: > The best way I see to do this is the > determine which nodes are within one edge (vertice) of the clicked > node and make them visible while all other nodes (either two or more > edges away from clicked node) become the same color as the background > and therefore invisible. Does anyone know how to measure how many > edges one node is from another node to do this. If you really want to have the distance, I guess a variant of the typical breadth-search algorithms (Google for it) for graphs should do. But from your description you want something simpler: All direct neighbors of some node. With your data structure, a brute force-search over all edges should reveal this. Pseudo-code: for all Edges { if(edge.from == center) edge.to is a neighbor else if(edge.to == center) edge.from is a neighbor } But I would consider changing the data structure (if possible), and right from the beginning provide each node with a list of its five neighbors. This costs some memory, but buys some CPU cycles. I didn't look at your code in great detail (fare to much for a quick check), but you maybe want to work a little bit on the object-oriented design of the program, too. /Thomas ========================================================================== TOPIC: Basic Java (was Re: I wrote my own Java in BASIC ! ! !) http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/29ec22b23b7d5d6d ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 7:29 am From: "Sebastian Millies" <[EMAIL PROTECTED]> "Thomas Weidenfeller" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > Hans-Marc Olsen wrote: > > Java was too expensive for me, so I wrote my own Java in BASIC. > > I have written that already in c.l.j.help: > > This is a prank to flood can.* (no idea what that hierarchy is about) > newsgroups with angry responses - see the newsgroup line in the original > posting. This is going on for some time now, in many newsgroups. > > It is best to ignore these posting. If you feel the need to respond, at > least remove the other newsgroups from your posting. If you feel the > need to "discuss" the "contents", set a follow up to a .advocacy group. > > /Thomas On the other hand, this reminds me of an amusing piece by Heinz Kabutz in the Java Specialists' Newsletter #67 on how to write BASIC code in Java. http://www.javaspecialists.co.za/archive/Issue067.html Read and smile ... -- Sebastian ========================================================================== TOPIC: Problem with ant javac task not finding interface dependence http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/16a880cc5daeb7d7 ========================================================================== == 1 of 2 == Date: Thurs, Nov 18 2004 7:35 am From: Gerard Krupa <[EMAIL PROTECTED]> Collin VanDyck wrote: > ... > If I make a change to that interface, incrementing the DB_VERSION, > apparently my ant javac task will recompile the interface correctly, but > at runtime the class that implemented the interface will still be using > the older value for DB_VERSION. > > I can, of course, fix this by cleaning out the previous build files, but > that takes a while. > > Is there a setting I can set on javac to find this dependency between my > object and the interface and compile both? IMHO the most effective solution is to use javamake (this can be plugged into Ant as a task similar to javac). It has extremely powerful dependency tracking facilities to deal with changes exactly like those that you describe. I find it more effective for incremental builds, though not as quick or fully-featured as the other main alternative - IBM's Jikes compiler. Neither of these compilers have complete support for J2SE 5.0 yet. Jikes has limited support for the new language features and AFAIK javamake just won't work at all. http://www.experimentalstuff.com/Technologies/JavaMake/ http://developers.sun.com/dev/coolstuff/javamake/ http://www-124.ibm.com/developerworks/oss/jikes/ HTH Gerard == 2 of 2 == Date: Thurs, Nov 18 2004 8:13 am From: Collin VanDyck <[EMAIL PROTECTED]> > IMHO the most effective solution is to use javamake (this can be plugged > into Ant as a task similar to javac). It has extremely powerful > dependency tracking facilities to deal with changes exactly like those > that you describe. I find it more effective for incremental builds, > though not as quick or fully-featured as the other main alternative - > IBM's Jikes compiler. > > Neither of these compilers have complete support for J2SE 5.0 yet. Jikes > has limited support for the new language features and AFAIK javamake > just won't work at all. > > http://www.experimentalstuff.com/Technologies/JavaMake/ > http://developers.sun.com/dev/coolstuff/javamake/ > > http://www-124.ibm.com/developerworks/oss/jikes/ > > HTH > > Gerard That's really helpful, thanks :) I am probably committed to staying with 1.4 for now, so this is probably just what I'm looking for. I appreciate it! ========================================================================== TOPIC: multiple jar generation with eclipse? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/396001d421144eb8 ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 7:55 am From: Bruno Grieder <[EMAIL PROTECTED]> Yoann Poizeau wrote: > Hello everybody, > I'm working with code warrior and i would like to change with eclipse. > > I need for my project to generate multiple Jar at the same time but i > haven't found the function in eclipse. I have find to generate 1 jar file > but Is there a way to generate multiple jar by compiling multiple project? > > Thanks, > > Poizeau Yoann > > Use Ant or as a workaround, download the JbossIDE which has a nice packaging manager ========================================================================== TOPIC: Displaying blank JLabel Icon. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8787f391c42b6a42 ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 8:02 am From: Chris Smith <[EMAIL PROTECTED]> Ken Adams <[EMAIL PROTECTED]> wrote: > So to do the second suggestion, Should I create a class the implements Icon? Yes. > If so, How do I override paint to do nothing yet the size of the image takes > up any panel it is in? Please let me know if I'm misunderstanding you. I was under the impression that the point was to create a transparent icon of a given size. Sizes in Java are calculated bottom-up, not top- down, so there's no way to take up the entire size of a panel, because the size of the panel *depends* on the size of the icon. You want to make this icon the same size as the visible one that you would otherwise be displaying. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: Which way is more efficient - comparing strings of different letter casing http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3acc767a96f24a10 ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 8:15 am From: Chris Smith <[EMAIL PROTECTED]> kaeli <[EMAIL PROTECTED]> wrote: > If I have a string and I don't know the letter case, and I wish to compare it > to a known string of known case, which of these methods is more efficient? Using equalsIgnoreCase is the right way to do this. I can almost guarantee it's more efficient, just based on simple logic -- if it weren't, then Sun would replace the current implementation with your code instead. The key point, though, is not that it's measured to be efficient, but simply that it's the right abstraction. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: Hardware spec published? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/de3a1ca8e469825c ========================================================================== == 1 of 2 == Date: Thurs, Nov 18 2004 8:24 am From: Chris Smith <[EMAIL PROTECTED]> VisionSet <[EMAIL PROTECTED]> wrote: > I want to know the minumum hardware spec of hardware items relevant to > running a Swing app. ie Graphics card and CPU. > > I know for instance that trying to run a Swing app on an old laptop I use is > a non-starter, I at least have to whack the colours down to 256. > > Surely there is sense in saying something like minimum 400 Mhz CPU etc Oh, okay. I didn't realize you wanted minimum system requirements. The word "spec" generally means a document that describes compliant implementations, so I was left wondering how hardware could be compliant to Swing. As far as minimum system requirements for Swing, they will of course depend on the application being written. The minimum requirements depend on a lot of factors beyond the UI framework, including all of the following: 1. The implicit resource demands of the application processing. 2. Which Swing features are used by the application. 3. The degree to which the application vendor has promised performance. 4. Marketing decisions about perceived application performance. Clearly, Sun can't make these decisions for you. Just as clearly, a low-end system that has no problem creating and displaying one JOptionPane can also have serious trouble with a more elaborate application that uses a lot of image data. So, in the end, you will still be responsible for writing the minimum system requirements for your applications. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 2 of 2 == Date: Thurs, Nov 18 2004 9:02 am From: "VisionSet" <[EMAIL PROTECTED]> "Chris Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > So, in the end, you will still be responsible for writing the minimum > system requirements for your applications. Okay, fair enough. What is the usual approach to arriving at them? Test on a range of hardware? I suppose you can get a fast PC to emulate a slower one, I imagine there are environments that do just that. -- Mike W ========================================================================== TOPIC: Search for byte pattern in a binary file. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cc671002cbe38f70 ========================================================================== == 1 of 5 == Date: Thurs, Nov 18 2004 8:40 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> xarax wrote: > His main concern is about finding the byte pattern > when it crosses a buffer boundary. The algorithms > mentioned above presume the entire file is in memory. Not at all. Knuth-Morris-Pratt requires no backing-up in the data to be tested, so that one can even be run with a byte-by-byte read method from a file. Boyer-Moore requires some backing-up to verify a potential match. If I am not mistaken, at worst as much as the wanted pattern is long. So this can e.g. easily be handed with a back-buffer of that size. I think Rabin-Karp requires a few passes over the data, and is not 100% reliable, due to using hashes, so this might not be a good idea for searching files. Oh, and it is of course possible to implement the algorithms on top of memory mapped I/O or RandomAccessFile, although I wouldn't do it. /Thomas == 2 of 5 == Date: Thurs, Nov 18 2004 8:51 am From: Chris Smith <[EMAIL PROTECTED]> Michael Borgwardt <[EMAIL PROTECTED]> wrote: > I'd solve it by keeping two buffers in memory and only replacing the "older" > one when you've gone through it. Oh, and refuse to search for a pattern that's > larger than the buffer size. Actually, one of the algorithms posted does partially solve the buffer problem. The Knuth-Morris-Pratt algorithm is a forward-only algorithm, which means that you ought to be able to wrap the byte[] in a ByteArrayInputStream, and just call read() in succession to get the characters you need. Note that this is not true, for example, of Boyer- Moore, so this is a unique characteristic of the algorithm. When you may need to look backwards (such as in Boyer-Moore), the code to search a large file on disk becomes much more complex and error-prone. On the other hand, Boyer-Moore sometimes doesn't need to examine every byte. If the search pattern is extremely large (on the order of several kilobytes, for example), this could be a win in performance for a disk- based search, since disk access is extremely slow. (I'm not familiar with Rabin-Karp, which Thomas also mentioned. I therefore have no comment on its advantages or disadvantages for this problem.) -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 3 of 5 == Date: Thurs, Nov 18 2004 8:53 am From: Chris Smith <[EMAIL PROTECTED]> Oops! Guess I should have waited for your response before writing my own! Thomas Weidenfeller <[EMAIL PROTECTED]> wrote: > Boyer-Moore requires some backing-up to verify a potential match. If I > am not mistaken, at worst as much as the wanted pattern is long. So this > can e.g. easily be handed with a back-buffer of that size. True, but only if the buffer is larger than the search pattern. Most of the time, I imagine this would be the case. It would, though, require special handling for searching at the end of the buffer (for example, you'd probably use two chained buffers so that at least one buffer's worth of data would always be available). -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation == 4 of 5 == Date: Thurs, Nov 18 2004 9:19 am From: Thomas Weidenfeller <[EMAIL PROTECTED]> Chris Smith wrote: > Oops! Guess I should have waited for your response before writing my > own! Why? This is Usenet :-) >>Boyer-Moore requires some backing-up to verify a potential match. If I >>am not mistaken, at worst as much as the wanted pattern is long. So this >>can e.g. easily be handed with a back-buffer of that size. > > > True, but only if the buffer is larger than the search pattern. I really have to look it up. AFAIR, B-M requires a maximum back-up of the size of the search pattern. It would be best to have that as a buffer. Otherwise things can become really slow - if one e.g. uses a random access file. > Most of > the time, I imagine this would be the case. It would, though, require > special handling for searching at the end of the buffer (for example, > you'd probably use two chained buffers so that at least one buffer's > worth of data would always be available). Without closer examination of the algorithm, I would go for a ring-buffer of the size of the wanted pattern, and a byte-by-byte read. Each read byte is added to the ring-buffer at the current write position and then further examined according to the algorithm. The write index of the ring buffer is advanced, and when the end of the buffer is reached, the write index is wrapped around to the first index of the buffer. When having to back up, a read index in the buffer can be moved around in the buffer, relative to the write index. /Thomas == 5 of 5 == Date: Thurs, Nov 18 2004 9:43 am From: Chris Smith <[EMAIL PROTECTED]> Thomas Weidenfeller <[EMAIL PROTECTED]> wrote: > I really have to look it up. AFAIR, B-M requires a maximum back-up of > the size of the search pattern. It would be best to have that as a > buffer. Otherwise things can become really slow - if one e.g. uses a > random access file. Yes, I'd agree in general. However, I can imagine certain situations, as I said in my other response, where you're looking for maximum performance on large search patterns and decide to use Boyer-Moore with a much smaller buffer (say, 512 bytes or so) and RandomAccessFile, with the hope that you won't need to read the majority of the file. You'd need to be very careful not to trigger idiosynchrasies of disks that are optimized for forward access, though. > Without closer examination of the algorithm, I would go for a > ring-buffer of the size of the wanted pattern, and a byte-by-byte read. Yes, that's also an option. It's a mere matter of a constant multiplier of space efficiency, and we all know that doesn't matter, right? ;) -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: JDK 1.5 is slow in some machines ??? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/56534cc98d3eba3e ========================================================================== == 1 of 2 == Date: Thurs, Nov 18 2004 8:50 am From: [EMAIL PROTECTED] (hp) Sometime before we have moved our RMI Client-Server Application from JDK 1.4 to JDK 1.5(Tiger). We have noticed great improvement in Application Startup Time and Speed. But with two of our clients, Application Startup Time is poor(extremely slow). The VM arguments and other settings regarding our application is same. What could be the reason for slowdown? something to do with display or Network or VM arguments or ... We are not sure. Can anyone help me with some suggestion? == 2 of 2 == Date: Thurs, Nov 18 2004 8:54 am From: Michael Borgwardt <[EMAIL PROTECTED]> hp wrote: > Sometime before we have moved our RMI Client-Server Application from > JDK 1.4 to JDK 1.5(Tiger). > We have noticed great improvement in Application Startup Time and > Speed. > But with two of our clients, Application Startup Time is > poor(extremely slow). > The VM arguments and other settings regarding our application is same. > > What could be the reason for slowdown? something to do with display > or Network > or VM arguments or ... We are not sure. > > Can anyone help me with some suggestion? A possible culprit are over-eager virus scanners that insist of scanning the entire contents of ZIP archives when they're opened. The Java class libraries are in a very *big* JAR (same format as ZIP) archive. ========================================================================== TOPIC: SWT Thread Problems http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4f533466141f7bf6 ========================================================================== == 1 of 2 == Date: Thurs, Nov 18 2004 8:58 am From: [EMAIL PROTECTED] (hepp) I have written a GUI that will do some work that takes a long time to finish when a button is pressed. I moved this work to a separate thread and tried to start it with Display.asyncExec(), but it made the GUI to hang until the work was finished. I don't understand why. Here is my code in simplified form: public class Gui implements Listener { private static Shell m_window; private Button m_startButton; // =============================== // Public functions. // =============================== public PrePostCheckGui( Display display ) { m_window = createGui( display ); } public Shell getWindow() { return m_window; } public void handleEvent( Event event ) { if ( event.widget == m_startButton ) doWork(); } // =============================== // Private functions. // =============================== public void doWork() { Display.getDefault().asyncExec( new Runnable() { public void run() { // When this is run the GUI freezes for 10 s. try { Thread.sleep(10000); } catch( InterruptedException e ) { } } } ); } public Shell createGui( Display display ) { Shell gui = new Shell( display ); // Create widgets. // ... return gui; } public static void main( String[] arg ) { Display display = new Display(); m_window = new PrePostCheckGui( display ).getWindow(); m_window.open(); while( ! m_window.isDisposed() ) { if ( ! display.readAndDispatch() ) display.sleep(); } display.dispose(); } } Do you see what is wrong? Thanks in advance, hepp == 2 of 2 == Date: Thurs, Nov 18 2004 9:22 am From: Chris Smith <[EMAIL PROTECTED]> hepp <[EMAIL PROTECTED]> wrote: > I have written a GUI that will do some work that takes a long time to > finish when a button is pressed. I moved this work to a separate > thread and tried to start it with Display.asyncExec(), but it made the > GUI to hang until the work was finished. I don't understand why. It's because you're confusing the purpose of the thread control elements of SWT. Display.asyncExec causes code to be run *in* the event thread, just at a later time. You want the opposite; the work should be done outside of the event thread. What you need to do is create a new thread and run it, or better yet use some kind of thread pooling to schedule the work in a separate thread. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: FTPClient slow on laptops http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b8a0832b81e3518d ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 9:00 am From: [EMAIL PROTECTED] (Barbara Vernaeve) Hi, I hope somebody can help me with following problem: I have a Struts based JSP application (JDK1.4.1_06). I am using org.apache.commons.net.ftp.FTPClient from the commons-net-1.0.0.jar to ftp up to 5 files to a server. If I try this via a browser op a desktop, this happens within 5 seconds. If I try the same thing with the same attachments via a laptop, this takes about 30 seconds. (On some laptops it is fast however.) What can be the problem here? Can it be linked to dynamic ip addresses vs static ip addresses? It has no link with the memory on the machines or with the browser. If I just open an ftp connection on the laptop or desktop and ftp a file, this happens in about the same time. I wait for an acknowledge of the ftp before the code goes on. Thanks for your help on this tough one! Barbara ========================================================================== TOPIC: CORBA or some other methodology? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a7b217bf697c503b ========================================================================== == 1 of 3 == Date: Thurs, Nov 18 2004 9:23 am From: [EMAIL PROTECTED] (Ted Holden) On 18 Nov 2004 03:59:54 -0800, [EMAIL PROTECTED] (Dave Monroe) wrote: >Applets have a security restriction that prohibits them from >interacting with either the host system (other than cookies) or any >network address other than the one that served the applet in the first >place. >The security restriction can be bypassed by affixing a digital >signature to the applet. At that point it's up to the user at the >host end to either accept or reject the signed applet. >I would suggest you go server-to-server rather than applet-to-server. >The applet-to-server architecture is pretty lame. > >Take a look at servlets and/or Java Server Pages. Also RMI-IIOP. Thanks! I should have mentioned that this application also requires media support in the form of the JMF and I would GUESS that would rule out servlets. The real question I had was whether or not some other way of connecting a server-side object to an applet might have come along which was viewed as superior to CORBA. Part of the problem I'm having is that just a few years back Java seemed like a reasonable and simple idea, i.e. an effort to have modern-looking and maintainable code for webcentric applications, nonetheless at this juncture there seems to be this bewildering sort of a collection of things including servlets, server pages, SOAP, struts, whatever those are, beans, enhandced beans, and whatever else. It would help some if there were any sort of a general page which offered brief and simple descriptions of all such, what they did, and why they existed. == 2 of 3 == Date: Thurs, Nov 18 2004 9:27 am From: [EMAIL PROTECTED] (Ted Holden) On Thu, 18 Nov 2004 09:25:15 +0100, Thomas Weidenfeller <[EMAIL PROTECTED]> wrote: > >You talk about performance, and then you talk about CORBA? With its huge >marshaling/unmarshalling overhead? Well, yes, CORBA can be used to >exchange data, but any other TCP or UDP based protocol would do, too. >You could build your own, customized protocol (which you can fine-tune >to your needs, but which is probably the most work). You could use HTTP >+ HTML to transport the data, you could (not recommended) use SOAP. Or >whatever suits your needs. For a number of reasons, the server object in question almost has to be in C++ and not java. It strikes me as more likely that the performance differential would be several to one for this particular task, the code is proprietary and a company secret which we don't need anybody trying to reconstruct from byte code, and it would be a major sort of hassle to even try to rewrite in Java. The question is, can SOAP or any other sort of an alternative to CORBA handle C++ objects? == 3 of 3 == Date: Thurs, Nov 18 2004 9:31 am From: [EMAIL PROTECTED] (Ted Holden) On Thu, 18 Nov 2004 15:36:08 +0100, Bruno Grieder <[EMAIL PROTECTED]> wrote: >Perfectly acceptable security can be achieved with a simple https post >or get. Now, if you want procedure calls with type marshalling but >simple stuff, why not XML-RPC? Thanks! Can xml-rpc handle an object written in C++, and, if so, where can I read more about it? ========================================================================== TOPIC: Is "String s = "abc";" equal to "String s = new String("abc");"? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/57b8aacdcf136f3f ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 9:35 am From: Chris Smith <[EMAIL PROTECTED]> kaeli <[EMAIL PROTECTED]> wrote: > It is my understanding that if you don't specify the "new" keyword, if > another string object already has a reference to the value "abc", a new > object is not created (no more memory is allocated) It's a little different than that. There is a pool of String objects maintained by the JVM. Some String objects are in that pool, and others are not. When you say: String a = "abc"; then the JVM arranges for "abc" to be in that pool, and then produces a reference to it when executing that code. When you write: String a = new String("abc"); then the JVM still arranges for "abc" to be in that pool, and still provides a reference to it, but that reference is then passed into a constructor to create a NEW String object that's NOT in the pool and copies the first one. It's that second String object which ends up being assigned to the reference. This is different from your statement above. If a String object exists that contains the same contents -- abc -- but the object is NOT in the pool (if, for example, it was read from a file or database), then the literal "abc" will resolve to a new String object that's different from that existing one. It's also a little imprecise to says that the pooled String objects are created by the code above. Instead, it's better to say that the code above ensures that at some point, the JVM will arrange for the String object to have been created when that code executes. However, that object will be created only once, regardless of how many times the code is executed, or even how many times the literal "abc" appears in the code. > Mostly the difference is seen with the equals method and '=='. > Yes. Use of '==' is, in fact, the only direct way to see the difference. Indirectly, of course, you could observe the memory usage of the application after a large number of repetitions of the code. -- www.designacourse.com The Easiest Way To Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation ========================================================================== TOPIC: Looking for co-op, internship or volunteer java programmer. http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/392330321f8c5f4d ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 9:47 am From: "Larry Barowski" <MElarrybar-AT-eng_DOT_auburnANOTHERDOTeduEND> "xarax" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Software Consultant" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Are you looking for opportunity to gain professional experience in the > > software development field? Do you have a passion for coding? Are > > you a quick learner? > > > > We are looking for talented java developers to participate in our > > wireless project. ... > > Let me get this straight. You want someone to donate > their skills (listed above) to benefit your company? > When I saw the topic I thought someone was looking for a project to join. Imagine my disappointment. ========================================================================== TOPIC: How to use javamail with Lotus Server? http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e30cbaaebd76bf67 ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 9:59 am From: Tor Iver Wilhelmsen <[EMAIL PROTECTED]> "Zsolt" <[EMAIL PROTECTED]> writes: > my application uses javamail to send emails via a SMTP server. Unfortunately > in the current case no SMTP server is available (I think because of > security), all emails must be sent via a Lotus server. Any idea what I could > do? Check if IBM/Lotus has a Lotus transport provider you can plug into the JavaMail APIs. ========================================================================== TOPIC: explanations about the Decorator design pattern http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cdc793ab3b8e63d7 ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 9:40 am From: "Chris Uppal" <[EMAIL PROTECTED]> Jean Lutrin wrote: > > Instead of having /one/ object, of class CountingBufferedStream, > > which is also a BufferedStream, and also a Stream, it would > > have /three/ objects. A "CountingStream" which wraps a second > > object that is a "BufferedStream" which in turn wraps a "Stream". > > And of course, if we wanted, there could be only two objects. Say, if > we don't need the buffering option (in this example), the > "CountingStream" could wrap directly the "Stream" !? > > Which in, in some way, is what makes this pattern really great ? Exactly ! (Though I should add that any particular application of the Decorator pattern may add constraints to what can be wrapped around what. Or there may be combinations that work well and others that don't. For instance in the Java IO streams, if you use buffering at all, then the buffered stream should normally be wrapped immedately around the underling file stream (or whatever), and other decorators should be wrapped around that -- just for efficiency) -- chris ========================================================================== TOPIC: clarification about login logic in a Webapp using Struts http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6107ee79d477edec ========================================================================== == 1 of 1 == Date: Thurs, Nov 18 2004 10:05 am From: [EMAIL PROTECTED] (Jean Lutrin) Hi all, I have a question regarding how things are named in the following scenario... Imagine a Web site where you have to login before you access, say, the "forums". 1. You click on the forum link 2. The server notices you're not logged yet and directs you to the login page. 3. You enter a correct username, but you mistype your password. 4. The server ask your password a second time. 5. You enter it wrongly again. 6. The server now, after two wrong tries, propose you to send your password back by email. 7. etc. If we're using some kind of MVC framework (self made, or already made, like Struts -- leaving aside consideration about wether or not Struts is really an MVC framework etc.), what is the model, what is the view, what is the controller in the above scenario? I think I understand the "view" part, but what about the model and the controller? More specifically, there's some "logic" involved here : after two wrong login tries, we propose to send the password back by email. What is this logic related to? I hope my question makes sense, Jean P.S: I want to precise that this is definitely not for homework (as it seems to be a concern here ;) Simply I want to level my programmatic skills and my english skills. ======================================================================= 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
