Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
epswing
Nov 4, 2003

Soiled Meat
God I hate Java GUI work. HATE.

So I've got this JFrame, let's call him 'happy'. Happy's just sitting there, chillin', he's got buttons and tabs and whatnot. In the same JVM, I start up a class which creates a ProcessBuilder and runs a process. Happy has nothing to do with any of this, can't see the ProcessBuilder, or the class that created it. This process started by ProcessBuilder has precious stdout and stderr InputStreams, which I gleefully want to display to the user in a brand spankin' new JFrame, let's call him 'motherfucker'. So the ProcessBuilder starts the process it's assigned to start and I spin up two threads to loop over the stdout and stderr I'm getting from that process. These two threads have the same instance of montherfucker, and in their loops are calling an append method to append their lines to a textarea sitting in motherfucker.

Here's the code those two threads are using to gobble up all the stdout and stderr of the running process:
code:
InputStreamReader isr = new InputStreamReader(input);
BufferedReader br = new BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null) {
	motherfucker.append(line);
}
br.close();
isr.close();
Remember, there are two threads running the above code, for one of them input is the stdout I'm getting out of some running process, and for the other input is the stderr. Each of them also have the same instance of motherfucker, which I'm appending lines to by calling a method.

But wait! How am I appending lines to the textarea sitting in motherfucker? You bet your rear end I'm using SwingUtilities.invokeLater. Here's the append method sitting in motherfucker:

code:
public void append(final String line) {
	SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			textarea.append(line + "\n");
		}
	});
}
So this is all fine and dandy. Motherfucker works like a charm. The problem is that happy is completely unresponsive until the process started by ProcessBuilder quits.

WHY?

Adbot
ADBOT LOVES YOU

Twitchy
May 27, 2005

epswing posted:

WHY?

You are looping over all the input / output in the seperate threads, but updating them all on the Event Dispatch thread (i.e. SwingUtilities.invokeLater(), which is the same no matter what JFrame you're using). Because you're looping over and invoking the Event Dispatch thread constantly it's locking up the other GUI. Could you not invoke the append() method at the end, and save the looping part in a StringBuilder or something?

Like:
code:
StringBuilder sb = new StringBuilder();
InputStreamReader isr = new InputStreamReader(input);
BufferedReader br = new BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null) {
    sb.append(line + "\n");
}
br.close();
isr.close();
motherfucker.append(sb.toString());
Would mean the Event Dispatch thread wouldn't be getting thrashed with what could be hundreds of lines or whatever, but it depends if you need the lines to appear in "real time".

Twitchy fucked around with this message at 00:06 on Jun 4, 2008

epswing
Nov 4, 2003

Soiled Meat
Well here's one for you: one of the processes I spawn and collect stdout/stderr from, well I just wrote a quick tcl script which prints hello, waits 45 seconds, prints goodbye, and exits. It looks like this:

code:
puts 'hi'
after 45000
puts 'bye'
exit 0
So that's what is coming in on stdout. So the stream that gobbles up stdout grabs the 'hi', and should sit there, blocked, for 45 seconds. And it does. And during this time, Mr. Happy is still frozen.

Here's another one for you: If I comment out the contents of the append method in the motherfucker jframe (so, zero calls to invokeLater), I get the same behavior.

code:
public void append(final String line) {
	/*SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			textarea.append(line + "\n");
		}
	});*/
}
Edit: Forgot this guy: :psyduck:

epswing fucked around with this message at 08:21 on Jun 4, 2008

zootm
Aug 8, 2006

We used to be better friends.

Twitchy posted:

