Switch to DuckDuckGo Search
   March 7, 2011  
< | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | >

NOTICE: This channel is no longer actively logged.

Toggle Join/Part | bottom
[00:00:14] *** Stephmw has joined ##java
[00:01:21] *** przem is now known as supercosmonaut
[00:03:29] *** titankiller has quit IRC
[00:03:49] *** demifuror has joined ##java
[00:04:57] *** surial has quit IRC
[00:06:04] *** jjido has quit IRC
[00:06:38] *** jjido has joined ##java
[00:08:00] *** Pozejdon has quit IRC
[00:08:55] *** barq has joined ##java
[00:10:11] <new2net> I have a private exception (nested class). It shows up as "Empty$Exception", how do I catch that outside of the package with Empty in it?
[00:10:38] <_W_> catch the first public superclass
[00:10:39] <FauxFaux> That's the internal name of the exception; nothing to do with Java. You can't without making it accessible.
[00:10:46] *** surial has joined ##java
[00:10:50] *** Ruudjah has joined ##java
[00:11:22] <new2net> Catch Empty e, ill give it a shot
[00:11:47] <FauxFaux> Not unless Exception extends Empty.
[00:12:44] <new2net> public interface SchemeList {...} class Empty { private Exception extends InvalidArgumentException{} }
[00:13:04] *** jjido has quit IRC
[00:13:58] *** Ivellina has quit IRC
[00:14:01] *** Swaagie has quit IRC
[00:14:19] <new2net> well it works with catch( Exception e ) { }... ill just leave it at that
[00:14:38] *** cyphorious has quit IRC
[00:14:43] *** jjido has joined ##java
[00:14:46] <cheeser> um. naming *your* exception Exception is rather dumb.
[00:15:14] <FauxFaux> Tee hee.
[00:15:20] <new2net> hmm... I'll rename it EmptyException extends Exception {}
[00:15:41] *** surial has quit IRC
[00:16:07] *** werdan7 has quit IRC
[00:16:09] <new2net> yeah I thought it was kind of stupid now that I'm actually catching it and not throwing it lol
[00:16:50] *** Carnage\ has joined ##java
[00:17:42] *** AliasWeird[v1] has joined ##java
[00:19:35] *** tewecske has quit IRC
[00:20:42] <new2net> FauxFaux you're right. But how can it throw the exception and not let me catch it by name?
[00:21:30] <FauxFaux> By making it private you've declared the type of exception thrown to be implementation defined; i.e. people outside aren't able to catch it explicitly... which is exactly the problem you're having.
[00:22:00] *** spaek has quit IRC
[00:22:58] <new2net> well my class is also private. Only the interface ("SchemeList") is public. What would be the most sensible place to put the exception, assuming it must be nested.
[00:24:22] *** epalm has quit IRC
[00:25:06] *** bitshuffler has joined ##java
[00:25:59] *** AliasWeird[v1] has left ##java
[00:26:11] <Planck_> Assumign it must be nested where?
[00:26:19] *** epalm has joined ##java
[00:27:21] <Matuku> Is there a way to test whether a method executed successfully as an if statement? i.e. if(method()) { ... }
[00:27:34] <new2net> oh nevermind :p I remember why I named it Exception lol.
[00:27:39] <Matuku> Where method doesn't return a boolean, obviously :P
[00:27:49] <Planck_> Matuku: what do you mean by "successfully"?
[00:27:53] *** glcrazy has quit IRC
[00:28:06] <new2net> ~junit
[00:28:06] *** rvsjoen has quit IRC
[00:28:06] <javabot> new2net, junit is a unit testing tool for java. See http://www.junit.org/
[00:28:47] <Matuku> Planck_: The method is adding a value to a hash table and need to make sure it's been added successfully
[00:29:19] <Planck_> Matuku: then if(hashTable.contains(value))
[00:29:32] *** jjido has quit IRC
[00:29:39] *** eyesUnclouded has joined ##java
[00:29:41] <Matuku> Yeah, thought that might be the only way to do it...
[00:30:10] <Planck_> I presume you mean that it *sometimes* adds a value to a hash table
[00:30:27] *** Kamaran has quit IRC
[00:30:44] <Planck_> And you want to check whether it took that branch.
[00:31:44] *** brau has quit IRC
[00:31:51] *** Carnage\ has quit IRC
[00:32:23] *** jjido has joined ##java
[00:34:59] *** nmx has quit IRC
[00:35:53] *** jjido has quit IRC
[00:38:59] <winux> hey guys.. i have an array of elements, and i want to make removal of the head element O(1), how do i do this while updating the indices to reflect the removal of the top index?
[00:39:06] *** lf94 has quit IRC
[00:39:20] <winux> not top index, but first index ie 0
[00:39:24] *** barq has quit IRC
[00:39:54] <aLeSD> hi all
[00:40:14] <aLeSD> I have a float[] ... and i want to create a subarray
[00:40:22] <aLeSD> is it possible ?
[00:40:44] <aLeSD> I mean : to create an array from the element n to n+100
[00:40:59] <aLeSD> without copy the elements
[00:41:01] <Planck_> Arrays.copyOfRange
[00:41:06] <Planck_> Oh, too bad then
[00:41:19] <aLeSD> hi Planck_ ...
[00:41:35] *** eidolon has quit IRC
[00:41:38] *** BoF has quit IRC
[00:41:48] <aLeSD> it's the same problem than before .. I discovered that I can't use a synchronized collection
[00:42:00] *** CodeWar has joined ##java
[00:42:03] <Planck_> For what?
[00:42:04] *** CodeWar has quit IRC
[00:42:10] <aLeSD> cause another thread (out of my control) is using it
[00:42:15] *** gkmngrgn has quit IRC
[00:42:16] *** CodeWar has joined ##java
[00:42:25] <aLeSD> Planck_, I am drawing a graph
[00:43:06] <aLeSD> I have a collections that always grow
[00:43:24] <aLeSD> only one thread add elements
[00:43:24] *** dmiles_afk has quit IRC
[00:43:51] <aLeSD> the others only read... I was tring with List.subList
[00:44:29] <Planck_> So the main problem is that you hand the list to a black-box thread that can do whatever it likes with the list?
[00:44:34] <aLeSD> but when the thread is drawing ... and I another is adding an element I have the Concurrent exception
[00:44:35] *** Johannes13 has quit IRC
[00:44:41] *** dmiles_afk has joined ##java
[00:44:57] *** kbotnen has joined ##java
[00:45:31] <aLeSD> not really ... I coded the part for drawing ... but I don't know if I want to pass the 'mutex' to the class
[00:45:52] <aLeSD> the drawing thread execute the function draw
[00:45:59] <aLeSD> I overrided it
[00:46:51] *** new2net has quit IRC
[00:47:12] <aLeSD> I mean
[00:47:21] <aLeSD> I passed to that class a List
[00:47:34] *** eidolon has joined ##java
[00:48:00] *** Johannes13 has joined ##java
[00:48:00] <aLeSD> Planck_, maybe the solution is to lock on the List object ?
[00:48:23] <aLeSD> without using mutex
[00:48:33] <aLeSD> Planck_, u are a genious
[00:48:36] <aLeSD> :D
[00:49:56] <Planck_> If the thread is using an iterator, then any modification that occurs for the whole lifetime of that iterator will fail.
[00:50:58] <aLeSD> Planck_: I 'm using size() and get()
[00:51:25] <CodeWar> is this a single producer multiple consumer problem?
[00:51:34] <aLeSD> my problem is that want to pass to that thread only the List
[00:51:38] *** cool123 has quit IRC
[00:51:41] <aLeSD> and not 'a mutex'
[00:52:13] <Planck_> Every object has a monitor associated with it, which can be used for mutex purposes.
[00:52:27] <aLeSD> but I can code the Draw() function using a lock to the List I pass it ... and I resolve the problem
[00:52:50] <aLeSD> yes
[00:52:59] <aLeSD> I am happy
[00:53:12] <Planck_> synchronized(list) { // do lots of drawing }, and synchronized(list) { // add new elements }
[00:53:25] <aLeSD> :)
[00:53:54] *** zChris has quit IRC
[00:54:30] *** Gather has joined ##java
[00:55:50] <Gather> I'm considering testing out java server pages and are in need of a fast lightweight development server. Beeing a .net deveolper i am a bit spoiled with everything working just by pressing f5. any suggestions?
[00:55:54] *** L-----D has joined ##java
[00:56:11] <Gather> preferably something that needs little or no configuration
[00:56:41] *** epalm has quit IRC
[00:57:08] *** eyesUnclouded has quit IRC
[00:57:31] *** CodeWar has left ##java
[00:57:34] *** fisted_ has joined ##java
[00:57:36] <aLeSD> Planck_ if I have a return in the synchronized block the lock is unlocked ?
[00:57:42] <winux> is it possible to have a remove function be O(1) time in an array containing an in-order list of elements?
[00:57:47] *** fisted has quit IRC
[00:57:55] <Planck_> Yes, it's unlocked whenever that block is exited by any means
[00:58:06] *** meiskam has quit IRC
[00:58:51] <Planck_> winux: not if you want to maintain random access semantics
[00:59:00] *** meiskam has joined ##java
[00:59:31] <winux> Planck_: hmm I am not sure that that is, i dont think it is a requirement though
[01:00:06] *** bobbytek has quit IRC
[01:00:25] <winux> Planck_: im just having trouble understanding how i could update the indices after an element is removed
[01:00:47] <winux> Planck_: in 0(1) time
[01:00:51] <Planck_> You can't.
[01:00:53] *** choongii has quit IRC
[01:01:34] <Planck_> You can impose a data structure on top that permits O(log n) time
[01:03:15] <winux> Planck_: how would that work? that sounds like a tree of some sort
[01:03:41] <Planck_> Yes, trees are one option, or skip lists
[01:03:44] *** halhorn has quit IRC
[01:03:48] <Planck_> Heaps do the job too
[01:04:10] *** Miesco has joined ##java
[01:04:41] <Miesco> Whats a good open source java implementation. Also if I use this will I get sued by Oracle?
[01:05:08] <Planck_> Miesco: OpenJDK. No.
[01:05:52] <Miesco> Planck_: I do humbly thank you.
[01:06:34] *** Nikelandjelo has quit IRC
[01:07:14] *** Miesco has left ##java
[01:07:38] <cheeser> why would oracle sue him?
[01:08:00] *** Cogito has joined ##java
[01:08:05] <Planck_> They sued google, they can sue you too!
[01:08:26] <Planck_> (Never mind the details of the case)
[01:08:35] *** dmiles has joined ##java
[01:09:30] <Rainier> Planck_, and just about end any reason to be associated with them anymore ;)
[01:10:04] <Rainier> Suing over usage of the OpenJDK would be taking a poison capsule.
[01:10:23] *** cocoloa has joined ##java
[01:10:24] *** McMAGIC-- has quit IRC
[01:10:24] *** dmiles_afk has quit IRC
[01:10:24] *** meiskam has quit IRC
[01:10:28] <Planck_> I can sue you too! I coudl probably even get a default judgement against you, if you didn't turn up.
[01:10:46] *** io2 has quit IRC
[01:11:01] *** meiskam_ has joined ##java
[01:11:18] *** HebusLeTroll has joined ##java
[01:11:31] <Rainier> Planck_, that might be, but the opportunities and reputation lost by them would be greater than any small (possibly monetary) gains they would get.
[01:11:36] <HebusLeTroll> Hello
[01:11:43] <Planck_> Sure :)
[01:12:28] <Planck_> Hence the answer to "can they sue you" would be "yes". The answer to "will they sue you" is "no" :-)
[01:14:27] <HebusLeTroll> I have to encode an uft8 string to a ByteBuffer, but i'd like to add a short int before to store its lenght. Have i to create a temp ByteBuffer to pass to CharsetEncoder.encode, then get its size, and then create another ByteBuffer ?
[01:14:35] *** werdan7 has joined ##java
[01:14:35] *** veasmkii has quit IRC
[01:14:38] *** io2 has joined ##java
[01:14:46] <HebusLeTroll> or is there a better solution ?
[01:15:01] <aLeSD> Planck_: what happen to a subList if I add an element to the main List ?
[01:15:51] *** Naith has quit IRC
[01:16:23] <Planck_> HebusLeTroll: There's a few ways to do it. E.g. A DataOutput does that already.
[01:16:42] *** Miesco has joined ##java
[01:16:47] <Miesco> Whats java-sdk-docs?
[01:16:59] <Miesco> API docs?
[01:17:02] <Planck_> In what context?
[01:17:08] <Planck_> I'd guess so
[01:17:15] <HebusLeTroll> Planck_ ok i'll look that, thanks
[01:17:24] <Miesco> Planck_: Does openjdk have these?
[01:17:27] *** io2 has quit IRC
[01:18:46] *** Johannes13 has quit IRC
[01:19:47] *** ModusPwnens has joined ##java
[01:20:06] *** zChris has joined ##java
[01:20:36] *** White-- has quit IRC
[01:20:54] <Planck_> Miesco: Yes, openjdk has docs. It would be a pretty sickly development kit if it didn't.
[01:20:58] <ModusPwnens> Hello. I am creating a JFrame and adding a JTabbedPane to it, but when the tab is created it does not have a name (I have verified that the name is not null when it is passed in)
[01:21:17] <Miesco> Planck_: kk
[01:21:18] *** Miesco has left ##java
[01:21:34] <ModusPwnens> http://pastie.org/1641259
[01:22:38] *** Versuchen has quit IRC
[01:22:42] <ModusPwnens> "name" is a string that is passed in from somewhere else.
[01:24:23] *** eyesUnclouded has joined ##java
[01:24:53] <Planck_> You replace the name with .setTabComponentAt
[01:25:49] <HebusLeTroll> Planck_ unfortunally ByteBuffer doesn't implements DataOuput :(
[01:27:07] <ModusPwnens> Planck_, what do you mean? I am doing that elsewhere and it isn't changing the name..
[01:27:52] *** JDuke128 has joined ##java
[01:28:12] <Planck_> Then you have some bug elsewhere. According to the docs, "Sets the component that is responsible for rendering the title for the specified tab"
[01:29:18] *** Fuco has quit IRC
[01:32:44] *** zatan has quit IRC
[01:33:32] *** VonNaturAustreVe has joined ##java
[01:33:34] *** racarter has quit IRC
[01:33:47] *** blbrown_win3 has joined ##java
[01:39:16] <aLeSD> Planck_, I am getting the same problem ... is it possible that lock on a List and lock on its subList is different ?
[01:39:48] <Rainier> Planck_, I do recall an issue on Mac (if that's his dev environment) where the native L&F would not remove the standard label when you set your own component ...
[01:40:04] <Rainier> Some strange things going on there :P
[01:41:00] <Rainier> though if I'd read a bit better that's opposite of the problem.
[01:41:02] <aLeSD> also here
[01:41:11] <Planck_> aLeSD: Yes, they are different objects
[01:41:26] <aLeSD> Planck_: s**t so .. I have the same prob
[01:42:22] <aLeSD> in the end I wil clone the list
[01:42:31] <aLeSD> and pass a copy
[01:42:47] <aLeSD> but it isn't efficient
[01:45:08] *** topriddy has quit IRC
[01:45:21] <Planck_> If the list only ever grows (and no other modifications are ever made), you can use a synchronized wrapper and just iterate over indicies instead of using an iterator.
[01:45:51] *** cocoloa has quit IRC
[01:45:55] <Planck_> It's just fragile
[01:46:26] <aLeSD> I will copy the list and optimize it in a second moment... I don't need fragile stuff now
[01:46:28] <aLeSD> :)
[01:47:01] <Planck_> yeah, it's not even very expensive to copy the sublist
[01:47:17] <Planck_> Or whatever you're iterating over. Both are O(n) anyway.
[01:47:39] <aLeSD> Planck_, :a semi-last question : I will use clone on the sublist .. I get an object ... may I cast it to any List ?
[01:47:54] <Planck_> Don't use clone().
[01:47:56] <Rainier> eek. use a copy constructor.
[01:48:02] <Rainier> new ArrayList(otherList);
[01:48:06] <aLeSD> ok
[01:48:08] <aLeSD> thanks
[01:48:44] <aLeSD> why ?
[01:49:26] <Rainier> ~clone
[01:49:26] <javabot> Rainier, clone is making copies of objects ( http://mindprod.com/jgloss/clone.html ). Also read an interview of Josh Bloch on why to use a "Copy Constructor versus Cloning": http://www.artima.com/intv/bloch13.html
[01:49:44] <gener1c> i made a tree and i want to inherit and extend it , but i want to extend the nodes as well and use a different attribute of the node as the key, is there a way to do that?
[01:49:58] *** racarter has joined ##java
[01:50:30] <racarter> )] [3:freenode/##java(+cnrt)] [Act: 1,2]
[01:50:34] *** lolsuper_ has quit IRC
[01:50:35] *** psst has quit IRC
[01:50:52] <gener1c> ~inheritance
[01:50:52] <javabot> gener1c, inheritance is http://java.sun.com/docs/books/tutorial/java/concepts/inheritance.html , http://java.sun.com/docs/books/tutorial/java/IandI/subclasses.html , and http://java.sun.com/docs/books/jls/third_edition/html/names.html#104101
[01:51:16] <Rainier> racarter, broken client?
[01:51:32] <racarter> what happened?
[01:51:45] <Rainier> [16:48] * racarter (~racarter@nat/google/x-duemvqgstgxjejtl) has joined ##java
[01:51:45] <Rainier> [16:49] <racarter> )] [3:freenode/##java(+cnrt)] [Act: 1,2]
[01:51:55] <racarter> oh. i have no idea
[01:52:15] <racarter> one minute. i have to disconnect
[01:52:23] *** racarter has quit IRC
[01:52:42] <Planck_> I recognise that format :)
[01:53:20] <Planck_> It's the latter half of an irssi status line :)
[01:53:35] <Rainier> That's the client I was guessing :P
[01:53:41] *** racarter has joined ##java
[01:53:55] <racarter> back!
[01:54:09] <Rainier> and no weird message! \o/ :P
[01:54:15] *** Sdw195 has joined ##java
[01:54:22] <racarter> w00t!
[01:54:37] *** Sdw195 has left ##java
[01:54:51] <racarter> http://pastebin.com/DMjRds9S <-- anyone have any idea why this doesn't work for me on Windows?
[01:55:03] <racarter> same thing looks fine on mac. kind of weird
[01:56:25] <Rainier> differences in line endings of the file?
[01:56:34] <Rainier> also, "doesn't work" is very vague.
[01:56:54] <racarter> oh sorry, it doesn't get sorted when I run it on windows
[01:57:00] <Planck_> The same file, or a version of the file converted to use Windows line separators?
[01:57:16] <racarter> line endings look ok to me
[01:57:25] <racarter> it's not that, it's just not getting sorted
[01:57:42] <Planck_> What are the line endings?
[01:57:50] <Planck_> Specifically, which bytes?
[01:57:52] <cbeust> racarter: sounds like a great opportunity to use a debugger and put a breakpoint on line 14
[01:58:02] <ojacobson> racarter: They wouldn't get sorted if it were one giant element
[01:58:02] <cbeust> I'm pretty sure you'll find out that your collection does get sorted
[01:58:15] <ojacobson> but yes, if you're not Sherlock Holmes, run the fucking debugger :)
[01:58:21] *** DJClean has quit IRC
[01:58:30] <ojacobson> Holmes can debug your program by pure deduction from the output. You can't.
[01:58:48] <racarter> me.. i was writing this in notepad..
[01:58:57] <racarter> it was supposed to be something quick
[01:59:03] <racarter> me.. = meh...
[01:59:04] <cbeust> racarter: Good lesson to learn then: using Notepad to write Java is painful
[01:59:25] *** Will123456 has quit IRC
[01:59:27] <racarter> I ended up writing it in python at the time just to sort what I needed alphabetically
[01:59:38] <cbeust> You'll always write Java faster with an IDE than a text editor.
[01:59:51] <racarter> then came back and ran it on mac just because it was weird it didn't work. and then it was fine on my mac
[01:59:59] <ojacobson> That's a pretty clunky way to read the lines of a file, though
[02:00:10] <ojacobson> BufferedReader + InputStreamReader gives you an actual 'read line' method
[02:00:22] <racarter> :) look man, I wrote it in 3 minutes...
[02:00:24] <gener1c> http://pastie.org/1641373
[02:00:32] <racarter> I didn't realize I was going to have to debug the core library now
[02:00:39] <ojacobson> The bug is almost certainly in your program.
[02:02:18] <Rainier> I agree with ojacobson, you should wrap your way up to a Reader that provides a "get line" method so line endings are handled for you.
[02:02:46] <racarter> so you guys think the issue is line endings?
[02:03:12] *** xiliax has quit IRC
[02:03:35] * Rainier thinks so, yes.
[02:03:45] <racarter> hmm...
[02:03:55] <ojacobson> I think your "read a line" code is bass-ackwards
[02:03:58] <ojacobson> so it's entirely possible
[02:04:26] *** phantomcircuit has quit IRC
[02:07:53] <xastey> anyone worked with the google's gdata/spreadsheet api?
[02:08:44] *** teralaser has quit IRC
[02:11:42] *** symptom has joined ##java
[02:11:51] *** jdolan_ has quit IRC
[02:14:28] *** AliasWeird[v1] has joined ##java
[02:14:47] *** AliasWeird[v1] has left ##java
[02:14:57] <racarter> meh. I remember why I didn't want to use BufferedReader now.
[02:15:34] <racarter> it uglifies your code by 20%
[02:16:04] <Rainier> You're worried about your code being ugly and it doesn't even work?
[02:16:12] <Rainier> I'd rather have a working ugly car than a pretty one that doesn't run.
[02:16:28] <racarter> yes. it always works on mac btw.
[02:16:44] <ojacobson> What's ugly about a loop over readLine?
[02:16:53] <ojacobson> Your sense of aesthetics appears to be damaged
[02:17:40] <racarter> new BufferedReader(new FileReader(... while((x = reader.readLine()) != null) ...
[02:17:58] *** surial has joined ##java
[02:18:17] <ojacobson> And the requisite try/finally
[02:18:25] <racarter> oh screw that
[02:18:27] <Planck_> Nah, his main throws Exception
[02:18:33] <ojacobson> all of which says what it does (though, using FileReader is clong)
[02:18:34] <Rainier> aw, surial, if only you'd joined a bit sooner ;P
[02:18:47] <racarter> i might get disconnected when I try to connect to a windows machine
[02:18:53] <ojacobson> racarter: if you want to halfass it, sure, but don't expect a lot of sympathy when your code doesn't work
[02:19:13] <racarter> python code was 12 lines long. just saying...
[02:19:23] <ojacobson> Did you forget the 'with'?
[02:21:43] *** symptom has quit IRC
[02:21:43] *** symptom has joined ##java
[02:24:23] *** racarter has quit IRC
[02:24:44] * eidolon throws a dead fish after racarter
[02:24:48] *** arborist has quit IRC
[02:25:49] <gener1c> i want to inherit a class and change an instance variable name after the inheritance in it and another class it uses
[02:25:52] <gener1c> is that possible?
[02:26:21] <Rainier> You can't affect the names of things declared in a superclass.
[02:26:24] <JDuke128> hi , i'll play a wav file from my game and loop it and use it often wave file but AudioClip on applet sucks and slow i think , whats the fastest way to cache wav file in ram and play it ?
[02:26:31] <gener1c> and what about aliasing?
[02:26:39] <Rainier> gener1c, no.
[02:26:51] <Rainier> Not unless you set up your own complicated "behavior" of sorts.
[02:27:04] <Rainier> I think you're trying to go about something the wrong way.
[02:27:15] *** realtime has quit IRC
[02:27:19] <gener1c> its a complex datastructure
[02:27:30] <Rainier> That doesn't discount what I said.
[02:27:31] <gener1c> made of derivitives of the same abstract avl tree
[02:27:36] <gener1c> yeah i know
[02:27:40] *** racarter has joined ##java
[02:27:52] <Rainier> I love it in here when someone mentions something in reply to someone and their next statement is supposed to make the reply fall down like cards ...
[02:27:59] <gener1c> i am trying to show you the big picture because i cant find an elegant way to use the abstract avl i made
[02:28:20] <racarter> yeah. BufferedReader worked on windows...
[02:28:39] <Rainier> gener1c, you have to name it something that is meaningful in the general case, that's all.
[02:28:40] <gener1c> i am trying to go about it another way Rainier
[02:29:29] <Rainier> and inheritance isn't all about code sharing either, if you've got something that is trying to do something almost entirely unlike what the superclass is doing, then it should be its own separate hierarchy.
[02:30:04] * Rainier .oO( tea. must be almost, but not entirely, unlike tea. )
[02:30:15] <gener1c> lol
[02:30:31] <gener1c> is that alice in wonderland?
[02:30:36] <Rainier> nope.
[02:30:45] <JDuke128> hi , i'll play a wav file from my game and loop it and use it often wave file but AudioClip on applet sucks and slow i think , whats the fastest way to cache wav file in ram and play it ?
[02:30:51] *** namidark has quit IRC
[02:30:52] <ojacobson> damn kids
[02:31:25] <JDuke128> this channel is full of fucking noobs , always no answers and operators f.cking assholes , I'll DDoS your IRC Channel Soon dumb asses
[02:31:36] <ojacobson> Ok, you get to leave now.
[02:31:40] *** ChanServ sets mode: +o ojacobson
[02:31:45] *** ojacobson sets mode: +b *!*~kadir*@46.2.15.*
[02:31:45] *** JDuke128 was kicked by ojacobson (JDuke128)
[02:32:02] <racarter> inheritance is overrated
[02:32:16] <gener1c> hey i dont want to write my avl tree 3 times mate
[02:32:17] <eidolon> nothing like a) not reading the topic, and b) being a dick.
[02:32:19] <Rainier> Trying to get service in a hotel by strangling the desk worker ... way to go :P
[02:33:01] <eidolon> bleah. is it my imagination, or do XML parsers fall down on nested comments? <!— <!— comment —> —> fails in really weird ways
[02:33:12] <ojacobson> eidolon: It's your imagination.
[02:33:19] <ojacobson> The XML parser is correctly rejecting your markup.
[02:33:21] <eidolon> meh.
[02:33:35] <racarter> XML. meh.
[02:33:36] <ojacobson> The comment there is -- <!--
[02:33:42] <ojacobson> the rest is not a comment
[02:33:53] <eidolon> pain in the butt to mark out a big block in an applicationcontext if it embeds other comments. 'sok. i deleted te block
[02:34:00] <gener1c> xpath ftw!
[02:34:07] * eidolon is just whining, ignore me.
[02:34:16] <Rainier> chiming in with random and almost unrelated comment!
[02:34:20] <racarter> applicationcontext? are we complaining about spring now?
[02:34:21] <Rainier> okay, I'm done :P
[02:34:35] <eidolon> racarter: that is where an applicationcontext.xml file is used, yes.
[02:34:37] * Rainier is psychic
[02:34:41] <racarter> guice ftw?
[02:38:54] <eidolon> using spring for DI right now. not ready to switch systems, tyvm :)
[02:38:55] *** tissue has joined ##java
[02:41:21] *** matsebc has joined ##java
[02:43:58] *** eyesUnclouded has quit IRC
[02:45:54] *** phantomcircuit has joined ##java
[02:47:19] *** HebusLeTroll has quit IRC
[02:49:29] *** racarter has quit IRC
[02:53:12] *** Matuku has quit IRC
[02:53:55] *** [twisti] has quit IRC
[02:56:57] *** eidolon has quit IRC
[03:01:16] *** gelignite has quit IRC
[03:02:06] *** jfisk1987 has quit IRC
[03:04:35] *** matsebc has quit IRC
[03:04:56] *** eidolon has joined ##java
[03:06:32] *** matsebc has joined ##java
[03:06:38] *** Alundra has joined ##java
[03:06:38] *** shaunren has joined ##java
[03:08:19] <Alundra> Okay people, I just created a folder and put folders containing images, music and text files in them. I also put a jar file in that folder. When I zip and then unzip this folder somewhere else on my computer everything works fine, but when I send it to another computer it does not. Any ideas why?
[03:08:46] <eidolon> ~tell alundra about doesn't work
[03:08:46] <javabot> The user alundra is not on ##java
[03:08:54] *** lf94 has joined ##java
[03:08:57] <eidolon> ~tell Alundra about doesn't work
[03:08:57] <javabot> Alundra, doesn't work is useless. Tell us what it is, what you want it to do, and what it is doing. Consider putting some code and any errors on a pastebin. (use ~pastebin for suggestions)
[03:09:28] <Alundra> wow
[03:09:44] <Alundra> Alright
[03:10:06] <Alundra> let me add one more detail: When I run the program, images are displayed and music is played. When another computer opens it, it does not.
[03:10:47] <eidolon> is this a standalone application or an applet?
[03:10:54] <Alundra> standalone appolication
[03:11:07] *** eyesUnclouded has joined ##java
[03:11:16] <eidolon> sounds like the images and programs and music are not on the classpath. i assume you're trying to open it as a resource?
[03:11:23] *** Unluckful has joined ##java
[03:11:27] <eidolon> does it jist 'not work' or does it throw an exception?
[03:11:59] <Alundra> eidolon: no no, the program is working fine, but it simply doesn't display the images or play the music
[03:12:57] <eidolon> then your application is suppressing an exception somewhere i suspect.
[03:13:14] <eidolon> throw some debugging in there - it's not finding your resources. i'm completely guessing here as you don't have any real data pointing at the problem
[03:13:17] <ojacobson> or ignoring something returning null
[03:13:20] <Alundra> Here is the code for creating and adding an image: http://pastebin.com/HaLux49p
[03:14:04] *** wliao has joined ##java
[03:14:39] *** mathesis has quit IRC
[03:15:53] <eidolon> Alundra: betcha a nickle your 'icon' is null
[03:15:54] <Unluckful> I am wondering if someone had a few seconds if they could help me with a question regarding PriorityQueues...I have one setup using a custom node (http://pastebin.com/dRnNdGNe) which is setup with, "PriorityQueue<HuffmanNode> queue = new PriorityQueue<HuffmanNode>();". For testing purposes, I've been adding numbers with priorities, but I am unable to see the actual behavior because when I try
[03:15:55] <Unluckful> to .peek() there is no output, only a memory ref.
[03:16:17] <cheeser> ~show us
[03:16:17] <javabot> Paste the code (and any errors) in the pastebin where we can see it. See ~pastebin for options. Also see ~testcase for good examples as to how to help us help you quickly diagnose and solve problems.
[03:16:29] <eidolon> cheeser: he did :)
[03:16:38] <cheeser> ha!
[03:16:48] <cheeser> um. not really.
[03:16:56] <eidolon> no, not really, but he made an attempt.
[03:17:01] <cheeser> there's no peek() there.
[03:18:15] <Unluckful> No, but shouldn't peek() work off of PriorityQueue?
[03:18:39] <cheeser> yes. it does. but without seeing how you're (mis)using it, how are we supposed to help?
[03:19:09] *** zemanel has joined ##java
[03:19:13] <Alundra> eidolon: okay, so how do I make sure that the icon isn't null?
[03:19:13] *** zemanel has left ##java
[03:19:19] *** BeholdMyGlory has quit IRC
[03:19:25] <Alundra> I could easily put it in a try block but...
[03:19:41] <Unluckful> I'm literally doing, "queue.add(new HuffmanNode(1, 1));" then "println(queue.peek());"
[03:20:02] <eidolon> if it's null, then the filepath lookup failed - meaning it didn't load. find out why not.
[03:20:36] <Alundra> eidolon: well... I've no idea why it failed :/
[03:20:42] <Alundra> no idea how to find out, either
[03:20:43] <eidolon> well, then figure it out :)
[03:20:46] <Alundra> (hence why I came here)
[03:20:57] <eidolon> no, you wanted to know why your app wasn't showing your icon. i just told you.
[03:21:04] <eidolon> did you check to see if it's null?
[03:21:32] <Alundra> I can't... since I'm sending it to my friend.. it opens fine to me
[03:22:43] *** tnzr has joined ##java
[03:23:12] <eidolon> dude. think a little. if blah==null System.out.println("Failed to find icon on path " + path);
[03:23:17] <eidolon> compile that and send it to him.
[03:24:52] *** Unluckful has quit IRC
[03:25:49] *** Unluckful has joined ##java
[03:26:29] <Alundra> ahh, well, she won't be able to see what's displayed on the console but I suppose I could show it in some dialog
[03:27:18] <eidolon> uhh
[03:27:26] <eidolon> why not?
[03:28:06] <Alundra> eidolon: just... trust me. :P
[03:28:36] *** shaunren has left ##java
[03:28:37] <ojacobson> You'd like us to troubleshoot symptoms (not the state of any particular part of the program) when neither you nor we can see the problem?
[03:28:40] <ojacobson> We trust you.
[03:28:46] <Rainier> Debugging things via proxy is hard.
[03:29:39] <ojacobson> Display a little initiative - you've gotten a couple of pointers at things that might be the source of the problem
[03:30:24] <ojacobson> There are docs floating around if you need help narrowing it down *once you have some information to work with*, but we're just as much at a loss as you are right now. The only difference is, you have the code, so you know what you're passing into things and what values are coming back out.
[03:31:01] <Alundra> The problem is extremely simple: It opens fine on my computer, no matter where I put the folder that keeps the images, the music files and my jar file. If it doesn't open on someone else's computer even though they have the pictures then obviously the filepath I specified somehow does not work for them.
[03:31:23] *** Serendib has joined ##java
[03:31:37] <eidolon> then you need to write your code in a way to avoid the assumptionst hat are causing your code to fail. think a little bit "What would happen if this file wasn't found on this path?" - riht now your code fails silently.
[03:31:41] <eidolon> so fix that.
[03:32:02] <Alundra> eidolon: Yes but that does not fix my actual problem
[03:32:44] <ojacobson> Diagnosing the specifics (down to the arguments and return values level) of this problem will help you figure out how to solve it in the general case
[03:33:15] <eidolon> since you dont know what your actual problm is beyond 'it doesn't work', its up to you to set the stage to get the information you need to debug your problem.
[03:33:26] <ojacobson> We
[03:33:26] <ojacobson> '
[03:33:28] <ojacobson> er.
[03:33:28] <eidolon> we can't intuit it - we've given you tons of suggestions on how to modify your code TO give you that information.
[03:33:34] <ojacobson> We're not a psychic repository of all possible failure modes
[03:33:39] <ojacobson> We're just some guys, you know?
[03:33:46] * eidolon is just zis guy, ya know?
[03:34:09] <eidolon> http://en.wikipedia.org/wiki/Zaphod_Beeblebrox <— reference.
[03:34:20] <Rainier> I got it without the link ;)
[03:34:27] <ojacobson> Thank you, Bueller.
[03:34:27] * eidolon gives Rainier a cookie.
[03:35:44] <Alundra> right
[03:36:28] * nucc1 wonders why printf() is not used so often in java programs. I just discovered it :p
[03:36:45] <ojacobson> nucc1: Surprisingly few programs involve writing to stdout
[03:36:48] <eidolon> because very few java programs use stdout?
[03:36:50] <ojacobson> String.format, however...
[03:36:51] <cbeust> nucc1: Good question. It arrived very late in the Java libraries and nobody got used in the habit of using it
[03:37:07] *** hex` has quit IRC
[03:37:14] <cbeust> ojacobson: eidolon: I write to sdtout all the time but force of habit makes me use System.out.println
[03:37:14] <nucc1> interesting arguments all. all my programs have been stdout basically
[03:37:24] <nucc1> mostly academic
[03:37:36] <nucc1> i thought it didn't exist
[03:38:02] <cbeust> nucc1: For short programs, stdout is obviously very convenient. For bigger software, I still find it convenient to write traces that I don't want to make part of the logging
[03:38:24] <cbeust> But it's definitely temporary, I always remove these before committing, let alone releasing
[03:38:35] <nucc1> yea, they slow down the programs considerably
[03:38:37] * eidolon whuglz log4j.
[03:38:44] <Rainier> yeah. I find it strange libraries that leave in printlns.
[03:38:44] <eidolon> okay, gonna go for a walk. later.
[03:38:52] <Rainier> eidolon, enjoy
[03:38:53] *** eidolon has quit IRC
[03:39:30] <nucc1> i like the fact that javac seems to have its inbuilt "makefile". i never worry about compiling my dependent files
[03:39:54] *** winux has quit IRC
[03:40:17] <cbeust> nucc1: You will if you start writing bigger software, and then it will be time to graduate to maven
[03:40:50] <nucc1> i should make some time to study that in advance then
[03:41:19] <cbeust> nucc1: yes, it's a good skill to have, you will undoubtedly encounter Maven if you get involved in serious Java software
[03:42:55] *** top^ has joined ##java
[03:43:51] *** Cymage has quit IRC
[03:51:54] *** rjohnson19 has quit IRC
[03:57:40] *** ojacobson has quit IRC
[03:58:11] *** Unluckful has left ##java
[03:58:38] *** winux has joined ##java
[03:58:49] *** ojacobson has joined ##java
[03:59:44] <Alundra> well this is stupid
[04:05:50] *** Alundra has quit IRC
[04:07:53] * Rainier presumes it was something that wasn't working the way Alundra thought it should despite working exactly the way he wrote it.
[04:08:47] *** r0bby is now known as robbyoconnor
[04:09:05] <cbeust> Story of my life.
[04:09:52] <cheeser> socialD++
[04:10:47] *** eidolon has joined ##java
[04:13:32] *** nchaimov has quit IRC
[04:13:38] * Rainier wished Sunday evening would last forever.
[04:15:19] *** milligan has quit IRC
[04:15:34] <winux> why
[04:16:16] <Rainier> winux, 1) it's not yet Monday, 2) it's still part of the weekend, but at the end, so you get to savor it, and 3) it's the perfect time of day.
[04:16:24] *** nchaimov has joined ##java
[04:16:37] <winux> yet the impending doom of monday is only a day away
[04:16:54] <Rainier> but if it lasted forever, it wouldn't matter, would it? :)
[04:17:09] <winux> couldnt the same be said for Monday evening?
[04:17:24] <winux> except for the weekend part
[04:17:41] <Rainier> no, cause you've already started the week. this way you're savoring the end.
[04:18:06] <winux> the thought of mondays approach always horrified me
[04:18:08] <winux> before it came
[04:18:26] <Rainier> nah, always more of a "why aren't the weekends longer?" for mew.
[04:18:28] <Rainier> me*
[04:19:23] <winux> i like fridays though
[04:19:41] <winux> if you worked 12 hour days they would be longer :D
[04:19:56] *** Garibald1 is now known as Garibaldi
[04:20:13] <Rainier> Besides, even if we just stick with the evening bit, there's always been that "evening time" some days where you're sitting around doing something (or "nothing") and it's reasonably enjoyable and you know the time won't last, as it'll just slip on into the night.
[04:21:03] *** joed has joined ##java
[04:21:45] * eidolon just codes, and doesn't think.
[04:22:02] <Rainier> If I'm weird for wishing that sort of time and feeling to last for a while longer than it physically will, then I blame it on our world's willingness to move like we've all been amped on stimulants :P
[04:22:08] *** chomping has joined ##java
[04:22:23] <Planck_> Caffeine.
[04:22:30] <winux> I just think its awkward that things seem to move faster as I age
[04:22:34] <winux> like
[04:22:38] <winux> 5 times faster
[04:22:45] <winux> i have no more boring moments
[04:23:11] <Rainier> eidolon, you're missing a whole "zen" aspect here, and you don't even have to do any sorts of rituals to seek it out either ...
[04:23:29] <Rainier> Planck_, to which I am hopelessly addicted.
[04:24:29] <eidolon> Rainier: actually, one would argue i'm being more zen about it than yo uare, since i'm just moving with it, not analyzing or it allowing it to change me :)
[04:24:31] *** _controller has joined ##java
[04:24:44] <winux> eidolon you just thought
[04:24:46] <Rainier> eidolon, but that was hardly the point :P
[04:24:50] *** pyrrhic has joined ##java
[04:25:00] <eidolon> winux: i don't THINK so!
[04:25:03] <eidolon> </deliberate>
[04:25:10] *** m0_ is now known as m0
[04:25:12] <_controller> Hi guys, does a future object retrieved from executorservice.submit throw an executonexception on get() even when it was properly caught? because that's what appears to be occuring in my application
[04:25:30] <winux> Rainier: i wish showers would last forever too
[04:25:39] <Rainier> _controller, that doesn't make much sense ...
[04:25:45] <_controller> i know that
[04:25:59] <Rainier> It sounds like you called get(), caught the exception, then did it again hoping it would succeed.
[04:26:06] <_controller> but i have a try/catch clause around the entire call() function
[04:26:07] <Rainier> That's not gonna work.
[04:26:12] <_controller> inside the call function
[04:26:19] <_controller> no rainier, not what happened
[04:26:40] <_controller> i have call() { try { .. } catch(Exception e) { .. } }
[04:26:41] <Rainier> winux, everyone I suppose has a different thing or time of day like I described earlier then I guess
[04:26:54] <_controller> nothing is outside of that try clause
[04:27:09] <_controller> unless for some reason an OutofMemory error cannot be caught?
[04:27:14] <Rainier> If the code inside threw an unchecked exception/runtime exception you wouldn't catch that.
[04:27:31] <m0> What are your thoughts regarding leaky abstractions?
[04:27:33] * Rainier rescinds that statement.
[04:27:42] <Rainier> Ignore what I said, that's wrong. anyway ...
[04:27:46] <winux> Rainier: well, even so, such a moment, if lasting to long, would become unpleasant
[04:27:53] <Rainier> _controller, that statement will not catch Error subclasses.
[04:28:01] <_controller> oh fuck
[04:28:02] *** sbalmos has joined ##java
[04:28:04] <_controller> lool
[04:28:05] <_controller> fuck me
[04:28:07] <Rainier> and I don't think you should modify it so it will.
[04:28:14] <_controller> rainier, i agree, i was debugging
[04:28:15] <Rainier> they're not meant to be caught.
[04:28:19] <_controller> i agree
[04:28:20] <Rainier> _controller, okay.
[04:28:22] <_controller> wow i feel stupid
[04:28:35] <_controller> thanks a lot
[04:28:42] *** billy_ran_away has joined ##java
[04:28:45] <Rainier> winux, well, no the idea I proposed above was that the moment lasts longer because it is pleasant.
[04:28:49] <_controller> ps does anyone know of any good opoen source generic object pool implementations/
[04:28:57] <_controller> i kinda need that to solve my outofmemory shit
[04:29:09] <_controller> <Rainier> If the code inside threw an unchecked exception/runtime exception you wouldn't catch that.
[04:29:11] <_controller> is that really true?
[04:29:12] <Rainier> winux, You certainly wouldn't want a moment to last longer if it wouldn't be pleasurable ...
[04:29:17] <Rainier> _controller, no. I mispoke.
[04:29:19] <winux> Rainier: but too much of a pleasant moment would turn unpleasant
[04:29:20] <Rainier> Being stupid for a moment.
[04:29:23] <_controller> oh
[04:29:51] <Rainier> _controller, that would catch runtime exceptions, yes.
[04:30:23] <Rainier> I had a momentary stupidity and typed before I thought it through fully.
[04:30:46] <winux> probably thinking about sunday evening :D
[04:30:46] <Rainier> winux, I don't think so. Depends on what you're doing/what it is/when it is.
[04:31:10] <Rainier> For the shower, you'd certainly turn into a prune, but that's a different problem ...
[04:31:30] <winux> Rainier: well, it depends on what you enjoy doing
[04:31:39] <_controller> rainier, that would catch_any_exception
[04:31:51] <Rainier> Any Exception or subclass of Exception.
[04:31:56] <_controller> exactly
[04:32:03] <_controller> regardless
[04:32:04] <_controller> thanks
[04:32:52] <_controller> btw rainier, if im using a threadpoolexectutor and a thread destroyed cause of an uncaught runtime error/exception (like in my case), does the executor automagically replace the thread?
[04:33:19] <Rainier> I wouldn't know off hand. Read the JavaDoc for insight.
[04:33:24] <_controller> ok
[04:33:57] <m0> Doug Lea has very nice Java Docs :)
[04:34:13] * Rainier thinks the ones from Oracle are just fine.
[04:35:15] <_controller> rainier, the docs dont specify really
[04:35:16] <_controller> i mean
[04:35:23] <_controller> corePoolSize - the number of threads to keep in the pool, even if they are idle.
[04:35:26] <m0> Well, Oracle didn't write up the docs ...
[04:35:28] <_controller> i dont know if this means they replace it
[04:35:57] *** deadaim has joined ##java
[04:36:28] <_controller> it does say Executors.newCachedThreadPool instance provides "automatic thread reclamation"
[04:36:38] <_controller> but nothing about using about constructing it yourself
[04:36:39] <cbeust> ~~ _controller tias
[04:36:39] <javabot> _controller, Try it and see. You learn much more by experimentation than by asking without having even tried.
[04:36:39] *** dextro_ has joined ##java
[04:36:40] <dextro_> wsSocket = new ServerSocket();
[04:36:44] <m0> _controller: the docs explain it pretty well, if you have more than core pool size, excess threads will be terminated.
[04:36:47] <dextro_> how do i make that only bind to localhost?
[04:36:58] <_controller> m0, im not talking about excess threads
[04:37:15] *** matsebc has quit IRC
[04:37:15] <_controller> im talking about in case one of the "core threads" were destroyed because of an uncaught error/exception
[04:37:26] <_controller> will there be "automatic thread reclamation"?
[04:37:28] <m0> dextro_: What implementation are you using? I assume there must be a "host" paramer
[04:37:32] <Planck_> dextro_: What other constructors are available?
[04:37:37] *** melic_ has joined ##java
[04:37:58] <dextro_> m0, Planck_, im a noob and did not understand either of your questions :(
[04:38:04] *** melic_ is now known as melic
[04:38:18] <Planck_> ~javadoc ServerSocket
[04:38:18] <javabot> Planck_: http://is.gd/vSKAef [JDK: java.net.ServerSocket]
[04:38:33] <dextro_> http://pastie.org/1641788
[04:38:42] <m0> Ah normal ServerSocket, I thought you were using WebSockets sorry :)
[04:38:59] <Planck_> Read that — it describes the ServerSocket class.
[04:39:10] *** ModusPwnens has quit IRC
[04:39:22] <_controller> m0, do u knw if there is automatic thread reclamation on a threadpoolexecutor?
[04:39:25] <m0> dextro_: If you read the JavaDoc, http://download.oracle.com/javase/6/docs/api/java/net/ServerSocket.html You will see one constructor has a bind parameter.
[04:40:09] *** eyesUnclouded has quit IRC
[04:40:10] *** TheBeerinator has quit IRC
[04:40:21] <Rainier> _controller, you* :)
[04:40:30] <m0> _controller: are you afraid if your poolsize exceeds?
[04:40:37] <_controller> no m0
[04:40:44] <dextro_> i have to set a backlog to choose a ip
[04:40:46] <dextro_> how silly
[04:40:50] <_controller> my corethreadsize is the same as maxpoolsize
[04:40:53] <dextro_> what should i use for backlog?
[04:40:55] <dextro_> 100000?
[04:41:12] <pyrrhic> You should look a little closer...
[04:41:14] <_controller> m0, so basically im just curious of the 'core thread size' is not active, will they substitute the failed thread?
[04:41:18] <ojacobson> dextro_: Not necessarily.
[04:41:20] <_controller> if*
[04:41:25] <ojacobson> You don't need to bind a ServerSocket during construction...
[04:41:31] <Planck_> dextro_: There's also a bind() method.
[04:41:53] <Planck_> Really, it makes sense to at least read once through the javadocs for a class before trying to use it.
[04:41:55] <pyrrhic> And a constructor that doesn't require a backlog value...
[04:42:08] <dextro_> i have read over it
[04:42:14] <dextro_> im just used to very low level programming
[04:42:19] <pyrrhic> I take that back I guess
[04:42:19] <dextro_> and doing all this stuff by hand
[04:42:39] <dextro_> and not needing to create 3 classes just to specify a bind addr
[04:42:46] <dextro_> java is crazyness
[04:42:48] <m0> dextro_: Well, the default value is 50 if that helps ...
[04:43:05] *** cbeust has quit IRC
[04:43:16] <Rainier> dextro_, I don't see how you need 3 to create the "bind addr"
[04:43:21] <dextro_> im going to try .bind and hope it doesn't actually create the listener until .accept is called for first time
[04:43:24] <dextro_> like the docs suggest
[04:43:28] *** cbeust has joined ##java
[04:45:27] <m0> _controller: I am lost what your trying to do, you first stated about exceptions, then pool size, then core thread size :)
[04:47:15] <Rainier> m0, he's worried that it might be possible at some point for his thread pool to not have any threads to execute a new task. which would be terribly silly.
[04:47:24] <Rainier> at least that's how I interpret it.
[04:47:26] <ojacobson> grumble, servlet-mapping
[04:47:44] <ojacobson> apparently <url-pattern>/</url-pattern> binds the servlet to every URL in your context
[04:47:45] *** _controller has quit IRC
[04:47:49] <ojacobson> which is very not what I wanted
[04:48:12] <cheeser> well, duh
[04:48:13] <cheeser> 8^)=
[04:48:16] <sbalmos> oops
[04:48:21] <ojacobson> Is there a way to spell what I want?
[04:48:30] <ojacobson> (I have this thing I would like to map to exactly the context root URL and nothing else)
[04:48:32] <cheeser> what *do* you want?
[04:48:38] <cheeser> ah
[04:48:39] <cheeser> hrm.
[04:48:46] <ojacobson> (index.jsp, except a servlet :)
[04:48:58] *** Cymage has joined ##java
[04:49:04] <cheeser> i'd use a filter
[04:49:33] <cheeser> check the URI. if it matches, terminate the chain. if not, send it on down the line.
[04:49:34] <ojacobson> http://paste.pocoo.org/show/349276/
[04:49:41] <ojacobson> Really, I just want to keep 'index.jsp' well away from my URL space
[04:49:45] <ojacobson> even if someone fucks up later :)
[04:50:00] <cheeser> do what now?
[04:50:03] <ojacobson> I could replace that with a trivial Jersey class
[04:50:11] *** Naith has joined ##java
[04:50:12] <ojacobson> It just feels like the wrong thing to do :)
[04:50:18] <cheeser> why not use a welcome file?
[04:50:24] <ojacobson> Doesn't the ... hmm
[04:50:33] <ojacobson> I thought welcome files needed to be in /
[04:50:44] <cheeser> i don't think so
[04:50:49] <ojacobson> I do not want that JSP in /, I want it in WEB-INF so it's out of the URL space entirely
[04:50:52] <ojacobson> brb, testing this theory :)
[04:51:06] <sbalmos> Quick Googling says to define something like /home in servlet mapping, then use home as the welcom efile
[04:51:09] <cheeser> oh. well, WEB-INF is not visible via external URL
[04:51:28] *** kab has quit IRC
[04:51:29] <ojacobson> That's the point..
[04:51:47] <ojacobson> I want the external URL to be the context URL, backed by a JSP in the WAR that cannot be reached by any other URLs
[04:52:02] <ojacobson> the obvious solution of leaving index.jsp in the WAR root means some idiot (probably me) could link to /index.jsp by mistake
[04:52:10] <ojacobson> Which is ugly and I don't want it :)
[04:52:19] <sbalmos> hrm... saving yourself from yourself.
[04:52:29] <sbalmos> I'd say filter then, also
[04:52:32] <ojacobson> Kind of. I'm thinking of it more as a way of keeping the URI space tidy
[04:52:46] *** Sniffy has quit IRC
[04:52:46] <ojacobson> ~cheeser++
[04:52:47] <javabot> cheeser has a karma level of 894, ojacobson
[04:52:58] <ojacobson> welcome-file-list did what I actually wanted, afaict
[04:53:45] <dextro_> wsSocket.bind(new InetSocketAddress("localhost", 25555));
[04:53:47] <dextro_> phew!
[04:53:58] <dextro_> this is more confusing than C :P
[04:54:10] <sbalmos> riiight...
[04:54:29] <ojacobson> Given that it's a nearly direct mapping to the BSD (POSIX) sockets API, I find that highly unlikely
[04:54:38] *** surial has quit IRC
[04:54:45] <ojacobson> A different linguistic structure, but fundamentally the same API
[04:54:53] <sbalmos> too much typing!
[04:55:04] *** msieradzki has quit IRC
[04:55:32] <Rainier> sbalmos, yes! drag and drop is *much* more effective ;)
[04:56:14] *** Cymage has quit IRC
[04:56:19] <sbalmos> Rainier: Go try "coding" something in NI LabView and check back with me
[04:56:31] <Planck_> Ugh
[04:56:33] <Rainier> sbalmos, I was joking.
[04:56:42] <sbalmos> Rainier: Naw, really? :o
[04:56:58] <Rainier> :P
[04:57:54] <Rainier> Depending on the context, it's not entirely odious, but the cases are small and rare.
[04:58:17] *** r0bby has joined ##java
[04:59:11] *** Naith has quit IRC
[05:00:09] *** robbyoconnor has quit IRC
[05:01:43] <Rainier> The NXT block-based stuff wasn't so bad, but it's much more fun to conquer such a device with a language that gives you more control. The course where I got to play with them proved the status of Java as a hammer though ;)
[05:02:49] *** IznastY has joined ##java
[05:05:22] *** eidolon has quit IRC
[05:07:03] *** demifuror has quit IRC
[05:07:12] *** eyesUnclouded has joined ##java
[05:07:15] <ojacobson> heh, welcome-file-list isn't *quuiiiiite* what I mean either, but it's close enough that I don't care (for once). :)
[05:07:31] *** cdg has joined ##java
[05:07:51] <ojacobson> If I had a directory /foo inside my WAR, and /WEB-INF/jsp/index.jsp in welcome-file-list, then requests for / and /foo/ would both go to /WEB-INF/jsp/index.jsp
[05:08:06] <ojacobson> as it happens this is a trivial .war with no directories, so that won't bite me now
[05:08:09] <ojacobson> might bite me later though :)
[05:10:59] <dextro_> [SEVERE] [WebInventory] WebServerClient.run(): java.lang.NullPointerException
[05:11:01] <dextro_> catch (Exception e) { plugin.log(Level.SEVERE, "WebServerClient.run(): " + e.toString()); }
[05:11:09] <dextro_> is there anyway to have it print out more info
[05:11:14] <dextro_> so i can actually figure out whats wrong
[05:11:21] <dextro_> its working fine on my windows dev machine
[05:11:30] <dextro_> once i put it on the linux server its getting errors
[05:12:43] <ojacobson> If your logging framework can log exceptions (most of them), let it do it
[05:12:48] *** winux has quit IRC
[05:12:53] <ojacobson> otherwise, log the whole stack trace rather than just the exception
[05:12:54] *** cdg has quit IRC
[05:14:55] <dextro_> im retarded and need you to be a little more specific
[05:15:40] <Rainier> That looks like, JUL. Which allows this: log(level, text, exception);
[05:15:56] <Rainier> So: plugin.log(Level.SEVERE, "blah blah", e);
[05:16:32] <Rainier> you get much better output passing it the exception instance.
[05:17:35] *** BoF has joined ##java
[05:18:02] <Rainier> If you don't have JUL, just check the JavaDocs for the particular logging framework you're using.
[05:19:34] *** topriddy has joined ##java
[05:21:31] *** cdg has joined ##java
[05:23:54] <cdg> What do you guys prefer for a rich client platform?
[05:25:03] *** nucc1 has quit IRC
[05:25:34] <Planck_> The richer the client, the more flexibility they have in selecting the platform I'll use for them :p
[05:26:07] *** pyrrhic has quit IRC
[05:26:39] <Planck_> (That's not actually true, but it makes more sense than most uses of the phrase "rich client")
[05:26:55] <cdg> Planck_: well which platform do you like the best?
[05:27:19] <Planck_> For what?
[05:28:23] <cdg> Planck_: semi-large application development
[05:29:07] <cdg> I don't really have time to learn more than one or two so I'm trying to figure out which are the best to learn.
[05:29:47] *** afkos has joined ##java
[05:31:25] *** zac314159 has joined ##java
[05:31:34] <ojacobson> That's so open-ended that you're better off asking google
[05:31:46] <ojacobson> if you can narrow down specific features you're looking for, maybe someone can provide useful information
[05:31:59] <echosystm> who here bothers writing unit tests for html/javascript UIs ?
[05:32:24] *** zac314159 has left ##java
[05:33:33] *** eyesUnclouded has quit IRC
[05:35:52] *** IznastY has quit IRC
[05:35:53] *** sbalmos has quit IRC
[05:36:44] *** CrossWired has quit IRC
[05:37:45] *** wchun has joined ##java
[05:39:16] *** IznastY has joined ##java
[05:43:39] *** topriddy has quit IRC
[05:47:48] *** c_axis has quit IRC
[05:49:27] *** r0bby has quit IRC
[05:50:30] *** IznastY has quit IRC
[05:50:40] *** r0bby has joined ##java
[05:51:48] *** McMAGIC-- has joined ##java
[05:52:46] *** racarter has joined ##java
[05:53:19] *** r0bby is now known as robbyoconnor
[06:01:27] *** bojo has quit IRC
[06:04:13] *** top^ has left ##java
[06:06:07] *** ojacobson has quit IRC
[06:10:33] *** robbyoconnor has quit IRC
[06:14:11] *** mischief has joined ##java
[06:16:16] *** bojo has joined ##java
[06:16:39] *** bitshuffler has quit IRC
[06:17:16] *** terranova has quit IRC
[06:17:57] *** flow3r has joined ##java
[06:21:30] *** delasteve has joined ##java
[06:22:43] *** phantomcircuit has quit IRC
[06:24:03] *** Naith has joined ##java
[06:24:24] *** Naith has quit IRC
[06:25:43] *** X-Scale has quit IRC
[06:29:03] *** rfw has joined ##java
[06:29:33] *** mistik1 has quit IRC
[06:30:10] *** mistik1 has joined ##java
[06:31:05] *** RobotCow has quit IRC
[06:31:29] *** melic has quit IRC
[06:31:36] *** RobotCow has joined ##java
[06:31:59] *** cschneid has quit IRC
[06:32:11] *** cschneid has joined ##java
[06:40:44] *** Fanook has joined ##java
[06:41:22] *** Bombstone has quit IRC
[06:42:03] *** caverdude has joined ##java
[06:45:07] *** Serendib has quit IRC
[06:45:36] *** flow3r has left ##java
[06:45:46] *** kbotnen has quit IRC
[06:51:49] *** harshhoney has joined ##java
[06:52:27] <harshhoney> how to convert excel workbook into xml sheet?????????
[06:53:53] *** robbyoconnor has joined ##java
[06:58:43] *** symptom has quit IRC
[07:03:54] <Fanook> that depends entirely on which version of excel you're dealing with, what the format of the excel file is, and what format you want the xml to be in
[07:04:36] *** rretzbach has joined ##java
[07:05:40] <Planck_> And very little to do with java
[07:08:17] <harshhoney> excel workbook is in 2007 and i want to make a single xml file
[07:08:54] <cbeust> harshhoney: wrong channel
[07:09:08] *** bojo has quit IRC
[07:09:21] <harshhoney> hello
[07:10:11] <harshhoney> but i want to convert it by coding
[07:10:13] <harshhoney> .........................
[07:10:17] <Bombe> Then do it.
[07:10:37] <harshhoney> but what code should i write?????????///
[07:10:49] <Bombe> So, you want us to write it?
[07:10:54] <Bombe> How much are you willing to pay?
[07:11:16] <harshhoney> i want only help
[07:11:38] <harshhoney> b,coz i convert by single sheet of excel
[07:11:40] <Bombe> No, you don’t. Please go away.
[07:11:58] *** _habnabit has joined ##java
[07:12:08] <Fanook> ~~ harshhoney java excel library
[07:12:09] <javabot> harshhoney, what does that even *mean*?
[07:12:14] <Fanook> ~~ harshhoney google java excel library
[07:12:14] <javabot> harshhoney, http://letmegooglethatforyou.com/?q=java+excel+library
[07:12:20] <Fanook> there. now go to it
[07:12:40] <harshhoney> tnx fanook
[07:12:47] *** Unluckful has joined ##java
[07:13:06] <Fanook> i don't know why you decided to bother us instead of just doing that search yourself
[07:13:16] *** delasteve has quit IRC
[07:13:29] <Unluckful> Hello friends! Does anyone know a program I can some some classes or .java files through, and recieve a graphic of my binary tree?
[07:14:12] <Fanook> Unluckful: you mean your class hierarchy?
[07:14:30] <Unluckful> I'm not sure :s I'm fairly new to programming
[07:15:02] <Unluckful> Hold on. I'll show you an example of what I am looking for...
[07:15:38] <Unluckful> http://imgur.com/RPlr6 <like this
[07:16:38] <Fanook> oh, you mean huffman trees
[07:16:48] <Fanook> google that term, it's a fairly standard algorithm
[07:16:53] <Unluckful> Oh
[07:16:57] <Unluckful> I know the algorithm
[07:17:17] <Unluckful> I just want to make sure what I have works, and thought seeing a visual representation of the tree would help me confirm/deney
[07:17:41] <Fanook> in that case, JGraph might be useful
[07:18:43] <Unluckful> Sounds very useful, Thank you very much - I'll look into it :)
[07:18:48] <Unluckful> Do you have any tips for using it?
[07:18:59] <Fanook> never used it
[07:19:01] <tjsnell> read the docs
[07:19:40] <Unluckful> Alright, thanks :)
[07:20:58] *** oso96_2000 has joined ##java
[07:21:51] <Rainier> ~fanook++
[07:21:52] <javabot> fanook has a karma level of 152, Rainier
[07:22:00] *** bojo has joined ##java
[07:24:10] *** afkos has quit IRC
[07:24:58] *** flip28 has joined ##java
[07:25:24] *** megaTherion has quit IRC
[07:26:13] <racarter> ~javabot++
[07:26:13] <javabot> javabot has a karma level of 223, racarter
[07:26:14] *** [[thufir]] has joined ##java
[07:26:23] <racarter> I just wanted to see what happens
[07:28:29] *** blbrown_win3 has quit IRC
[07:28:44] *** yoshx has joined ##java
[07:29:17] *** yoshx has quit IRC
[07:30:13] <Rainier> racarter, you think it's going to stop you? ;)
[07:32:45] <racarter> ~javabot--
[07:32:46] <javabot> javabot has a karma level of 222, racarter
[07:32:51] <racarter> ha!
[07:33:08] <racarter> ~racarter++
[07:33:09] <javabot> Changing one's own karma is not permitted.
[07:33:10] <javabot> racarter, you have a karma level of -4
[07:33:12] <racarter> damn
[07:33:27] <Rainier> Must have already been negative. It usually goes down by 1 for that.
[07:33:48] <racarter> I think I've previously had a disagreement with javabot once before
[07:34:13] <Rainier> 3 times?
[07:34:16] <racarter> I don't remember what happened now though
[07:34:25] <racarter> I think it was all the same incident
[07:34:33] *** zuxqoj has joined ##java
[07:35:18] * Rainier tries to find an icon from FamFamFam he can repurpose (without clashing meaning) to say "this is the initial group element in this tree"
[07:35:53] <Rainier> I'm thinking a left pointing triangle to the right of the item's editor, or a checkmark image.
[07:38:33] *** racarter has quit IRC
[07:40:23] *** Peej has quit IRC
[07:41:16] <Rainier> Except I saw a post on how much magic this requires, it'd be nice if I could load up images in my HTML file I feed to a JDesktopPane from inside my program JAR. Honestly though if I really wanted such behavior it's much simpler to extract it to a temporary location on run images and all :P
[07:42:21] <Rainier> by magic, I mean I found a post on how to make your own tags, with appropriate handler. I suppose the tree could be scanned for images and fixed in some other manner.
[07:42:37] <Rainier> and, no, JDesktopPane does not support the "data URI" :(
[07:42:40] <Rainier> (I tried)
[07:43:11] *** dj_pi has quit IRC
[07:44:56] *** flip28 has quit IRC
[07:45:07] *** Kamaran has joined ##java
[07:45:57] <Rainier> The post I found added what was essentially a JButton (just to prove the concept) to the document based on a custom tag. Pretty neat, but the magic involved was almost stab yourself with pointy objects ...
[07:46:29] <Rainier> I wish someday they'd remove their "In a future release there may be more and/or better support for HTML/CSS" notes in red from the JavaDoc. They give a false hope.
[07:47:22] <Rainier> HTML and CSS are pretty ubiquitous, and Swing can't even display a recent version of either. :-/
[07:52:19] *** echelog has joined ##java
[07:53:05] *** _habnabit has left ##java
[07:53:16] *** fez has joined ##java
[07:53:44] *** tolland_ has joined ##java
[07:54:42] *** dmb has joined ##java
[07:55:26] *** cschneid_ has joined ##java
[07:55:52] *** kermit has quit IRC
[07:56:02] *** Wagoo has joined ##java
[07:56:11] *** jtrally_ has joined ##java
[07:56:17] *** cschneid has quit IRC
[07:56:17] *** L-----D has quit IRC
[07:56:17] *** echosystm has quit IRC
[07:56:17] *** oogaw has quit IRC
[07:56:17] *** Mkop has quit IRC
[07:56:17] *** lahwran has quit IRC
[07:56:17] *** Glavata has quit IRC
[07:56:17] *** dmb_ has quit IRC
[07:56:17] *** l2trace99 has quit IRC
[07:56:17] *** vpit3833 has quit IRC
[07:56:17] *** tolland has quit IRC
[07:56:17] *** jtrally has quit IRC
[07:56:18] *** Blub\0 has quit IRC
[07:56:18] *** thomasp has quit IRC
[07:56:18] *** e_ has quit IRC
[07:56:18] *** samferry has quit IRC
[07:56:18] *** Kneta_ has quit IRC
[07:56:18] *** jtrally_ is now known as jtrally
[07:56:29] *** _Tristan_ is now known as Tristan
[07:56:50] <Rainier> deebo, honestly, that's more on topic than probably a quarter to a third of what gets discussed here (quite a lot), I hadn't rambled on endlessly, and opinions aren't expressly verboten here. Therefore, try and have a bit more decorum ;)
[07:56:56] *** L-----D has joined ##java
[07:56:58] *** Mkop has joined ##java
[07:56:59] *** Tristan is now known as Guest77820
[07:57:29] *** chameloid has joined ##java
[07:59:13] *** samferry has joined ##java
[08:00:48] *** melic has joined ##java
[08:01:13] *** Blub\0 has joined ##java
[08:01:18] *** tjsnell sets mode: +b *!*@66-189-196-161.dhcp.yakm.wa.charter.com
[08:02:38] <Planck_> Wow.
[08:02:56] *** oso96_2000 is now known as oso[OuT]
[08:05:31] *** Yusdan has joined ##java
[08:05:52] *** Glavata has joined ##java
[08:07:13] *** zuxqoj has quit IRC
[08:10:27] *** Engin has joined ##java
[08:15:00] *** terranova has joined ##java
[08:16:10] *** platzhirsch has joined ##java
[08:20:23] *** ExtraSpice has joined ##java
[08:23:42] *** banpdtr_ has joined ##java
[08:25:20] *** Matic`Makovec has joined ##java
[08:27:16] *** CodeWar has joined ##java
[08:28:14] *** LouisJB has quit IRC
[08:30:38] *** DJClean has joined ##java
[08:32:39] *** frangiz has joined ##java
[08:34:23] *** _Jorde has joined ##java
[08:34:49] *** mazzachre has joined ##java
[08:38:43] <mischief> !lua
[08:38:55] <mischief> ~lua
[08:38:56] <javabot> mischief, what does that even *mean*?
[08:38:59] <mischief> :(
[08:40:54] <mischief> ive been trying to get luajava working all day to no avail -.-
[08:41:40] *** platzhirsch has left ##java
[08:45:16] *** CodeWar has quit IRC
[08:47:10] *** Yusdan has quit IRC
[08:48:07] *** Unluckful has quit IRC
[08:48:10] *** Glavata has quit IRC
[08:49:30] *** zuxqoj has joined ##java
[08:51:04] *** VooDooNOFX has quit IRC
[08:52:08] *** xastey has quit IRC
[08:52:50] *** choongii has joined ##java
[08:53:01] *** r0bby has joined ##java
[08:55:12] *** VonNaturAustreVe has quit IRC
[08:55:40] *** robbyoconnor has quit IRC
[08:56:32] *** terranova has quit IRC
[08:57:53] *** frangiz has quit IRC
[09:00:05] *** Yusdan has joined ##java
[09:01:23] *** Rainier has left ##java
[09:02:43] *** frangiz has joined ##java
[09:05:28] *** wolfman2000 has quit IRC
[09:08:39] *** openpercept has joined ##java
[09:10:56] *** eitch0000 has joined ##java
[09:17:27] *** oyvinmar has joined ##java
[09:17:28] *** mastroDani has joined ##java
[09:17:59] *** supercosmonaut has quit IRC
[09:20:21] *** cbeust has quit IRC
[09:23:37] *** anny__ has joined ##java
[09:23:47] <anny__> hey all
[09:23:59] <anny__> is anyone familiar here with jsp
[09:24:32] <Cher> ~ask
[09:24:32] <javabot> The Ask To Ask protocol wastes more bandwidth than any version of the Ask protocol, so just ask your question.
[09:24:42] <aLeSD> hi all
[09:24:51] <aLeSD> I have a strange question to resolve
[09:25:06] <aLeSD> I hve a list and some sublist .. created from the first
[09:25:24] <aLeSD> I want that all this lists has a common lock
[09:25:42] <Cher> Common lock for what? synchronized?
[09:26:11] <anny__> i need to perform a possibly long operation from a jsp page (db backup), is it good practice to do so
[09:26:19] <deebo> no
[09:26:20] <aLeSD> I explain better: a = List... b = a.subList ... I want that synchronize(a) and synchronize(b) will block both
[09:26:24] <aLeSD> Cher, yes!
[09:27:59] <Cher> aLeSD: Collections.synchronizedList() will do exactly what you want.
[09:30:06] <aLeSD> Cher: not really ... cause I can't create the sub list
[09:30:07] *** topriddy has joined ##java
[09:30:08] <aLeSD> mmm
[09:30:48] <Cher> aLeSD: Why can't you create the sub list?
[09:32:11] <aLeSD> Cher, I mean I can't use List.subList function
[09:32:22] <aLeSD> ops
[09:32:24] <aLeSD> sorry
[09:32:47] *** frangiz has quit IRC
[09:33:07] <aLeSD> Cher ... no wait
[09:33:34] <aLeSD> List a = new List ;;; b = Collections.synchronizedList(a);
[09:33:50] *** barq has joined ##java
[09:33:58] *** frangiz has joined ##java
[09:33:59] <aLeSD> c = b.subList(....) ... doesn't work
[09:34:15] <Cher> aLeSD: Have you read the documentation of Collections.synchronizedList()?
[09:34:16] <aLeSD> List a = new List ;c = a.subList(..) ; b = Collections.synchronizedList(a);
[09:34:23] <aLeSD> doesn't work
[09:34:47] <Cher> (Obviously not...)
[09:35:08] <aLeSD> my english sucks
[09:35:39] <Cher> Do you see the code example in the documentation?
[09:35:50] <aLeSD> yes
[09:36:11] <Cher> Then create your references like in the code example.
[09:36:40] <aLeSD> Cher: and the sublist ?
[09:36:49] <aLeSD> it is critical that all access to the backing list is accomplished through the returned list.
[09:36:55] <Cher> List a = Collections.synchronizedList(new ArrayList()); List b = a.subList(...);
[09:36:57] *** mastroWork has joined ##java
[09:37:29] <Cher> You mean that modifications of b also change a?
[09:37:59] <aLeSD> I mean that synchronized on b has to lock a
[09:38:05] <aLeSD> and viceversa
[09:38:41] *** TzilTzal has joined ##java
[09:39:51] <Cher> Does it mean that you have transactions over the lists where the implicit synchronization of a synchronized List will not do?
[09:40:17] *** mastroDani has quit IRC
[09:40:17] <aLeSD> Cher Vector is synchronization and fails
[09:40:39] <aLeSD> I am reading from a sublist ... meanwhile another thread is adding elements
[09:40:53] <aLeSD> I get Concurrent exception ...
[09:40:56] *** pen has joined ##java
[09:41:16] <Cher> ~paraphrase
[09:41:16] <javabot> Don't paraphrase code or errors. If you knew what was important to show us, you wouldn't need us to answer your question. You should pastebin the *actual* code and the *actual* error. Anything else is most likely going to be useless.
[09:42:07] <aLeSD> I tried to synchronize in the sublist (reading thread) and on the main list (adding) ... no way ... It seems that list and sublist are two different object atteched to the same array
[09:45:26] <Candle_> aLeSD: Look at BlockingQueue, and other collections in the java.util.concurrent package.
[09:45:34] *** barq has quit IRC
[09:45:38] *** Candle_ is now known as Candle
[09:45:41] <aLeSD> Cher http://pastebin.com/C1gcbySQ
[09:46:26] <Cher> The _ hurts my eyes.
[09:46:48] <Cher> And you're not using Collections.synchonizedList().
[09:46:57] <Candle> The aim of the ConcurrentModificationException is to fail fast to tell you that you are trying to do something silly.
[09:47:20] *** oyvinmar has left ##java
[09:47:38] *** Kamaran has quit IRC
[09:48:01] <Cher> It could be so simple. List<X> a = Collections.synchronizedList(new ArrayList<X>()); List<X> b = a.subList(...); one Thread: a.add(); and the other Thread: synchronized(a) { for (final X x : b) { ... } }
[09:48:01] <Candle> Cher: The leading _ are from languages that don't have proper encapsulation (e.g. php4!) keywords like 'private'.
[09:48:16] <Cher> Candle: Maybe, but is this PHP or Java? ;-D
[09:48:24] *** mastroWork has quit IRC
[09:48:47] *** Slush- has joined ##java
[09:48:52] <Candle> Cher: Exactly my point, they are not needed here.
[09:49:22] *** drindt has joined ##java
[09:49:23] <Candle> It does look like the BlockingQueue is actually what aLeSD wants.
[09:49:36] <Cher> aLeSD: If this won't do, i.e. you want concurrent iteration, not synchronized / fail-fast iteration, do what Candle says.
[09:49:45] *** winux has joined ##java
[09:49:48] <Candle> ~~ aLeSD javadoc BlockingQueue
[09:49:48] <javabot> aLeSD: http://is.gd/j5SGs [JDK: java.util.concurrent.BlockingQueue]
[09:49:54] <aLeSD> Cher: I used Collection.syncronized ... it fails
[09:50:11] *** scruz has joined ##java
[09:50:47] <Candle> Yes, it fails because you are doing a concurrent modification. which, er, is correct.
[09:51:07] <scruz> hello
[09:51:12] <aLeSD> my problem is that a and a.subList are two different object
[09:51:21] <Candle> Anyway, I suspect we've given you enough hints for things to go read and investigate.
[09:51:31] <aLeSD> ok
[09:51:33] <aLeSD> thanks
[09:51:47] *** Ch30ps has joined ##java
[09:53:01] <Cher> aLeSD: I doubt your problem is that a and a.subList are two different objects. Check the "other Thread" part of what I said. The sublist for Collections.synchronizedList needs to be synchronized on its origin list for non-atomic operations.
[09:54:01] *** mastroWork has joined ##java
[09:54:40] <aLeSD> Cher: what I am tryng to do is to synchronized on the sublist to lock the origin list too ... So I am tring top modify the subList to lock the main list... I mean Object will have a field used by synchronized
[09:55:36] <aLeSD> I will try to b.syncfield = a.syncfield
[09:56:07] *** Fuco has joined ##java
[09:58:18] *** coalado has joined ##java
[09:59:12] <Cher> aLeSD: Why don't you just lock a on the "other Thread"?
[09:59:26] <aLeSD> Cher: it's general
[09:59:57] <aLeSD> it takes a List ... I won't to pass a reference to another List ... it does make sens
[10:00:02] <aLeSD> doesn't
[10:00:30] <Cher> I still don't see the problem. Maybe if you paste the code of the other thread...
[10:02:56] *** frangiz has quit IRC
[10:04:12] *** frangiz has joined ##java
[10:04:16] <aLeSD> Cher: the other code simply sync on the sublist
[10:04:34] <Cher> aLeSD: But how does it use the sublist... man, please don't paraphrase.
[10:04:57] *** mastro has joined ##java
[10:05:18] *** io2 has joined ##java
[10:06:27] <aLeSD> http://pastebin.com/NQFbREui
[10:07:46] <Cher> aLeSD: Where exactly are you getting the ConcurrentModificationException? Can you paste a stack trace?
[10:08:34] *** mastroWork has quit IRC
[10:09:12] <aLeSD> http://pastebin.com/dtt4Z4Xp
[10:10:22] <Cher> aLeSD: And what line in the previous paste is Line 73 of SensorEventGraphView?
[10:11:38] *** Glavata has joined ##java
[10:12:12] <aLeSD> synchronized (_list) {
[10:12:12] <aLeSD> if (_list.size() == 1) {
[10:12:19] <aLeSD> Sync... is line 72
[10:13:05] <aLeSD> it's accessing to _list meanwhile the other thread is adding an element
[10:13:14] *** Mkop has quit IRC
[10:13:35] <aLeSD> lokk ... everything work if I simply pass all the list to the other thread
[10:13:50] <Cher> I don't see a "if (_list.size() == 1) {" in the code that you've pasted.
[10:14:09] <aLeSD> 0_o
[10:14:31] *** barq has joined ##java
[10:14:31] <aLeSD> ah shit... I pasted the point function
[10:15:46] <aLeSD> http://pastebin.com/e7swE4wq
[10:16:41] <Cher> And what line in the paste matches "SensorEventGraphView.java:73"?
[10:16:50] <aLeSD> 36
[10:16:56] <aLeSD> ops 37
[10:17:43] <Cher> Well, then I'd use collection from java.util.concurrent instead.
[10:18:54] *** mastroWork has joined ##java
[10:20:04] *** anny__ has quit IRC
[10:22:16] *** mastro has quit IRC
[10:24:08] *** topriddy has quit IRC
[10:25:24] <Cher> aLeSD: I do not have much experience with java.util.concurrent. Your use case looks like a typical consumer-producer pattern to me. I would give LinkedBlockingQueue a try.
[10:26:08] <aLeSD> I will
[10:29:58] *** jjido has joined ##java
[10:31:41] *** Matuku has joined ##java
[10:32:38] *** mhahe has joined ##java
[10:32:52] *** arborist has joined ##java
[10:33:56] *** frangiz has quit IRC
[10:33:56] *** rfw has quit IRC
[10:34:28] *** frangiz has joined ##java
[10:34:44] *** abhijain has joined ##java
[10:35:26] *** tonique has joined ##java
[10:36:28] *** rvncerr has joined ##java
[10:38:27] *** RedEx` has joined ##java
[10:38:59] *** mastro has joined ##java
[10:40:54] *** barq has quit IRC
[10:43:02] *** mastroWork has quit IRC
[10:43:28] *** RedEx` has left ##java
[10:44:25] *** harshhoney has quit IRC
[10:45:20] *** topriddy has joined ##java
[10:45:42] <tonique> curious system.out.println(linkedlist.get(1)) works while g.drawString(linkedlist.get(1),10,10) doesn't ?
[10:46:00] *** stimpie has joined ##java
[10:47:02] <topriddy> hi, am trying to access a 32-bit dll through java-jni. it complains it cant load dll under 64-bit. so i switch to my 32 bit jre, and run the java command bit still get the same error message.
[10:47:55] <topriddy> my questions is can i specify a java app to run as either 32/64-bit by just running the corresponding bit jres?
[10:53:00] *** mastroWork has joined ##java
[10:54:09] *** terranova has joined ##java
[10:56:32] *** mastro has quit IRC
[10:57:02] *** Sliker has joined ##java
[10:58:55] *** TzilTzal has quit IRC
[11:01:13] *** selckin has joined ##java
[11:04:52] *** psst has joined ##java
[11:06:31] *** elzoog has joined ##java
[11:06:41] *** impulse150 has joined ##java
[11:07:21] *** GibbaTheHutt has joined ##java
[11:07:32] *** mastro has joined ##java
[11:08:00] *** Everclear72216 has joined ##java
[11:08:17] <tonique> in other words how can i squeeze my Integer back out of an object ?
[11:08:51] <elzoog> What is up with pastebin.com? When I paste something there I can't see the result.
[11:10:41] *** Noya has joined ##java
[11:10:49] *** mastroWork has quit IRC
[11:12:01] *** daark has joined ##java
[11:12:25] *** topriddy has quit IRC
[11:12:30] <elzoog> I have a question. If I have a class Fraction { public Fraction multiply(Fraction foo) } How do I enforce a compiler error if someone tries Fraction myFrac = new Fraction(); myFrac.multiply(myFrac2);
[11:13:24] <Everclear72216> Hi I have a question concerning the PropertyResourceBundle class. In which folders relative to the program's working directory will getBundle() look for the *.properties files?
[11:13:53] *** X-Scale has joined ##java
[11:14:07] *** tonique has left ##java
[11:14:14] <Everclear72216> I keep getting MissingResourceExceptions
[11:15:09] *** loxs has joined ##java
[11:15:23] <Candle> elzoog: Supply a constructor that forces initialisation of the fields in the Fraction class, for added points, make the Fraction class completely immutable by using the 'final' keyword.
[11:15:52] <loxs> folks, how am I supposed to start this in ubuntu? http://code.google.com/p/luke/downloads/detail?name=lukeall-1.0.1.jar
[11:15:54] <balooo> tonique: do you mean linkedlist.get(1).intValue()
[11:16:00] <loxs> there are no instructions on the website
[11:17:25] <Candle> loxs: try 'java -jar <path to jar>' ?!
[11:17:56] <loxs> thanks Candle
[11:19:21] <Candle> loxs: Which is how you excecute any java archive (jar) that is executable; any search for something like 'execute jar file' would probably have answered your question without the need to some and ask here.
[11:19:22] <elzoog> Candle: I did that.
[11:19:31] *** murr4y has joined ##java
[11:19:56] <Candle> ~~ elzoog pastebin
[11:19:56] <javabot> elzoog, http://paste.pocoo.org/ - Paste the final url after you've pasted your stuff there.
[11:20:12] *** [[thufir]] has quit IRC
[11:21:20] *** nucc1 has joined ##java
[11:21:32] *** steffo has joined ##java
[11:21:58] <elzoog> Candle: http://paste.pocoo.org/show/349397/ Look for the comment //Below line should give a compiler error
[11:22:19] *** Indigenous has joined ##java
[11:22:23] <Candle> ~ elzoog conventions
[11:22:24] <javabot> Candle, what does that even *mean*?
[11:22:24] <Everclear72216> The docs only explain naming conventions like <basename>[_<language>][_<country>].properties
[11:22:28] <Candle> ~~ elzoog conventions
[11:22:28] <javabot> elzoog, conventions is http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html , or "ThisIsAClassName, thisIsAVariableOrMethodName, THIS_IS_A_CONSTANT_NAME". See also http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html
[11:22:35] <Candle> (re your package name)
[11:23:53] *** novitololo has joined ##java
[11:24:48] <elzoog> Candle ??
[11:25:08] <Candle> Yes, reading.
[11:25:14] *** ab500 has quit IRC
[11:25:37] *** ab500 has joined ##java
[11:26:24] *** pippijn has joined ##java
[11:26:26] <pippijn> hi all
[11:27:08] <Candle> elzoog: Ok, What sort of error are you wanting? Why should that line fail? What are you doing with the return value from that method call [if they are immutable, then that call should do nothing to either Fraction instance]? ... (probably more to come, but start with those!)
[11:27:11] *** TzilTzal has joined ##java
[11:27:18] <pippijn> I'm trying to draw a swing component to a bufferedimage like this: http://npaste.de/zp/
[11:27:30] <pippijn> but I get a completely white image
[11:27:39] <pippijn> what am I doing wrong?
[11:27:45] *** loxs has left ##java
[11:28:04] <mapreduce> wyvern: Possibly. Where do I see that exception trace?
[11:29:18] <elzoog> Candle, I want to have the multiply function be so that it MUST return a Fraction. So test2.multiply(test) should be an error.
[11:30:05] <mapreduce> elzoog: Do you mean it must take a Fraction?
[11:30:09] <mapreduce> rather than return one
[11:30:20] <elzoog> I want it to force test2.multiply(test) to be assigned to a fraction. Even if it's something like test2 = test2.multiply(test)
[11:30:26] *** impulse150 has quit IRC
[11:30:47] <mapreduce> You want to force the return value to be used, do you mean?
[11:31:09] <Candle> elzoog: Ah, hm. Saying that the method signature returns a Fraction handles that part. As to if the user uses the result of the operation that's their lookout.. THere is a compiler warning that shows in Netbeans (and probably others) that says that the return value of a method is not used.
[11:31:18] <elzoog> mapreduce: Yeah, since Fractions are immutable, test2.multiply(test) won't do anything
[11:31:58] *** wchun has quit IRC
[11:32:08] <mapreduce> elzoog: Ok, you have IDE warnings for that, or you could write something that processes the source (a CheckStyle or PMD rule perhaps).
[11:32:09] <Candle> elzoog: Also, some of the static analysis tools will pickup on that issue too.
[11:32:14] <novitololo> Hi, I've downloaded the following library: http://sourceforge.net/projects/jamod/files/jamod/1.2/ (jamod-1.2-SNAPSHOT-sources.jar). And I've added that .jar in the classpath. However, I'm not able to see any .class file from that Library. Any thoughts?
[11:32:39] *** mastro has quit IRC
[11:32:42] <elzoog> Is it possible to enforce a compiler error on test2.multiply(test) ??
[11:32:55] <mapreduce> Not without changing the compiler.
[11:33:06] <Candle> Not as the library developer.
[11:33:08] <mapreduce> elzoog: It seems likely that the real problem is something else - someone isn't testing their code or isn't learning from their mistakes.
[11:33:15] <mapreduce> So.. what is the real problem?
[11:33:30] *** ff1959 has joined ##java
[11:33:41] <elzoog> mapreduce: Did you see the code?
[11:33:47] <mapreduce> No.
[11:33:55] <Candle> mapreduce: Apart from the "package MathTools;", the aparrant lack of unit tests, not much.
[11:34:11] <elzoog> http://paste.pocoo.org/show/349397/
[11:34:15] <mapreduce> Candle: Yeah, that's in "someone isn't testing their code" :)
[11:34:49] <mapreduce> Ok, I can see code, what's the problem?
[11:34:58] <mapreduce> Ah, "Below line should give a compiler error"
[11:35:03] *** frangiz has quit IRC
[11:35:11] <Candle> up, enter. He wanted that line to give a compile error.
[11:35:15] <mapreduce> Why should it give a compiler error? What would having that give a compiler error solve?
[11:35:22] <mitch0> hrmp. what's the JPA way of specifying /*+append*/ (bulk insert) hint? my gogle-fu fails
[11:36:11] *** frangiz has joined ##java
[11:36:24] <elzoog> mapreduce: Well, it's an immutable object. The function returns a Fraction type. If you don't have myFrac = t.multiply(x) shouldn't it give a compiler error?
[11:36:49] <Candle> Nope. The method may have side-effects.
[11:37:07] <Candle> Detecting side effects is one of those *HARD* problems.
[11:38:05] *** daark has quit IRC
[11:38:44] <elzoog> Since I am now pretty much finished with the writing the code stage of this class. What is a sane way of creating a unit test for it?
[11:39:00] *** flowmode has joined ##java
[11:39:27] *** mastro has joined ##java
[11:39:48] <Candle> in before "unit tests should be written first" ... think of possible edge cases and write tests that confirm that they behave as expected.
[11:40:25] <elzoog> mapreduce: Let's say I fix the package name to something that follows a naming convention, and I test this class. Then I give it to you for you to use in your program. Shouldn't I warn you about doing something like test2.multiply(test)?
[11:41:01] <flowmode> ~pastebin
[11:41:01] <javabot> http://pastie.org - Paste the final url after you've pasted your stuff there.
[11:41:35] <elzoog> Candle: How do you create a unit test for this class?
[11:41:37] <pippijn> I'm nom trying to draw a swing component to a bufferedimage of type TYPE_INT_RGB and now I get a completely black image
[11:41:38] <Candle> elzoog: No, it's mapreduce's problem, If he wants to call that method and ignoree the return value, it's his problem, not yours. You've done pretty much all you can by making it immutable.
[11:43:36] *** bn` has quit IRC
[11:43:53] <elzoog> Candle: What is standard procedure for making a unit test?
[11:44:15] *** Soliah has quit IRC
[11:45:18] *** xiliax has joined ##java
[11:45:47] *** megaTherion has joined ##java
[11:46:34] *** Scaatis has joined ##java
[11:46:39] <Scaatis> hello
[11:46:42] <Candle> elzoog: Well, you have a few methods with sensible return values. (multiply, constructors, add, subtract, ...) for each of those, create a 4 line test for each to test the basic case, then think about what inputs may break each method, (supplying 0 as the denominator) and test to see if you get the expected result. Note that 'new Fraction(0,0,0)' is perfectly valid [according to the first constructor], and it would throw an exception.)
[11:47:31] *** daark has joined ##java
[11:47:46] <mapreduce> elzoog: It's a language limitation. If Java had operator overloading you could write it as test * test2, and that would fail to compile on its own.
[11:48:04] *** jjido has quit IRC
[11:48:10] <elzoog> Candle: Do you create a separate class for that? I.E. class testFraction?
[11:48:15] <mapreduce> elzoog: There's not really a lot you can do as a library supplier.
[11:48:18] <Candle> Fraction a = new Fraction(2,0,0); Fraction b = new Fraction(3,0,0); Fraction expected = new Fraction(5,0,0); assertEquals(expected, a.add(b));
[11:48:43] *** Soliah has joined ##java
[11:48:46] <Scaatis> I have the following problem: I have the class AbilityType<T extends Ability>. In ability I defined the static method isValidTarget. Can I call that method in the AbilityType class by calling T.isValidTarget ?
[11:48:53] <elzoog> Candle: What I mean is, is it sane to have test code in the Main function like the previous guy had?
[11:48:55] <Candle> If the add method doesn't result in a fraction of 5 then the test fails and someone screwed up.
[11:48:57] *** IznastY has joined ##java
[11:49:00] <mapreduce> elzoog: String also is immutable, and you don't get compile errors for forgetting to use the results of its methods.
[11:49:32] <Candle> elzoog: Test code in a main method is generally a bad idea as it clutters the functionality of your class.
[11:49:33] *** Versuchen has joined ##java
[11:49:49] <Candle> ~~ elzoog junit
[11:49:49] <javabot> elzoog, junit is a unit testing tool for java. See http://www.junit.org/
[11:50:18] <elzoog> Candle: That's what I thought. So where should I put test code? I am aware of the principle of trying all kinds of things to break it. I am just wondering where to put those tests.
[11:50:56] <Candle> elzoog: It depends on how the tests are to be run, go and have a read of the junit website.
[11:51:11] <elzoog> What's an easy example of how to use junit?
[11:51:20] <Candle> THERE'S ONE ON THE SITE.
[11:51:43] <Candle> Personally, I would use Maven as my build tool, that would specify a structure and where to put my tests.
[11:52:34] <Candle> elzoog: People provide links, they provide them for YOU to go and READ. There's no point in re-typing everything into IRC.
[11:52:37] <jww> hello guys.
[11:52:43] *** pen has quit IRC
[11:52:49] <jww> does someone know where I could get some help with icefaces ?
[11:52:51] *** msieradzki has joined ##java
[11:53:01] <mapreduce> Alaska.
[11:53:12] <jww> heh :)
[11:53:53] *** IznastY has quit IRC
[11:53:54] <Scaatis> Candle: you seem to know your way around java. Do you know whether the function call I described would work?
[11:54:32] <Candle> Scaatis: Not via a static method, no.
[11:54:47] <Candle> ~~ Scaatis type erasure
[11:54:47] <javabot> Scaatis, type erasure is the notion that all generics info *FROM INSTANCES* is gone [the String in List<?> x = new ArrayList<String>();], as well as generics info being irrelevant for method signatures (void foo(List<Integer> x) and void foo(List<String> x) cannot co-exist in the same class).
[11:54:55] <Scaatis> yeah I read about that
[11:55:06] <Scaatis> can you recommend some other way of calling that method?
[11:55:13] <Candle> Scaatis: Statically?
[11:55:44] <flowmode> How can I mock hibernate in a spring application? I just want to disable any database functionality so I could debug the rest of the application. Wiring looks like this: http://pastie.org/1642712
[11:55:51] <mapreduce> Scaatis: Sure. void foo(T t) { t.thatMethod(); }
[11:56:08] <mapreduce> I.e., you need an instance to call an instance method.
[11:56:09] *** ktorn has quit IRC
[11:56:24] <Scaatis> it's not an instance method
[11:56:33] <Scaatis> it's a static method I'm trying to call
[11:57:08] <Scaatis> but I don't know of what class other than that it must be a subclass of Ability
[11:58:11] <mapreduce> Then you can't do it. Make it an instance method instead.
[11:58:17] <Scaatis> ok
[11:58:21] <mapreduce> Even if that means adding a new parallel inheritance hierarchy.
[11:58:44] <Scaatis> thank you
[11:58:48] *** Scaatis has left ##java
[11:58:55] <mapreduce> Another way is reflection, but that's a piss-poor approach to design.
[11:58:58] <Candle> ~next
[11:58:58] <javabot> Another satisfied customer. Next!
[11:59:27] <novitololo> I'm trying to read from Serial Port, but I need to know the identifier. I'm using ubuntu. How could I know the identiifier?
[11:59:53] <mapreduce> novitololo: As in the filename?
[12:00:04] <jww> prolly /dev/ttySxx , grep it in dmesg .
[12:00:13] <mapreduce> ~~ novitololo google list serial ports ubuntu
[12:00:13] <javabot> novitololo, http://letmegooglethatforyou.com/?q=list+serial+ports+ubuntu
[12:00:13] *** flowmode has quit IRC
[12:00:44] *** gelignite has joined ##java
[12:01:21] *** io2 has quit IRC
[12:01:24] <reisi> novitololo: what api are you using?
[12:01:52] <novitololo> I'm using SerialConnection.class
[12:02:16] <reisi> novitololo: i'm throwing a guess that you made that class?
[12:02:29] <novitololo> it's in the jamod library.
[12:02:35] <novitololo> for modbus communication
[12:02:52] *** flowmode has joined ##java
[12:03:36] <reisi> interesting
[12:03:37] *** Soliah has quit IRC
[12:04:28] <reisi> novitololo: apparently they build on the original javax.comm api
[12:04:36] <flowmode> sorry my connection dropped, did anyone take a look @ my question about mocking hibernate
[12:05:27] <novitololo> reisi: ok. My only concern is to know which ID should I give to that connection... Should I give ttyS0 ?
[12:05:46] <novitololo> that's in /dev/ttyS0, and I know it's my serial port where I'm connecting
[12:06:07] <novitololo> but that's not working... it doesn't seem to realize that id is the port, so I was wondering if there are other ids related
[12:06:15] <reisi> novitololo: try-and-see, it's most likely going to be called /dev/ttyS0 in your code as well
[12:07:41] <reisi> flowmode: well you can turn off the runtime dependency to hibernate IF your service -level uses the data access level through *your* interfaces
[12:08:08] *** Soliah has joined ##java
[12:08:36] <reisi> flowmode: the higher (from db->hibernate->dao->services->ui layers) you go with any knowledge of hibernate/jpa the more difficult (impossible) it is to "mock it away"
[12:08:57] *** homie has quit IRC
[12:09:14] <reisi> flowmode: transactionmanager is easily replaced with a null impl, so you can leave your transaction attributes be in the mock case
[12:09:49] <flowmode> reisi: okay that sounds insightful, I'll just research a little to understand what you mean
[12:10:01] *** homie has joined ##java
[12:10:15] <flowmode> I've had to do this at breakneck speed, starting with spring & hibernate just yesterday.. :)
[12:10:30] <reisi> flowmode: then you are going to fail, i'm afraid
[12:11:05] <flowmode> I hope it's a failure to learn from in that case
[12:11:11] <dreamreal> don't mock hibernate. For one thing, it's really sensitive and resents it. For another, mock a service layer.
[12:11:27] <reisi> flowmode: but when you get more time, look at the samples from springsource, at least one of those has different dao (data-access [object]) backends (jpa, sql), which will give you a better understanding
[12:12:04] <flowmode> thanks.
[12:12:23] <novitololo> reisi: thanks. I'm working on this
[12:12:24] <reisi> flowmode: that might had been petstore for spring-3.0
[12:12:46] <Candle> novitololo: Just remember that any code you write is highly unlikely to be platform independent. I would try to write it in terms of streams as much as possible, allowing me to create something that will work if /dev/ttyS0 does not exist.
[12:13:18] <novitololo> Candle: I'm thinking on creating a properties files, and passing those "ids" via arguments.
[12:13:29] <reisi> serial ports w/ java == major pita, especially with usb-rs232 devices
[12:13:43] *** echosystm has joined ##java
[12:14:01] <echosystm> what is the benefit of hibernate over plain JPA ?
[12:14:17] <scruz> echosystm: hibernate implements jpa
[12:14:32] <echosystm> yes, but what implementation-specific things does hibernate do?
[12:14:39] <scruz> jpa is a specification. hibernate, eclipselink, etc implement that specification
[12:14:41] <echosystm> ie. why would you use hibernate over eclipselink
[12:14:43] <reisi> echosystm: with jpa2 i think very little, you can still give it "hints" and use hibernate-specific annotations
[12:14:48] *** pen has joined ##java
[12:15:13] <reisi> echosystm: i believe that in some not-so recent benchmarks hibernate was an order of magnitude faster, though it might be very difficult in osgi environments
[12:15:24] <echosystm> alrighty
[12:15:38] *** magentar has joined ##java
[12:16:07] *** Soliah has quit IRC
[12:16:09] <reisi> echosystm: but if you are starting now, aim to use (it through) jpa2 only
[12:16:31] <novitololo> reisi: it seems the problem is not from the connection itself, but it doesn't find a class: http://pastebin.com/ea1sYFrN
[12:16:31] <echosystm> i use eclipselink
[12:16:31] *** daark has quit IRC
[12:16:40] <echosystm> i was just curious if there is any reason to give hibernate a shot
[12:16:47] <dreamreal> um, if you were looking for speed, you'd avoid JPA altogether
[12:16:48] <scruz> reisi: any jpa tutorial that's implementation-agnostic?
[12:17:00] <echosystm> i feel safer using eclipselink - being the JPA2 reference implementation etc.
[12:17:14] <dreamreal> echosystm: *snrk* JCP for the win, indeed.
[12:17:31] <reisi> novitololo: well that's just it, (hope you are on linux or some sun unix) you need javax.comm api's; strange that your maven didn't complain about those missing?
[12:18:02] <reisi> scruz: no idea, we've been battling it out with native hibernate from 3.0
[12:18:07] <scruz> ~jpa tutorial
[12:18:07] <javabot> scruz, what does that even *mean*?
[12:18:20] <novitololo> I'm on Ubuntu with Eclipse... javax.comm api, ok, will check that..
[12:18:23] <dreamreal> jamod's pretty nice
[12:18:31] <echosystm> scruz: you just dont use anything that isn't in javax.persistence 2.0
[12:18:34] <scruz> prolly will go the pure hibernate route too
[12:18:35] <dreamreal> modbus is icky, but jamod is nice
[12:19:01] *** Everclear72216 has quit IRC
[12:19:12] *** banpdtr_ has left ##java
[12:19:17] <dreamreal> novitololo: what kind of devices are you talking to? And are you talking to them over TCP/IP or serial? (If serial... ack)
[12:19:40] <novitololo> serial so far.
[12:19:51] <novitololo> they are dupline devices
[12:19:54] <scruz> i wanted to steer clear of eclipselink and jpa because i'm building a module in a framework and wasn't too sure about limitations of persistence.xml position
[12:19:56] <novitololo> (from carlo gavazzi)
[12:20:24] <dreamreal> I found serial to be very problematic. TCP/IP had its own problems, but was far easier to work with. I've not worked with those; I've used Festo, B&R, and Wamod devices.
[12:20:47] <echosystm> any good framework will be persistence-agnostic
[12:20:59] <dreamreal> scruz: use a service layer.
[12:21:00] <novitololo> dreamreal: I will move to TCP/IP, but I thought it would be easy as start to play with serial.
[12:21:17] <dreamreal> novitololo: no, because serial just gives you an extra set of problems to work with at the very start.
[12:21:19] *** zemanel has joined ##java
[12:21:21] <dreamreal> (as you see.)
[12:21:36] <dreamreal> TCP/IP is better but *avoid* TCP over USB if you can.
[12:21:45] <novitololo> how would you recommend then?
[12:22:14] <novitololo> I've zero experience with Modbus protocol and all this area...
[12:22:24] <dreamreal> what would I recommend for what?
[12:22:45] <novitololo> TCP over what?
[12:23:00] <dreamreal> Oh, over cat5 :)
[12:23:34] <dreamreal> just direct. USB has location ONLY by hub - hook 32 devices onto a single USB hub and you ... know they're on that hub, but not which device is which, if they're identical otherwise.
[12:24:10] <dreamreal> so imagine you have five barcode scanners on a single hub: #3 goes out, then comes back online. It can easily come back online as #6, instead.
[12:24:19] <novitololo> I see
[12:24:24] <novitololo> interesting, thanks mate
[12:25:33] *** zChris has quit IRC
[12:25:35] <dreamreal> Yeah, I... didn't find the same. I thought TCP/IP was far easier, for all kinds of reasons.
[12:25:55] <dreamreal> Oh, BTW: one other thing to watch for: modbus is a *recommendation*
[12:26:28] <dreamreal> much like RSS, you comply if you ... well... with RSS, you can say "We use RSS" if all you use is XML.
[12:26:53] *** flowmode has quit IRC
[12:27:05] <dreamreal> (Everything is "should." "You should use a top-level node of RSS," for example. Meanwhile: legal RSS has NO top-level node, and can use "rss0.92, eh" for one if it likes.)
[12:27:26] *** wliao has quit IRC
[12:28:50] *** eaxxae has left ##java
[12:29:17] <novitololo> dreamreal: Thanks a lot for all this information.
[12:31:39] <dreamreal> novitololo: my pleasure. I spent a year wrestling with modbus - great fun, really.
[12:31:49] <dreamreal> We used a cloud solution to manage a metric ton of modbus devices. :)
[12:31:49] *** ech0s7 has joined ##java
[12:31:50] <ech0s7> hi
[12:32:55] <scruz> dreamreal: if speed was a major consideration, wht DAL/ORM would you recommend?
[12:32:59] *** frangiz has quit IRC
[12:33:06] <ech0s7> why i get this error: The method setRoundingMode(RoundingMode) is undefined for the type NumberFormat int this code: http://pastebin.com/sTWPtabV
[12:33:09] <dreamreal> Pick NoSQL.
[12:33:35] <dreamreal> scruz: I'm biased towards one. The company whose product we used ended up hiring me.
[12:33:41] <scruz> mongodb or any particular recommendation?
[12:34:13] <dreamreal> mongo is good. sharding in mongo's iffy but for a single server it's fast as hell. For Java it's very verbose, but... service layer.
[12:34:25] <echosystm> mongodb is web scale
[12:34:26] <dreamreal> mongo's TX layer is meh, too.
[12:34:33] <dreamreal> but it's definitely fast, second fastest I tried.
[12:34:38] <echosystm> the auto sharding is the secret ingredient in the web scale sauce
[12:35:01] <scruz> we're currently using postgres/hibernate
[12:35:10] *** flip28 has joined ##java
[12:35:16] <dreamreal> echosystm: and it's where mongo actually fails :(
[12:35:44] <dreamreal> TX is another bit in the sauce that serves as a major roadblock. Lastly, knowledge is the last problem.
[12:36:20] * mischief hates threading
[12:37:07] *** horte has joined ##java
[12:37:43] <elzoog> Candle: Sorry for this question (I have read some of the junit web site). For my class Fraction, would it make sense to create another class called testFraction and put junit test code in that class? I don't want to clutter up the Fraction class with test code (otherwise, why not just keep the test code in Main?)
[12:37:50] <echosystm> i like threads
[12:37:57] *** frangiz has joined ##java
[12:38:09] *** supercosmonaut has joined ##java
[12:38:20] <dreamreal> I do too, going naked is just... cold
[12:38:26] <scruz> threads hold my pants together
[12:38:29] <dreamreal> elzoog: hahaha, yes
[12:38:43] <dreamreal> geez, create a test class that has nothing to do with the class you're testing except as a user
[12:38:46] <elzoog> echosystm: I like needles
[12:39:02] <Candle> elzoog: That's pretty much the pattern, yes.
[12:39:21] <echosystm> elzoog: junit tests sit outside our code, thats kind of the whole point - they test your code
[12:39:25] <elzoog> dreamreal: Was that a stupid question?
[12:40:12] <dreamreal> elzoog: somewhat, yes
[12:40:22] <echosystm> elzoog: do you know how to use maven?
[12:40:39] <dreamreal> I wouldn't have called it a "stupid question" myself, but it's a question with an obvious answer
[12:40:42] <echosystm> learn how to use maven, then using junit will make a lot more sense
[12:41:15] <echosystm> (every important class in /main/ should have an equivalent class in /test/)
[12:41:17] <dreamreal> and don't use JUnit; JUnit is stupid. Use TestNG.
[12:41:30] *** mastro has quit IRC
[12:41:58] <echosystm> does testNG offer much that junit4 doesnt?
[12:42:08] * dreamreal snrks.
[12:42:38] <dreamreal> Yes. JUnit is Eclipse to TestNG's IDEA; JUnit 4 is an attempt by Beck & Co. to stay somewhat relevant while testNG continues to run circles around it.
[12:43:09] <echosystm> i keep using junit just because all the testing libraries i use seem to suck it down as a dependency
[12:43:16] <elzoog> Where do I get testNG?
[12:43:16] <echosystm> meh
[12:43:38] <dreamreal> JUnit is always playing catch-up to testNG; you can expect JUnit to be at testNG's level from four years ago, maybe.
[12:43:44] <echosystm> elzoog: learn how to use maven first
[12:43:56] <echosystm> its important
[12:44:16] <echosystm> when youve learned to use maven, you will know where to find testng
[12:44:25] <echosystm> and you will know how to write unit tests
[12:44:29] <echosystm> or at least where to put them
[12:44:38] *** rvncerr has quit IRC
[12:45:09] <elzoog> echosystem: All of that just to test a relatively simple Fraction class? I would kind of like to test whether or not all of the algorithms I put in there are working like I would like them to tonight if possible
[12:45:13] <dreamreal> elzoog: hahaha
[12:45:40] <echosystm> is it part of some larger project elzoog ?
[12:45:48] <echosystm> or is your fraction class your entire project
[12:46:39] <elzoog> echo: Eventually it might be, or it might not be. Maybe it's a library that only I will use, although I told the guy who wrote the original library that I was going to make improvements on his library.
[12:47:01] <echosystm> is the original library a maven project?
[12:47:10] <echosystm> show me the library
[12:47:43] <elzoog> echo: He has Polynomial class, TaylorSeries class, RungeKutta class, and so forth.
[12:48:00] <echosystm> ok, well anyway, maven is an important tool
[12:48:08] <echosystm> it will simplify a lot of things
[12:48:28] <echosystm> for example, to use testng you were going to download a jar from somewhere and put it in one of your claspath folders right?
[12:48:33] <mapreduce> We have a DLL that does some stuff by launching the JVM (yes, stupid, I know), and apps that use it do not appear in VisualVM, making tracking down an OutOfMemoryError harder.
[12:48:38] *** fr0ggler has joined ##java
[12:48:53] <mapreduce> It's launched via JNI, not as a separate process.
[12:49:08] <echosystm> to do that same thing in maven is like 4 lines of xml and will be portable
[12:49:37] <echosystm> maven will also give you a simple command to actually run your tests, rather than having to run testng out of the jar or whatever
[12:50:04] <scruz> dreamreal: my experience with not only sql db's isn't much. i tend to see them as basically key-value stores. and no, my application isn't Google-scale.
[12:50:12] <echosystm> long story short, if youre doing java programming you will need to know how to use maven (or one of the various equivalents)
[12:50:55] <elzoog> echo: The original package is here: http://homepage.mac.com/jhuwaldt/java/Packages/MathTools/MathTools.html
[12:51:36] *** choongii has quit IRC
[12:51:55] <elzoog> echo: Thing is, it would be better if many of the objects in his package were immutable. For example, Fraction objects should be immutable. Polynomial objects should also be immutable. And so forth.
[12:52:11] <elzoog> echo: Also, he uses a few inefficient algorithms
[12:52:19] *** oo_miguel has joined ##java
[12:52:38] <mapreduce> elzoog: If you're refactoring away from a mutable class and that's why you want to catch clients who use it as if it were mutable, you should have said. :)
[12:52:41] <oo_miguel> what is the simplest, straight forward way to save and load an hashtable to and from a file?
[12:52:44] <elzoog> echo: I almost had to rewrite the Fraction class because what he had doesn't make sense
[12:53:40] <mapreduce> elzoog: You should probably treat it as a different library rather than fixing the original, as you'll break existing code without compile errors.
[12:53:55] *** srji has joined ##java
[12:54:03] <mapreduce> So change package names, at least.
[12:54:12] *** djspock has joined ##java
[12:54:12] <echosystm> who here has done web-mvc stuff before?
[12:54:21] *** djspock has left ##java
[12:54:54] <fr0ggler> oo_miguel, do you want this file to be read by humans, or just back into your program? if it's the former, you'd just need to loop over the structure and stringify whatever's in it. if it's the latter, serialisation.
[12:54:54] <echosystm> i dont understand how "web mvc" is anything like real mvc
[12:55:02] <fr0ggler> echosystm, erm
[12:55:05] <elzoog> mapreduce: Well, in the Fraction class for example, his code for converting a double to a fraction was fine (he uses continued fractions). All I needed to change was to give the function a return value.
[12:55:11] *** jjann has joined ##java
[12:55:11] <fr0ggler> echosystm, the paradigm is consistent.
[12:55:24] <mapreduce> elzoog: So by removing the side effect you break code that relied on it.
[12:55:39] <mapreduce> Therefore it's not going to be a version one can upgrade to.
[12:55:46] <echosystm> in a normal MVC framework, you can nest views
[12:56:04] <echosystm> how can you do that on the web?
[12:56:09] <mapreduce> iframes!
[12:56:19] <elzoog> mapreduce: I already e-mailed him about making the classes immutable, he admitted it was a good idea
[12:56:21] <echosystm> on the web youre restricted to one controller/view per full screen
[12:56:21] <mapreduce> MVC is a concept, not an implementation.
[12:56:34] <jjann> Hi. What is the right way to just check if rows were returned for a query with jdbc? (ie I'm not interested in the results just if there was a result at all) (using a PreparedStatement, jdbc4)
[12:56:38] <mapreduce> elzoog: Sure, and I agree, it's a good idea, but it would break existing code that uses the library.
[12:57:05] <fr0ggler> echosystm, nested views are down to the view technology, not the paradigm.
[12:57:08] <elzoog> mapreduce: So, how should I continue?
[12:57:35] <echosystm> MVC was a specific smalltalk pattern, everyone has just taken their own spin on it and its become a synonym for "separating views, logic and datastructures"
[12:57:43] <echosystm> but anyway...
[12:58:06] <dreamreal> scruz: key/value stores aren't all that no-sql is. And key/value is icky.
[12:58:08] <dreamreal> fr0ggler: yo!
[12:58:23] <fr0ggler> hey dreamreal
[12:58:24] <mapreduce> elzoog: Rename the packages and don't pretend to anyone that they can upgrade from the original.
[12:58:32] *** Cymage has joined ##java
[12:58:40] <elzoog> Seems like Java has become a really detailed hobby (it's not related to my real job at all)
[12:58:44] <fr0ggler> echosystm, huh? you've just contradicted yourself.
[12:58:53] <mapreduce> That gives you a chance to correct the typos too - package names in Java are lowercase.
[12:59:00] <dreamreal> fr0ggler: check the dropbox! i finally got a good copy uploaded.
[12:59:07] <fr0ggler> dreamreal, *checks*
[12:59:07] <echosystm> take spring for example - if you wanted a guestbook widget and a newsfeed widget on every page, how would you do that without repeating controller logic all over the place?
[12:59:09] <mapreduce> elzoog: Java isn't a good hobbyist language. Try Python instead.
[12:59:20] <mapreduce> Python is more fun.
[13:00:01] <fr0ggler> echosystm, well I guess the model that the view is based on would incorporate multiple widget elements, hence one view.
[13:00:08] *** paulweb515 has joined ##java
[13:00:09] <dreamreal> echosystm: heh
[13:00:09] <elzoog> mapreduce: For some reason I don't like python. I've tried coding in it.
[13:00:16] <dreamreal> "without repeating... haha"
[13:00:21] <dreamreal> modular systems for the win, clearly
[13:00:25] <fr0ggler> i wouldn't say a widget constituted a single view
[13:00:40] <fr0ggler> in MVC terms at least
[13:00:44] <elzoog> mapreduce: I like Java because i know enough Java to get something quick and dirty up and running in it.
[13:01:27] <ech0s7> Do you know any methods to round a decimal to two decimal places without using DecimalFormat ?
[13:01:38] <elzoog> mapreduce: I guess my main gripe with python is I really don't like having blocks delimited by n spaces instead of { }
[13:01:47] <ech0s7> s/round a decimal/round a double
[13:01:55] <mapreduce> elzoog: I read by indentation rather than braces, so that doesn't bother me.
[13:02:14] *** Ch30ps has quit IRC
[13:02:51] *** titankiller has joined ##java
[13:02:51] <echosystm> so, lets say i had a newsfeed that worked with "newsentry" (database) objects
[13:02:55] <elzoog> mapreduce: I also READ by indentation. But I don't want it to be so picky that if I put in 4 spaces instead of 3 that it will act up
[13:03:10] <dreamreal> elzoog: hahaha
[13:03:17] <echosystm> then i had a guestbook that worked with "guestbookentry" database objects
[13:03:31] <mapreduce> Is Python as picky as that? I don't type my spaces manually so I've never noticed.
[13:03:41] <echosystm> if those two views were included in one screen, the model for that screen would comprise both?
[13:03:44] <echosystm> i dont get it
[13:04:00] <elzoog> mapreduce: I'm too used to C, and C++. So I want my language to look kind of like C or C++
[13:04:06] <dreamreal> echosystm: sounds fundamentally broken
[13:04:08] <mapreduce> elzoog: I don't know why you would mix indentation levels.
[13:04:12] *** mah01 has joined ##java
[13:04:12] <mapreduce> s/levels/sizes/
[13:04:39] <echosystm> i've just never understood how you would nest views in a web application
[13:04:42] <echosystm> ive never had to do it
[13:04:45] <mapreduce> elzoog: That's quite a disability. It's odd that novice developers get more choice than you. :)
[13:04:53] <elzoog> mapreduce: Well, I might accidentally put in too many or too few spaces.
[13:05:12] <dreamreal> elzoog: you do know that python uses context for that, right?
[13:05:14] <mapreduce> elzoog: You might be using the wrong editor then.
[13:05:20] <dreamreal> You can indent by one or two or fifteen spaces?
[13:05:38] <dreamreal> it says "let me look for indentation based on what was JUST interpreted"?
[13:05:47] <elzoog> mapreduce: How is that odd?
[13:05:49] <mapreduce> dreamreal: I think he means that he has two lines intended to be at the same level, but he types an extra space in one line.
[13:05:56] *** pen has quit IRC
[13:05:57] <mapreduce> elzoog: It's odd that experience disables you.
[13:06:05] <dreamreal> I have to say, this is really amusing, though... seeing someone reject python because of spaces rather than its' crushingly slow speed is amusing
[13:06:28] <mapreduce> Shouldn't you have more choice than a novice, because there are languages you might choose that a novice would find too difficult?
[13:06:42] *** steffo has quit IRC
[13:07:28] <elzoog> mapreduce: Well, to get something up and running quickly in Java or C++ would take me less time than in Python because I am familiar with what Java and C++ programs look like. If Python's syntax were more C++ like I might be a bit more willing to learn it
[13:07:39] *** rretzbach has quit IRC
[13:07:48] <mapreduce> dreamreal: People where I work have the idea that Python is faster than Java, because I wrote a Python program that communicates with a camera over serial, and it operates faster than one that does the same via IP and via a DVR.
[13:07:59] <mapreduce> The second one is a Java program.
[13:08:18] *** frangiz has quit IRC
[13:08:20] <mapreduce> ~education++
[13:08:20] <javabot> education has a karma level of 1, mapreduce
[13:08:25] <elzoog> Is Python faster than Java?
[13:08:31] <mapreduce> (not that I work in education, just that education is needed)
[13:08:39] <mapreduce> elzoog: About 100x slower, on average.
[13:08:47] <dreamreal> hehe
[13:09:14] *** frangiz has joined ##java
[13:09:17] <elzoog> I work in education. But the subject I teach has absolutely nothing to do with computer programming
[13:09:46] <mapreduce> A common delusion.
[13:10:00] *** nucc1 has quit IRC
[13:10:06] <mapreduce> There's some programmer out there sick to the back teeth of the subject you teach.
[13:10:39] <elzoog> mapreduce: ??
[13:11:15] <elzoog> mapreduce: I teach English. Students are at the level where they struggle with "Can you give me an example of ~~?"
[13:11:26] <mapreduce> English? See NLP.
[13:11:37] *** LouisJB has joined ##java
[13:12:47] <elzoog> mapreduce: If students struggle with a sentence such as "Can you give me an example of a fruit?", how would something like NLP be relevant for them?
[13:13:43] *** kieran491 has joined ##java
[13:15:11] *** echosystm has quit IRC
[13:15:26] *** alex88 has joined ##java
[13:16:02] <elzoog> mapreduce: If I wrote a Fraction class in Python, would it be faster?
[13:16:28] <Planck_> Faster to write, probably.
[13:16:37] *** Kraln has quit IRC
[13:17:17] <elzoog> Planck_: What about faster as in adding up a million different fractions and getting the correct result?
[13:20:13] <Planck_> A million isn't much :)
[13:20:58] <Planck_> Adding a million numbers a thousand time, Java might end up faster in total (development + runtime)
[13:21:43] *** jjann has quit IRC
[13:21:55] <Planck_> (Note: python 2.6 already has exact rational arithmetic built-in)
[13:22:02] *** hyppias has joined ##java
[13:22:49] <elzoog> Planck_: There can't be any such thing at exact rational arithmetic unless you are talking about arbitrary precision
[13:22:59] <Planck_> Yes, that's exactly what I am talking about.
[13:23:59] *** jjido has joined ##java
[13:24:38] <Planck_> It's certainly possible to implement in Java as well - but it will take a while to do right.
[13:24:39] <elzoog> Planck_: Does Python include a continued fraction algorithm for finding rational approximations to reals?
[13:24:42] <Planck_> Yes
[13:25:40] <alex88> probably noob question, after a function is runned, the vars created are disposed automatically?
[13:26:08] <Planck_> alex88: short answer is yes
[13:26:19] <alex88> Planck_: nothing more needed, thank you
[13:26:49] <elzoog> Planck_: So if I want Python to give me a fraction of num/den with num and den being 1 million digits long each that will give me the value of pi to 2 million digits, it will automatically do that?
[13:28:10] <Planck_> If you give it a value of pi accurate to that precision, sure.
[13:28:35] <cheeser> isn't this what ##python is for?
[13:28:44] <cheeser> answer: yes, it is.
[13:28:46] <Planck_> I would have thought so
[13:32:11] *** snoopdave has joined ##java
[13:32:45] *** jjido has quit IRC
[13:33:27] <elzoog> Planck_: Think is, if I continue to play around with Java, and get better at it than I am now, it's kind of unlikely that I would get a job in the Java programming field. Therefore, for me, Java is a hobby.
[13:34:32] *** jjido has joined ##java
[13:36:08] *** dextro_ has quit IRC
[13:36:24] *** Unemployed has joined ##java
[13:36:51] *** fisted_ has quit IRC
[13:39:21] *** elb0w` has quit IRC
[13:43:58] *** mastroDani has joined ##java
[13:44:02] *** novacall has joined ##java
[13:44:43] <novacall> anyone know how to detect if a java applet is accepted by the user through javascript..? Not if java is installed, but if the applet is ran or not
[13:45:16] <dreamreal> ~applets
[13:45:17] <javabot> Check the topic, read http://javachannel.net/wiki/pmwiki.php/FAQ/Applets - Basically, we don't support them here. Try the sun forums at http://tinyurl.com/2q2hog; consider the new Windows/OS X/Linux 32/64bit JNLP-compatible "Plugin2" from Java 6u10 (http://java.sun.com/javase/6/webnotes/6u10/plugin2/index.html)
[13:46:27] <alex88> setScale and roundingmode can be used only with BigDecimal?
[13:46:41] *** nibbless has joined ##java
[13:47:14] *** abhijain has quit IRC
[13:47:32] <fr0ggler> alex88, what does the API say?
[13:47:42] <mapreduce> elzoog: There's not exactly a shortage of vacancies for Java programmers.
[13:47:56] *** jdolan has joined ##java
[13:50:50] *** alex88 has quit IRC
[13:51:33] *** Luc1fel has joined ##java
[13:53:30] *** glcrazy has quit IRC
[13:54:14] *** jjido has quit IRC
[13:55:24] *** alex88 has joined ##java
[13:55:39] <alex88> sorry disconnected -.- someone has answered?
[13:56:40] *** Xgc has joined ##java
[13:57:07] <dreamreal> 07:44 < fr0ggler> alex88, what does the API say?
[13:58:04] *** jjido has joined ##java
[13:58:36] *** dreamreal has quit IRC
[14:00:58] *** Soliah has joined ##java
[14:01:22] *** kermit has joined ##java
[14:01:26] *** Johannes13 has joined ##java
[14:02:25] *** sveajobb has joined ##java
[14:02:30] *** dreamreal has joined ##java
[14:02:46] <sveajobb> Hi, how do you declare the default constructor in an anonymous class?
[14:03:00] *** alex88 has quit IRC
[14:03:05] *** jjido has quit IRC
[14:03:09] <selckin> you don't
[14:03:22] <dangertools> sveajobb: {}
[14:03:38] *** mastroWork has joined ##java
[14:03:44] <paulweb515> sveajobb: you just fill in any fields it needs as you create it ... if that's even necessary
[14:04:39] <sveajobb> The problem is I that I want to create an object, which might throw an exception, and set it in the anon-class. I guess I could create it outside of the class first
[14:04:44] <Planck_> yeah, an initialization block is the closest you get
[14:04:49] *** snoopdave has left ##java
[14:06:03] *** Fisiu has joined ##java
[14:06:20] *** jjido has joined ##java
[14:06:23] <sveajobb> I see, thanks for your help :)
[14:06:30] <dreamreal> sveajobb: you know, if it's hard AT ALL, losing anonymity might be the easiest thing
[14:06:57] *** mastroDani has quit IRC
[14:07:04] *** titankiller has quit IRC
[14:07:47] <mapreduce> sveajobb: new Foo() { { try { obj = new Bar(); } catch (BarException e) { obj = new Baz(); } } }
[14:08:00] *** frangiz has quit IRC
[14:08:43] *** novitololo has left ##java
[14:08:43] <mapreduce> Damn, I think I just screwed up on precedence for the first time in ages.
[14:08:53] <mapreduce> if (e instanceof Exception || e instanceof Error && e.getMessage().equals("some on None") || e instanceof ExceptionInInitializerError) {
[14:09:00] *** adamisme has joined ##java
[14:09:08] *** Myth17 has joined ##java
[14:09:09] *** adamisme has left ##java
[14:09:56] *** frangiz has joined ##java
[14:10:03] <selckin> you should cry for needing that anyway
[14:11:36] *** coalado has quit IRC
[14:12:24] *** idletask has joined ##java
[14:12:29] <idletask> Hello
[14:12:54] *** MikeJansen has joined ##java
[14:12:56] *** nitish has joined ##java
[14:14:04] *** flip28 has quit IRC
[14:14:08] <idletask> Specific question about Sun's JVM (1.6)... We're starting to get OOMs because of PermGen space, and the solutions I have seen so far are either passing -XX:MaxPermSize or both -XX:+CMSClassUnloadingEnabled and -XX:+CMSPermGenSweepingEnabled to the command line
[14:14:28] <oo_miguel> how can i serialize a hashtable<String,MyClass> ?
[14:14:33] <oo_miguel> Hashtable*
[14:14:59] <idletask> Isn't there an option so that the JVM sizes memory zones dynamically instead?
[14:15:03] <fr0ggler> oo_miguel, is MyClass Serializable?
[14:15:07] <oo_miguel> aah I need to make myclass serial..
[14:15:09] <oo_miguel> exactly
[14:15:11] <oo_miguel> i misssed that
[14:15:15] <oo_miguel> thank you
[14:15:21] <fr0ggler> ~~oo_miguel serialization
[14:15:22] <javabot> oo_miguel, serialization is the process of transforming objects to bytes and back. See http://is.gd/4YvEJ (tutorial), http://is.gd/4YvFa (cheeser's blog), http://is.gd/4YvFz (the spec), and ask me about ~jbmar
[14:15:30] <selckin> idletask: permgemsize you require is pritty fixed and you can determine ahead of time, unless you're doing funky things
[14:15:38] *** Joddie|work has joined ##java
[14:16:18] <selckin> idletask: if you're doing like a lot of war redeploys without restart and running into it, you're probably leaking memory, otherwise just increase the max
[14:16:34] *** Myth17 has quit IRC
[14:16:56] *** titankiller has joined ##java
[14:17:06] *** pen has joined ##java
[14:17:19] *** Unemployed has quit IRC
[14:18:08] <idletask> selckin: well, this is not my code, but I've seen this error appear from time to time recently... As far as I've read so far, JRockit seems to be immune to the problem
[14:20:03] *** taitale has joined ##java
[14:20:28] <selckin> you've yet to ask a question
[14:20:30] <idletask> But getting "out of" Sun's JVM is a nono
[14:21:04] <idletask> I did ask it earlier
[14:21:15] <idletask> [07/03/2011 14:13] <idletask> Isn't there an option so that the JVM sizes memory zones dynamically instead?
[14:21:22] *** zuxqoj has quit IRC
[14:21:54] *** zuxqoj has joined ##java
[14:22:35] *** msieradzki has quit IRC
[14:23:06] *** coalado has joined ##java
[14:23:22] *** fisted has joined ##java
[14:23:37] <selckin> what zones there are and the types are determinal by the initial/max heap size and the configured gc, but all of them have fixed permgem afaik
[14:24:05] <elzoog> Planck_: I looked at this web site http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-python-ruby-jython-jruby-groovy/ Looks like Python is dog slow compared to Java. If I really needed arbitrary precision fractions, might be just as well to use apfloat
[14:24:22] *** jdolan has quit IRC
[14:24:24] <idletask> selckin: indeed, I know about that, it's 64M for Sun's 1.6
[14:24:48] <idletask> selckin: and I also know Sun's 1.6 can size its heap dynamically with -XX:+AggressiveHeap
[14:24:54] <idletask> But that's for the heap only
[14:25:24] <selckin> elzoog: if you want more useless numbers check out http://shootout.alioth.debian.org/
[14:26:10] *** glcrazy has joined ##java
[14:26:28] <selckin> you should probably just increase it and move on
[14:26:34] <selckin> not worth the time
[14:27:07] *** cool123 has joined ##java
[14:27:29] <idletask> I was afraid of that :/ I hate bandaids on wooden legs :/
[14:28:57] *** scruz has quit IRC
[14:30:22] *** dinesh___ has joined ##java
[14:30:22] *** jjido has quit IRC
[14:30:53] *** nucc1 has joined ##java
[14:32:13] <dinesh___> hi all, i've got a regular expression question, is it possible to reference a previous group in a negation, such as in ([^ ])+^[^\1] ?
[14:34:05] *** zuxqoj has quit IRC
[14:34:13] *** jjido has joined ##java
[14:34:36] <idletask> dinesh___: with a negative lookahead, yes
[14:34:46] <dinesh___> when i write in something such as ^([abc])[^\1]$ , i am getting an error "Illegal/unsupported escape sequence near index 11 ^([abc])[^\1]$ ^"
[14:34:48] <idletask> dinesh___: [] is not the thing to use, since it's a character class
[14:35:20] <dinesh___> hm okay i'll try with that then
[14:35:34] <dinesh___> yes i know but in this case my group is going to match only a single character
[14:36:11] <idletask> Yes, but since what you capture is dynamic, this cannot be used in a complemented character class anyway
[14:36:15] <idletask> So you have no choice
[14:36:25] *** nitish_mythology has joined ##java
[14:36:48] <dinesh___> ok i'll have a look at how to do this with the negative lookahead then thanks
[14:36:57] <idletask> You have to write (x)(?!x) where x is the regex
[14:37:17] <idletask> (?!...) is a negative lookahead
[14:37:21] *** frangiz has quit IRC
[14:37:27] <idletask> That should be (x)(?!\1) even
[14:37:40] *** tewecske has joined ##java
[14:38:05] *** selckin has quit IRC
[14:38:29] <dinesh___> ^([abc])(?!\1).$ , this seems to be equivalent to what i wanted to do initially, i guess
[14:39:11] <dinesh___> yep, + the final . to actually consume the character
[14:39:13] <dinesh___> thanks
[14:39:14] *** zhulikas has joined ##java
[14:39:45] *** nitish has quit IRC
[14:40:27] *** jjido has quit IRC
[14:41:07] *** frangiz has joined ##java
[14:41:18] *** jww has quit IRC
[14:41:31] *** ojacobson has joined ##java
[14:41:52] *** L-----D has quit IRC
[14:42:17] *** remonvv has joined ##java
[14:42:30] *** Kneta_ has joined ##java
[14:42:55] *** Pozejdon has joined ##java
[14:44:28] *** jjido has joined ##java
[14:45:14] *** Engin has quit IRC
[14:45:36] *** bitshuffler has joined ##java
[14:49:12] *** kermit has quit IRC
[14:49:15] <oo_miguel> my public class only has Strings , booleans, and doubles, but trying to save it throws a not serializableException
[14:49:26] <oo_miguel> even after i put implelments Serializable
[14:49:38] <oo_miguel> there
[14:49:43] <oo_miguel> any ideas?
[14:49:49] *** nitish has joined ##java
[14:50:21] <idletask> Implementing the interface is not enough
[14:50:33] *** ech0s7 has quit IRC
[14:51:23] <oo_miguel> thought its enough
[14:51:25] <dreamreal> oo_miguel: pastebin.
[14:51:37] * dreamreal eyes idletask
[14:52:06] <oo_miguel> http://pastebin.com/1icx5dyd
[14:52:39] *** remonvv has quit IRC
[14:52:57] <balooo> they're never initialized?
[14:53:02] <psst> How do persistence providers get registered with JPA? I've seen a META-INF/services approach but I am in an OSGi environment and I think there needs to be some other way because the META-INF/services makes classloader assumptions which don't hold in OSGi-land (I'm told)
[14:53:02] <oo_miguel> whats missing in my approach
[14:53:12] <oo_miguel> balooo: no
[14:53:15] *** nitish_mythology has quit IRC
[14:53:33] <ojacobson> oo_miguel: and the code that actually throws an exception?
[14:54:32] <oo_miguel> http://pastebin.com/LRL3zULr
[14:54:36] <oo_miguel> this throws the exception
[14:54:51] <oo_miguel> the writeObject thing in particular
[14:55:09] <ojacobson> How about something a little more complete? If you knew what it was safe to cut out, you wouldn't need us to answer your question, so something that's reasonably close to a whole program would be nice.
[14:55:10] <dreamreal> can you create a test case?
[14:55:29] <oo_miguel> Ok guys, ill make a little programm then
[14:55:38] *** hex` has joined ##java
[14:57:30] *** jjido has quit IRC
[14:59:26] <oo_miguel> http://pastebin.com/G0M7eU20
[14:59:37] <oo_miguel> so thats a COMPLETE prog that throws the exception
[14:59:48] <oo_miguel> java.io.NotSerializableException:
[15:00:09] <ojacobson> The TestCase.this reference in each instance of TestCase.Res is not serializable.
[15:00:19] <ojacobson> It's also not visible in your program, because you never use it, but it's there.
[15:00:38] <ojacobson> Make 'Res' static or a top-level class so that it doesn't have an implicit reference to an instance of its containing class.
[15:01:05] <oo_miguel> ah, so the problem is, that its an inner class?
[15:01:18] <ojacobson> In this case, yes, an inner class of a non-serializable outer class.
[15:01:26] *** tjsnell sets mode: -b *!*@66-189-196-161.dhcp.yakm.wa.charter.com
[15:01:30] <oo_miguel> allright, thank you
[15:01:32] <ojacobson> Making TestCase itself serializable would also work, but it's almost certainly not what you want.
[15:01:44] <oo_miguel> its not what i want , you are right
[15:02:09] *** zhulikas has quit IRC
[15:02:13] <oo_miguel> but making Res static sounds good
[15:02:22] <dreamreal> or making it a standalone class
[15:02:23] *** aitd has left ##java
[15:02:35] <balooo> ojacobson: so there is always an implicit reference to a parent class of an inner class unless it's static?
[15:02:38] <oo_miguel> i wonder which is nicer in my case
[15:03:01] <oo_miguel> when would one use an non-static inner class then?
[15:03:19] <idletask> In case you want your data to be persistent upon application instances :p
[15:03:20] <ojacobson> balooo: Yes; conceptually inner classes exist once per instance of the outer class, not once per class, but they're implemented using a single class and a pointer to the instance of the outer class associated with the instance of the inner class
[15:03:28] *** nitish_mythology has joined ##java
[15:04:23] *** sebersole has joined ##java
[15:04:41] <oo_miguel> thx a lot
[15:05:46] <balooo> so, with respect to the classloader, the inner class is only loaded once? but has references to several outer classes instances associated with the inner class?
[15:06:36] *** nitish has quit IRC
[15:07:29] *** ShiintoRyuu has joined ##java
[15:08:10] <ShiintoRyuu> Ive been looking for the jdk sample/jnlp directory on osx, but didnt find it so far. is it possible its not shipped with, and not included in the development tools from developer.apple.com?
[15:08:16] <ojacobson> balooo: disassemble the inner class (Foo$Bar.class) with javap and have a look
[15:09:20] <ojacobson> You'll see a generated field that's not in the source code of the outer class type (Foo in this case).
[15:10:04] <balooo> i've never used javap :)
[15:10:04] * balooo tries
[15:10:32] <FauxFaux> It's exciting.
[15:12:09] *** frangiz has quit IRC
[15:12:21] *** frangiz has joined ##java
[15:12:29] *** oo_miguel has quit IRC
[15:12:52] <ojacobson> It's one of the leakier abstractions in the JDK :)
[15:13:19] *** mastroWork has quit IRC
[15:13:53] <dreamreal> ojacobson: if you had one piece of advice to give people using java, what would it be?
[15:14:21] <ojacobson> Same as any other language: Read the error message.
[15:15:04] <balooo> cool, so basically i'm guessing the class is loaded once by the classloader, but that hidden field always has a reference to the instance of parent class it belongs to
[15:15:23] <balooo> ls
[15:15:23] <javabot> balooo: wrong window, genius
[15:15:45] <ojacobson> Yes, have a look at <init>
[15:15:49] <ojacobson> (the implementation of the constructor)
[15:15:54] *** nitish has joined ##java
[15:16:10] *** tuxwet has joined ##java
[15:16:15] <ojacobson> dreamreal: did you want something Java-specific?
[15:16:27] <dreamreal> nope, not necessary
[15:16:35] <dreamreal> anyone else?
[15:17:09] <mapreduce> Yes. I want to know why the CEO can see corruption as he scrolls around a particular view, and I can't.
[15:18:06] *** matsebc has joined ##java
[15:18:28] *** TzilTzal has quit IRC
[15:18:40] *** mastroWork has joined ##java
[15:18:52] *** cool123 has quit IRC
[15:18:57] *** nitish_mythology has quit IRC
[15:19:24] <balooo> ok, so i declared an empty constructor, but then javap -c i think tells me it consumes the parent class (Foo in the eg above)
[15:19:46] <ojacobson> balooo: If you disassemble it you can see what it's doing with it
[15:19:54] <ojacobson> There's a flag for javap to show you the bytecode
[15:19:56] <ojacobson> it's pretty readable
[15:20:30] *** kieran491 has left ##java
[15:20:37] <balooo> http://pastebin.com/EF2kUi6n
[15:21:08] <ojacobson> this$0 is the gensym for the the field used to implement 'Result.this' within the inner class
[15:21:16] <ojacobson> (That name is not guaranteed, don't rely on it :)
[15:21:34] <ojacobson> The compiler worries about making sure it's populated
[15:21:43] <ojacobson> From the JVM's point of view, inner classes are not magic :)
[15:21:47] <ojacobson> They're just classes
[15:22:15] *** cocoloa has joined ##java
[15:23:52] <balooo> cool thanks!
[15:24:30] *** sebrock has joined ##java
[15:25:27] *** saml has joined ##java
[15:26:11] *** Joddie|work has quit IRC
[15:26:49] *** Ch30ps has joined ##java
[15:26:54] *** nitish_mythology has joined ##java
[15:28:06] *** qiip has joined ##java
[15:28:21] <mapreduce> Ah, good old gensym.
[15:29:01] <mapreduce> So, the code uses the EDT properly but still has corruption in the UI for some people. Great stuff.
[15:29:24] *** Bleadof has joined ##java
[15:29:58] *** Myth17 has joined ##java
[15:30:09] *** nitish has quit IRC
[15:32:11] *** echelog has joined ##java
[15:32:15] *** nitish_mythology has quit IRC
[15:33:45] <saml> wow patebin layout not good. i can't even see the code
[15:34:05] *** tissue has quit IRC
[15:34:44] <cheeser> looks fine here
[15:35:43] <ech0s7> it's very strange
[15:36:37] *** VJTachyon has joined ##java
[15:36:56] *** Myth17 has quit IRC
[15:36:59] <saml> java.lang.InterruptedException: sleep interrupted I get this
[15:37:05] <saml> and it pirints Hi again
[15:37:10] <ech0s7> i have fixed
[15:37:18] <ech0s7> i have put "return" in catch(){}
[15:37:57] *** Pozejdon has quit IRC
[15:37:59] <saml> you so smart
[15:38:35] *** jjido has joined ##java
[15:38:56] <cheeser> iirc, calling interrupt() is frowned upon
[15:40:09] <dreamreal> ierc, you mean. ("if everyone recalls correctly.") editable to "iercatd." ("if everyone recalls correctly, and they do."
[15:42:49] *** echelog has joined ##java
[15:43:23] *** eidolon has joined ##java
[15:43:49] <mapreduce> Collective recall.
[15:44:42] <ojacobson> ech0s7: Per the Thread javadocs:
[15:44:43] <ojacobson> InterruptedException - if any thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown.
[15:45:13] <ojacobson> Thus: your Thread.interrupted() check at the top of your loop never sees an interrupted thread, because interrupting a sleep causes sleep to report the interruption using an exception
[15:45:22] <ech0s7> ojacobson: yes, i have read
[15:45:34] <ech0s7> but i'm not using Thread.interrupted(),
[15:45:40] <ech0s7> but Thread.isInterrupted
[15:45:44] <ojacobson> Sure.
[15:45:55] <ojacobson> But since sleep() clears the interrupted status, that's never going to return true either
[15:45:55] <ech0s7> The interrupted status of the thread is unaffected by this method (isInterrupted)
[15:46:02] *** sbalmos has joined ##java
[15:46:08] <ech0s7> ok ojacobson
[15:46:30] *** jdolan has joined ##java
[15:46:35] <mapreduce> ojacobson: Won't it return true if sleep was interrupted?
[15:46:44] <ojacobson> mapreduce: No.
[15:46:49] <mapreduce> Why?
[15:46:56] <ojacobson> Scroll up to the snippet of the sleep javadocs I pasted about 15 lines ago.
[15:47:09] <mapreduce> Yeah, I just looked in IDEA.
[15:47:21] <ojacobson> Most things that can throw InterruptedException also clear the interrupted status when they do so
[15:47:22] *** eyesUnclouded has joined ##java
[15:47:32] <mapreduce> ech0s7: while (true) { try { sleep(2000); } catch (InterruptedException e) { return; } }
[15:47:51] *** matsebc has quit IRC
[15:47:55] <ojacobson> I would keep the interrupted check but that does give you two exits from the loop to think about
[15:48:27] <mapreduce> Which matters because?
[15:48:37] <ojacobson> Because I dislike while(true) intensely :)
[15:48:39] *** matsebc has joined ##java
[15:48:44] <mapreduce> Ah, irrationality.
[15:48:51] <ojacobson> If your loop has paths that may skip the sleep for a number of iterations, it would make a practical difference
[15:48:53] *** Sambler has joined ##java
[15:48:54] <sbalmos> ojacobson: As opposed to... ?
[15:49:06] <mapreduce> As opposed to holding a mutable variable and mutating it.
[15:49:21] <mapreduce> If I never see retBoolean again I'll be happy.
[15:49:31] <mapreduce> (not quite the same thing I know)
[15:49:32] <ojacobson> while (!Thread.interrupted()) or while (!Thread.currentThread().isInterrupted()) depending on whether you're exiting (and can safely clear the interrupted status) or not.
[15:49:32] *** Sambler has quit IRC
[15:49:33] *** Railgun has joined ##java
[15:50:01] *** novacall has quit IRC
[15:50:36] <sbalmos> I guess that gets into philosophical discussions on short-circuiting loops before doing some possibly long/intense operation(s)
[15:50:47] <mapreduce> ojacobson: You'd need an extra variable to avoid the return.
[15:50:55] *** novitololo has joined ##java
[15:50:57] <ojacobson> I wouldn't avoid the return.
[15:51:01] *** t0rc has joined ##java
[15:51:08] <mapreduce> Ok, then how would you write the whole thing?
[15:51:20] *** jjido has quit IRC
[15:51:24] <ojacobson> Using a queue and an executor. :)
[15:51:33] <ojacobson> But, for the sake of discussion... *scribble*
[15:51:53] * sbalmos facepalm
[15:52:14] <novitololo> Hi, I'm trying to use the jamod library with the gnu.io instead of the javax.comm, and in the info of jamod it is said "However, there is also support for building with the gnu.io prefix (RXTX), via the boolean build property build.serial.gnu (true will cause the build process to replace the javax.comm prefix with gnu.io in the sources used for builds).". I would like to know where should I set that property, since in the source
[15:52:20] <ojacobson> http://paste.pocoo.org/show/349539/
[15:52:53] <mapreduce> Oh, so you still have two routes out of the loop.
[15:52:56] <ojacobson> yes
[15:53:07] <ojacobson> That part I'm actually okay with; it's a thing to keep in mind, not a thing to avoid in and of itself
[15:53:19] <ojacobson> I just dislike infinite loops with a special-cased exit point :)
[15:53:44] <mapreduce> Ah.
[15:53:58] *** eidolon has quit IRC
[15:53:58] <mapreduce> Do you dislike recursive algorithms for the same reason?
[15:54:12] <ojacobson> Recursive algorithms without a base case, yes
[15:54:19] <mapreduce> No, those with a base case.
[15:54:22] <ojacobson> There was a convergence trick I saw in haskell that made me itch
[15:54:33] <dreamreal> novitololo: where do you see that?
[15:54:50] <novitololo> http://jamod.sourceforge.net/kb/serial_slave_howto.html
[15:54:57] <mapreduce> Nevermind, the CEO can stick his scrolling corruption.
[15:54:59] <novitololo> Info box, on top
[15:55:01] * mapreduce works on something more fun.
[15:55:05] <dreamreal> novitololo: you can do that by altering pom.xml, possibly: <properties><property name="build.serial.gnu">true</property></properties>
[15:55:17] <dreamreal> oh, sorry
[15:55:24] <ojacobson> as in mvn -Dbuild.serial.gnu=true ...
[15:55:28] <dreamreal> <build.serial.gnu>true</build.serial.gnu>
[15:55:35] <novitololo> dreamreal: ok, I didn't know that.
[15:55:37] <ojacobson> (You'll need to build your own version of the library; it's not something you can toggle using the binaries)
[15:55:40] <mapreduce> mvn -Dbuild.serial.gnu
[15:55:43] <dreamreal> but at the same time, I don't see anything in the pom that would use that
[15:55:49] *** eidolon has joined ##java
[15:55:51] <mapreduce> These things default to true when you specify them, afaik.
[15:57:17] *** mastroWork has quit IRC
[15:57:22] *** openpercept has quit IRC
[15:57:25] <novitololo> dreamreal: should I add that in the pom.xml?
[15:57:27] *** tilerendering has quit IRC
[15:57:32] *** fisted has quit IRC
[15:57:50] <mapreduce> dreamreal: My one bit of advice would be to seriously try IDEA out.
[15:58:00] <dreamreal> novitololo: I don't know, because I still don't see where any such transformation happens in the source tree
[15:58:23] <dreamreal> mapreduce: thanks
[15:58:34] <novitololo> ok....
[15:59:16] <dreamreal> the maven pom doesn't show any such property being used or any such transform being applied
[15:59:50] <novitololo> they should specify which "properties" they are refering too...
[16:00:04] <novitololo> via the boolean build property..
[16:00:16] <mapreduce> So now we've found the "HTTP referer" guy.
[16:00:18] <frimend> If I use jsf, I don't have to use javascript?
[16:00:23] <dreamreal> frimend: heh
[16:00:40] <mapreduce> frimend: Java's Crypt is unrelated to JSF.
[16:00:44] <cheeser> frimend: why would you?
[16:00:47] <dreamreal> frimend: depends on a lot of things. Most JSF impls will include javascript for you.
[16:00:58] <frimend> oh
[16:01:03] *** fisted has joined ##java
[16:01:08] *** jjido has joined ##java
[16:01:22] <frimend> I am assigned on a project with all these fancy tools, just finished a tutorial for jsf.
[16:01:41] <frimend> Taking input from a box, putting it inside a bean, displaying it on another page.
[16:01:49] <frimend> linking between the pages.
[16:01:55] <frimend> It feels really neat, jsf.
[16:02:35] <dreamreal> I hope you always feel that way. :)
[16:03:43] *** evilgeenius has joined ##java
[16:04:26] *** yxz97 has joined ##java
[16:05:52] <mapreduce> Yep, should keep the level of competition down a bit.
[16:07:03] *** pen has joined ##java
[16:07:55] *** cythrawll has joined ##java
[16:08:04] *** hariju has joined ##java
[16:08:08] *** cheeser sets mode: -b *!*~kadir*@46.2.15.*
[16:08:56] *** frangiz has quit IRC
[16:09:16] <hariju> how can i divide paths to files when making a jar archive? i want to have two "root folders" that are taken from the same folder, and jar keeps putting them together for one path
[16:10:57] *** mastroDani has joined ##java
[16:11:33] *** jjido has quit IRC
[16:11:33] <ojacobson> hariju: Can you show us a directory tree and the desired outcome? It's not clear from your description what you're trying to do
[16:11:45] *** mastroDani has quit IRC
[16:12:32] *** IznastY has joined ##java
[16:12:39] <mapreduce> hariju: cd ..
[16:12:59] <mapreduce> hariju: jar cf thejar.jar firstroot secondroot
[16:13:03] <mapreduce> or something akin.
[16:13:38] *** jjido has joined ##java
[16:13:49] <evilgeenius> Where's the best place to ask questions about software licensing?
[16:13:50] *** frangiz has joined ##java
[16:14:57] *** r0bby has quit IRC
[16:15:12] <ojacobson> evilgeenius: a lawyer
[16:15:56] <evilgeenius> I've developed a web app for a company which they are paying me a large fee for, which includes small monthly payments to keep the VPS alive. Now I'm about to deliver it to them but I need to create some kind of contract and Im not sure what to do. Basically I want to say that they are licensed to use the web app but they don't own it.
[16:15:57] <novitololo> dreamreal: The info box says that this "property" will change javax.comm to gnu.io in the sources used for builds, so I could do that myself manually because I know where javax.comm is imported, right? That would do the trick
[16:16:07] *** matsebc has quit IRC
[16:16:10] <ojacobson> evilgeenius: a lawyer
[16:16:15] <dreamreal> Sure. I don't see in the build pom where that happens, but hey.
[16:16:27] <evilgeenius> ojacobson: I can't really afford a lawyer
[16:16:35] <mapreduce> evilgeenius: Copyright law already covers that case.
[16:16:42] <ojacobson> Consult a lawyer specializing in business contracts. It'll cost you less than the inevitable problems *not* hiring a lawyer to figure this out will
[16:16:57] <ojacobson> Cost of doing business, dude.
[16:17:21] *** bojo has quit IRC
[16:17:21] <cheeser> and none of that is relevant here.
[16:17:23] <evilgeenius> mapreduce: What do you mean Copywright law covers it?
[16:17:32] *** nibbless has quit IRC
[16:18:08] <mapreduce> evilgeenius: Everything you produce is owned by you unless you explicitly assign copyright to someone else.
[16:18:09] <evilgeenius> mapreduce: my worry is that because they have paid me to do this, they will think they own it, which I can't have.
[16:18:26] <ojacobson> The time to sort this out was when you accepted the work
[16:18:27] <dreamreal> if they've paid you to do it, they probably do own it.
[16:18:31] <ojacobson> If it's a work for hire, they may well own it
[16:18:37] <ojacobson> your desires notwithstanding
[16:18:43] <ojacobson> lawyer, you, hire
[16:18:48] <ojacobson> I'm out, this is way o/t here.
[16:18:54] *** ldh has joined ##java
[16:19:42] <evilgeenius> Well here seemed like a good place to go for some general advice, and it was.
[16:20:01] <mapreduce> http://en.wikipedia.org/wiki/Work_for_hire seems to be a good read.
[16:20:06] *** teralaser has joined ##java
[16:20:21] <cheeser> now take to a pm
[16:20:37] <mapreduce> \msg cheeser ok
[16:23:13] <evilgeenius> mapreduce: cheers
[16:23:40] *** frangiz has quit IRC
[16:24:03] *** frangiz has joined ##java
[16:24:11] *** frangiz is now known as fisk_
[16:26:45] *** maxorator has joined ##java
[16:27:54] *** Elvanor has joined ##java
[16:28:40] <Elvanor> I need a locking mechanism similar to java.util.concurrent.locks.ReentrantLock, but I want to be able to unlock() without throwing exception if the lock is not held by this thread. Does Java have a class for that?
[16:29:01] <mapreduce> It has the try..catch mechanism.
[16:29:19] <ojacobson> That sets off all kinds of alarm bells in my head
[16:29:26] <ojacobson> how do you write code that doesn't know if it holds a lock or not?
[16:29:28] *** Pawnee has quit IRC
[16:29:36] <mapreduce> Badly.
[16:29:38] <evilgeenius> mapreduce: It would seem as though you are right, Copyright is covered in my case :-) Thanks again! (i dont know how to pm)
[16:29:58] <mapreduce> evilgeenius: You type /msg cheeser I now know how to pm, assuming cheeser is your target.
[16:30:58] <cheeser> i have a whitelist so i'd never see it.
[16:31:07] <evilgeenius> "now take to a pm" - what sort of wanker says that?
[16:31:30] <mapreduce> Oh feck.
[16:31:45] * mapreduce didn't consider that an exception's getMessage() might return null.
[16:31:57] *** evilgeenius has quit IRC
[16:32:01] <dreamreal> did it cause an exception? :)
[16:32:01] <cheeser> evilgeenius: one who's role is to keep this channel on topic and one that can permanently remove offenders from the channel.
[16:32:04] <cheeser> now stfu.
[16:32:31] <sbalmos> cheeser: Too late.
[16:32:56] <sbalmos> cheeser: The equally-wanky wanker was too timid to stick around
[16:32:57] <cheeser> bah
[16:33:00] <cheeser> 8^)=
[16:33:12] <cheeser> network is laggy this morning.
[16:33:24] <tjsnell> heh
[16:33:46] <sbalmos> cheeser: I'll buy that excuse!... At a discount
[16:34:00] <cheeser> it's ok. he'll be back. i'll give him shit the. P^)=
[16:34:09] *** bearded_oneder has joined ##java
[16:34:34] *** ChanServ sets mode: +o dmlloyd
[16:34:46] *** ojacobson has quit IRC
[16:36:13] *** ChanServ sets mode: -o tjsnell
[16:36:24] *** cschneid has joined ##java
[16:36:38] <mapreduce> dreamreal: Yes, it did. And in an area where I deliberately swallow exceptions.
[16:36:40] *** jjido has quit IRC
[16:36:52] *** yxz97 has left ##java
[16:37:04] <mapreduce> Actually, where the JVM deliberately swallows exceptions, an UncaughtExceptionHandler.
[16:37:27] *** subichan has joined ##java
[16:37:37] *** cschneid_ has quit IRC
[16:37:43] <horte> Guys, when working with JPA is it better to not use primitives in my Entities? When working with MySQL and some Entities are added on other ways then through Java (e.g. manually) I often get the exception saying trying to assert Null to a primitive variable. Is there some kind of best practise like always use Non-primitives in the Entity?
[16:38:28] <subichan> hi guys. I'm not even sure this can be done in mathematics but trying here isn't certainly a sin, so.. have you ever found an areCoprime() method around in APIs? I'd need that now
[16:38:46] <dreamreal> I don't even know what that means :)
[16:39:26] <mapreduce> Having no positive integer factors in common, aside from 1.
[16:39:28] *** ojacobson has joined ##java
[16:39:44] <idletask> Well, use Math.gcd
[16:39:54] *** IznastY has quit IRC
[16:39:59] <idletask> If it equals to 1, then you're done
[16:40:03] <mapreduce> subichan: Sounds quite straightforward.
[16:40:12] <mapreduce> idletask: Methods have to exist for you to be able to use them.
[16:40:13] <dreamreal> yeah, it does sound fairly straightforward
[16:40:25] <idletask> mapreduce: there is a gcd in Math
[16:40:26] <psst> subichan: it's not expressly supported in the API, but you could easily implement Euclid's algorithm to find the gcd
[16:40:39] <mapreduce> ~javadoc Math.gcd(*)
[16:40:39] <javabot> I don't know of any documentation for Math.gcd(*)
[16:40:45] <mapreduce> idletask: No, there isn't.
[16:41:04] <idletask> In BigInteger, there is
[16:41:52] <idletask> Sorry for the confusion
[16:42:15] <psst> idletask: well pointed out
[16:42:37] <jink> ~javadoc BigInteger.gcd(BigInteger)
[16:42:38] <javabot> jink: http://is.gd/yxNCRn [JDK: java.math.BigInteger.gcd(BigInteger)]
[16:43:07] <subichan> oh thanks
[16:43:15] <psst> subichan: so there you go. Probably faster to implement your own, but you can create two BigInteger objects and use (a.gcd(b) == 1) as your expression for 'are co-prime'
[16:43:31] <subichan> wow! I'm relieved of writing a mathematical algorithm!!
[16:43:37] <subichan> you've made my day
[16:43:50] <psst> subichan: I mean it might run faster, not that it would be faster to write it
[16:43:51] *** jjido has joined ##java
[16:44:10] *** cbeust has joined ##java
[16:44:23] <psst> subichan: really? That's just about the easiest algorithm there is. Why would you be afraid of implementing it?
[16:44:34] <subichan> yeah, i figured, bu honestly speaking i wouldn't know where to begin to write that as i'm not very much acquainted with elementary number theory
[16:44:41] <subichan> even if it's elementary :p
[16:45:04] <shiranpuri> psst: pfft, there's a lot of simpler ones
[16:45:46] *** ninja_sense has joined ##java
[16:46:10] <psst> subichan: it would be a good learning exercise for you if you are interested in learning Java.
[16:46:33] <subichan> i'm not interested in learning maths! :p
[16:46:50] <sbalmos> oooookay....
[16:46:53] <psst> shiranpuri: not *much* simpler (at least not without being entirely trivial like multiplyByZero(int i))
[16:47:19] <shiranpuri> how about min,max, and abs? :p
[16:47:34] <idletask> Now you're pushing it
[16:47:44] <psst> idletask: too hard! too hard!
[16:47:46] <shiranpuri> btw, multiplyByOne's more useful
[16:48:13] *** mhahe has quit IRC
[16:48:16] <shiranpuri> harder to implement tho :o
[16:48:21] <psst> subichan: did you have a bad experience with maths as a child?
[16:48:43] <psst> shiranpuri: I wish we had stories like this in our sizing meetings!
[16:48:43] *** EvilPenguin has joined ##java
[16:48:57] *** pen has quit IRC
[16:49:29] *** Alkhi has joined ##java
[16:49:42] *** EvilPenguin has quit IRC
[16:51:14] <shiranpuri> psst: about how many hours for that feature?
[16:51:23] * idletask likes how isPowerOfTwo() is simple to do
[16:51:40] <subichan> psst: i'm still trying to prove why 3+2 makes 5
[16:52:02] <psst> shiranpuri: that would be 3 ideal engineering days.
[16:52:49] <psst> subichan: Why? (hint: start from the Peano axioms)
[16:53:01] *** devkhadka has joined ##java
[16:53:09] <shiranpuri> psst: so ~60 hours including meetings and unplanned difficulties?
[16:53:15] *** pyrony has quit IRC
[16:53:50] *** IznastY has joined ##java
[16:53:58] <psst> shiranpuri: possibly — we don't have a figure for our current velocity yet
[16:53:59] *** EvilPenguin has joined ##java
[16:54:20] *** hariju has quit IRC
[16:55:41] <subichan> peano > zfc
[16:55:45] *** kagu has joined ##java
[16:56:57] *** tigger0jk has quit IRC
[16:57:36] <subichan> my last random statement was meant to neutralise the out of topic topic, and i was indeed successful
[16:57:39] *** mazzachre has quit IRC
[16:57:57] <cheeser> um. ok.
[16:58:02] <subichan> howdy cheeser
[16:58:45] *** tigger0jk has joined ##java
[16:58:58] *** Ch30ps has quit IRC
[16:59:34] *** mah01 has quit IRC
[17:00:04] *** caverdude has quit IRC
[17:00:53] *** kagu has quit IRC
[17:01:52] *** kebomix has joined ##java
[17:01:56] *** kagu has joined ##java
[17:02:31] <kebomix> how to make a grid like this in swing? or what is the grid name !? http://img848.imageshack.us/img848/7223/gridw.jpg
[17:02:44] *** Phil has quit IRC
[17:03:01] <FauxFaux> Noob design time. I have a service that maps daos to other objects; I'd basically like to put an abstract makeFoo() method on the daos' parent, but I don't want the logic in the daos. Am I stuck with an if (x instanceof XDao) { return makeX(x); } if (x instanceof YDao) {return makeY(x); }? (Or a Map<Class<?>,Producer>, or..)
[17:03:21] *** jjido has quit IRC
[17:03:23] *** Phil has joined ##java
[17:03:36] <ojacobson> seems like the sort of thing virtual methods are for
[17:04:15] *** freeone3000 has joined ##java
[17:04:17] <ojacobson> public <T> T make() { return this.createProduct(); } protected abstract <T> T createProduct();
[17:04:31] *** cool123 has joined ##java
[17:04:49] <FauxFaux> That's going to involve having the creation logic actually inside the TO/DAO class, though, which feels horrible.
[17:05:21] *** winux has quit IRC
[17:05:21] *** jjido has joined ##java
[17:05:31] <ojacobson> Insufficient context to offer useful answers. Code more useful than prose.
[17:06:14] <mapreduce> ojacobson: Why not inline make() if all it does is return createProduct()?
[17:06:21] <ojacobson> mapreduce: I would.
[17:06:33] *** ExtraSpice has quit IRC
[17:06:34] *** SpaceDoG has quit IRC
[17:06:37] <ojacobson> Illustrated it in two pieces to draw attention to the part that varies
[17:06:47] <mapreduce> I see.
[17:06:49] <ojacobson> but in practice I'd probably have make be abstract and get rid of createProduct
[17:07:01] <Candle> FauxFaux: I've used a Map<Class<T extends DaoInterface>, T>, with some form of if (isassignableFrom(..)) check;, although ojacobson's pattern does seem to imply that you need an instance of the DAO before getting an instance of the DAO..
[17:07:03] <FauxFaux> I'm trying to think of a sane example.
[17:07:28] <ojacobson> From some of the acks you're emitting it sounds like you're conflating DAOs and their products into a single class
[17:07:34] <ojacobson> which is, quite obviously, gross
[17:07:48] *** youdonotexist has joined ##java
[17:09:53] *** BoF has joined ##java
[17:10:21] *** jjido has quit IRC
[17:10:46] *** EnginA has joined ##java
[17:10:53] <Candle> ojacobson: What happens when your DAOs need different constructor arguments?
[17:12:08] *** SpaceDoG has joined ##java
[17:14:56] <idletask> Must go
[17:14:58] <idletask> Have fun
[17:15:00] *** idletask has quit IRC
[17:15:36] *** devkhadka has quit IRC
[17:15:47] <ojacobson> Candle: Same thing that happens when you have any other behaviour whose argument list varies - you introduce adapters to provide a uniform way to do it
[17:15:51] <ojacobson> (if you need one)
[17:16:05] *** Alkhi has quit IRC
[17:16:08] *** matsebc has joined ##java
[17:16:55] *** jjido has joined ##java
[17:17:21] *** Cogito has quit IRC
[17:17:34] *** pyrony has joined ##java
[17:22:02] *** Sambler has joined ##java
[17:23:47] *** Muzzy has joined ##java
[17:24:12] *** srji has quit IRC
[17:25:33] *** tigger0jk has quit IRC
[17:26:22] *** Johannes13_ has joined ##java
[17:26:48] *** cbeust has quit IRC
[17:26:53] *** magentar has quit IRC
[17:27:59] *** bitshuffler has quit IRC
[17:29:19] *** Johannes13 has quit IRC
[17:32:31] *** epalm has quit IRC
[17:34:05] *** syphar has joined ##java
[17:34:22] *** syphar has quit IRC
[17:35:06] *** epalm has joined ##java
[17:35:15] *** Pozejdon has joined ##java
[17:36:18] *** bindaas has quit IRC
[17:36:48] *** bindaas has joined ##java
[17:39:23] *** pyrony has quit IRC
[17:39:24] *** freeone3000 has quit IRC
[17:39:39] *** horte has quit IRC
[17:39:39] *** EnginA has quit IRC
[17:40:22] *** bindaas has quit IRC
[17:41:12] *** fuzzygroove has joined ##java
[17:42:11] *** _Jorde has quit IRC
[17:44:17] *** lahwran has joined ##java
[17:44:41] <lahwran> because I'm lazy, I'm going to ask here before looking it up; how would I check if the local date is a specific month and day?
[17:44:57] <ojacobson> ~javadoc Calendar
[17:44:57] <javabot> ojacobson: http://is.gd/Xo0B35 [JDK: java.util.Calendar]
[17:46:12] <Skyec> if i want to switch content in a composite in JFace, what is the best practice of doing that/
[17:46:23] *** ShiintoRyuu has left ##java
[17:46:41] <Skyec> in ApplicationWindow, there is a createContents and getContents... but there doesn't appear to be a setContents if I want to change the contents... or am I understanding this wrong?
[17:47:37] *** jesmon has joined ##java
[17:48:07] *** cool123 has quit IRC
[17:50:34] *** supercosmonaut has quit IRC
[17:52:14] *** chomping has quit IRC
[17:52:30] *** coalado has quit IRC
[17:52:34] *** nixness has joined ##java
[17:52:37] *** BoF has quit IRC
[17:53:47] *** jjido has quit IRC
[17:54:32] *** foocraft has quit IRC
[17:54:35] <Skyec> i found my answer here: http://www.eclipse.org/forums/index.php?t=rview&goto=633910&th=198756 (StackLayout or GridLayout)
[17:54:55] *** EuroTrash has joined ##java
[17:55:19] *** tombee has quit IRC
[17:57:08] *** cool123 has joined ##java
[17:57:43] *** sphenxes has joined ##java
[17:57:57] *** novacall has joined ##java
[17:58:07] <novacall> where do i go for applet support?
[17:58:33] <fr0ggler> ~applets
[17:58:33] <javabot> Check the topic, read http://javachannel.net/wiki/pmwiki.php/FAQ/Applets - Basically, we don't support them here. Try the sun forums at http://tinyurl.com/2q2hog; consider the new Windows/OS X/Linux 32/64bit JNLP-compatible "Plugin2" from Java 6u10 (http://java.sun.com/javase/6/webnotes/6u10/plugin2/index.html)
[17:58:50] <novacall> anyone good with applets and want to pm me?
[17:59:05] *** Luc1fel has quit IRC
[17:59:06] <Skyec> just out of interest, why don't we support applets? Are they considered an evil or something
[17:59:07] <tjsnell> applet support is somewhere on the 12th level of hell
[17:59:13] <Skyec> haha
[17:59:22] <tjsnell> Skyec: read the links above
[17:59:23] *** supercosmonaut has joined ##java
[17:59:39] <Skyec> tjsnell: thanks
[18:01:17] <jesmon> Skyec: you're free to help him with his applets issue, tho :)
[18:01:29] <fr0ggler> in PM
[18:01:32] <jesmon> (in private)
[18:01:34] <Skyec> no, i'll take my chances headbutting a drill
[18:01:41] <fr0ggler> good choice
[18:02:46] <novacall> lmao
[18:02:57] *** jjido has joined ##java
[18:04:07] *** ech0s7 has quit IRC
[18:04:48] *** pyrony has joined ##java
[18:05:40] *** bindaas has joined ##java
[18:06:50] *** Frostix has joined ##java
[18:09:12] *** bitshuffler has joined ##java
[18:09:39] *** stimpie has quit IRC
[18:10:17] *** IznastY has quit IRC
[18:10:22] *** epure_ has joined ##java
[18:14:00] <novacall> How do i echo exceptions?
[18:14:04] *** Sambler has quit IRC
[18:14:08] <novacall> the error that is
[18:14:13] <cheeser> you print it
[18:14:17] *** supercosmonaut has quit IRC
[18:14:20] <ojacobson> or its stacktrace, more usefully
[18:14:31] <novacall> yea i know that cheeser
[18:14:38] <cheeser> then why ask?
[18:14:39] <novacall> whats the syntax for printing exceptions?
[18:14:45] <Skyec> http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Throwable.html (printStackTrace)
[18:14:51] <cheeser> same as anything else mostly
[18:14:52] <novacall> System.out.print(exception1); ??
[18:14:52] *** selckin has joined ##java
[18:15:04] <cheeser> when you tried that what happened?
[18:16:47] *** lhnz has quit IRC
[18:16:52] *** novacall has quit IRC
[18:16:55] *** rciovati has joined ##java
[18:17:56] *** dinesh___ has quit IRC
[18:17:59] *** cool123 has quit IRC
[18:20:21] *** cbeust has joined ##java
[18:21:22] *** Yusdan has quit IRC
[18:21:36] *** BoF has joined ##java
[18:22:13] *** svm_invictvs has joined ##java
[18:22:17] <svm_invictvs> Oh, Hai
[18:22:20] <svm_invictvs> ~javabot
[18:22:20] <javabot> for a FAQ and a quick tutorial on how to use javabot, see: http://javachannel.net/wiki/pmwiki.php/FAQ/Javabot
[18:22:26] *** IznastY has joined ##java
[18:23:38] *** platzhirsch has joined ##java
[18:24:05] *** platzhirsch has left ##java
[18:24:37] *** new2net has joined ##java
[18:24:50] *** gkmngrgn has joined ##java
[18:25:30] <new2net> what is "heap" (a heap) ?
[18:26:17] <new2net> "<jkhan> your class sh**s all over the heap"
[18:26:55] <cheeser> ~google java heap
[18:26:55] <javabot> http://letmegooglethatforyou.com/?q=java+heap
[18:26:57] *** subichan has quit IRC
[18:27:14] <new2net> can you make it click on the "im feeling lucky" button also please
[18:27:31] <fr0ggler> new2net, are you really that lazy?
[18:27:39] *** Matic`Makovec has quit IRC
[18:28:15] <new2net> no, I just wanted to get an answer from a person.
[18:28:31] *** nucc1 has quit IRC
[18:28:36] <fr0ggler> not the question, the "make it do the lucky thing"
[18:29:54] *** Matic`Makovec has joined ##java
[18:30:27] <mapreduce> new2net: People are overrated.
[18:30:30] <mapreduce> At least, I am.
[18:30:59] <new2net> I thought it was funny :D
[18:31:15] *** TheBeerinator has joined ##java
[18:31:30] *** eitch0000 has quit IRC
[18:32:03] <new2net> is the call stack a "heap"?
[18:33:03] *** platzhirsch has joined ##java
[18:33:05] *** platzhirsch has left ##java
[18:33:24] <new2net> oh, wait. a heap is the memory the OS gives a program to run in. If the program uses too much memory it has to request more from the OS. Eventually the OS (if its not stupid) will cut the program off.
[18:35:36] *** novitololo has left ##java
[18:36:12] <_W_> a heap is a pile
[18:36:16] <mapreduce> It just denies the request eventually.
[18:36:34] <mapreduce> malloc gets a NULL back, new (in Java) throws an OutOfMemoryError, etc.
[18:37:25] *** jjido has quit IRC
[18:39:17] *** cyphorious has joined ##java
[18:39:51] <new2net> I know my program will never use more than 2MB of memory. Is there any benefit to telling the OS this fact before my program executes? this is a "min heap" right.
[18:42:36] *** chandan_kumar has joined ##java
[18:42:55] *** lhnz has joined ##java
[18:43:43] *** jdolan has quit IRC
[18:44:31] *** jjido has joined ##java
[18:44:51] *** cool123 has joined ##java
[18:45:28] *** aaron11 has joined ##java
[18:45:30] *** jjido has quit IRC
[18:45:33] *** srcerer has quit IRC
[18:47:02] *** LouisJB has quit IRC
[18:48:43] *** Bombstone has joined ##java
[18:48:52] *** srcerer has joined ##java
[18:49:26] *** supercosmonaut has joined ##java
[18:49:51] *** fr0ggler has quit IRC
[18:53:13] <aaron11> Hey, umm when I do the colision detection thing that MrJavaHelp gave im getting a StackOverFlow exception. Personally, I have no idea about exceptions, I just know to catch them without knowing what they are. I was wondering if you guys could help. JavaLearn3 class: http://paste.ubuntu.com/577077/ JavaLearn2 class: http://paste.ubuntu.com/577078/ Enemy class: http://paste.ubuntu.com/577079/
[18:54:24] *** lhnz has quit IRC
[18:56:08] <new2net> paste the stack trace also... lol
[18:56:21] <cheeser> ~lol
[18:56:22] <javabot> Maybe LOL stands for "Limited Operable Literacy".
[18:56:52] <aaron11> :P Sorry, Im also talking in another chanel
[18:56:55] <whaley> ~stacktrace
[18:56:56] <javabot> http://i.imgur.com/jacoj.jpg
[18:57:23] <new2net> that made my day
[18:58:27] <aaron11> Exception in thread "main" java.lang.StackOverflowError
[18:58:28] <aaron11> at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[18:58:28] <aaron11> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[18:58:28] <aaron11> at java.lang.reflect.Method.invoke(Method.java:616)
[18:58:28] <aaron11> at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:262)
[18:58:28] <aaron11> at javax.swing.UIDefaults.getUI(UIDefaults.java:769)
[18:58:30] <aaron11> at javax.swing.UIManager.getUI(UIManager.java:1000)
[18:58:32] <aaron11> at javax.swing.JPanel.updateUI(JPanel.java:126)
[18:58:33] *** cheeser sets mode: +b *!*aaron11@unaffiliated/aaron11
[18:58:33] *** aaron11 was kicked by cheeser (for flooding you get a 2 minute ban to give you time to read the topic (/topic ##java))
[18:58:35] *** windparadise has joined ##java
[18:59:33] <windparadise> hello, I am trying to write an application in java which will be integrated into android. it is an intrusion detection system where a camera will start recording when it sense a movement.
[18:59:48] <cheeser> try #android-dev
[18:59:54] <cheeser> android isn't java
[19:00:39] *** cheeser sets mode: -b *!*aaron11@unaffiliated/aaron11
[19:01:31] *** lhnz has joined ##java
[19:02:28] *** aaron11 has joined ##java
[19:02:38] <mapreduce> Ugh, sounds like CCTV.
[19:02:39] <aaron11> Sorry about that
[19:02:50] <aaron11> http://paste.ubuntu.com/577086/
[19:02:59] <aaron11> Thats the stacktrace.
[19:03:29] <mapreduce> JavaLearn3 line 32 seems to call JavaLearn2 line 17, and vice versa.
[19:03:31] <mapreduce> Stop that.
[19:04:24] <aaron11> mapreduce, It would be nice for a simple definition for stacktrace.
[19:04:48] <new2net> 1024 is the stack size. I always wanted to know. Heh... looks like a bad case of recursion to me
[19:04:51] <mapreduce> Would you kindly make sense?
[19:05:07] <mapreduce> where you = aaron11
[19:05:13] *** t0rc has quit IRC
[19:05:47] <aaron11> Uhh... lets see, what does stacktrace mean? ;-)
[19:09:41] *** IznastY has quit IRC
[19:09:52] *** nibbless has joined ##java
[19:14:18] *** KarlKFI|work has joined ##java
[19:15:41] *** epalm has quit IRC
[19:17:34] <mapreduce> You should know, you used the word.
[19:17:46] *** cbrock has joined ##java
[19:18:06] <mapreduce> I think you should turn your PC off, you clearly have no use for it.
[19:18:12] * mapreduce turns his PC off
[19:19:46] *** Midir has joined ##java
[19:20:18] <new2net> aaron11, is java your only programming language?
[19:20:30] *** barckl3y has joined ##java
[19:20:40] *** Indigenous has quit IRC
[19:21:03] <barckl3y> hello I have a question ,,, how I consume a EJB from other pc?
[19:21:50] <new2net> a program (possibly a thread) follows a certain path through the code. The program makes calls to methods, as they are called they are added to the Stack (you do know what a stack is right? its a LIFO data structure). Once the method has been executed successfully it is removed from the stack.
[19:22:18] <new2net> once the stack is empty the program is over and you win.
[19:22:39] <new2net> my life story.
[19:22:49] <barckl3y> someone can help me
[19:23:19] *** osrec has joined ##java
[19:24:43] *** cool123 has quit IRC
[19:24:51] <osrec> Hi - I was wondering, does using Spring open you up to potential behaviour modification by users as they can potentially modify the XML application context?
[19:26:50] <sbalmos> What potholed country road of thought brought you to that conclusion?
[19:27:07] *** lamdk has joined ##java
[19:27:11] *** mxweas has joined ##java
[19:27:45] <osrec> I'm a noob :|
[19:27:55] *** gelignite has quit IRC
[19:28:06] <new2net> why does metasploit come to mind when you compare an attack vector to "potholed country road"?
[19:28:53] *** eidolon has quit IRC
[19:29:01] <osrec> sbalmos: please could you explain why my logic is flawed - it would help me understand spring better - thanks
[19:29:32] <dmlloyd> osrec, normally the security manager protects you from stuff like that
[19:29:40] <dmlloyd> but I wouldn't be surprised if spring doesn't use permission checking
[19:29:40] <aLeSD> is it possible to create a variable in a function that will not be reinitialized xext time ?
[19:29:51] * sbalmos backspaces
[19:29:54] <dmlloyd> as that's way too "enterprisey" for them
[19:30:22] <aLeSD> somethinf like static in c
[19:30:31] <osrec> aLeSD: static in java exists too
[19:30:46] *** LouisJB has joined ##java
[19:30:55] <new2net> aLeSD transient? (serialization) or "static", a field which belongs to a class?
[19:30:56] <sbalmos> dmlloyd: I'm thinking more fundamentally. How's a user supposed to get ahold of the application context, much less modify it, if it's bundled in the same archive as code (the compressed WAR, EAR, etc)? Makes it as easy/hard as uncompressing the archive and swapping out a class file
[19:32:26] <osrec> sbalmos: so what you are saying is that when the application is deployed, the application context is tightly bundled in a compressed format, so it is difficult to get at by users?
[19:33:07] *** aaron11 has quit IRC
[19:33:11] <sbalmos> no more so than any other class file, resource file, etc in the archive
[19:33:50] *** eidolon has joined ##java
[19:34:02] *** cool123 has joined ##java
[19:34:02] <sbalmos> it's not like in Spring you have a WAR of your app, and then this XML file sitting out here in the open, waiting to be completely mangled by a too-curious end-(l)user
[19:34:49] <dmlloyd> signed JARs are how you protect against that
[19:35:01] <dmlloyd> signed JARs plus a security manager
[19:35:16] <osrec> sbalmos: ok, so your logic is that the spring application I deploy will be just as easily modified as any arbitrary class file?
[19:35:24] *** Sou|cutter has joined ##java
[19:35:43] <saml> in jsp, i do <c:set var = "foo.bar" value="adf.adf" scope="request"/> but ${foo.bar} is empty
[19:35:53] <new2net> sbalmos: you must validate all data server side. Are you familiar with any web application attacks?
[19:36:21] <sbalmos> new2net: No, I'm just some dolt who thought I could slap code together like in PHP.
[19:37:04] *** NS_IS has joined ##java
[19:37:11] *** maxorator has quit IRC
[19:37:29] <new2net> so why is XML injection unclear?
[19:37:55] *** tilerendering has joined ##java
[19:38:12] *** kibibyte has joined ##java
[19:38:17] <osrec> dmlloyd, sbalmos : thanks for your input
[19:38:31] *** epalm has joined ##java
[19:38:35] <sbalmos> new2net: Because the XML isn't being dynamically injected from some outside source! It's bundled as part of the app!
[19:41:05] *** yogi has joined ##java
[19:42:01] *** gelignite has joined ##java
[19:43:37] *** aut has joined ##java
[19:44:00] <aut> any of you that hire java people, where do you look for your employees (outside of personal network)
[19:47:43] <tjsnell> local JUG, universities etc
[19:48:19] <cbeust> aut: LinkedIn :)
[19:48:46] <new2net> sbalmos: indeed. My mistake, ty for catching it.
[19:49:19] <sbalmos> aut: I just had four offers over the weekend, from tjsnell's & cbeust's suggestions
[19:49:43] <saml> so ${map.someKey} doesn't work either right? for EL
[19:49:44] <sbalmos> new2net: :)
[19:49:56] <saml> map.put("someKey", "asdf"); ${map.someKey}
[19:51:17] <push[RAX]> ${map[someKey]}
[19:54:37] <aut> yea ive heard linkedin is reallygood.. but how do you use it? :)
[19:55:03] *** IznastY has joined ##java
[19:55:10] <aut> you add all your friends? or do you post a job on there?
[19:55:44] <wyvern`> it's a profressional-oriented social network.
[19:55:48] *** jdolan has joined ##java
[19:56:25] <aut> wyvern`: yea, i know, but i dont know how people use it to find employees
[19:56:31] <aut> other than networking...
[19:56:55] <wyvern`> oh. recruiters typically look on linkedin for people
[19:57:10] <aut> do they search by company to poach? :)
[19:57:23] <wyvern`> sometimes
[19:57:25] <cbeust> aut: You do not add your friends. Everybody but your friends. That's the point :)
[19:57:38] <tjsnell> heh
[19:57:45] <sbalmos> LinkedIn != FB
[19:57:47] *** supercosmonaut has quit IRC
[19:57:52] <aut> so you add randoms? :)
[19:57:57] <sbalmos> *sigh*
[19:58:09] *** NS_IS has quit IRC
[19:58:11] <sbalmos> aut: Do you actually interact with other people in a professional manner?
[19:58:14] <aut> nope
[19:58:24] <sbalmos> that's a problem.
[19:58:55] *** Rupan has joined ##java
[19:59:05] <aut> i realize.. that's why i asked originally how you would find people *outside* of using your personal network :)
[19:59:07] *** barckl3y has quit IRC
[19:59:28] <Rupan> is there a way to make keytool export the X.509 public certificate from a JAR signature?
[20:00:12] *** barckl3y has joined ##java
[20:00:52] <Rupan> say I have some file from a random JAR, META-INF/CERT.RSA. I can then do "keytool -printcert -file META-INF/CERT.RSA" and it will print out the fingerprints. What I want is the corresponding RSA public key instead.
[20:00:59] *** jdolan has quit IRC
[20:01:10] <Rupan> is it possible to get it?
[20:01:25] <Rupan> i.e. without writing custom code
[20:01:38] *** barckl3y has quit IRC
[20:02:02] *** jdolan has joined ##java
[20:03:40] <Rupan> or, even better, is it possible to import the given certificate from CERT.RSA into a local keystore and use that keystore to verify other APKs in an automated fashion?
[20:04:14] <wyvern`> you can certainly import a cert into a keystore
[20:04:21] <wyvern`> note that .RSA is a completely pointless extension.
[20:04:27] <wyvern`> Is it pem? use .pem.
[20:05:53] *** sukumarasingha has joined ##java
[20:06:04] <Rupan> <wyvern`>: it isn't PEM, thats the thing. It is an RSA signature from a JAR file.
[20:06:05] *** PelleTut has joined ##java
[20:06:16] <wyvern`> what format is it? RSA is not a format.
[20:06:24] <Rupan> <wyvern`> sorry, PEM
[20:06:30] <Rupan> erm
[20:06:36] <Rupan> hang on so this is what I've got
[20:06:40] <wyvern`> don't paste
[20:06:44] <wyvern`> unless you're sure it's not private data
[20:06:59] <wyvern`> (it probably is if it's a cert, but just don't want you to leak data you didn't mean)
[20:07:09] <Rupan> I have a JAR file that I've obtained online with a signature from an authority that I trust
[20:07:11] *** bojo has joined ##java
[20:07:17] <wyvern`> ok
[20:07:37] <Rupan> this JAR file is signed with a private RSA key, probably using jarsigner
[20:07:45] <Rupan> and a keystore
[20:08:16] *** windparadise has quit IRC
[20:08:17] <Rupan> obviously I don't have the private keystore. So I want to extract the public parts of the key using only the signature
[20:08:25] <wyvern`> if you want to create a JKS keystore out of a PEM cert, that's: keytool -importcert -keystore foo.jks -file bar.pem
[20:08:26] <Rupan> which should be possible
[20:08:28] <wyvern`> or something like that
[20:08:44] *** new2net is now known as N2N
[20:09:10] <Rupan> keytool error: java.lang.Exception: Input not an X.509 certificate
[20:09:17] <Rupan> thats what I've been trying to say
[20:09:24] <wyvern`> i see. Is it text?
[20:09:27] <Rupan> this is not an X.509 certificate file
[20:09:32] *** N2N is now known as new2net
[20:09:39] <wyvern`> Rupan, if it's a cert, it should be public. Paste it so I can look at it.
[20:09:39] <Rupan> it is the RSA signature, extracted from a JAR file
[20:09:40] <wyvern`> ~paste
[20:09:41] <javabot> http://pastie.org - Paste the final url after you've pasted your stuff there.
[20:09:50] *** chandan_kumar has quit IRC
[20:09:51] <Rupan> <wyvern`>: it is binary
[20:09:56] <wyvern`> ok it's probably DER then
[20:10:06] <wyvern`> try this:
[20:10:16] <wyvern`> openssl x509 -in foo.der -inform DER -out foo.pem
[20:11:29] <Rupan> wrong tag
[20:11:32] <Rupan> 18801:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:380:Type=X509_CINF
[20:11:32] <Rupan> 18801:error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:tasn_dec.c:748:Field=cert_info, Type=X509
[20:11:57] <wyvern`> try doing -noout -text instead of the -out part
[20:12:17] *** EnginA has joined ##java
[20:12:32] <Rupan> same thing
[20:12:35] <wyvern`> ok
[20:12:37] <Rupan> lemme upload it somewhere
[20:12:39] <Rupan> hang on
[20:14:23] *** caverdude has joined ##java
[20:15:11] <Rupan> http://nopaste.voric.com/paste.php?f=n5g387
[20:15:15] <Rupan> thats the uuencoded form
[20:15:28] <Rupan> it is shipped as a binary file, just uudecode taht to get the original
[20:16:02] *** cyphorious has quit IRC
[20:16:23] *** jdolan has quit IRC
[20:17:03] *** GibbaTheHutt has quit IRC
[20:17:13] *** Intrepd has joined ##java
[20:17:31] *** jdolan has joined ##java
[20:18:20] *** NateW has joined ##java
[20:19:01] *** sukumarasingha has quit IRC
[20:19:48] <NateW> i'm new to oop and im trying to grasp inheritance. if i have a classes extending from a superclass, and have an array of the superclass, then try to call a method from one of the classes, it doesnt work.
[20:20:04] <NateW> thow can i access a method from one of the lower classes in this case?
[20:20:08] <NateW> *how
[20:20:53] *** Rayne has joined ##java
[20:21:14] <Rupan> wyvern`: the command "keytool -printcert -file META-INF/CERT.RSA" works, and prints out the public key's signature
[20:21:15] *** BoF has quit IRC
[20:21:38] <wyvern`> ah well it's a JKS then
[20:21:49] <Rupan> a-ha
[20:21:57] <wyvern`> (probably)
[20:22:02] <Rupan> what is a JKS, exactly?
[20:22:26] <wyvern`> a java-specific format for certs and private keys
[20:22:51] <Rupan> I thought that too, but I can't seem to export from it
[20:23:08] <wyvern`> can you do a keytool -keystore foo -list -v ?
[20:23:29] *** Midir has quit IRC
[20:23:32] <wyvern`> NateW, you'd need it to be an array of the subclass to use the subclass's methods
[20:23:34] <Rupan> keytool error: java.io.IOException: Invalid keystore format
[20:23:49] <wyvern`> hm
[20:23:51] <wyvern`> might be PKCS12 then
[20:23:54] <wyvern`> what does 'file' say about it?
[20:24:01] <Rupan> "data". :(
[20:24:07] <wyvern`> great ;)
[20:24:31] <wyvern`> try -storetype PKCS12
[20:24:47] *** Pozejdon has quit IRC
[20:24:51] <Rupan> what I'm trying to accomplish is automated verification of other signed JAR files, using a known-good public key
[20:25:35] <Rupan> keytool error: java.io.IOException: DER input, Integer tag error
[20:25:39] <wyvern`> bleh
[20:25:46] <wyvern`> check and see what -printcert does in the source then
[20:25:49] *** zatan has joined ##java
[20:25:50] <wyvern`> the manpage for -printcert is worthless
[20:26:10] <Rupan> it seems that there is DER-encoded data in this file
[20:26:23] <Rupan> is there a way to print out the raw DER fields?
[20:26:30] <wyvern`> i suppose it might be BER instead of DER
[20:26:32] <NateW> wyvern`: so if i have a superclass called Animal, and subclasses called Dog and Cat, and have methods in Dog. if i use Animal[]array = new Animal[3]; and array[0] = new Dog(); , i cant use the Dog class methods in array[0] ??
[20:26:47] <wyvern`> right, because the type of the array is Animal[] not Dog[]
[20:27:16] <wyvern`> in the same way you can't call String methods on elements of the array -- the type isn't String[].
[20:27:31] <NateW> is there a way to hold multiple subclasses together in an array?
[20:27:58] <NateW> (and access their methods)
[20:28:06] <wyvern`> sure. You can put any Animal subclass you want in an Animal[]. You just don't get to access them as their subtypes.
[20:28:33] <wyvern`> You can do instanceof checks and casts, but generally this style of code is frowned on (and indicates a poor OO design)
[20:29:32] *** new2net is now known as N2N
[20:30:12] *** riotz has joined ##java
[20:30:59] *** Symbi0nt|GER has joined ##java
[20:31:00] *** IznastY has quit IRC
[20:31:57] *** IznastY has joined ##java
[20:32:03] *** LouisJB has quit IRC
[20:32:12] *** IznastY has quit IRC
[20:32:32] *** alicia_b has joined ##java
[20:32:44] *** White_Cat has joined ##java
[20:32:49] <White_Cat> hi
[20:32:51] *** Rayne has quit IRC
[20:33:09] <White_Cat> I am trying to return whatever stack.pop() returns what should be my functions data type?
[20:33:13] <Rupan> wyvern`: its definitely ASN.1: dumpasn1 works perfectly on it
[20:33:25] <wyvern`> Rupan, interesting. It might be BER not DER though
[20:33:27] *** alicia_b has left ##java
[20:33:48] <Rupan> wyvern`: do you know what format jarsigner writes out signatures in?
[20:33:57] <wyvern`> nope
[20:34:09] *** NateW has left ##java
[20:34:23] *** yxz97 has joined ##java
[20:34:39] <White_Cat> I have a stack that handles a single data type and I want to return it :/
[20:35:01] <wyvern`> ~~ White_Cat generics
[20:35:02] <javabot> White_Cat, For a tutorial on generics, please see http://javachannel.net/wiki/pmwiki.php/Main/Generics
[20:37:50] *** Kamaran has joined ##java
[20:40:42] <White_Cat> umm
[20:40:47] <White_Cat> I am trying to return a custom class
[20:43:06] *** N2N has quit IRC
[20:43:43] *** bangolio has joined ##java
[20:44:30] <bangolio> what I do now is: URL MyURL = new URL("http://www.google.com"); URLConnection MyURLConnection = MyURL.openConnection();
[20:44:36] <bangolio> what are the consequences, if any, if instead I just do this: URLConnection MyURLConnection = new URL("http://www.google.com").openConnection(); ?
[20:45:41] <wyvern`> they are equivalent
[20:47:03] *** meling has quit IRC
[20:47:25] <bangolio> great, less code, thanks!
[20:48:27] <bangolio> it's not bad practice or anything?
[20:49:24] <_W_> no
[20:49:42] <bangolio> thanks again :)
[20:49:51] <_W_> if URL had resources to clean up, it could be, but no such need is documented
[20:51:09] <mapreduce> bangolio: The consequence is that you have one fewer badly named variable.
[20:51:33] <bangolio> that wasn't really my code just an example :P
[20:51:44] *** Caffeine has joined ##java
[20:51:44] *** zChris has joined ##java
[20:52:48] *** carutsu has joined ##java
[20:54:54] <Caffeine> I would like to know where is defined the way items in a JComboBox are displayed. I know how the items are rendered, but I need to tweak their disposition in the drop-down menu. I've looked at the JComboBox source code... still have no clue.
[20:56:16] <carutsu> suppose I'm creating a servlet that connects to another server though a socket, now, I'm getting bytes through that socket, so, I want to buffer that until I receive a marker of end of message (I'm setting that marker to be EOL,) what I tried is something like this: https://pastebin.com/dKRrqiWV but it just hangs
[20:56:20] <Caffeine> What I need to do: Rendered items are displayed in a 1 column list, I want to change that for a multi-column list.
[20:56:37] <White_Cat> wyvern` I am a bit confused still
[20:57:11] <carutsu> I *know* that the message is sent, it's part of the handshake, the message is sent by the server the minute a connection is made
[21:03:22] *** IppatsuMan has joined ##java
[21:03:24] <wyvern`> White_Cat, what are you trying to do?
[21:03:38] <carutsu> can I have an input stream that give me the raw bytes?
[21:03:49] <wyvern`> that is what inputstreams do.
[21:04:39] *** IppatsuMan has quit IRC
[21:04:40] <wyvern`> also you're throwing away an IOException, so you deserve your fate
[21:06:21] <dmlloyd> carutsu, if you never get character 13, you see it will hang
[21:06:33] <dmlloyd> carutsu: make character be an int, first of all
[21:06:47] <dmlloyd> carutsu: second of all read the docs for read() which clearly state that if you get a -1 that means EOF
[21:06:47] <carutsu> dmlloyd: yes, but I'm sure I get the character 13.
[21:06:55] <dmlloyd> well you're obviously not, are you
[21:07:01] <dmlloyd> if you were, you wouldn't be in a loop
[21:07:08] <carutsu> hm
[21:07:12] <dmlloyd> also
[21:07:17] <dmlloyd> line 3 makes *no* sense
[21:07:24] <dmlloyd> you're reading from an empty stream
[21:07:27] <dmlloyd> linke 7 returns -1
[21:07:31] <dmlloyd> line 11 fails
[21:07:38] <dmlloyd> line 14 will write -1
[21:07:46] <dmlloyd> then it will go to the top of the loop, line 3
[21:07:51] <dmlloyd> where a new, empty stream is created
[21:08:05] <dmlloyd> surely you see how little sense this makes
[21:08:17] <carutsu> dmlloyd: yep, you're right on that
[21:08:55] <dmlloyd> the fact is you must *always* handle exceptions and you must *always* be prepared to read a -1 marking EOF
[21:09:13] <dmlloyd> and if you don't make your result variable an int, you won't be able to distinguish between a read of 0xff and the EOF which is -1
[21:09:36] <carutsu> if this is a socket, what does -1 mean? end of packet?
[21:09:41] <ojacobson> end of stream
[21:09:50] <ojacobson> peer closed at least the output side of the connection
[21:09:56] <ojacobson> There will be no further data on that stream, ever
[21:10:10] <carutsu> ojacobson: got it
[21:10:12] <dmlloyd> note that the socket may still be writable
[21:10:26] *** LouisJB has joined ##java
[21:11:17] *** lighta has joined ##java
[21:11:32] *** io2 has joined ##java
[21:12:21] *** Wulfspider has quit IRC
[21:13:35] *** sebrock has quit IRC
[21:16:03] *** Midir has joined ##java
[21:19:06] <reisi> has anyone noticed there is at least once per week a new (not content-wise) singleton article linked on dzone?
[21:19:18] <ojacobson> memetic hazard detected :-(
[21:20:58] <sbalmos> ParseConstructTooComplexException thrown
[21:20:59] *** nucc1 has joined ##java
[21:22:09] *** cool123 has quit IRC
[21:22:58] *** terranova has quit IRC
[21:23:03] <ojacobson> Ranting about singletons is the new writing an IRC client
[21:23:25] <reisi> heh agreed, i withdraw my case
[21:24:12] *** mhahe has joined ##java
[21:24:34] *** jtheuer has joined ##java
[21:24:57] <reisi> though not sure if i understood you correctly; i was making the point about articles which are for the use of singletons, not rants against (those seem rare at least at dzone)
[21:25:12] <carutsu> dmlloyd: about the exception, it seems to me that IOException is just way too broad to do anything about it, so, should I just log the exception and quit?
[21:25:19] <ojacobson> And people wonder why I have no faith in programming blogs
[21:26:18] * Cher thinks, Singletons are evil.
[21:26:37] <Cher> And for the fun of it, I also blogged about that already years ago.
[21:27:06] <cbeust> Cher: Singletons are not evil, implementing them with static is
[21:27:19] *** meling has joined ##java
[21:27:56] <Cher> Well, if a ClassLoader is used, Singletons can even be properly tested - but I don't really want to get ClassLoading involved in Unit Testing only for the sake of getting Singletons tested.
[21:28:02] <Sou|cutter> cbeust: how do you implement one without static? (assuming no DI)
[21:28:05] <jtheuer> any recommendations for a fast stream decompressor in java? I want to load a packed ~3GB file into memory. is java.util.zip.ZipInputStream fine? (It should also have a corresponding output stream for compressing but speed is irrelevant, here)
[21:28:27] <Cher> jtheuer: Is it a single file? Then why not gzip instead of zip?
[21:28:30] <Sou|cutter> no DI seems like tying a hand behind your back these days
[21:28:51] <jtheuer> Cher: single file. gzip is also in the java6 api?
[21:28:52] <ojacobson> Sou|cutter: same way you implement one with DI
[21:28:57] <cbeust> Sou|cutter: you use DI :)
[21:28:58] <Cher> jtheuer: Yes.
[21:29:09] *** seyfarth has joined ##java
[21:29:10] <jtheuer> ah ok.
[21:29:13] <Cher> Is DI = dependency inversion?
[21:29:17] <ojacobson> create once at system start, pass to dependents via parameters (constructor, method, whatever)
[21:29:18] <cbeust> injection
[21:29:24] <dmlloyd> carutsu: yeah in your case though it might be smart to rethrow it, maybe wrapped in some runtime exception, to make the whole thing fail
[21:29:26] <Sou|cutter> dependency injection
[21:29:30] *** seyfarth has left ##java
[21:29:54] <carutsu> dmlloyd: ok, thanks
[21:29:58] <jtheuer> found it. Cher, in unix i prefer bzip2 over gzip, but bzip is not in java, right?
[21:30:02] <reisi> Cher: dependency inversion could though be the thing of tomorrow, if you blogged about it :D
[21:30:35] <carutsu> dmlloyd: I'm not quite used to exceptions' better practices
[21:30:46] <Cher> reisi: Yep :D I should get slapped for mixing dependency injection and inversion of control.
[21:30:59] *** Tiktalik has joined ##java
[21:31:06] <Cher> DI - Ah okay. Well, sounds to me as it's not really a Singleton by the design of its class then, just a Singleton because it's made sure that by usage there's just one instance in scope. I'm okay with that then.
[21:31:17] <ojacobson> Bit of a jargon overload problem
[21:31:29] <cbeust> Cher: Not really, they both mean the same thing
[21:31:32] <ojacobson> I tend to use "singleton" for GoF singletons (with a static instance and a getInstance-alike method)
[21:31:43] <ojacobson> I don't have a good name for objects you only happen to have created one of
[21:32:00] <ojacobson> it seems like such a fundamental thing that it may not even need a name, but then, I thought that about DI, too
[21:32:33] <reisi> spring docs/ppl talk always about [stateless] services
[21:33:34] <Sou|cutter> ojacobson: you thought DI didn't need a name?
[21:33:39] <Cher> jtheuer: afaik bzip2 is not in the standard API. However, I think a Java implementation exists, see Ant.
[21:33:48] <ojacobson> Sou|cutter: I'm being a bit snide
[21:34:02] <Sou|cutter> ojacobson: ah :) hard to read tone in text sometimes
[21:34:47] *** fisted has quit IRC
[21:35:02] <sbalmos> ojacobson: Prototype?
[21:35:42] <Tiktalik> Hey guys
[21:36:05] <Tiktalik> Will you kill me for being an almost complete newbie at java?
[21:36:09] <Cher> OT: Now the Nigerian connection already disguises as "Nigeria police force"...
[21:36:49] *** LyQuid has joined ##java
[21:36:59] *** mashedo has joined ##java
[21:37:05] <Cher> Tiktalik: No, you won't be killed for being a newbie. Darwin likes creatures that develop. Darwin only hates people who pretend to develop.
[21:37:18] <Tiktalik> xD
[21:37:24] <sbalmos> Cher: Apple, on the other hand...
[21:37:56] <Cher> sbalmos: Do you refer to Apple in the context of Darwin or in the context of the Nigerian Connection? :D
[21:38:02] *** SniperFodder has joined ##java
[21:38:25] <sbalmos> yes
[21:38:26] <sbalmos> :o
[21:40:03] <mapreduce> Either Darwin or God better take responsibility for humans having appendices. We're not books, ffs.
[21:40:15] *** Nikelandjelo has joined ##java
[21:41:28] *** Behold has joined ##java
[21:42:13] *** BeholdMyGlory has quit IRC
[21:42:35] <Cher> There's much crap on Twitter...
[21:42:51] *** c_axis has joined ##java
[21:43:13] <mashedo> Hi, got a small problem with cardlayouts, how can I make my program know what card that currently is showing. Lets say it notifies a method everytime it changes card. but what command can the mathod use to get the current card. I thought it would be something like "getCurrentCard", but cant find anything like it.
[21:43:52] <mordu> this is so stupid. I am actually googling for legal disclaimers and no warrenty information to put in my software -.-
[21:44:52] <Cher> mordu: Why not use the one of the BSD license? Not the whole license, if that is not applicable for you, just the "no warranties use at own risk" paragraph?
[21:44:58] <wyvern`> just throw the bsd license or something. it has headers for that
[21:45:19] <mashedo> And I'm sorry for my english but I hope you understand anyway
[21:45:57] *** jjido has joined ##java
[21:47:30] <Cher> mashedo: Afaik: CardLayout actually lacks such a method. What you can do is to keep track of which Containers you've added to CardLayout, and see which of these is visible. That's the one currently shown. But before doing so, I suggest looking for a more elegant way.
[21:48:20] <Cher> Oh, and you needn't keep track of the Containers. The Container on which you set CardLayout does that already.
[21:49:00] <mashedo> Okey, thank you for the help :)
[21:50:48] <Cher> Events on card changes are also fired - at least indirectly. The container previously showing is hidden, the container now to show is shown. A ComponentListener can handle these events.
[21:51:44] <Cher> If you attach sthe same ComponentListener to all Containers that you manage using CardLayout, the componentShown() event will be fired with event.getComponent() being the card that's shown.
[21:52:19] <mordu> Cher: the warranty information in the bsd license is kinda.. cryptic
[21:52:34] *** echo_mirage has joined ##java
[21:53:08] *** balou has joined ##java
[21:53:38] <Cher> That doesn't matter. It's strongly believed to be legally safe. Just change a few things like "the regents" unless you're a university with regents ;-)
[21:53:59] <mashedo> okey, I'll try to do that, although I'm still a bit of a rookie at java, but I'm gonna give it a try and se if I can make it
[21:54:21] <Nikelandjelo> Does anybody know any good lib for double integral calculus?
[21:54:51] *** Lone_Rifle has joined ##java
[21:56:29] *** fisted has joined ##java
[21:58:41] *** jjido has quit IRC
[21:59:03] *** sorabji52 has joined ##java
[21:59:07] *** BSWolf has quit IRC
[21:59:08] <mordu> Cher: i found this, seems good http://giladmanor.blogspot.com/2009/11/software-disclaimer-sample.html ^^
[21:59:33] *** Busata has joined ##java
[21:59:46] <ojacobson> mordu: Consult a lawyer
[21:59:51] <mordu> seriously?
[21:59:55] <ojacobson> seriously.
[21:59:56] <mordu> for an android application?
[21:59:58] <mordu> bah
[21:59:59] <mordu> :(
[22:00:12] <ojacobson> If you're going to write a disclaimer, ask a lawyer what you can and can't disclaim
[22:00:13] <ojacobson> and how
[22:00:41] <mordu> but using the BSD part is ok?
[22:01:01] <Cher> Yes, seriously. If you doubt the BSD license, which is in use for >>20 years already, and rather take the first disclaimer in the first blog that you find, you should better consult a lawyer.
[22:01:08] <ojacobson> Most of the well-known FOSS licenses have had lawyers at them already (at least in the US, though they should be fine in most Berne signatories)
[22:03:34] <mordu> you guys mean the last part on http://opensource.org/licenses/bsd-license.php ?
[22:03:34] <_W_> I tend to go with "this isn't my code, I just wrote it" myself
[22:03:44] <mordu> Starting with "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT"
[22:03:47] <mordu> ?
[22:04:02] *** Kristen207 has joined ##java
[22:05:01] *** BSWolf has joined ##java
[22:05:11] <mordu> why is it in caps btw?
[22:05:16] <mordu> anyone knows that?
[22:05:16] *** Johannes13_ has quit IRC
[22:05:24] <cheeser> ask a lawyer
[22:05:27] <Kristen207> Hey, I have a stupid question. repaint() according to the API will repaint a component. Does that mean that it repaints the entire canvas, or just a single component?
[22:05:48] *** X-Scale has quit IRC
[22:05:50] <_W_> mordu, it is my belief that most of that stuff is cargo cult lawyering - but don't take my word for it, ask a professional
[22:06:20] <mordu> so you guys don't publish software?
[22:06:39] <ojacobson> We do - but we mostly use licenses either (a) written by our respective employers' legal teams or (b) established FOSS licenses
[22:06:40] <cheeser> asking for legal advice on irc is about the dumbest thing you can do. apart from following that advice. 8^)=
[22:06:42] <ojacobson> we don't make up our own
[22:06:48] *** Carnage\ has joined ##java
[22:07:18] <mashedo> Cher: I'm not very good at using interfaces, but how do I avoid writing all four methods in every container, since I would only need the ComponentShown() to send a notification.
[22:07:21] <mordu> cheeser: well, asking about well used disclaimers isnt a bad question tho?
[22:07:24] <_W_> well, I do >< but I am very wierd when it comes to copyrights, so
[22:07:33] <sbalmos> cheeser: Indeed. One should Ask Slashdot!
[22:07:51] <_W_> mordu, what can we tell you though, without consulting *our* lawyers?
[22:08:51] <mordu> So, for all these Android and iphone developers, im pretty sure they havent hired a lawyer. Are they living dangerously?
[22:09:11] <cheeser> probably. but none of this has anything to do with java so please take it elsewhere.
[22:09:18] <ojacobson> I suspect the short answer is that attempts to disclaim liability for basic merchantability are basically useless
[22:09:28] *** vanguard has joined ##java
[22:09:29] <mordu> cheeser: ok
[22:09:33] <ojacobson> so they're not living any more dangerously than any other small vendor (i.e., low probability, high screw factor)
[22:10:12] <mashedo> Cher: Could I make an abstract super class to all container classes implementing the interface and extending javax.swing.JPanel as all of my containers currently do? since a class can't extend to more then one "class"
[22:10:24] *** ivenkys_ has joined ##java
[22:11:14] <mashedo> Or is it just easier to write all four methods in all the container classes
[22:11:22] <vanguard> I use Java for a couple years now and find it quite good, but when I am in #c++or #python, everybody laughs about java -- is it really that bad?
[22:11:34] <dmlloyd> no, it's fine
[22:11:35] <Cher> mashedo: No don't implement the interface in the containers :/
[22:11:41] <Lone_Rifle> it depends
[22:11:42] <cheeser> vanguard: some people have small penises and overcompensate.
[22:11:43] <dmlloyd> we always laugh about C++ and python
[22:11:48] <cheeser> see?
[22:11:48] <cheeser> 8^)=
[22:11:49] * dmlloyd *ahem*
[22:11:51] <Rupan> wyvern`: I finally figured it out
[22:11:53] *** MichealH has quit IRC
[22:11:57] <wyvern`> Rupan, oh? what was it
[22:12:12] *** ivenkys has quit IRC
[22:12:31] <Lone_Rifle> to be frank, there are many arguments for and against each language/etc
[22:12:36] <Cher> mashedo: You want only one instance of that event listener. Rather implement it in the class where you want to process the event that a different container is shown.
[22:12:39] <Lone_Rifle> just pick the best tool for the job
[22:12:59] *** Midir has quit IRC
[22:12:59] *** balooo has quit IRC
[22:13:05] <Rupan> wyvern`: the RSA signatures are stored in some sort of proprietary ASN.1 encoding. Sun's KeyTool.java had the magic bits to understand the format and dump the contained certificates in PEM format
[22:13:09] <Lone_Rifle> vanguard: what do the C++ people say anyway?
[22:13:14] <wyvern`> Rupan, wow, that's lame
[22:13:22] <wyvern`> why the hell would you do that? DER is already bad enough
[22:13:30] *** VonNaturAustreVe has joined ##java
[22:13:44] <vanguard> Lone_Rifle: slow, proprietary, no pointer arithmetics
[22:14:02] <wyvern`> haha.
[22:14:13] <Rupan> wyvern`: my thoughts exactly.
[22:14:13] <wyvern`> because aliasing is fun and good for security!
[22:14:14] *** shaunren has joined ##java
[22:14:20] <vanguard> dmlloyd: why do you laugh about python? I use it for two weeks and really like it to far
[22:14:39] <Rupan> wyvern`: I had to write a custom tool to do the job using code from KeyTool, since it can't so it natively (apparently)
[22:14:48] <wyvern`> Rupan, :(
[22:14:57] <Rupan> yeah, super lame
[22:15:03] <Rupan> but I've got my X.509 certs now :)
[22:15:05] <wyvern`> i just went through an epic trail of JKS/PKCS12 sadness in SunJSSE recently so I feel your pain
[22:15:24] *** SuperHark has joined ##java
[22:15:40] <Lone_Rifle> vanguard, I personally can live without pointer arithmetic
[22:15:41] <Cher> Every language has its pros and cons. I don't see a point in being religious about Java vs. Foo - even though I like Java very much. Programming languages come and go - slowly, but still.
[22:15:56] <cheeser> yeah. it's retarded.
[22:15:57] <Lone_Rifle> vanguard: you might find that the perf gap between Java/C++ has closed a bit
[22:16:00] <dmlloyd> vanguard: I'm just making a point. I actually don't give a crap about python.
[22:16:10] <dmlloyd> Lone_Rifle, yeah, C++ is catching up :)
[22:16:16] *** noobie25 has joined ##java
[22:16:23] <cheeser> heh
[22:16:27] <vanguard> Lone_Rifle: pointer arithmetic is where most of my C++ error come from in first place.
[22:16:36] <Lone_Rifle> dmlloyd: I can't tell if you're being funny or serious
[22:16:44] *** SuperHark is now known as MichealH
[22:17:09] <Lone_Rifle> dmlloyd: given that ppl might be working out how to be more productive in c++
[22:17:19] <noobie25> can someone tell me some possible "test cases" for a String Input in java?
[22:17:23] <Lone_Rifle> vanguard: it has its place
[22:17:32] <vanguard> other question: I have a game which overwrites a JPanel's paintComponent method and paints everything there. It is really slow given that it is only a silly 2D game. Is there some way to make that faster?
[22:17:48] <Cher> noobie25: Just log this channel? What's the use cases for your test cases?
[22:17:56] <Lone_Rifle> ~profiler
[22:17:57] <javabot> a profiler is a tool to find performance bottlenecks. VisualVM is included in JDK nowadays and is great for a free profiler; jprofiler and jprobe cost money (jprofiler has a free eval period). Some more are listed here: http://javafaq.mine.nu/lookup?169
[22:18:50] <noobie25> Cher: Just to validate that they are indeed a string and valid.
[22:18:54] <bearded_oneder> vanguard: my advice; exploit the great tools the language holy wars produce to your advantage, but be tool agnostic. use the tool that best fulfills the project's specs and satisfies it's budget.
[22:19:04] *** RobotCow has joined ##java
[22:19:15] *** drindt has quit IRC
[22:19:22] <Cher> noobie25: As in binary data that may or may not be a String?
[22:19:38] <noobie25> Cher: I actually have c++ background, but this is possibly a java interview question I may be asked for a QA position.
[22:20:09] <Cher> noobie25: Define "String Input".
[22:20:44] *** pipeep has joined ##java
[22:21:00] <Cher> noobie25: And do you really think you can "trick" interviews and companies by trying to guess their questions upfront and digging out specific answers? ;-D
[22:21:15] <noobie25> Cher: I think the question is very broad...., but I think String Input will be defined as "what is passed in as a parameter".
[22:21:44] <noobie25> Cher: No. But i'd like to understand what the question was trying to state.
[22:21:47] *** pist0l-fish has joined ##java
[22:22:14] <Cher> noobie25: That's still not very specific. Do you mean parameter in the sense of command line argument, in the sense of method argument or in some different meaning?
[22:22:39] <Lone_Rifle> vanguard: perhaps a crucial aspect of the whole Java/C++ argument is the GC
[22:22:49] <noobie25> Cher: So given a binary number as a string ...ie: 00011010, a possible test case would be validate binarynumber as an integer.
[22:23:07] <noobie25> Cher: Method argument......
[22:23:29] <Lone_Rifle> vanguard: if you understand what GC does and how (if!) it affects perf,
[22:23:33] <noobie25> Cher: this will be more for unit testing.
[22:23:44] <Cher> In that case I wouldn't validate it myself, I would rather use the API...
[22:23:45] <Lone_Rifle> vanguard: then you'll be better able to objectively compare the langs
[22:24:51] <noobie25> Cher: Well, given that there is no API written yet..... or we use some standard one like junit.
[22:25:14] <Cher> Good test cases always are: null String, empty String, extremely long String, Strings with "strange" characters like non-ASCII chars and control chars... But that's not specific to Java. That's just generic testing.
[22:25:46] <noobie25> Cher: sounds same like what i would check in c++
[22:25:49] <Cher> You find the equivalence classes (don't know if that's the correct English term, I hope you can still understand it), and you guess some destructive samples.
[22:25:57] <vanguard> Lone_Rifle: I thought C++ had a GC as well, which frees everything after leaving a block like {}
[22:26:02] <vanguard> other question: I have a game which overwrites a JPanel's paintComponent method and paints everything there. It is really slow given that it is only a silly 2D game. Is there some way to make that faster?
[22:26:14] *** Muzzy has quit IRC
[22:27:05] *** LyQuid has quit IRC
[22:27:28] <noobie25> Cher: I think you are right. The question is more of a generic testing question ... and i was thinking it was strangely tied to something else.
[22:28:34] <Cher> noobie25: What's also good is Strings with code points beyond char - where the actual character is represented by an int value, and Java internally codes this in UTF-16 as far as I understand.
[22:29:23] <mashedo> Cher: I'm sorry for being a newbie, but I've implemented the component listener to the "listener class", How do I connect it to the components so that the ComponentShow() will fire every card change?
[22:29:27] <wyvern`> Cher, "surrogate pair" is what you're thinking of.
[22:29:41] *** fuzzygroove has left ##java
[22:29:52] <Cher> mashedo: addComponentListener().
[22:30:07] <Cher> wyvern`: Eh! Stop reading my mind! It's private! ;-D
[22:30:22] <wyvern`> JMS MessageListener question -- I'm not seeing in the Javadocs what the threading model is when you have many MessageListeners each attached to a different MessageConsumer
[22:30:28] <wyvern`> Cher, :)
[22:30:51] <noobie25> Cher: I think each char has their equiv ascii character ...and the string really just an array that allocates their order.
[22:31:25] <noobie25> Cher: I'm not sure if it is UTF-16, however ...
[22:31:27] <wyvern`> The internal encoding of Java is UTF-16, but this isn't really exposed
[22:31:30] *** Frostix has quit IRC
[22:31:36] <Cher> noobie25: Erm - no. Of all possible code points, only 128 have equivalent ascii chars, of which 33 are control chars...
[22:31:53] <Cher> noobie25: The vast majority of code points is (far) beyond ascii.
[22:32:00] <wyvern`> 2^32 - 128 = a lot
[22:32:43] <noobie25> thanks :).
[22:33:09] <wyvern`> speaking of 'a lot': http://hyperboleandahalf.blogspot.com/2010/04/alot-is-better-than-you-at-everything.html
[22:33:34] *** kibibyte has quit IRC
[22:33:54] <Busata> the alot monsterrr1
[22:34:24] <pist0l-fish> i am using apache ant to compile java project, and using <jar> to make a distributable. problem is, i have some libraries (i.e. other jar files) that need to be included in my jar file. how can i achieve this?
[22:35:05] <wyvern`> pist0l-fish, in maven you could use shade or assembly. fatjar and onejar are other tools.
[22:35:35] *** asraniel has joined ##java
[22:35:41] <pist0l-fish> ah, i am using ant, however
[22:36:33] <asraniel> hello, is it possible to find out the name of the jar file of my java application (from the code)? I want to create a updater for my application that replaces the current jar
[22:37:03] <wyvern`> asraniel, probably easier to just create a new jar that's earlier in the classpath
[22:37:54] *** jtheuer has quit IRC
[22:38:00] *** Busata has quit IRC
[22:38:04] *** Symbi0nt|GER has quit IRC
[22:38:06] <Cher> asraniel: For all I know about Windows, this will fail, at least up to XP. For Vista and Windows 7 I don't know. The reason: You cannot write a jar from which you're actually running classes. You'd need at least two separate .jars or a batch around it.
[22:38:36] <Cher> asraniel: I've experienced this when developing the built-in updater for Gridarta (a map editor for the Crossfire and Daimonin MMORPGs).
[22:38:38] *** new2net has joined ##java
[22:39:06] *** vanguard has left ##java
[22:39:20] <Cher> asraniel: However, the .jar file can be found via the ClassLoader. Check if it's a URLClassLoader and get the URLs. This should include your .jar.
[22:40:43] <asraniel> Cher: thanks for the info
[22:40:51] <Cher> asraniel: in short: ((URLClassLoader) getClass().getClassLoader()).getURLs()[0]
[22:41:18] <Cher> asraniel: Of course with the correct instanceof checks, and looping on the array.
[22:41:23] <asraniel> Cher: thank you even more :) i'm probably going to download in a seperate file, and having the startup batch/sh file do the swap
[22:41:57] <Cher> asraniel: On POSIX, no need for a separate file to do the swap. Just write the new jar and restart the Java program.
[22:42:35] <new2net> java time :D
[22:43:15] *** fisk_ has quit IRC
[22:43:29] <asraniel> Cher: hm, two codepaths.. not sure about that. but easier
[22:43:50] *** Dux has joined ##java
[22:44:05] <asraniel> Cher: while i'm at it, do you know if there is a way to "restart" my application? my plan is to tell the user to do it, but if i could do it in an automatic way, that would be better
[22:44:19] <Cher> asraniel: Iirc you can try writing to the .jar, and if it fails, you know you're on Windows ;-D
[22:44:21] <Dux> asraniel: wrapper
[22:44:26] <mashedo> Can you use "switch" to go through event.getComponent()? ex. switch(event.getComponent()); case "card1"; case "card2"; etc?
[22:44:32] <Cher> asraniel: I'd tell the user to restart.
[22:45:32] <asraniel> Cher: thx :) yeah i was thinking about the trying and failing :)
[22:45:39] <shiranpuri> mashedo: you can't switch on a string in java
[22:45:46] <wyvern`> until java 7 :)
[22:45:51] <Cher> mashedo: You can switch on a String with Java 7 and newer.
[22:46:25] *** EnginA has quit IRC
[22:47:11] <mashedo> ahh ok, good to know :)
[22:47:14] <wyvern`> java 7 is expected middle of the year or so, right?
[22:47:18] <ojacobson> A component is not a string, though
[22:47:22] <ojacobson> so still no
[22:47:28] <ojacobson> why not give each component its own listener, and avoid the switch entirely?
[22:47:32] <ojacobson> (giant if block)
[22:47:40] <Cher> mashedo: Depending on your application, you could do this: Use Java 7, use distinct component names, and switch on the names.
[22:47:54] *** ff1959 has quit IRC
[22:48:08] *** Carnage\ has quit IRC
[22:48:23] <shiranpuri> could use a hash table...
[22:48:30] <Cher> mashedo: However, what I would do if the cases make sense and are different: I would put each case into a Command object, put my components and commands in a Map<Component, Command> and just invoke map.get(event.getComponent()).run() or so.
[22:48:34] *** matsebc has quit IRC
[22:49:02] <Cher> mashedo: What shiranpuri said, I just consumed more bandwith for the same facts ;-)
[22:50:16] *** qeed has joined ##java
[22:50:18] <wyvern`> looks like oracle says jdk7 will be out July 28th.
[22:50:28] <mashedo> Cher: shiranpuri: I have never done that and got no clue on how to do it
[22:50:29] <Cher> That's 6 days late.
[22:51:23] <qeed> hello is there anyway to coerce java scanner to read everything within a quote and parse it backslashes too? something like 'abc \' de' i know there is usedelimiter, but i cant seem to make a proper regex for it?
[22:51:49] <Cher> mashedo: To get a clue, you could start reading the docs of java.util.Map.
[22:52:07] <mashedo> ojacobson: not quite sure what you mean, I'll probably stick to the huge if block at the moment.
[22:52:18] <mashedo> Cher: will do that
[22:52:18] <ojacobson> mashedo: What is this, an ActionListener for a bunch of buttons?
[22:52:56] <Cher> ojacobson: He's doing CardLayout, and for some reason not known to me, wants to do something when the card's changed, depending on which card is shown then.
[22:53:49] *** Lone_Rifle has quit IRC
[22:54:37] <Cher> mashedo: If you use swing, there's a third option. You could use putClientProperty() on your Containers if they're Swing components. You could use an Integer property value, and then switch on that.
[22:54:52] *** Wicked has quit IRC
[22:55:10] *** X-Scale has joined ##java
[22:55:24] <mashedo> let me explain then, I got a global navigation bar, wich has different buttons disabled depending on wich card currently being shown.. I can add that I'm doing this in netbeans frameworks, not me favorite IDE
[22:55:53] <mapreduce> One ActionListener per button.
[22:56:09] *** xingped has joined ##java
[22:56:10] <mapreduce> No switch required.
[22:56:31] *** Wicked has joined ##java
[22:56:34] <Cher> mapreduce: Which will exactly help in which way in disabling the buttons depending on the current card of the CardLayout?
[22:56:52] <xingped> Question: Can anyone explain to me how to use or include an external jar in a compiled/exported jar file from Eclipse?
[22:57:25] <mapreduce> Cher: There's no need to show controls that can't be used.
[22:57:33] <mashedo> There is more ways to change cards than the navigation bar, otherwise it would have been easy
[22:58:59] <Cher> mapreduce: Technically, you're right. From a UI design and user perspective, I wouldn't want my navigation bar's address field to change size only because I change in history between the last and not-last elements.
[22:59:15] <Cher> mapreduce: I prefer if buttons I cannot use temporarily just "go grey".
[22:59:38] <Cher> mapreduce: That's also the standard behaviour of most applications.
[22:59:41] <mapreduce> I didn't say anything should change size.
[23:00:13] <mapreduce> Cher: Chrome's forward and back buttons behave how you describe.
[23:00:20] *** scruz has joined ##java
[23:00:21] *** Pawnee has joined ##java
[23:00:25] *** tigger0jk has joined ##java
[23:00:40] <mapreduce> Its context menus do not.
[23:00:56] <scruz> hi
[23:01:06] <Cher> mapreduce: Yes, they do. The forward control in the navigation bar that can't be used because I'm on the top of the history is still shown, but disabled.
[23:01:14] * scruz doffs nonexistent hat to mapreduce
[23:01:34] *** epalm has quit IRC
[23:02:03] <mapreduce> Cher: Yes, I said those behave as you describe.
[23:02:08] <Cher> mashedo: For the buttons, btw., if you're using ActionListener right now, I recommend using Action instead.
[23:02:17] <new2net> if a nested class satisfies an interface the parent implements will the type checker still stop my rampage?
[23:02:55] *** rjohnson19 has joined ##java
[23:02:58] <mapreduce> new2net: The compiler doesn't treat that case specially.
[23:03:31] <Cher> new2net: It shouldn't because the implementation of the interface at the parent could be "younger" than the implementation of the interface at the subclass.
[23:03:55] *** sbalmos has quit IRC
[23:04:12] <mapreduce> What subclass?
[23:04:13] <Cher> new2net: This situation would be considered a compatible change to the superclass.
[23:04:43] <asraniel> Cher: a somehow related question. i friend of mine suggested that i use a simple jnlp file to launch my application, that way i don't have to worry about how to upgrade, did you consider this for your application?
[23:04:48] <mashedo> Cher: I'm trying to use the component listener and a huge if block to check wich one triggerd the action
[23:04:55] <Ruudjah> I'm reading this -> http://www.kdgregory.com/index.php?page=java.enum . In the last paragraph, he says there's still a role for static ints. Can't static ints be replaced by concrete classes?
[23:05:02] <Cher> asraniel: Oh yes, definitely!
[23:05:33] <mapreduce> Ruudjah: Interop with stuff that uses bitmasks.
[23:05:51] <Cher> mashedo: A ComponentListener to findout the button that triggered an Action? Or did I misunderstand something?
[23:05:53] <scruz> Ruudjah: imo, you can replace static ints with enums, but what mapreduce said
[23:06:13] <asraniel> Cher: did you use it, and if not, why not? my only worry is that sometimes my user does not want to upgrade
[23:06:35] <new2net> hmm..I'll have to experiment with countable, thats an easy one to implement
[23:06:36] <Cher> asraniel: The only reason why some of my UI apps are not yet Webstart is that I simply haven't converted them yet. I should do so, though.
[23:06:47] <mapreduce> Ruudjah: He didn't say 'ints' in that paragraph.
[23:06:49] <scruz> mapreduce: i suppose it makes more sense to make a derived class an entity rather than its parent, doesn
[23:06:55] <Cher> asraniel: If the user does not want to upgrade - well, isn't that the user's choice?
[23:06:56] <scruz> doesn't it?
[23:07:14] <mapreduce> scruz: Dunno, what's an entity?
[23:07:36] <scruz> orm mapping class. maps directly to a relational table
[23:08:00] <asraniel> Cher: can the user refuse to upgrade with webstart? have to test it
[23:08:01] *** nucc1 has quit IRC
[23:08:52] <scruz> like i have a users table, and a User class that maps to that table
[23:09:14] <mashedo> Cher: hmm maybe I have missunderstood the use of component listener, but I have added it to every "card"container, so when they change they trigger componentshown. And in component shown I got a big if block compairing the event.getcomponent with my different components
[23:09:39] <Cher> mashedo: Ah I thought you were talking of the Actions of the buttons in your navigation bar.
[23:09:54] <Cher> asraniel: Iirc he can, and imo he should be able to refuse to upgrade with webstart. Everything else means the user looses control over her machine.
[23:11:10] <asraniel> Cher: exactly. a quick test shows that at least with a default webstart file i can't choose if i want to upgrade or not. but perhaps there is a option somewhere. and i need to get rid of the webstart java splash ;)
[23:11:15] <bearded_oneder> asraniel: have you http://download.oracle.com/javase/tutorial/deployment/ ?
[23:11:55] *** Glavata has quit IRC
[23:11:55] *** nchaimov has quit IRC
[23:11:55] *** Wyzard has quit IRC
[23:11:55] *** ztj has quit IRC
[23:11:55] *** nolsen01 has joined ##java
[23:12:00] *** ztj has joined ##java
[23:12:30] <bearded_oneder> asraniel: and http://www.oracle.com/technetwork/java/javase/tech/articles-jsp-139072.html#deployment
[23:12:40] <nolsen01> I'm learning about thread. I have a very simple class but am getting a NullPointerException. Can someone help? http://pastebin.com/4mhPnWR7
[23:12:44] <Ruudjah> mapreduce: interop using bitmasks? huh?
[23:12:49] <scruz> the issue now is that instead of just User, i have WebUser and LocalUser
[23:12:54] *** VonNaturAustreVe has quit IRC
[23:13:10] <mashedo> is the warning "Leaking this in constructor" anything to worry about.. ?
[23:13:18] <mapreduce> Ruudjah: Some protocols define integer constants, e.g., we have 0xDECADE11 in some stuff.
[23:13:19] <scruz> Ruudjah: some native C-based code uses bitmasked int values
[23:13:20] <wyvern`> mashedo, it's a thread safety problem
[23:13:25] <Ruudjah> Isn't a concrete class a constant?
[23:13:29] <mapreduce> That's not a bitmask I suppose.
[23:13:35] *** io2 has quit IRC
[23:13:42] <Ruudjah> ah
[23:13:47] <mapreduce> Um, we have a mask of what cameras there is data for in a file.
[23:14:03] <Cher> mashedo: Yes, it is. If your constructor throws an exception, you might expect that your object was not constructed. However, it is, and even though your constructor aborted, the object can be referenced and used through the leaked this reference.
[23:14:08] *** sigtau has joined ##java
[23:14:12] <scruz> Ruudjah: if bit 1 is set, this should happen, if bit 3 is set, that should happen, etc
[23:14:13] <mapreduce> 5 would mean "data from cameras 1 and 3"
[23:14:14] <Ruudjah> Right, but I am mainly designing new code. I don't need nor need to consider this.
[23:14:27] *** johntramp has joined ##java
[23:14:28] <scruz> then do enums by all means
[23:14:29] *** johntramp has left ##java
[23:14:31] <Cher> nolsen01: r is null. You haven't initialized it.
[23:14:33] <wyvern`> cher, to say nothing of the problem that initialization guarantees don't take effect until after the ctor finishes
[23:14:39] <Ruudjah> In that case, I can replace enums by class instances, rright?
[23:14:44] <mapreduce> Yeah, new code never has to interoperate with old code. :)
[23:14:50] <Ruudjah> const < enum < interface + concrete classes
[23:14:51] <asraniel> bearded_oneder: thx for the links
[23:14:52] <mapreduce> Ruudjah: In Java, you always can, yes.
[23:15:03] *** pist0l-fish has quit IRC
[23:15:04] <mapreduce> But why do you want to?
[23:15:15] *** johntramp has joined ##java
[23:15:18] <nolsen01> Cher: Thank you
[23:15:24] <Cher> wyvern`: Yes, just another reason why being careful passing "this" away in the constructor :)
[23:15:24] *** Wyzard has joined ##java
[23:15:57] <scruz> Ruudjah: unless i'm missing something about your situation, it seems you're not getting the point of enums. i believe they're meant to be named constants
[23:16:01] <Ruudjah> 1. Classes are cheap and "i feel" more OO: make an object. 2. enums are often spelled CAPS
[23:16:23] <wyvern`> another nice thing about enums is that you can switch on them.
[23:16:24] <mapreduce> "more OO" is not a goal, more of a gaol.
[23:16:40] <scruz> and what wyvern` said, too
[23:16:43] <Ruudjah> scruz, yes, I know, but is not java about making classes & objects?
[23:16:49] <mapreduce> Enum members are objects.
[23:16:59] <scruz> java is about getting stuff done
[23:17:11] <scruz> or at least, the point to using java, anyway
[23:17:16] <mashedo> Cher: wyvern`: What do you do to avoid the error/safty problem?
[23:17:22] <dmlloyd> good thing we have all these people here to tell us what java is about!
[23:17:25] <Ruudjah> enum gender { M, F} I can also make interface enum
[23:17:39] <wyvern`> mashedo, try using a static factory method to register the newly constructed object isntead of doing it all in the ctor
[23:17:46] <nolsen01> How do you decide whether you should initialize in the constructor or not?
[23:17:50] <Ruudjah> with Male as concrete class implementing it
[23:17:52] <Cher> mashedo: Design the depencies in the code so that this needn't passed away. And if it can't be avoided, be extremely careful.
[23:17:52] <mapreduce> And feel free to ignore conventions if you don't like ALL_CAPS.
[23:18:03] <Ruudjah> now I don't need switch
[23:18:21] <mapreduce> Ruudjah: I use enums but no switch statements.
[23:18:38] <scruz> enums are probably clearer than what you're trying to do
[23:18:45] <Ruudjah> I just used this in a project, and now I have a lot more concrete classes. But I can do much more stuff with them.
[23:19:22] <scruz> especially if you're going to have to check what type (read: implementation) the concrete classes are
[23:19:41] <Ruudjah> e.g.
[23:19:42] <scruz> mapreduce: did you get the point i was trying to illustrate?
[23:20:05] <mapreduce> enum Gender { Male { Gender preferredMate() { return Female; } }, Female { Gender preferredMate() { return Male; } }; abstract Gender preferredMate(); }
[23:20:34] <Sou|cutter> mapreduce: you're missing some corner cases! ;)
[23:20:34] *** asraniel has quit IRC
[23:20:50] <mapreduce> It's ok, I don't live in SF.
[23:20:57] <Ruudjah> haha
[23:20:58] <scruz> using the User class, i mean
[23:21:00] <scruz> lol
[23:21:04] * Sou|cutter grins at mapreduce
[23:21:15] <Ruudjah> I read Diaspora switched their gender field to a textfield from boolean
[23:21:20] *** hyppias has quit IRC
[23:21:23] *** X-Scale has quit IRC
[23:21:39] <Sou|cutter> Ruudjah: I usually go with M/F/unknown
[23:21:53] <Ruudjah> Anyways, I have an example I'd like to share
[23:21:59] <scruz> Ruudjah: that's one case where it makes a great deal of sense to use an enum
[23:22:00] <new2net> Where can I learn the difference between <T> and <E>
[23:22:05] <mapreduce> Sex: M/F/Yes Please!
[23:22:11] *** cbrock has quit IRC
[23:22:20] <Ruudjah> Consider Settlers of Catan (I hope you guys know the game)
[23:22:22] * scruz shakes his head at mapreduce
[23:22:23] <Sou|cutter> new2net: they are the same
[23:22:26] <mapreduce> new2net: The names are arbitrary.
[23:22:38] <new2net> <N> is what I will use then.
[23:22:39] <Ruudjah> Numerous implementations use an enum for the resources (timber, wheat, ore, clay, sheep)
[23:22:43] <cheeser> ~~ new2net generics
[23:22:43] <javabot> new2net, For a tutorial on generics, please see http://javachannel.net/wiki/pmwiki.php/Main/Generics
[23:22:44] <shiranpuri> mapreduce: you get a compile error instead :p
[23:22:49] <Sou|cutter> new2net: go for it
[23:22:53] <Ruudjah> I use an interface for that, along with an abstract base class
[23:23:03] <Ruudjah> and a concrete type for each resource type
[23:23:07] <mapreduce> shiranpuri: For what?#
[23:23:24] <Ruudjah> Since now I have first class classes
[23:23:38] <new2net> ty cheeser. You read my mind
[23:23:55] <Ruudjah> My options on using them in the system are suddenly exploded
[23:23:58] <mapreduce> Java doesn't have first-class classes, unless you count Class<T>
[23:24:05] <shiranpuri> mapreduce: your static checker choking on yes please, it doesn't compute for it :P
[23:24:17] <Sou|cutter> Ruudjah: I shy away from enums in general.. they're just not very flexible
[23:24:21] <scruz> Ruudjah: if you're going to implement methods, you can do the concrete classes thing. if all you want is values, enums are a better way to go, imo
[23:24:28] <dmlloyd> they're really good at what they do
[23:24:48] <scruz> and anyway, enums are basically subclasses of Enum<T>
[23:24:48] <mapreduce> scruz: Why avoid enum if they have methods?
[23:24:56] <Ruudjah> but refactoring enums requires refactoring all code using it
[23:25:13] <Ruudjah> like a lot of boring unnecesary stuff
[23:25:19] <Cher> I like methods in enums.
[23:25:25] <scruz> no particular reason. except enums are implicitly final
[23:25:30] <mapreduce> Ruudjah: How does that differ from classes?
[23:25:36] <mapreduce> scruz: Great!
[23:25:37] <Ruudjah> So I shy away at using enums _at all_, since I never know if I need to extend the enums
[23:25:42] <scruz> no public constructors
[23:25:49] <mapreduce> Great!
[23:26:10] <mapreduce> Do you shy away from using double for the same reasons?
[23:26:30] <Ruudjah> I always wrap it in a class
[23:26:41] <wyvern`> oh boy.
[23:26:49] <Ruudjah> as everyone does :)
[23:26:56] <mapreduce> Military Typing.
[23:27:38] <Ruudjah> wrap -> composite
[23:27:51] <mapreduce> Ruudjah: http://syntaxfree.wordpress.com/2006/12/24/static-vs-dynamic-typing-do-what-thou-wilt/
[23:28:12] *** matsebc has joined ##java
[23:28:21] <mapreduce> Unfortunately the examples are in Haskell, but I expect you can grasp the point.
[23:28:56] *** eidolon has quit IRC
[23:30:39] *** echo_mirage has quit IRC
[23:30:42] *** r0bby has joined ##java
[23:30:51] *** echo_mirage has joined ##java
[23:30:59] <Ruudjah> mapreduce: After skimming 4 mins over it, I'm not sure I grasp it
[23:31:16] *** yitz_ has joined ##java
[23:31:35] *** Kamaran has quit IRC
[23:31:42] *** echo_mirage has quit IRC
[23:31:47] <yitz_> What would be the easiest/best way to time a code segment? System.currentTimeMillis() deltas?
[23:32:01] <Skyec> use joda time
[23:32:04] *** jdolan has quit IRC
[23:32:14] <Skyec> http://joda-time.sourceforge.net/
[23:32:16] <wyvern`> getting time measurements is hard to do well
[23:32:30] <wyvern`> cliff click has a very good presentation on benchmarking java
[23:32:30] <scruz> i think he's trying to profile an op
[23:32:44] <mapreduce> yitz_: System.nanoTime()
[23:33:02] <Skyec> oh, my bad
[23:33:09] <yitz_> h. o ons g n
[23:33:29] <mashedo> got my navigationbar working now, I really appreciate the help, still got a small problem with "Leking this in constructor", tried making some static method but that just gave alot of "non-static referance" errors. The line giving me the "leaking this in contructor" is addComponentListener(this);
[23:34:19] <mapreduce> Ruudjah: It demonstrates the unreadability you cause yourself if you insist on giving every variable a unique type.
[23:34:28] <yitz_> t s stalker
[23:34:38] <yitz_> tesps/pt
[23:34:40] <yitz_> stakear
[23:34:53] <mapreduce> yitz_: Wrong channel.
[23:35:10] <Ruudjah> mapreduce: I only have the feeling the readability increased when I made a type for everything
[23:35:28] <scruz> Ruudjah: whatever works for you
[23:35:35] *** _yitz has joined ##java
[23:35:40] <mapreduce> Ruudjah: Because you can end up converting between types a lot.
[23:35:50] <_yitz> Yay. Client's messed up :S Sorry for ^^
[23:35:59] <Ruudjah> Isn;t that only in the implementation of that type?
[23:37:20] <mapreduce> mashedo: Make a separate class for the ComponentListener.
[23:37:51] <mapreduce> addComponentListener(new ComponentListener() { methods here }); for example
[23:37:54] *** realtime has joined ##java
[23:38:07] <new2net> assertTrue(A "parameterized" type == a "generic" && A "raw type" == a primitive); //?
[23:38:20] <dmlloyd> what?
[23:38:20] <wyvern`> new2net, no
[23:38:23] <mapreduce> new2net: fail
[23:38:33] <wyvern`> Map is a raw type. int is a primitive.
[23:38:54] *** jjido has joined ##java
[23:39:27] <wyvern`> Map<Foo, Bar> has its generic parameters bound. Map does not.
[23:39:41] *** r0bby has quit IRC
[23:39:55] <scruz> g'night folks.
[23:39:58] *** echo_mirage has joined ##java
[23:40:03] *** echo_mirage has quit IRC
[23:40:08] <mapreduce> class Map<K, V> {} declares a parameterised class. It can be used raw or parameterised.
[23:40:09] <nolsen01> Don't JFrames have a setBackground method?
[23:40:38] <mapreduce> nolsen01: What does your compiler think on the matter?
[23:40:41] *** scruz has quit IRC
[23:41:01] *** Serendib has joined ##java
[23:41:21] <nolsen01> I haven't compiled it yet but Netbeans is saying "Cannot find symbol."
[23:41:58] <mapreduce> Have you written your own class named JFrame?
[23:42:13] <nolsen01> No, I extended JFrame
[23:42:16] *** yitz_ has quit IRC
[23:42:25] <mashedo> mapreduce: I'l try that, may I ask how all of you have learned java, through school?, by your own?
[23:42:28] <nolsen01> Oh my
[23:42:31] <nolsen01> No i didn't
[23:42:33] <nolsen01> I'm sorry
[23:42:45] *** fisted has quit IRC
[23:42:46] *** sphenxes has quit IRC
[23:42:55] <mapreduce> mashedo: Originally through the following:
[23:42:56] *** saml has quit IRC
[23:43:00] <mapreduce> ~tutorial
[23:43:01] <javabot> Please see http://download.oracle.com/javase/tutorial/
[23:43:41] <mapreduce> I'd been programming for 13 years by that point though, which probably helped.
[23:44:09] <wyvern`> yeah, the java tutorial is really good
[23:44:11] <new2net> "Generics help improve readability"... next page.... <T extends Object & Comparable< ? super T >> T Collections.max(Collection< ? extends T >)
[23:44:31] <Sou|cutter> new2net: that actually makes a lot of sense
[23:44:35] <wyvern`> new2net, would you rather need to cast things?
[23:44:48] <Sou|cutter> new2net: once you understand generics more, you will be able to make sense of that
[23:45:08] <tjsnell> the problem is your stupid not smart like us
[23:45:16] <wyvern`> haha, mean
[23:45:28] <tjsnell> no, just stating the implied
[23:45:34] <Sou|cutter> tjsnell: if you're not going to add to the conversation, you can stfu
[23:45:41] <tjsnell> oh boo hoo
[23:45:42] <Sou|cutter> I was not implying that
[23:45:47] <tjsnell> don't go quit irc in a huff now
[23:46:13] <mashedo> new2net: atleast your smarter than me, atleast when it comes to java :)
[23:46:22] <Sou|cutter> tjsnell: anything to get away from your noxious attitude
[23:46:28] <tjsnell> coolio
[23:46:42] <tjsnell> if it helps that smug feeling you like
[23:47:22] *** Alkhi has joined ##java
[23:47:25] <new2net> How hard are generics to learn (compared to regex)?
[23:47:42] <tjsnell> loads easier
[23:48:09] <Sou|cutter> tjsnell: this shit is poison to the channel culture. We both know we don't get along on IRC, so why don't we just ignore eachother
[23:48:34] * tjsnell smiles
[23:48:50] *** glcrazy has quit IRC
[23:49:07] <cheeser> i'm with Sou|cutter on this one. no need to bust the newbie's balls.
[23:49:33] <tjsnell> it was a joke
[23:49:47] <tjsnell> but soulcutter is so tightly wound as to be devoid of joy or humor
[23:50:09] <Alkhi> hi! A small newbie question: I wrote code in drjava but school wants it to work in ecplipse and for some reason this perfectly(haha) written code doesnt work :D I dont want anyone to check it but maybe some hints what I am doing wrong
[23:50:12] <Sou|cutter> My buttons have been pushed a lot recently, my saint-like patience has worn thin of late
[23:50:30] <Sou|cutter> apologies for over-reacting
[23:50:32] <cheeser> Alkhi: you shouldn't be using IDEs yet.
[23:50:34] *** fisted has joined ##java
[23:50:39] <tjsnell> you need smaller buttons :)
[23:50:57] <Cher> I wonder what schools throw IDEs on their students...
[23:51:01] <tjsnell> most
[23:51:12] *** elzoog has quit IRC
[23:51:20] <tjsnell> it seems most CS programs are more trade school like
[23:51:40] <wyvern`> Alkhi, while I share the general consensus of "you shouldn't be using an IDE yet", what errors are you getting
[23:52:25] <tjsnell> Alkhi: we all wrote really horrible code at some point
[23:52:37] *** riotz has quit IRC
[23:52:48] <Alkhi> hmm it asks me to run in "Ant build" and then it does nothing
[23:52:54] *** ojacobson has quit IRC
[23:52:59] <mashedo> Cher: My school or more exactly my examinator in a design course is forcing us to use the framework in netbeans, not the best tool if you ask me
[23:53:26] *** eyesUnclouded has quit IRC
[23:53:36] <Cher> mashedo: Oh dear... I feel with you.
[23:53:52] <new2net> I was told to use eclipse. Beats cat > ClassName.java so I've stuck with it
[23:54:16] <tjsnell> barely :)
[23:55:13] <Cher> imo doesn't beat vim -t ClassName.java ;-D but I'm very special about this.
[23:55:19] <tjsnell> heh
[23:55:43] <tjsnell> you don't use and ide cher?
[23:55:52] <new2net> its so - so, cat > ClassName.java allows you to close your eyes and type it all in 1 go or no go. It adds a certain level of what the ACM calls "professionalism".
[23:56:12] <Alkhi> works now, woot
[23:56:16] <new2net> trust me- I'm a professional.
[23:56:18] <Alkhi> had to make new project
[23:56:25] <Alkhi> :P
[23:56:29] <Cher> Well, from time to time I use IntelliJ IDEA. I love its intentions. It is a good addition to Checkstyle, Findbugs and PMD to improve the quality of my source code. IntelliJ IDEA has found lots of bugs in my code.
[23:56:44] <Cher> But I wouldn't use IntelliJ IDEA at all if there wouldn't be IdeaVIM.
[23:57:00] <Sou|cutter> ~start an ide war
[23:57:01] <javabot> Netbeans kicks the living shit out of everything else!
[23:57:05] * tjsnell is currently waiting on IDEA to index the world
[23:57:15] <tjsnell> hence my time to bug Sou|cutter :)
[23:57:45] <Sou|cutter> tjsnell: did you check the idea faq?
[23:57:52] <tjsnell> heh
[23:58:09] <Cher> Also, most of the time I do coding at work, and this is a mixed-language project. The software itself involves Assembly, C and Java. The environment also has batch files, Makefiles, Shell scripts, Perl scripts and XSLTs. Some colleagues use Eclipse, but I've never seen one outperforming me + xterm + bash + vim. :)
[23:58:09] <tjsnell> I've found a way to REALLY screw up IDEA
[23:58:14] * Kristen207 stretches
[23:58:19] <Kristen207> Yay arraylist
[23:58:20] <Kristen207> ;;
[23:58:43] <wyvern`> 10.0.2's package visibility bug is pretty bad :/
[23:58:47] <wyvern`> it made me go back to 10.0.1
[23:58:55] <tjsnell> wyvern`: what is that?
[23:59:26] <wyvern`> context: multimodule project, A depends on B
[23:59:37] <Cher> However, I'd not say that any of the popular IDEs actually is bad. All of them are quite good. Some of the differences are just a matter of taste, and usually if one adds a feature, the others will clone it sooner or later.
[23:59:38] <wyvern`> B's packages and classes show up in 'package view' in A.
[23:59:41] <wyvern`> it doesn't always happen
[23:59:46] <tjsnell> ahh
[23:59:49] <tjsnell> never have seen that
[23:59:50] <tjsnell> odd

   March 7, 2011  
< | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | >