[00:00:01] *** sepult has quit IRC [00:00:23] <yshavit> IvoryZion: well, but "null" means "default behavior." So for whatever reason, they wanted to give you this hook, but make it optional. [00:00:46] <yshavit> I don't know if this hook in particular is a useful one :) but that idea is okay in theory. [00:01:13] <IvoryZion> Really, what theory? [00:01:38] *** sepult has joined ##java [00:01:52] <yshavit> the "this is an optional thing that you may or may not want to override, and it's not important enough for us to force you to do so" theory [00:02:13] *** skillz2billz has joined ##java [00:02:15] *** QbY has joined ##java [00:02:25] <IvoryZion> yshavit: Like a "you should override this, but we really don't care" theory? [00:02:53] *** Niall has quit IRC [00:03:15] <QbY> this is probably an IDE question but I'm not getting an answer; i'm writing an app that requires the opening of a TCP socket. how can i get my ide to let me write as me, but run it as root for debugging [00:03:17] <yshavit> there's a difference between "you should" and "you must." If the default behavior is one that's fine 90% of the time, why force everyone who wants to extend JComponent to declare a method that does the same thing (returning null) [00:03:51] *** adaro has quit IRC [00:04:03] <pr3d4k4t> QbY: You don't. [00:04:12] <pr3d4k4t> QbY: Open a non-privileged port. [00:04:30] <QbY> pr3d4k4t: .. and then just change it for deployment? [00:04:33] *** sepult has quit IRC [00:05:10] <pr3d4k4t> QbY: Then use something sensible for deployment like a load balancer or a proxy. Exposing apps through privileged ports is a no-no. [00:05:26] <pr3d4k4t> QbY: Which port is it? [00:05:28] <QbY> hrm.. i'm building a fake pop3 server [00:05:28] *** sepult has joined ##java [00:05:34] <thefalling> how do i make it to where if a user types 1 on the keyboard, it presses a button [00:06:25] <pr3d4k4t> QbY: I see. Try debugging it on port 11000 or whatever. [00:06:47] *** lvh has left ##java [00:06:49] <pr3d4k4t> QbY: Now to run that on 110 for real, you have a few options. [00:06:50] <QbY> yeah, i just changed it to 10254 [00:06:52] <QbY> 1024 [00:07:14] <IvoryZion> yshavit: I see your point. I would submit that a method that returns null should be wholly absent from the interface. If it does nothing, then it probably shouldn't be included and overriders can implement their own. [00:09:05] <yshavit> IvoryZion: But that would make it more difficult for the look-and-feel to use that method. It would have to use reflection to first find out if the method exists. For whatever reason, the Swing people thought this is important enough to declare the behavior, but that the default behavior of "do whatever you want" is good enough, and safe enough, to be the default implementation. [00:09:08] *** Ilod has joined ##java [00:09:56] <pr3d4k4t> QbY: The safest thing to do once you deploy for real is to run this setuid. Google for that and you'll get lots of infos. You'll need to write a shell program that starts Java with the appropriate permissions for accessing resources. [00:10:29] <QbY> could always just use iptables i guess too [00:10:45] <pr3d4k4t> QbY: Heh - and that's supposed to be easier for him? [00:10:46] <yshavit> IvoryZion: it's a judgment call to put that method in that kind of a gray area, I'll grant that. In another universe, that might be an interface method. :) [00:10:57] <pr3d4k4t> QbY: It'll certainly teach him a lot more about how to configure his system's network :) [00:11:03] <QbY> i'm essentally building a server that our subscribers will connect to -- since we've moved -- when they connect it sends a single "email" advising them on what they need to do [00:12:08] <pr3d4k4t> QbY: Why not just send them an email? ;;) [00:12:18] <QbY> old mail servers are gone; and we did [00:12:21] <QbY> tons of emails [00:12:23] <QbY> and they ignored htem [00:12:24] <QbY> :) [00:12:41] <pr3d4k4t> QbY: And what makes you think that they'll pay attention to this? [00:12:47] <c_axis> does anyone else not like the way ui event listening works in java? [00:12:58] <c_axis> coming from obj-c where i can have different methods called directly for different events [00:13:16] <pr3d4k4t> c_axis: Yeah, coming from Objective-C/Cocoa Java's event handlers suck. [00:13:42] <pr3d4k4t> c_axis: Coming from Windows/KDE/Gnome, they look like the greatest thing since sliced bread. [00:13:54] <yshavit> IvoryZion: anyway, it's nice to chat about. Some people don't have that kind of curiosity, they just say "that's how it is!" and get angry at the question "why" [00:14:03] <pr3d4k4t> c_axis: If you are willing to overlook their lack of dynamism they're quite nice. [00:15:19] <pr3d4k4t> c_axis: The real missing feature is the lack of delegates. Otherwise you've got everything you need. Think of the time when you hard-coded handlers to components in IterfaceBuilder; that's more or less how Java works. [00:16:17] <IvoryZion> yshavit: I agree, the "why" of it, is typically very important. At least in my opinion. I can't say that I would never design software that way, but I can say, in 15 years I've never seen it clear to use a method that does nothing. My experience doesn't preclude the need may exist. [00:16:28] <IvoryZion> Thanks for your input. I appreciate it. [00:17:30] <yshavit> IvoryZion: My first reaction was actually that it was a mistake from an earlier rev, but javadoc says it's new in 1.5 [00:17:46] <yshavit> Maybe it's something that third-party vendors (JIDE etc) specifically requested? [00:17:49] <c_axis> pr3d4k4t: yes, delegation would be lovely ; ). anyway, thanks [00:19:54] <pr3d4k4t> c_axis: You're welcome. [00:22:39] *** goki__ has quit IRC [00:23:35] *** Niall has joined ##java [00:25:55] *** BfrOv3rfl0w_ has joined ##java [00:29:19] *** BfrOv3rfl0w has quit IRC [00:31:05] <yshavit> IvoryZion: I was thinking about it as I was taking the trash out just now, and I agree with you. If it's that unimportant for most classes (I couldn't find a single class on google that overrides it), just declare it as a separate interface. Instanceof isn't so hard. [00:31:46] <_W_> I don't see the need for even instanceof [00:31:49] *** PowerJC has joined ##java [00:32:11] <_W_> but then, spring would probably look quite different if I got to design it ^^ [00:32:12] *** PowerJC has left ##java [00:32:15] <_W_> *swing [00:32:59] * pr3d4k4t shakes his head. [00:33:16] * pr3d4k4t leaves the channel before he gets the Java willies. [00:33:22] <yshavit> _W_: if more than a couple classes would use it, but they don't have a common ancestor that also uses it, why not interface? [00:33:44] <SEcki> instanceof is handy sometimes [00:33:45] <yshavit> erm, s/interface/interface and instanceof/ [00:34:42] *** CodeWar has quit IRC [00:34:45] <_W_> I don't think implementing an interface should have a functional effect [00:35:09] <ojacobson> Indeed. Java's been moving away from magical tag interfaces since 1.5 (if not before that). [00:35:13] <_W_> it muddies the waters, makes cause and effect harder to trace and keep track of [00:35:32] <ojacobson> Annotations are okay, if only because they *don't* participate in the type system (extending an annotated class doesn't annotate your class, for example) [00:35:35] *** Razorigga has quit IRC [00:35:46] <ojacobson> Overuse of magic annotations can be just as bad, but it takes more [00:35:50] <yshavit> ojacobson: this is an interface that would actually provide a method [00:35:59] *** exobyte has quit IRC [00:36:09] <ojacobson> Further, the need to "recover" type information (by using instanceof/casting) is a fairly major design smell [00:36:13] <pr3d4k4t> ojacobson: To me that's more complexity on top of the language that it doesn't need. [00:36:28] <ojacobson> If you need to use an object as a specific type, you shouldn't lose track of the fact that it's that type in the first place, and you shouldn't force your clients to do it for you, either [00:36:36] <pr3d4k4t> ojacobson: And if Java didn't have a Pascal-like typing system you wouldn't need instanceof ;) [00:36:40] <_W_> yshavit, I am fond of composition; if you want to send the library a component that provides a functionality, you should do so by sending an instance to a method [00:36:41] <ojacobson> heh [00:36:46] <ojacobson> nominative interfaces wbni [00:36:53] <_W_> pr3d4k4t, I don't need instanceof [00:37:42] <_W_> (and if I ever get around to making my own language for the JVM, it won't have such features) [00:37:44] *** EricInBNE has joined ##java [00:38:25] <yshavit> _W_: difference in style, I guess. That seems like it'd be messier to me, but to be fair I haven't done it much. [00:39:20] <IvoryZion> This is my most recent, unsolved, Swing dilemma. Right-clicking a JList brings up a JPopupMenu. Selecting an option from the menu fires the associated actionPerformed() method. In actionPerformed() I need to know the original JList item that was right-clicked on. [00:40:02] <IvoryZion> The popup menu covers multiple list items when show. [00:40:03] *** LouisJB has quit IRC [00:40:40] <yshavit> IvoryZion: I forget, at the time that actionPerformed is called, is the JPopupMenu still open? [00:40:45] <IvoryZion> Therefore getting the mouse location can of a clicked menu item may or may not return the JList item that was right-clicked. [00:40:56] <IvoryZion> yshavit: good question. No [00:41:54] <Rainier> Add a mouse listener to the JList, catch which item was right clicked before the popup is shown (hopefully) [00:42:06] <yshavit> IvoryZion: have you considered convincing your clients that CLI is the way to go? I'm not saying it'll be easier... but it'll be easier than dealing with the mess that is Swing. ;-) [00:42:28] *** thefalling has quit IRC [00:42:59] <ojacobson> Does right-clicking a list somewhere that isn't a selected item change the selection? [00:43:07] <IvoryZion> yshavit: I wish I could, but my client is my professor who's teaching a GUI programming class. Hard sell maybe... :-) [00:43:14] <ojacobson> If so, the right thing to do is to ask the list's selection model what was selected and operate on that/those [00:43:28] <Rainier> IvoryZion, to determine whether or not the mouse click on the JList is a popup-able can be done via mouseEvent.isPopupTrigger(); [00:43:31] <yshavit> Real programmers don't use GUIs! [00:43:41] <IvoryZion> ojacobson: Right click does fire a selection. [00:43:45] <IvoryZion> *not [00:43:49] *** rchern has quit IRC [00:43:52] *** Insane8675309 has joined ##java [00:43:55] *** okae has joined ##java [00:43:57] *** Insane8675309 has left ##java [00:44:05] <SEcki> yshavit: real programmers use ed! [00:44:12] <Rainier> IvoryZion, right, that's why you use the isPopupTrigger() plus your own mouse listener on the JList to determine which item was right clicked, store it, then use that value later. [00:45:03] <yshavit> SEcki: real programmers use the butterfly! Or possibly the butterfly shortcut in emacs. [00:45:04] <Rainier> If that makes sense to you. [00:45:24] <Rainier> ugh, can we just focus on helping IvoryZion and not unoriginal XKCD references? [00:45:33] <Rainier> Good comedy is spontaneous [00:45:41] *** lilalinux is now known as lilalinux_away [00:45:57] * Rainier returns to his C program :-/ [00:46:11] <SEcki> yshavit: he, where is that xkcd about real programemrs ... [00:46:28] *** rchern has joined ##java [00:47:31] <IvoryZion> Rainier: So my ActionListener on JMenuItem needs a reference to the MouseListener on the JList. The MouseListener will save the Point of the most recent right-click. The actionPerformed() method will query the MouseListener for this Point. [00:47:37] <IvoryZion> Is that correct? [00:48:00] <yshavit> SEcki: http://xkcd.com/378/ [00:48:02] <Rainier> uh ... yeah, I think so. [00:48:34] <yshavit> Rainier: sorry, I'll stop now. [00:48:36] <Rainier> sorry, a bit distracted, but yeah, store the point (or better yet, the index calculated frrom that point!) somewhere accessible by both listeners. [00:49:04] <IvoryZion> Rainier: I think I can make that work. Seems like quite a bit of scaffolding for something that could be much easier. [00:49:22] <Rainier> the isPopupTrigger thing I mentioned isn't exactly necessarily, but it makes sure the points you store are only for events triggering the popup [00:49:50] <SEcki> ~yshavit++ [00:49:50] <javabot> yshavit has a karma level of 2, SEcki [00:50:59] *** c_axis has quit IRC [00:51:15] <IvoryZion> The more I work with JLists, the more I feel they should have the option to be created as containers that maintain their contents rather than just paint them. This would be heavier yes, but would simplify the programming model for people willing to trade size for ease. [00:51:54] *** CheerBear_ has joined ##java [00:52:01] <Rainier> I don't quite get how that would be better ... [00:52:07] <FauxFaux> IvoryZion: I guarntee you someone will have wrapped that up for you. [00:52:08] <IvoryZion> Then event listeners on the JLists could receive a reference to the element in question rather than juggle mouse coordinates and hoping for the best. [00:52:20] <Rainier> That doesn't scale [00:52:28] <Rainier> That's why they did JList and JTable the way they did [00:52:40] <Rainier> It also destroys the easy separation between the view and the model. [00:52:52] <IvoryZion> Rainier: It should be an option in the ctor. [00:52:57] <IvoryZion> Not necessarily. [00:53:02] <FauxFaux> Or you could wrap it. [00:53:06] <yshavit> IvoryZion: now that I think about it... this might be overly convoluted, but what if right-clicking the JList brought up the popup via an anonymous class (a Runnable or such), which the right-click action could initialize to store the JList? [00:53:13] <Rainier> So now something that just you want should be an option for everyone? [00:53:43] <Rainier> They created JLists and JTables to cover a pretty good base that everyone would be able to use. [00:54:51] <IvoryZion> Rainier: I just think providing the option makes the client programming model more intuitive. [00:55:19] *** CheerBear has quit IRC [00:55:24] <Rainier> I don't think so ... I'd say that I understand how to get what I want very well because I also understand the fundamentals of how JList and JTable work. [00:55:48] <Rainier> JList shouldn't behavior shouldn't be changed just because some people don't take time to get it. [00:55:53] <yshavit> IvoryZion, Rainier: Then again, nothing precludes someone from writing such a self-managing component that uses JList... [00:56:50] <Rainier> I really don't get how adding panels to another panel in a sequential grid is easier than a JList for this purpose. If I wanted that, I'd use a GridLayout parent panel and go from there. [00:57:02] <Rainier> If all items were not the same height, then I'd try wrangling with SpringLayout or GroupLayout. [00:57:55] <Rainier> (though in reality, I've found it pretty not-so-nice to get either to do a single column list of non-same-height panels that stretch from west to east ... maybe I should write another layout manager for that) [00:58:23] <Rainier> (writing layout managers is relatively easy and, different from conventional thoughts, actually fun) [00:58:40] <Rainier> StackLayout :) [00:58:44] <Rainier> anyway ... [00:58:44] <IvoryZion> Rainier: Having a Component maintained with a reference to it's model element doesn't break MVC. I'm certainly not an MVC expert, but I don't see any imposed difficulty. [00:59:12] <Rainier> You're managing it twice essentially though. [00:59:34] <IvoryZion> Yes, but by choice because you, as the programmer, are given the option. [00:59:48] <Rainier> You might as well replace those stacked components with an instance of a special class that directly contains the data it's worried about and how to paint it. [01:00:13] *** CheerBear has joined ##java [01:00:16] *** digitaloktay has quit IRC [01:00:35] <Rainier> Besides the fact that it would use more memory, the model then has to either know which component is associated with what, or when the List is told to update, the List then has to tell that component, there's now 3 hops. [01:00:58] <IvoryZion> Rainier: I guess we'll have to agree to disagree. Although I understand your perspective. [01:01:25] *** digitaloktay has joined ##java [01:01:41] <Rainier> Not to be "mean" but I'm just saying this from (what I consider to be) a view of a person who knows how certain components in Swing work, and thus work with them, not against them. [01:03:03] <Rainier> hmm, stacklayout doesn't seem like it'd be all that hard. [01:03:26] *** CheerBear_ has quit IRC [01:03:28] <Rainier> panel.add(panel, StackLayout.CENTER & StackLayout.FILL_HORIZONTAL); [01:03:37] <shingoki> JList and JTable aren't awful, but they really aren't designed THAT well [01:03:43] <shingoki> there are clear flaws with big parts of them [01:03:48] <Rainier> Like what? [01:04:09] <shingoki> Well, ListModel should be very similar to TableModel, but isn't [01:04:17] <Rainier> I used to think they were quite awful (well, JTable anyway), but I've gotten much better at Swing and find them not to be all that terrible. [01:04:39] <shingoki> For example as far as I can find, there is no neat way to fire an event that a list has changed completely [01:04:45] <Rainier> shingoki, they serve different purposes, but I do find it a bit odd that the fire+ methods are public for DefaultTableModel but not DefaultListModel. [01:05:00] <shingoki> They're not terrible, especially compared to every other table/list implementation I've ever seen [01:05:08] <shingoki> they could just do with a version 2 ;) [01:05:28] <Rainier> I don't think it would be that hard to add "list changed" fire method, though, if you wanted. [01:05:30] <shingoki> Well, DefaultTableModel isn't really much use anyway, the Abstract stuff is all you need [01:05:43] <shingoki> It's more a problem with the actual events [01:05:50] <Rainier> DefaultTableModel is nice if you don't want to implement one yourself and need add/remove [01:06:25] <shingoki> I guess, but I don't really like it, and implementing a TableModel is about the easiest bit of tables :) [01:06:29] *** skbohra_ has joined ##java [01:06:53] *** skbohra has quit IRC [01:08:31] <shingoki> ListDataEvent only has "changed", "added" and "removed" types, which technically is enough, but it's needlessly messy to tell a listener that you have completely new contents [01:09:13] <Rainier> then extend DefaultListModel, and add a method that tells it all the rows up to the previous amount changed and the rest are added. [01:09:21] <shingoki> the "neatest" way I could find was to make the model temporarily appear to be empty, and fire a "removed" event for all rows, then appear to be full again and fire an "added" method for all rows [01:09:36] *** nfrs has joined ##java [01:09:37] <shingoki> yeah I guess you can chose that pair of events as well, instead of a remove then add [01:09:43] *** Soliah has joined ##java [01:09:44] <Rainier> which requires duplicate repaints :) [01:09:49] <shingoki> but either way you end up with two events and possibly two updates [01:09:50] <shingoki> yup [01:09:59] <nfrs> is there a variant of File.createTempFile() to create a temporary directory? [01:10:00] <shingoki> either one gives two repaints [01:10:17] <shingoki> that's my point - there is no equivalent of the TableModel "everything has changed" event [01:10:20] <Rainier> no, the "current rows need updating, then add the rest" doesn't [01:10:31] <Rainier> that does one repaint per row [01:10:35] <shingoki> yes it does, there is no event for "some changed and some added", you need two events [01:10:47] <yshavit> I gotta head out, good night guys! [01:10:52] <Rainier> right, but that's still only one repaint per row [01:11:02] <Rainier> removing them all then readding them results in possibly two repaints [01:11:13] *** yshavit has left ##java [01:11:37] <shingoki> yes that's true. But of course it requires me to pointlessly work out whether I am bigger or smaller, then send either an added or removed to make the size change and a "changed" for the rest [01:11:57] <IvoryZion> hmmm.... Even though JPopupMenu is no longer showing once my actionPerformed() method fires, it does have the properties desiredLocationX and Y which appear to contain the remnants of it's upper left corner. Anyone know how to acquire these? [01:11:59] <shingoki> if a single event for that made sense for table, which it definitely did, why did they not bother for lists? [01:12:05] <Rainier> meh, them having a method for it would just mean they'd be doing that work for you anyway ... but whatever. [01:12:10] <shingoki> not really [01:12:13] *** Insane8675309 has joined ##java [01:12:31] <shingoki> since a table can be told to just forget any internal state etc. and start again, which is exactly what you want to happen [01:12:41] <Rainier> Well, they could repaint the whole thing entirely, true, but for whatever reason they didn't quite do it, besides the fact that that wouldn't be waht you wanted anyway. [01:13:00] *** Stephmw has joined ##java [01:13:05] <Rainier> because I've found when you tell a JTable that everything has changed, it seems to forget all the cell renderers you told it to use for columns. [01:13:06] *** jcp has quit IRC [01:13:20] <shingoki> plus it doesn't risk getting out of sync - I think that's why I went for the complete erase/replace approach, since I don't really want to trust every JList to always track everything, and I don't really see why whoever designed it wanted to have to track state in the model and also the view. [01:13:20] *** jcp has joined ##java [01:13:53] <shingoki> Rainier: It probably depends which event you give it - you need to make sure you send the one for "number of rows and row contents changed, but columns haven't" [01:14:08] <shingoki> you might have given it the one where columns change as well, so columns would be rebuilt and renderers lost [01:14:26] <Rainier> it doesn't matter, if you tell it rows 0 to end updated, it repaints them. if you tell it "table data changed" it forgets *everything* [01:14:49] <Rainier> Anyway, I've figured out most of this stuff because I do stuff like this: http://www.asmcbain.net/projects/quickview/quickview.png [01:14:56] <shingoki> no, there are at least 3 options. Some set of rows changed, Number of rows changed, rows and columns changed. [01:15:17] *** CodeWar has joined ##java [01:15:32] <shingoki> Well, I've also figured out at least that last one from doing jpropeller.googlecode.com ;) [01:15:39] <Nickwiz> free UML tools for windows. Dia best? [01:16:14] <Rainier> I'm talking about TableModel.fireTableDataChanged(), I think or fireTableStructureChanged(), unless I'm not recalling it correctly, I believe they both forgot cell renderers. [01:16:34] <shingoki> fireTableStructureChanged is equivalent to setModel and will lose your columns. fireTableDataChanged specifically does NOT lose the columns. I don't think it should lose the renderers, but it might do ;) [01:16:52] <shingoki> it certainly doesn't lose for example column width, etc. so it would be odd if it lost renderers, not sure though [01:16:54] *** CodeWar has quit IRC [01:17:14] <Rainier> that's what I mean, I think it loses the renderers, but I don't have anything handy with which to check, nor do I really want to spend time digging something up, [01:17:41] *** rchern has quit IRC [01:17:41] <shingoki> no that's fine, but it is still useful to have the extra options in table model that are missing in list model [01:18:17] <Rainier> I think I already agreed to that, just for completeness, even if I wouldn't use them :P [01:18:41] * Rainier should add his TreeTable code to his Swing Addendum project, rather than keep it separate. [01:19:12] <shingoki> ah right, sorry to go on, I just remember that list thing as a face-palm moment when I realised what I had to do ;) [01:19:23] <shingoki> I don't actually ever use JList myself, I always use a JTable with one column, since frankly that gives you the same thing with less duplication, but I needed a ListModel to use combo boxes [01:19:30] *** rchern has joined ##java [01:19:44] <Rainier> You can use ComboBoxes with a JTable [01:19:47] *** geri has quit IRC [01:19:58] * Rainier finds it neat that his TreeTable *doesn't* use JTree :) [01:19:59] <shingoki> Ah can you? I must have missed that ;) [01:20:24] *** allquixotic has joined ##java [01:20:28] <Rainier> Well, it's not different than a JList in tha trespect, just make a renderer that handles that. [01:20:58] <shingoki> Ah hang on do you mean displaying a combobox in a table, or using a tablemodel for the contents of a combobox? [01:21:20] <Rainier> oh. if you mean the former, then yes. the latter, no. [01:21:27] *** magn3ts has joined ##java [01:21:43] <shingoki> ah well :( [01:21:54] *** t0rc has joined ##java [01:22:07] <Rainier> You could write an adapter, but you probably don't want to do that, given the discussion we've just been through :P [01:22:10] <shingoki> it was the latter - I wanted nice combo boxes with a custom model, but the model has to be a listmodel, more or less. It's the only place where you actually have to use a listmodel [01:22:13] <shingoki> yup [01:22:13] <Rainier> s/given/knowing/ [01:22:32] <shingoki> the listmodels and tablemodels I use are all adapters from a more sane model anyway [01:22:53] <allquixotic> Hi, I am running Sun JDK 1.6.0_18 on Ubuntu 9.10. I have a Swing JComboBox with an ItemListener. I set a breakpoint on the ItemListener's itemStateChanged method. Then I tried changing the selected value using the drop down. As a result, my entire X11 input system is locked up, and I have to drop to a TTY to kill Java to regain keyboard/mouse control. [01:23:02] <Rainier> I don't see what's so insane about them, I use them directly ... [01:23:10] *** Iszak has joined ##java [01:23:18] <IvoryZion> Rainier: I'm attempting to implement your idea on a JList. I'm running into a bit trouble. If I set JList.setComponentPopupMenu( my JPopupMenu ), any MouseListeners are not called. [01:23:33] <shingoki> I should clarify I don't really dislike jtable/jlist though, I just think they could be better, which is not surprising given they are pretty old now. For reference, I looked at SWT, wxWidget and GTK tables/lists and none of them are particularly better [01:23:48] <Rainier> IvoryZion, erm ... that shouldn't happen. [01:24:14] <IvoryZion> Rainer: I've tried setComponentPopupMenu() before and after adding additional listeners, with the same result. [01:24:18] <Rainier> IvoryZion, okay, in that case, you'll have to not do setComponentPopupMenu and have your mouse listener show the popup after it's gotten the information it requires. [01:24:22] <shingoki> Rainier: They're not terrible, just not that great. For example, a Collections List is a much nicer "list" than a ListModel, so I more or less use a List for my model, then an adaptor to a ListModel or TableModel [01:24:25] <IvoryZion> If I don't call setComponentPopupMenu(), the listeners are called. [01:24:50] <Rainier> shingoki, I believe they were created before List [01:24:52] *** goki__ has joined ##java [01:25:13] <Rainier> and it attempts to be closer to JTable (though not the same as), so making it a List would make it quite different from TableModel. [01:25:18] <shingoki> Rainier: Yup that's what I mean - the swing models aren't bad at all, for the time, but it's clear now that there are better ways to do the same thing [01:25:56] <shingoki> Rainier: Yes my model is only for tables that actually display a "list of rows", which covers a lot of table use but obviously not all [01:26:01] *** EnginA has joined ##java [01:26:29] <Rainier> hmm, I'm not sure what a Table would do if not for listing rows with items in them ... ;) [01:26:38] <shingoki> well yeah, so it covers most options ;) [01:26:39] *** Ilod has quit IRC [01:27:03] <shingoki> just a List, then a RowView that will convert an element of that list into a set of columns [01:27:27] <shingoki> it's just a little easier to work with than a TableModel, because you don't need to reimplement the row handling every time, just the column handling [01:30:11] *** andy^ has quit IRC [01:30:41] <Rainier> hm, if I did put the TreeTable junk into Swing Addendum, I'd have to clean it up and move my dependence on DefaultTableModel on up to TableModel so I don't have methods that still update/work with internal DefaultTableModel data (I only overwrote / implemented what I used/needed) [01:31:06] <Rainier> Which results in some wacky usage of stuff like addRow(*) [01:31:40] <Rainier> great ... now I've got 3 extra things on my todo list I didn't expect. [01:32:06] <shingoki> yay [01:35:56] *** ankylose has joined ##java [01:40:33] *** skillz2billz has quit IRC [01:41:09] *** psyvenrix has joined ##java [01:41:18] *** IvoryZion has quit IRC [01:42:39] *** joet3ch has quit IRC [01:44:34] *** IvoryZion has joined ##java [01:45:36] *** piksel has joined ##java [01:47:02] *** kmh_afk has quit IRC [01:47:15] <IvoryZion> I wonder if anyone else has seen this. I'm using NetBeans 6.8 and have the following line of code in a mouseClicked() method ---> JpopupMenu_menu.show( Jlist, e.getX(), e.getY() ); [01:47:37] <IvoryZion> If I set a breakpoint on that line, then step. My entire Linux machine locks. [01:47:38] *** DWSR has quit IRC [01:48:14] <IvoryZion> I have to reboot. [01:49:06] *** Willy has quit IRC [01:50:52] *** nfrs has left ##java [01:50:57] *** IvoryZion has quit IRC [01:51:33] *** IvoryZion has joined ##java [01:51:47] *** Magnastash has quit IRC [01:51:50] <IvoryZion> Sorry if anyone responded and I missed it. [01:51:52] *** EnginA has quit IRC [01:51:55] <IvoryZion> Could you repost? [01:52:11] *** mooglenorph has joined ##java [01:52:16] *** korin43 has joined ##java [01:52:53] <mooglenorph> Hi. I'm having .jar file problems: a jar that works on my home system with a blank classpath gives a NoClassDefFoundError on the system I'm trying to deploy to [01:53:46] <mooglenorph> http://pastie.org/868526 is the MANIFEST.MF [01:53:54] *** CheerBear_ has joined ##java [01:54:26] *** Cymage has joined ##java [01:54:28] <mooglenorph> I've verified that all those files are actually in the jar, [01:54:41] *** luneff has quit IRC [01:54:58] *** Theravadan has quit IRC [01:55:27] <mooglenorph> And don't know what to try after that. [01:56:41] <IvoryZion> mooglenorph: what are the OS's of the systems you're using? [01:56:56] <mooglenorph> IvoryZion: linux and linux, one is debian, the other is a ROCKS cluster [01:56:59] *** Zaidwi has quit IRC [01:57:27] <mooglenorph> IvoryZion: the working one (my desktop) is debian. I have sun java 5 installed. I've even tried making the jar on the cluster, no dice, I get the same error. [01:57:55] *** CheerBear has quit IRC [02:00:38] *** vladimirs has joined ##java [02:01:46] <mooglenorph> Okay, curiosier and curiosier: it works if I make the jar on the cluster, but not if I move the jar out of the directory it was made in. [02:01:58] <IvoryZion> mooglenorph: Sometimes the current directory doesn't end up in the class path on some systems. [02:02:46] <mooglenorph> http://pastie.org/868526 [02:03:07] <mooglenorph> I updated my paste with relevent info, am I doing anything obviously wrong there that would cause the behavior I listed? [02:03:20] *** CheerBear has joined ##java [02:03:26] <mooglenorph> Ideally I'd like to be able to make the jar on my home computer, copy it over the the cluster, and go. [02:03:34] *** bojo_ has joined ##java [02:03:35] *** bojo has quit IRC [02:03:53] *** jottinger has quit IRC [02:05:25] <mooglenorph> I may be totally misunderstanding this: does it look for support-jars INSIDE the jar I'm making, or in the directory that the jar is in in the filesystem upon invocation? [02:06:20] *** CheerBear_ has quit IRC [02:06:24] <Nickwiz> free UML tools for windows. Dia best? [02:06:37] *** teralaser has quit IRC [02:06:38] *** UnNaturalHigh has joined ##java [02:07:52] *** BfrOv3rfl0w_ has quit IRC [02:08:49] *** c_axis has joined ##java [02:09:49] *** korin43 has quit IRC [02:09:56] *** DWSR_ has joined ##java [02:10:08] <UNIX107> what is necessary tools for compiling an classe on tomcat server ? thnks [02:10:42] <impl> well [02:10:46] <impl> first you need a Java compiler [02:10:50] <impl> and then you need Tomcat [02:10:55] <impl> and yeah that's pretty much it. [02:11:07] <FauxFaux> And a clue, don't forget that. [02:11:32] <impl> mm, yeah, that always slips my mind for some reason :( [02:11:42] * impl pokes himself in the eye with a fork [02:11:45] <hiredman> well, if you have a jvm you can use a java compiler written in java [02:12:00] *** shingoki has quit IRC [02:12:06] *** armyriad has joined ##java [02:12:18] <impl> and if you write a little JSP script to upload the Java file and compile it for you [02:12:21] <impl> all you need is Tomcat! [02:13:13] <UNIX107> impl tomcat is installed ! [02:13:25] <impl> go you! *high five* [02:13:26] <UNIX107> and run without problem [02:13:34] *** seanthegeek has joined ##java [02:13:34] *** DWSR_ is now known as DWSR [02:13:57] <UNIX107> i have an small application run in local without prob but when i upload it to th server [02:13:58] *** Iszak has quit IRC [02:14:09] <UNIX107> i have probleme with compilation of classes [02:14:37] <UNIX107> if some one interessted can see all page error in pastbin [02:14:42] *** fadax has quit IRC [02:14:47] <seanthegeek> I know a little C++, Python, and VB.NET. But, I have never worked with java, Where would be a good place for me to start? [02:15:37] <UNIX107> in short thes is th pb : org.apache.jasper.JasperException: Unable to compile class for JSP: [02:15:41] *** Stephmw has quit IRC [02:15:59] <Rainier> seanthegeek, well, anywhere you like! but I'd suggest learning the basics first then working on simple apps and going on up. [02:16:32] <seanthegeek> rainier: Thanks! [02:16:41] *** seanthegeek has left ##java [02:18:00] *** IvoryZion has quit IRC [02:21:38] *** convivial has quit IRC [02:23:24] *** DWSR has quit IRC [02:23:43] *** andy^ has joined ##java [02:23:54] *** convivial has joined ##java [02:24:18] *** platzhirsch has quit IRC [02:24:51] *** mpiechotka has joined ##java [02:25:19] *** mpiechotka has left ##java [02:25:47] *** SEcki has quit IRC [02:25:57] *** Descra has joined ##java [02:26:32] *** geaaru has quit IRC [02:27:36] *** lilHermit has quit IRC [02:29:20] <allquixotic> Does anyone know of an IDE or similar tool that generates an implementation of an interface that encapsulates another instance of the same interface, and forwards the calls and re-throws exceptions? I'm trying to get console output of all the methods called, their parameters and their return values for a fairly hairy interface. I can do it by hand, but it'd be nice to know if there's a tool for next time. [02:30:26] *** ndouba has joined ##java [02:30:31] <ndouba> hi all [02:30:38] <vladimirs> allquixotic: NetBeans has a tool to generate GUIs [02:30:39] *** NoobFukaire has joined ##java [02:31:12] <allquixotic> vladimirs, No, I mean an "Interface", hehe, not a [Graphical User] Interface :) [02:31:25] <allquixotic> as in: public interface Blah { ... [02:31:28] <vladimirs> ah [02:31:30] <NoobFukaire> a software contract [02:31:50] <ndouba> I have a producer-consumer model written up using the Executors framework in java.util.concurrent. I took a look at the application's execution behaviour using visualvm (profiler) and noticed that only two threads are being engaged in parallel instead of 6 when i submit 6 parallel tasks. [02:31:53] *** Magnastash has joined ##java [02:31:58] <ndouba> any ideas what could be causing this behaviour? [02:32:44] <NoobFukaire> sounds like you didn't make the pool large enough [02:33:16] <ndouba> i have a pool of 10 [02:33:16] *** Brklyn has quit IRC [02:33:24] <allquixotic> ndouba, your producer-consumer model has a bounded buffer, right? [02:33:24] <NoobFukaire> pastebin [02:33:28] <ndouba> isn't that enough for 6 parallel tasks? [02:33:58] <ndouba> ~pastebin [02:33:58] <javabot> http://mysticpaste.com - Paste the final url after you've pasted your stuff there. [02:34:07] <allquixotic> ndouba, is it just that the tasks are sitting in the queue and not being started at all, or are the tasks being started and then blocking waiting for the buffer? [02:34:13] <vladimirs> ndouba: are they waiting on some input? maybe there's a deadlock [02:34:35] <NoobFukaire> lol mystic coders [02:34:59] <ndouba> http://mysticpaste.com/view/2171 [02:35:05] *** UnNaturalHigh has quit IRC [02:35:17] <ndouba> no all the tasks are completing [02:35:26] <ndouba> but the problem is that only two threads are being engaged [02:35:50] <ndouba> it seems like there is some sort of "thread affinity" [02:35:54] *** terabit has quit IRC [02:36:11] <NoobFukaire> that's usually an os thing, attaching an execution context to a specific cpu resource [02:36:23] <NoobFukaire> so that way the memory stays coherent [02:37:15] <ndouba> the second thing i find strange is that the second time i execute the method with the same inputs, the result gets returned 60% faster [02:37:28] <vladimirs> caching? [02:37:42] *** amr has joined ##java [02:37:53] <ndouba> but results are being fetched from the internet [02:38:05] <ndouba> how could caching come into play? [02:38:06] <NoobFukaire> you are supplying enough tasks to use that may threads right? [02:38:16] <amr> anyone here used the genady rmi plugin? [02:38:19] <ndouba> i am supplying 6 threads at the same time [02:38:31] <ndouba> s/threads/tasks [02:39:40] <ndouba> i'll paste the output log [02:39:44] <allquixotic> even if you had a uniprocessor, it should still at least use the available threads in the pool to start each of the 6 tasks, then interleave them... I don't think the hardware is really relevant unless you expect them to run literally at the same time on a system with SMP < 6 [02:40:07] <allquixotic> what SMPness is your CPU though, out of curiosity? [02:41:38] <ndouba> http://mysticpaste.com/view/2174 <--- timing logs [02:42:14] <ndouba> allquixotic: it is an intel core 2 duo [02:42:29] <allquixotic> hmm :) [02:43:42] <ndouba> allquixotic: that doesn't really explain why only two of the 10 threads are being used at any point in time [02:44:02] *** NoobFukaire has left ##java [02:44:19] *** v0n has quit IRC [02:44:22] <ndouba> i understand that SMPness would allow me to run more processes in true parallel [02:44:35] <ndouba> but i should see some staggered activity in each thread no? [02:45:35] <vladimirs> ndouba: if i were u, id trace the control execution but with system.out messages [02:45:57] <allquixotic> ndouba, have you tried using something like ScheduledThreadPoolExecutor? I see that you're using FixedThreadPool but you could also use another implementation of ExecutorService [02:46:27] <ndouba> allquixotic: the events are invoked by user actions (unfortunately). they're not scheduled events. [02:46:34] <hiredman> ndouba: do you have the visualvm output somewhere? [02:47:12] <allquixotic> ndouba, you don't _have_ schedule anything with ScheduledThreadPoolExecutor, it's just another implementation != the Executors.newFixedThreadPool one. I don't know how much code they share under the hood, but I suppose that'd also depend on your JVM and platform [02:47:24] <hiredman> are you really sure only two threads are running? [02:47:52] <allquixotic> I suppose it's possible that, for some reason, your JVM says "Oh, you have SMPness of 2, so I'm only going to run two tasks at a time" -- but that would just about defeat the purpose of the ExecutorService [02:48:44] *** joet3ch has joined ##java [02:49:22] <allquixotic> it's certainly not that way on my platform -- I just wrote something using ScheduledThreadPoolExecutor a couple weeks ago, and had 20 threads interleaving tasks on an 8-way Core i7 [02:50:11] *** whaley has joined ##java [02:50:38] *** BeholdMyGlory has joined ##java [02:50:48] <ndouba> hmm [02:50:52] <ndouba> sorry i was absent for a while [02:50:57] <ndouba> i was trying to profile the code again [02:50:58] <allquixotic> if I were you I'd set a breakpoint or suspend your program while it's running in an IDE like netbeans or eclipse, and use the threads window to see what the state of all the threads in the JVM is [02:51:34] <ndouba> ok so i took a look again [02:51:35] <vladimirs> allquixotic: i second that [02:52:18] <ndouba> alright.. [02:52:19] <ndouba> one second [02:53:09] *** UnNaturalHigh has joined ##java [02:53:30] <allquixotic> vladimirs, but now that I think about it, I'm not exactly clear on how ndouba would distinguish between a thread that's blocked because of his application logic, and a thread that currently does not have a task from the executor [02:53:53] <allquixotic> a blocked thread (e.g. waiting on I/O) would probably be in the "sleeping" state, right? [02:54:01] <allquixotic> but a thread that currently has _no_ task associated would also be sleeping? [02:54:17] <allquixotic> can probably walk the individual thread stack traces to see though :) [02:54:46] <vladimirs> using system.out.println would still show any blocks IMO [02:55:27] *** UnNaturalHigh has quit IRC [02:56:25] *** SudoKing has quit IRC [02:57:32] *** SudoKing has joined ##java [02:59:24] <ndouba> hi all [02:59:28] <ndouba> did what you suggested [02:59:34] <ndouba> 3 tasks are running concurrently only [02:59:42] <marcosroriz> guys do you think this name is too stupid? getSortedValidFields(); [02:59:43] <marcosroriz> ? [03:00:05] <_W_> yes [03:00:21] <marcosroriz> anyidea of a better name? [03:00:33] <marcosroriz> I want to express that I'm getting the valid fields of a given class in a sorted way [03:00:34] <_W_> something more specific [03:00:36] <ndouba> sortValidFields? [03:00:37] <ndouba> :P [03:00:48] *** dfas has quit IRC [03:00:49] <_W_> also, the "sorted" part might be part of the return type (e.g. SortedSet) [03:01:01] <_W_> "fields" is meaningless [03:01:05] *** karter has joined ##java [03:01:27] <marcosroriz> ndouba, I liike this name [03:01:29] <marcosroriz> sortValidFields [03:01:46] *** karter has left ##java [03:02:04] <ndouba> so back to my threadpool problem:() [03:02:05] <ndouba> :) [03:02:20] <ndouba> 7 threads are suspended and 3 are running [03:03:07] *** nmx has quit IRC [03:03:46] <allquixotic> are you able to get a stack trace on the threads that are suspended? [03:04:42] *** zed_DX has joined ##java [03:05:40] *** Niall has quit IRC [03:06:44] *** piksel has quit IRC [03:08:58] <ndouba> allquixotic: hmmm [03:08:58] <ndouba> ok [03:09:00] <ndouba> i see it now [03:09:05] <ndouba> 6 threads [03:09:53] <ndouba> but now my problem is this... if we are interleaving then how come the time it takes to execute 5 tasks in parallel =~ 5 tasks in sequence on the first try but on the second try it's 60% faster? [03:10:37] *** vladimirs has left ##java [03:12:20] <allquixotic> ndouba, might be caching somewhere between you and the remote host [03:13:22] <allquixotic> send different data and it shouldn't be any faster [03:13:31] <ndouba> true [03:13:44] <ndouba> but allquixotic: the response time from the remote host is always consistent [03:13:48] <ndouba> ~200ms per request [03:13:48] <javabot> ndouba, I have no idea what 200ms per request is. [03:13:56] <ndouba> lol [03:13:56] <allquixotic> what JVM and OS? [03:14:08] <ndouba> debian java 6se [03:14:23] <allquixotic> Sun Java? [03:14:32] <ndouba> yes [03:14:38] <allquixotic> hmm, very similar to my environment then [03:15:20] <allquixotic> have you tried replacing the "guts" of your code with just some simple print statements or producing random integers? in other words, throw out your app logic and just try basic stuff using the same executor pattern. I might be able to save you time on that actually [03:15:32] <allquixotic> I did something for a programming assignment, but since it's all over and I got a 100%, I guess I can share with you :) [03:15:42] *** okae has quit IRC [03:15:50] <ndouba> lol [03:15:59] <ndouba> graduated from university for some 10 years now;0 [03:16:20] <ndouba> i dont think you need to worry about programming assignments:) [03:16:21] <allquixotic> it uses a ScheduledThreadPoolExecutor to push sequential integers into a buffer (producers), and print them out (consumers) [03:16:33] <allquixotic> if you run it, and it only starts two threads, then we know it's your platform [03:16:42] <allquixotic> I'll jar it up and send it over [03:21:00] <armyriad> Is there anyway that I can view the code that makes up the default classes? For example, could I see the code in the ArrayList class? [03:22:29] *** dawciobiel has joined ##java [03:23:02] <FauxFaux> armyriad: The JDK contains the code, in the cunningly disguised "src" jars. [03:23:10] <FauxFaux> Your IDE will show you them if you haven't failed at setting it up. [03:24:05] *** bulletxt has joined ##java [03:24:17] *** dawciobiel has quit IRC [03:24:37] <bulletxt> hi, is it somehow possible to have a portable jvm? So I can put it together with my app and use it instead of making the user have to install jvm? [03:25:36] *** setz has quit IRC [03:26:41] <SeriousWorm> http://portableapps.com/node/903 ? [03:26:54] <FauxFaux> bulletxt: There's no sensible way to do that. gcj is the most popular but it sucks unbelievably terrible. [03:27:07] <bulletxt> ok.... :) thanks [03:27:12] <bulletxt> that's what I thought [03:27:14] <SeriousWorm> http://portableapps.com/apps/utilities/java_portable [03:27:28] <bulletxt> SeriousWorm: thanks Ill check it out [03:27:32] <SeriousWorm> np [03:28:35] *** emehrkay has joined ##java [03:29:43] *** servo has quit IRC [03:31:17] *** mreggen has joined ##java [03:31:31] *** ndouba has quit IRC [03:36:42] *** joed has joined ##java [03:40:14] *** askhl_ has quit IRC [03:41:59] <donthitme> PYTHON SUPREMACY [03:44:02] *** askhl_ has joined ##java [03:47:25] * armyriad hits donthitme [03:48:43] *** Angel-SL has joined ##java [03:49:03] *** jasecrucial has joined ##java [03:53:11] *** sepult has quit IRC [03:54:57] <tiemonster> is there a way to put focus on a text field after processing an actionPerformed? [04:02:09] *** anaconda has quit IRC [04:02:51] *** samferry is now known as sam_ [04:03:34] *** anaconda has joined ##java [04:05:13] *** domX_ has joined ##java [04:06:49] *** Iszak has joined ##java [04:06:58] *** ndouba has joined ##java [04:09:52] *** domX has quit IRC [04:12:15] *** joet3ch has quit IRC [04:13:03] *** SudoKing has quit IRC [04:13:04] *** SudoKing_ has joined ##java [04:13:46] *** SudoKing_ is now known as SudoKing [04:14:02] *** daN-R-G has quit IRC [04:14:38] *** amr has quit IRC [04:16:24] *** meling2 has quit IRC [04:16:46] *** meling2 has joined ##java [04:17:53] *** joet3ch has joined ##java [04:21:38] *** yshavit has joined ##java [04:22:13] *** tiemonster has quit IRC [04:23:01] *** Rainier is now known as AMcBain [04:25:35] <oorza> In an abstract class, is there a way to define it such that child classes must implement an abstract inner class? [04:25:49] <joed> ~tias [04:25:49] <javabot> Try it and see. You learn much more by experimentation than by asking without having even tried. [04:27:15] *** Furyhunter has joined ##java [04:28:11] *** kater_ has quit IRC [04:28:18] *** forneus has joined ##java [04:28:44] <FauxFaux> I'm confused by the question. [04:28:58] *** ankylose has quit IRC [04:29:09] <joed> As is he. [04:29:18] <joed> That is why I asked him to try it. [04:29:51] *** kater has joined ##java [04:29:56] <oorza> Alright, I have an abstract class, and I want all children to define some methods inside an inner class. [04:30:08] <oorza> abstract class foo { abstract class bar { } } [04:30:40] <FauxFaux> It would be kind of cool to be able to do abstract class A { static abstract class Q { abstract void foo(); } static Q newQ() { return new Q(); } }; not that I can think of a sensible use. [04:30:46] *** emehrkay has quit IRC [04:31:30] <FauxFaux> You can't do that. Why do you want to? As I said, I can't think why. [04:32:16] *** alek_b has quit IRC [04:32:20] <Soliah> Is it bad style to do while (true) { ... break } ? [04:32:37] <AMcBain> Not necessarily. [04:32:53] *** bojo_ has quit IRC [04:33:05] <AMcBain> Which is the best way of saying yes and no at the same time while not expressing an opinion on it (which everyone has sooner or later). [04:33:15] <Soliah> Hah. [04:33:24] <yshavit> Soliah: It's not *always* bad, but it often is :) [04:33:28] <FauxFaux> What else are you going to write? while (somebool) { if (cond()) somebool = false; else { ... ? } }; [04:36:52] *** poseidon has quit IRC [04:37:42] <Soliah> Actually it was bad. Just needed to think about it differently :\ [04:37:59] *** Mavrik- has quit IRC [04:39:36] *** CodeWar has joined ##java [04:39:51] *** vsync has quit IRC [04:40:17] *** alek_b has joined ##java [04:40:21] <yshavit> Soliah: that's usually the case :) while(true) is almost always (but not always always) due to not thinking about it right. [04:41:44] *** c_axis has quit IRC [04:42:40] <Soliah> I guess most of the time if you have while(true) { if (cond()) ... } you can probably move cond() to while (cond()). [04:46:50] <FauxFaux> Yeah. Obviously ...; if(cond()) ... ; ...; } ... [04:47:15] <yshavit> and conversely, most of the time if you have while(true) { ... if(cond()) {break;} } then it's better to do while(!cond()) {...} [04:47:55] <yshavit> or possibly a do-while, though I may get yelled at for saying that. ;-) [04:48:05] *** CodeWar has quit IRC [04:48:26] <AMcBain> why? [04:48:38] <yshavit> AMcBain: why would I get yelled at for it? [04:48:40] *** juan--d-_-b has joined ##java [04:48:46] <AMcBain> yes [04:49:09] *** Magnastash has quit IRC [04:49:20] <yshavit> AMcBain: there are those who say it's A Bad Thing and implies code smell, though I (and I guess you) aren't among them. [04:49:49] <AMcBain> I use what makes sense and is logical to use at the time, unless there's some other significant reason not to use it. [04:50:20] <yshavit> Ditto. :-) [04:52:18] *** juan--d-_-b has quit IRC [04:52:37] *** juan--d-_-b has joined ##java [04:52:48] *** bojo_ has joined ##java [04:55:36] *** digitaloktay has quit IRC [04:56:14] *** xerora has joined ##java