You are looping over all the input / output in the seperate threads, but updating them all on the Event Dispatch thread (i.e. SwingUtilities.invokeLater(), which is the same no matter what JFrame you're using). Because you're looping over and invoking the Event Dispatch thread constantly it's locking up the other GUI. Could you not invoke the append() method at the end, and save the looping part in a StringBuilder or something?
Batching the input would probably be a good idea, but waiting until the entire stream is read absolutely would not fit this use-case; it would only show anything once the processes had completely stopped.

Furthermore the invokeLater method just appends update events to the queue, unless there was a lot of events (which the last post shows that there really isn't) you can't really block the UI thread like that. And even then I don't think the effect would be the one shown there.

epswing: I'm still worried that the stream reader stuff is running in the UI thread for some reason (the symptoms fit too well, dammit). Can you breakpoint on it (any line) in a debugger and check the full stacktrace doesn't have any Swing stuff in it?

Twitchy
May 27, 2005

zootm posted:

Batching the input would probably be a good idea, but waiting until the entire stream is read absolutely would not fit this use-case; it would only show anything once the processes had completely stopped.

Furthermore the invokeLater method just appends update events to the queue, unless there was a lot of events (which the last post shows that there really isn't) you can't really block the UI thread like that. And even then I don't think the effect would be the one shown there.

epswing: I'm still worried that the stream reader stuff is running in the UI thread for some reason (the symptoms fit too well, dammit). Can you breakpoint on it (any line) in a debugger and check the full stacktrace doesn't have any Swing stuff in it?

I guess you're right, I just assumed that because the GUI was noticably locking then the processes would have to have been taking a long time (therefore probably alot of lines to parse and a ton of events added to the queue). I just thought adding what could be thousands of events to the Event Queue could have an adverse effect, especially if alot of events are queued in front of his mouse click or whatever; I'm not exactly sure of the size of the input / output streams though. I didn't think the batching of the lines would be appropriate but it's an option, even having a progress bar would suffice if there were too many lines to process, especially since the user would only see lines whizzing past anyway.

Edit: Doh, it just clicked on what he's trying to do, I guess it wouldn't be appropriate.

Instead of doing a proper debug if you want the easy way to find out just do
code:
System.out.println(Thread.currentThread().getName());
to find out if it's running on an independent thread.

epswing posted:

:psyduck:
Ah, it seems zootm is probably right, how are you making the threads?

Twitchy fucked around with this message at 11:32 on Jun 4, 2008

zootm
Aug 8, 2006

We used to be better friends.

Twitchy posted:

Ah, it seems zootm is probably right, how are you making the threads?
To be clear I was talking to epswing about this on IRC last night and it sounded like he was doing the right thing here, I just wanted to double-check.

Twitchy posted:

Instead of doing a proper debug if you want the easy way to find out just do
code:
System.out.println(Thread.currentThread().getName());
to find out if it's running on an independent thread.
This would probably work too, assuming the Swing thread has a sensible name (I think it does?).

epswing
Nov 4, 2003

Soiled Meat
Right before looping over the InputStreams I put a System.err.println("reading input " + input + " on thread " + Thread.currentThread().getName());. The output was:

code:
reading input java.io.BufferedInputStream@1301ed8 on thread Thread-2
reading input java.io.FileInputStream@a37368 on thread Thread-3
Here's another one for you, the two jframes are basically two separate programs, each running in their own javaw.exe with their own main method, etc.

How is this possible.

1337JiveTurkey
Feb 17, 2005

I think that SwingUtilities.isEventDispatchThread() is exactly what you guys are looking for.

Twitchy
May 27, 2005

epswing posted:

Here's another one for you, the two jframes are basically two separate programs, each running in their own javaw.exe with their own main method, etc.

How is this possible.

It's possible that ProcessBuilder launches subprocesses which would still be run under the same JVM instance, so only 1 Event Dispatch thread would exist between processes; honestly I don't know enough about ProcessBuilder for it to be anything other than a guess. I know JFrames appear as their own application in Task Manager but I haven't checked if they run in a seperate process or not normally so i'll check that out later.

Can you post the code you're using to launch the motherfucker process through ProcessBuilder?

Twitchy fucked around with this message at 17:20 on Jun 4, 2008

epswing
Nov 4, 2003

Soiled Meat

1337JiveTurkey posted:

I think that SwingUtilities.isEventDispatchThread() is exactly what you guys are looking for.

The thread creating the ProcessBuilder and both threads sucking up with stdout/err are isEventDispatchThread() == false. (<-- edit: typo)

Twitchy: I guess I'll be putting together a working example, which is going to be a bitch, but at this point what choice do I have. I've removed the motherfucker jframe from the scenario completely and happy still freezes, inexplicably. I must have something else going wrong. :psyduck:

I loving hate GUI/Swing work. This is the kind of stuff that makes me want to quit my job and go into pig farming. It's challenging, but for all the wrong reasons. :smith:

epswing fucked around with this message at 18:38 on Jun 4, 2008

zootm
Aug 8, 2006

We used to be better friends.

epswing posted:

The thread creating the ProcessBuilder and both threads sucking up with stdout/err are isEventDispatchThread() == true.
Then the sucking threads are not being run in separate threads, they're running in the same thread as UI, for whatever reason. That result seems to mean that everything is running in the same thread.

epswing posted:

I loving hate GUI/Swing work. This is the kind of stuff that makes me want to quit my job and go into pig farming. It's challenging, but for all the wrong reasons. :smith:
For what it's worth most GUI frameworks are like this. The one that bugs me most is Winforms on .NET Compact Framework; it's like the normal framework with all of the stacktraces and error messages removed.

epswing
Nov 4, 2003

Soiled Meat

epswing posted:

The thread creating the ProcessBuilder and both threads sucking up with stdout/err are isEventDispatchThread() == true.

zootm posted:

Then the sucking threads are not being run in separate threads, they're running in the same thread as UI, for whatever reason. That result seems to mean that everything is running in the same thread.

OH sorry, that should be isEventDispatchThread() == false. They're all false, all NOT on the event dispatch thread.

Peacefully Adrift
Jun 4, 2004

by angerbeet
Design question here.. I'm in the process of trying to put together a little app for fun..

I'm taking a file full of entries like these

quote:

2008/06/05 00:19:22 - Ardmore used -2 power at Megalith of Doom
2008/06/05 00:19:22 - Ixion used -2 power at Megalith of Doom
2008/06/05 00:19:07 - Ixion used -2 power at Megalith of Doom
2008/06/05 00:19:02 - Ardmore added 4 power at the Megalith of Doom

I'm attempting to build an app that will take a log full of entries like that and then build a player by player log that I can run operations on (For day 06/04 how much power did Ixion add, how much power did Ardmore use, etc).

I'm sort of stumped as to the best way to tie this all together.. I'm thinking some sort of list with timestamp keys, or something, but I'm really not that familiar with the language. I've started with a hashtable of Player objects, it's the specifics of the Player object design that I just can't figure out a good approach.

Peacefully Adrift fucked around with this message at 02:30 on Jun 5, 2008

Phillyt
Dec 2, 2006

by Tiny Fistpump
Where can I find the source code for an API library or whatever? I'm trying to find one of the packages in javax.swing but I haven't had much look with Google or looking in my own folders.

epswing
Nov 4, 2003

Soiled Meat

Phillyt posted:

Where can I find the source code for an API library or whatever? I'm trying to find one of the packages in javax.swing but I haven't had much look with Google or looking in my own folders.

Look in your jdk directory (mine is C:\Program Files\Java\jdk1.6.0_02), I have a src.zip file with the entire java core.

Twitchy
May 27, 2005

Phillyt posted:

Where can I find the source code for an API library or whatever? I'm trying to find one of the packages in javax.swing but I haven't had much look with Google or looking in my own folders.

If you have the JDK installed most IDE's will let you right click the Class name and goto the source code.

zootm
Aug 8, 2006

We used to be better friends.

Twitchy posted:

If you have the JDK installed most IDE's will let you right click the Class name and goto the source code.
Just ctrl-clicking the item in question should take you there in Netbeans or Eclipse.

mister_gosh
May 24, 2002

I have a real bonehead beginner type question that I'm embarrassed to ask, but here goes:

code:
public class ABC {
  public String abc;

  public String def() {
    def = abc; ...
  }
  public String ghi() {
    abc = "456"; ...
  }
  public static void main(String args[]) {
    abc = "123"; ...
  }
}
How can I access this without declaring it static? I essentially want a "global" variable for the instance of the class that I can change at any time.

Normally I'd achieve this type of thing by passing a variable between classes via method parameters, but given that this is all contained in the same class, I'm suddenly feeling very stupid (note- I'm all self taught and thus may be missing a few important fundamentals). Thanks in advance!

oh no computer
May 27, 2003

The easist getaround for this is to move all your code from main() into the constructor, and then add a call to new ABC() in main().

Funking Giblet
Jun 28, 2004

Jiglightful!
Use get and set methods instead.

Phillyt
Dec 2, 2006

by Tiny Fistpump
I'm trying to find some sort of spell checker source code so I can better learn hash trees. I Googled "open source Java spell checker" but I seem to only find really expensive ones for enterprise applications. Is there a good example of this that anyone knows of?

mister_gosh
May 24, 2002

Phillyt posted:

I'm trying to find some sort of spell checker source code so I can better learn hash trees. I Googled "open source Java spell checker" but I seem to only find really expensive ones for enterprise applications. Is there a good example of this that anyone knows of?

I'm not sure I understand the question, but why not just use a Java IDE like Netbeans (or Eclipse)? If you spell a variable wrong, it'll let you know.

Apologies if that's not what you meant and I'm stating the obvious.

Edit: Oh my face is red

mister_gosh fucked around with this message at 18:28 on Jun 10, 2008

oh no computer
May 27, 2003

http://www.devdaily.com/java/jwarehouse/jazzy/src/com/swabunga/spell/event/SpellChecker.java.shtml?

csammis
Aug 26, 2003

Mental Institution

mister_gosh posted:

I'm not sure I understand the question, but why not just use a Java IDE like Netbeans (or Eclipse)? If you spell a variable wrong, it'll let you know.

Apologies if that's not what you meant and I'm stating the obvious.

He wants the code for a spell checker, not a spell checker for his code :v:

Phillyt
Dec 2, 2006

by Tiny Fistpump

Thanks for that. I'll check it out.

mister_gosh
May 24, 2002

I can't get my JList to update. I'm going to have to get you guys on the payroll as it seems I can't get anything done without you guys. A huge thanks to everyone!

I have a button in a JFrame class. When executed, it instantiates a popup JFrame and then passes it a class that has all the info I need to browse through the data:

code:
SelectObjectPopup sop = new SelectObjectPopup();
sop.initMetaObj(metaObj);
I then have (apologies for length!):

code:
01 public class SelectObjectPopup extends JFrame {
02 
03  /* ... instance variables ... */
04  
05  public SelectObjectPopup() {
06    initComponents();
07  }
08  
09  public void initMetaObj(MetaObj metaObj) {
10    java.awt.EventQueue.invokeLater(new Runnable() {
11      public void run() {
12        new SelectTopicSetPopup().setVisible(true);
13      }
14    });
15  }
16
17  private void initComponents() {
18  
19    /* text field, buttons declared/initialized */
20    jScrollPane1 = new javax.swing.JScrollPane();
21    jList1 = new javax.swing.JList();
22
23    /* button event stuff */
24
25    // I changed this, was AbstractListModel:
26    jList1.setModel(new javax.swing.DefaultListModel() {  
27      String[] strings = { "DUMMY" };
28      public int getSize() { return strings.length; }
29      public Object getElementAt(int i) { return strings[i]; }
30      });
31        jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
32        jList1.addMouseListener(new java.awt.event.MouseAdapter() {
33            public void mouseClicked(java.awt.event.MouseEvent evt) {
34                browseApplication(evt);
35            }
36        });
37        jScrollPane1.setViewportView(jList1);
38
39        /* layout and pane stuff */
40        pack();  
41  
42  }
43
44  private void browseApplication(java.awt.event.MouseEvent evt) {
45     
46    try {
47      DefaultListModel dlm = (DefaultListModel)jList1.getModel();
48      int sz = dlm.size();
49      System.out.println("sz is "+sz);
50            
51      [B]dlm.clear();[/B]
52          
53      [B]dlm.removeAllElements();[/B]
54            
55      // iterate through custom vector and add content to JList
56      for(int x = 0; x < count; x++) {
57        String name = customVector.indexAt(x));
58        System.out.println("name:" + name);
59        dlm.addElement(name);
60      }
61            
62      jList1 = new javax.swing.JList(dlm);
63      [B]jList1.updateUI();[/B]
64      [B]jScrollPane1.updateUI();[/B]
65            
66      System.out.println("done building JList");
67            
68    } catch(Exception e) {
69      System.out.println("Exception: "+e.toString());
70    }        
71  }
72  // Variables declaration - do not modify
73  private javax.swing.JButton jButton1;
74  private javax.swing.JButton jButton2;
75  private javax.swing.JList jList1;
76  private javax.swing.JScrollPane jScrollPane1;
77  private javax.swing.JTextField jTextField1;
78  // End of variables declaration
79}


So anytime I click in the list, it displays DUMMY as the only list value, yet in the command window, I see all of the values I want it to populate the list.

I have tried many variations of clearing the jList1 and repopulating it with no success. Thanks again in advance for any input you can provide!

mister_gosh fucked around with this message at 19:08 on Jun 10, 2008

zootm
Aug 8, 2006

We used to be better friends.
You're only reassigning the field jList1; the original JList instance is still displayed in the UI. What you should really be doing is is assigning a DefaultListModel to jList1 once, never reconstructing jList1, and modifying the model (i.e. the DefaulListModel object) directly.

For what it's worth you look like you're using Netbeans. Create a new property (i.e. a getter) for a ListModel instance on the main object and use that in the designer as the model for the element (there's a dropdown that'll let you select any property of the right type). Just have a field containing the (one!) DefaultListModel instance you're using, have the getter return that, and operate only on that.

zootm fucked around with this message at 19:51 on Jun 10, 2008

mister_gosh
May 24, 2002

zootm posted:

You're only reassigning the field jList1; the original JList instance is still displayed in the UI. What you should really be doing is is assigning a DefaultListModel to jList1 once, never reconstructing jList1, and modifying the model (i.e. the DefaulListModel object) directly.

For what it's worth you look like you're using Netbeans. Create a new property (i.e. a getter) for a ListModel instance on the main object and use that in the designer as the model for the element (there's a dropdown that'll let you select any property of the right type). Just have a field containing the (one!) DefaultListModel instance you're using, have the getter return that, and operate only on that.

Thanks for the info. I am using Netbeans (6x) and trying to work through the interface to try to get it to do what you describe. I'll let you know how it goes once I find out how to create the property and find the dropdown (I think I've been staring too long at the screen!).

Twitchy
May 27, 2005

mister_gosh posted:

Thanks for the info. I am using Netbeans (6x) and trying to work through the interface to try to get it to do what you describe. I'll let you know how it goes once I find out how to create the property and find the dropdown (I think I've been staring too long at the screen!).

Aswell as the reasons zootm said before, there is another major reason why it's not working at all:

code:
jList1.setModel(new javax.swing.DefaultListModel() {
	String[] strings = { "DUMMY" };

	public int getSize() {
		return strings.length;
	}

	public Object getElementAt(int i) {
		return strings[i];
	}
});
Is overriding your getElementAt() method to only return elements in the "string" array, same with the getSize() method (which only ever returns 1, this is different from dlm.size()). Really it doesn't seem like you should have to sub class it at all, and if you want the "DUMMY" list item there to begin with, just use the addElement() method after you've created the DefaultListModel.

code:
DefaultListModel dlm = new DefaultListModel();
dlm.addElement("DUMMY");
jList1.setModel(dlm); // change to these lines

jList1 = new javax.swing.JList(dlm); // remove this line
jList1.updateUI(); // i don't think you need these
jScrollPane1.updateUI(); // ditto
Edit: and just a little pointer, avoid the line numbers as it's harder to paste for someone trying to help ;)

Twitchy fucked around with this message at 21:02 on Jun 10, 2008

zootm
Aug 8, 2006

We used to be better friends.
More explicitly, the property (along with the field) would look like this:

code:
DefaultListModel listModel = new DefaultListModel();

public ListModel getListModel()
{
    return listModel;
}
Now, the NB 6 releases seem to have this jazzy new binding framework stuff that lets you bind to whatever property on whatever object you feel like. To do this for this simple example, go to the properties for your JList in the editor, select the "..." to bind the property "model", then select the object "Form" (which refers to the current form) and there should be a property "listModel" listed, corresponding to your item. Select this and it will insert something like ${listModel} into the box and that's your binding done and dusted.

From then on just write your action handlers to update the model and the changes will be shown in the UI. You do not need to manually update the UI at all, Swing is pretty good for noticing changes in its underlying models and updating automatically.

Edit: Here is the full source to an example which I just made in the UI designer, hopefully it'll be illustrative. The only methods I wrote are the ones detailed above and the content of the "hilarityButtonActionPerformed" method (the method itself was added by the designer). Incidentally I don't know how the binding stuff works in full but it might be possible to bind your data more directly to the "elements" property of the JList.

zootm fucked around with this message at 21:05 on Jun 10, 2008

mister_gosh
May 24, 2002

Thanks guys. I'm getting somewhere (with setting the property/getter) but need to put it down for a couple hours to tend to life outside of work. I'll report back.

Again, I really appreciate the time!!

mister_gosh
May 24, 2002

zootm posted:

Edit: Here is the full source to an example which I just made in the UI designer, hopefully it'll be illustrative. The only methods I wrote are the ones detailed above and the content of the "hilarityButtonActionPerformed" method (the method itself was added by the designer). Incidentally I don't know how the binding stuff works in full but it might be possible to bind your data more directly to the "elements" property of the JList.

Wow, thanks again for everything! I got my class files all set up using essentially the same code you pasted, and then compiled and got:

quote:

Netbeans came out of the closet to say:
bad class file: C:\Program Files\NetBeans 6.0.1\java1\modules\ext\beansbinding-1.2.1.jar(org/jdesktop/beansbinding/BindingGroup.class)
class file has wrong version 49.0, should be 48.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
private org.jdesktop.beansbinding.BindingGroup bindingGroup;
1 error
BUILD FAILED (total time: 1 second)

I'm getting this error because the jar I'm building stupidly requires a jar built under Java 1.4 due to the proprietary API I am using within it...if I compile using 1.6, it works fine, but then I'll break the API calls.

mister_gosh
May 24, 2002

Ok, thanks again. I got it to work using almost the same code in Netbeans 5. Something in the bindings methods of Netbeans 6 requires it to be compiled in Java 1.5 (surprisingly not the entire swing-layout-1.0.3.jar).

Netbeans 5 definitely isn't as nice but it's still a lot better than building AWT from scratch :)

Thank you, thank you, thank you!

zootm
Aug 8, 2006

We used to be better friends.
No problem. Incidentally, though, Java 5 and 6 can call 1.4 JARs without any problem at all; unless you need the code you produce to run on 1.4 or earlier it shouldn't be an issue at all.

nonathlon
Jul 9, 2004
And yet, somehow, now it's my fault ...
While we're discussing Netbeans, what are people's feelings or experiences with (desktop, GUI) application frameworks? I've got a few programs to write in my future and have been checking out some of the choices. As these applications will end up on MacOS (in addition to other platforms), I've been looking for document-centric toolkits (i.e. an application has multiple documents each in it's own window) but there seems to be only single window or project-centric options.

Things I've looked at:

* JIDE / JDAF: nice but commercial, which doesn't suit for reasons other than money.

* Swing Application Framework / SAF / JSR 296: looks like it might be the go, although I'm still getting my head around it.

* Netbeans: impressive, although it seems to be mostly angled towards producing applications that look and behave like Netbeans.

* Eclipse: couldn't make heads or tails of it.

* Jazz: commercial but it might allow FOSS use.

* QtJambi: I like Qt, and this produces visually appealing apps.

* Various small projects: aloe, spar, Skeleton.

Any other ideas or opinions?

zootm
Aug 8, 2006

We used to be better friends.
Netbeans, using its newer Swing Application Framework stuff, is very good at making SAF apps. I assume your other Netbeans entry is the Netbeans framework itself, which is neat but only really for apps which are a lot like Netbeans, like you state. Eclipse is much the same when used as a framework.

I wouldn't go with QtJambi since I'm not a big fan of Qt, although as you say it might fit well with you since you do like the framework. Swing has the advantage of (these days) integrating very well with both Windows and Linux (GTK+) systems; the OS X stuff is nice too but Apple provide it themselves and it can be a little slow. Pre-Qt4 I'm not sure how great Qt is across platforms.

zootm fucked around with this message at 14:27 on Jun 11, 2008

Farchanter
Jun 15, 2008
EDIT: Nevermind, resolved.

Farchanter fucked around with this message at 05:02 on Jun 16, 2008

darqness
Jul 20, 2006
I have some code that queries a UDDI registry at runtime and returns the wsdl address. Now in a language like ruby I can just pass that url into a function and start calling the methods of the web service. I am sure this is possible in Java but every resource I have found so far talks about generating the classes to interact with the web service at build time. Is dynamic run time service binding or whatever you want to call it possible in java and if so how?

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
Is there a way to define an operator in java? It's not really necessary for what I'm doing, I was just curious...

Instead of:

ArrayList<Double> pointsList = divide(aggregatedPoints, dataSetSum);

Doing something like:

ArrayList<Double> pointsList = aggregatedPoints/dataSetSum;

Adbot
ADBOT LOVES YOU

oh no computer
May 27, 2003

fletcher posted:

ArrayList<Double> pointsList = aggregatedPoints/dataSetSum;
You'd probably have to cast one or both of the variables as a double for it to return a double, this should work with Java5 or later.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply