code logs -> 2007 -> Thu, 20 Sep 2007< code.20070919.log - code.20070921.log >
--- Log opened Thu Sep 20 00:00:08 2007
01:11 ReivZzz is now known as ReivClass
02:43 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Z?]
03:00
<@ToxicFrog>
Sweet bouncing jibbly fuck
03:01
<@McMartin>
?
03:01
<@ToxicFrog>
Was Java's threading model created by inimical intelligences that watch us from beyond the veil of reality?
03:01
<@ToxicFrog>
Was it found scrawled in blood on the walls of Rl'yeh?
03:01
<@McMartin>
No. It predates anyone working out how to do it right, though.
03:02
<@McMartin>
In particular, it predates pthreads by about five revisions.
03:02
<@ToxicFrog>
Was it, perhaps, written in dire languages readable only by the mad upon ancient papyrus scrolls recovered from a cursed thread?
03:02
<@McMartin>
Get a version of the API that doesn't include all the deprecated methods, imo.
03:02
<@ToxicFrog>
No-one knows, because of its original discoverers, there are no survivors.
03:02
<@McMartin>
Oh, give me a break.
03:02
<@McMartin>
I write multithreaded code in Java rgularly with no ill effects. *twitch*
03:02
<@ToxicFrog>
Heh.
03:03
<@ToxicFrog>
Using 1.5 here, BTW.
03:03
<@ToxicFrog>
As far as I can tell, all it has some kind of bastard hybrid of a condition variable and a mutex.
03:03
<@ToxicFrog>
Presumably, you are expected to implement other structures on top of that if you need them.
03:03
<@McMartin>
You, uh, are aware of the "synchronized" keyword?
03:03
<@ToxicFrog>
Yes.
03:03
<@McMartin>
Yeah, so, that's a mutex.
03:03
<@McMartin>
A re-entrant one, even.
03:03
<@ToxicFrog>
Yeah, but inside it, you can use wait()/notify()
03:04
<@McMartin>
Yeah, but don't.
03:04
<@ToxicFrog>
Which is where the condition-variable-esque behaviour comes into play.
03:04
<@McMartin>
wait() and notify() are part of Object.
03:04
<@ToxicFrog>
I, err, kind of have to, as I need thread A to start thread B, then block until thread B signals readiness.
03:04
<@McMartin>
If you need Traditional Locks, 1.5 has them in a subpackage.
03:04
<@ToxicFrog>
Normally this is a message pass, but Java doesn't appear to have that.
03:04
<@McMartin>
Also note that condition variables only work when they are also mutex hybrids.
03:05
<@ToxicFrog>
So that makes it a barrier, whoops, doesn't have that either.
03:05
<@McMartin>
Barrier:
03:05
<@ToxicFrog>
So I have main do a synchronized(server) { server.wait(); }, and server do a synchronized(this) { notify(); } when it's ready.
03:06
<@McMartin>
That's ordinary condition variables.
03:06
<@McMartin>
wait() without a mutex barrier like that is a guaranteed race condition, and condition variables can only exist if they're woven into mutexes.
03:06
<@McMartin>
(See also SDL's implementation of them)
03:07
<@ToxicFrog>
Granted.
03:07
<@McMartin>
So, uh, 1.5 also has a subpackage of synchonization classes that I refuse to touch because I don't trust them.
03:08
<@ToxicFrog>
I'm sorely tempted to just write message passing, if I can figure out where to wedge it in.
03:08
<@McMartin>
java.util.concurrent and its subpackages.
03:08
<@ToxicFrog>
Possibly as an interface, then I can just have all of my Threads implement MessagePass.
03:08
<@McMartin>
Which includes BlockingQueue.
03:09 * Vornicus does wonder why the java.util containers aren't threadsafe.
03:09
<@McMartin>
Vorn: Because they aren't atmoic.
03:09
<@McMartin>
atomic
03:09
<@McMartin>
Or rather, operations thereon aren't.
03:09
<@ToxicFrog>
...except, fuck
03:09
<@ToxicFrog>
Interfaces Aren't Mixins.
03:09
<@McMartin>
Mixins are of the devil, anyway.
03:10
<@McMartin>
Give your objects message queues as fields or something so that you don't have name collisions.
03:10
<@ToxicFrog>
Hmm. I guess I can subclass Thread and...yes. That works.
03:11
<@ToxicFrog>
Since all message passes involve thread references anyways.
03:11
<@McMartin>
... wait, how have you not been subclassing thread?
03:11
<@McMartin>
Just using Runnable everywhere?
03:11
<@ToxicFrog>
Well, I mean subclass Thread, and then subclass it further for my actual threads.
03:12
<@McMartin>
Right
03:12
<@ToxicFrog>
...right. Lack of multiple returns for the lose.
03:12
<@McMartin>
I suspect java.util.concurrent.BlockingQueue will provide much entertainment as well, though I haven't used it myself.
03:13
<@McMartin>
Multiple returns are evil and non-object-oriented, so Java no can has.
03:13
<@McMartin>
Anonymously defined inner class with two fields, though, can has.
03:13
<@ToxicFrog>
Yeah. Or just Do It Right and create a Message class.
03:14 * McMartin has a certain tendency to comically overuse anonymous classes.
03:14
<@ToxicFrog>
ISTR anonymous class definitions being hideously ugly.
03:14
<@ToxicFrog>
Otherwise I would be whipping out anonymous-functions-as-Runnables a lot more frequently.
03:14
<@McMartin>
Depends on context.
03:14
<@ToxicFrog>
(the lack of closures also makes them of lesser value to me)
03:14
<@McMartin>
When you're defining, say, iterator() on your custom collcetion it fits in nicely.
03:15
<@McMartin>
What, you haven't defined TFUtil.Applicable yet?
03:15 * Vornicus dislikes Java specifically because of the lack of operator overloads. Which I still don't understand what the hell they were on about, but I guess that's because I've never seen them /really/ misused.
03:15
<@ToxicFrog>
I don't have a util package for Java yet, this is the first time I've used it in ages.
03:15
<@ToxicFrog>
MessagePassingThread will be the first entry in it.
03:15
<@McMartin>
x = new Runnable() { run() { System.out.println("Lolz0rz"); } }; x.run();
03:15
<@McMartin>
If memory serves.
03:16
<@McMartin>
Vorn: iostream tops the list.
03:16
<@ToxicFrog>
Vornicus: C++'s iostream, and Java's String, both abuse them.
03:17
<@McMartin>
String offends me slightly less, but my main objection to String overloading it is that StringBuffer and StringBuilder don't, and they should and String shouldn't.
03:17
< Vornicus>
iostream is pretty bad. String, idunno. Most languages let you do that; I find that languages that use specific operators for string concatenation are rare.
03:17
<@McMartin>
String is bad because Swtring lets you do that and it's O(n^2) to do so.
03:17
< Vornicus>
ah, well
03:17
< Vornicus>
that would be an important point.
03:17
<@McMartin>
The O(n) version requires you use a different class that doesn't understand + or +=.
03:18
<@McMartin>
And which one it is by default changed from 1.4 to 1.5.
03:19
< Vornicus>
heh
03:19
<@McMartin>
Ooh, ConcurrentMap looks nice too.
03:19
<@McMartin>
Too bad my experiments require me to maintain 1.4 compliance. =(
03:19
<@McMartin>
One of the subsystems I'm using won't eat 1.5 code.
03:19
<@ToxicFrog>
Hmm. How do I get a reference to the host Thread?
03:20
<@McMartin>
It's in either System or Runtime.
03:20
<@McMartin>
If you mean "The thread running right now".
03:20
<@McMartin>
But there's a static method that will hand it to you.
03:21
<@ToxicFrog>
Neither System nor Runtime appears to have a method returning a Thread.
03:21
<@McMartin>
OK, hang on, checking the APIs.
03:22
<@McMartin>
I know it's there because PQL uses it.
03:22
<@ToxicFrog>
And yeah, that's what I'm after - Message::Message(Object) needs to know the current thread so that it can tell the destination thread where it came frmo.
03:23
<@McMartin>
Yeah. PQL can bind on "currently running thread" to match patterns of the form "This happens in one thread"
03:23
<@McMartin>
Thread.currentThread().
03:23
<@McMartin>
It's static.
03:24
<@ToxicFrog>
Aha.
03:24
<@ToxicFrog>
Thankye.
03:24 * McMartin has actually never used that one in actual Java code.
03:24
<@McMartin>
Only in raw JVM assembler.
03:24
<@McMartin>
(stop looking at me like that)
03:25
<@ToxicFrog>
It should, I think, lock on the target thread...
03:29
<@ToxicFrog>
...hmm.
03:29
<@ToxicFrog>
Ok, sender needs to block until reciever signals readiness.
03:29
<@ToxicFrog>
Reciever then blocks until sender finishes send.
03:29
<@McMartin>
The Queue won't handle that?
03:29
<@ToxicFrog>
Then sender blocks until until reciever replies, at which point the whole thing happens in reverse.
03:29
<@ToxicFrog>
Oh, right. Forgot to look at that.
03:33
<@ToxicFrog>
....hrm.
03:33
<@ToxicFrog>
I can ask it what its remaining capacity is, but I can't set it.
03:34
<@ToxicFrog>
Aha. But it's implemented by SynchronousQueue, which looks like what I'm looking for.
03:37 Vornicus is now known as Darius
03:40
<@ToxicFrog>
...hmm. Can I downcast in Java?
03:41
<@ToxicFrog>
Or, more generally: Thread.currenThread() returns a Thread.
03:41
<@ToxicFrog>
I need to call MessagePassingThread methods.
03:47
<@McMartin>
Right.
03:47
<@McMartin>
MessagePassingThread t = (MessagePassingThread)Thread.currentThread();
03:47
<@McMartin>
If this is called from, say, the main thread, you should do an instanceof check first.
03:47
<@McMartin>
If the cast fails a ClassCastException is thrown.
03:51
<@ToxicFrog>
Hmm. I wonder if I can get main to automatically be a MessagePassingThread.
03:52
<@ToxicFrog>
Eeeehehehehehehe
03:53
<@ToxicFrog>
class A1 extends MessagePassingThread {
03:54
<@ToxicFrog>
public static void main(String[] argv) { MessagePassingThread main_thread = new A1(); main_thread.start(); main_thread.join(); return; } }
03:56
<@McMartin>
Works for me
03:56
<@McMartin>
That, of course, isn't really main, but close enough.
03:57
<@ToxicFrog>
Yes.
03:57
<@McMartin>
(Wouldn't work for UQM ;_;)
03:57
<@ToxicFrog>
(;.;)
03:57
<@McMartin>
(SDL is picky about non-main threads touching the framebuffer)
04:02
<@ToxicFrog>
;.;
04:02
<@ToxicFrog>
Error communicating with child thread: java.lang.NullPointerException
04:04
<@ToxicFrog>
God forbid the stack trace give me line numbers.
04:04
<@ToxicFrog>
Oh, right, need -g
04:06
<@ToxicFrog>
...right. Need to allocate sendq and replyq in the constructor.
04:07
<@ToxicFrog>
...
04:07
<@ToxicFrog>
aaargh
04:09
<@ToxicFrog>
...
04:09
<@ToxicFrog>
So, apparently
04:09
<@ToxicFrog>
If I have a method send(Message)
04:10
<@ToxicFrog>
And another method, send(Object)
04:10
<@ToxicFrog>
Calling thread.send(null) will resolve to send(Message) and die screaming.
04:12
<@McMartin>
Overloading like that is seriously asking for trouble.
04:12
<@McMartin>
Overloads are *statically* resolve and hinge on how various things happen to have been cast.
04:12
<@ToxicFrog>
Aah.
04:13
<@McMartin>
Java and C++ are not I7.
04:13
<@ToxicFrog>
Presumably, this means that foo(Object bar) { send(bar) } will resolve to send(Object) even if bar is a Message at runtime?
04:13
<@McMartin>
(Or ML.)
04:13
<@McMartin>
That is correct.
04:13
<@McMartin>
It's basically only ever safe to overload like that if send(Object) does a type-check and then either complains or forwards to send(Message).
04:14
<@ToxicFrog>
That's what send(Object) does.
04:14
<@McMartin>
Ah.
04:14
<@McMartin>
In that case, your problem is that the expression "null" is castable to anything.
04:14
<@ToxicFrog>
And it's still not safe, because send(null) calls send(Message), which tries to call SynchronousQueue.put(null)
04:14
<@ToxicFrog>
Which is a runtime error.
04:14
<@McMartin>
Right.
04:15
<@McMartin>
"Most specific statically resolvable type" is the overload rule, IIRC.
04:15
<@McMartin>
But you'd better nullcheck in send(Message), not send(Object).
04:15
<@ToxicFrog>
Or rewrite the API so that you always pass it Objects, and never precreated Messages.
04:16
<@McMartin>
Also possible, I suppose.
04:16 * ToxicFrog deems this both more appropriate and easier to implement, does so
04:19
<@ToxicFrog>
Ok!
04:19
<@ToxicFrog>
We now have message-passing, in 50 lines or so.
04:19
<@McMartin>
Hooray!
04:19
<@McMartin>
Is this for work, or are you contending with Java for an unrelated reason?
04:20
<@ToxicFrog>
It's september, so this is for classes.
04:20
<@McMartin>
Ah, yes
04:20 * ToxicFrog works in the summer - and almost never in Java, thank the numberless lords of chaos - and attends classes in the fall and winter.
04:21
<@McMartin>
I see that the rumored life-giving season of "Spring" does not exist in the northern wastelands.
04:21
<@ToxicFrog>
Well, spring is the first month or two of the summer semester.
04:21 * McMartin is currently dusting off P65 again.
04:21
<@ToxicFrog>
But even if it's physically spring, it's logically summer.
04:21
<@ToxicFrog>
Hmm. I'm actually surprised by how easy this was.
04:22
<@McMartin>
Yes, but when I was at Berkeley, the two main-year semesters were Fall and Spring.
04:22
<@McMartin>
And that's the nature of most serious Java programs.
04:22
<@ToxicFrog>
Having a pre-existing SynchronousQueue and threading support and not needing to move Objects between VMs may be a contributing factor~
04:22
<@McMartin>
Everything is *almost* there already; you just have to find it and tweak it to be just the way you actually need.
04:22
<@McMartin>
So the ability to rapidly search and assimilate Javadoc will speed up coding by orders of magnitude.
04:23
<@ToxicFrog>
Aah. Here we have three four-month semesters - fall, winter and summer.
04:24
<@ToxicFrog>
Ok. Now that my tools are done, I can start on the actual assignment.
04:25 Chalcedon [~Chalcedon@Nightstar-2472.ue.woosh.co.nz] has quit [Quit: Gone]
04:25
<@ToxicFrog>
...hmm.
04:25
<@ToxicFrog>
It would be really convenient if I could generalize send/recieve/reply to work across sockets.
04:26
<@ToxicFrog>
I feel a MessagePassingSocket class coming on.
04:27 Chalcedon [~Chalcedon@Nightstar-2472.ue.woosh.co.nz] has joined #code
04:27 mode/#code [+o Chalcedon] by ChanServ
04:29
<@ToxicFrog>
I think I just need to say that class Message implements Serializeable, yes?
04:30
<@McMartin>
Probably, assuming it doesn't have anything seriously freakish in it like a HashMap.
04:30
<@McMartin>
If a Message is basically just made of Strings, though, then yes, you're golden
04:30
<@ToxicFrog>
...hrm. Upon reflection, it has a MessagePassingThread and an Object.
04:31
<@McMartin>
That could get unpleasant pretty quick.
04:31
<@ToxicFrog>
Yeaaaaah.
04:31
<@McMartin>
You'd need to implement Serializable and then override the methods that handle serialized forms.
04:31
<@McMartin>
But, uh, you're talking about RPC at that point.
04:31
<@ToxicFrog>
Which is what the course is about anyway~
04:31
<@McMartin>
Heh heh heh
04:32
<@ToxicFrog>
Anyways...upon further consideration, a MessagePassingSocket message needs different fields anyways.
04:32
<@ToxicFrog>
In particular, sender is a socket, not a thread.
04:32
<@ToxicFrog>
And content needs to be serializeable.
04:32
<@McMartin>
You still might be able to get a top-level interface out of it, but it won't be a fake mixin, that's for sure.
04:34
<@ToxicFrog>
Yeah. I think what I need here is to Do It Right and write a Message with an interface for getting the payload out, and then an InterThreadMessage with Thread sender and Object payload, and a NetworkMessage with Socket sender, Serializeable payload and custom serialize/deserialize to handle setting up sender right when it comes off the wire.
04:35
<@McMartin>
First, do your homework~
04:35
<@McMartin>
Then, do the stuff that will come in handy later.
04:37
<@ToxicFrog>
This will come in handy for the homework immediately, though.
04:37
<@McMartin>
Ah
04:38
<@ToxicFrog>
Since it involves at least two nodes, each one consisting of two threads and communicating with other nodes over TCP.
04:38
<@McMartin>
Aha, I see.
04:38
<@ToxicFrog>
(also: re: Mixins being evil and wrong: Serializeable is totally a mixin even if the docs call it an interface, thank god.)
04:39
<@McMartin>
(Well, OK. But serialization should be done in a non-OO way.)
04:39
<@McMartin>
(<3 Pickle & friends)
04:39
<@McMartin>
(And it's not really a mixin, either, it's a pair of methods that are always defined, and the interface is basically just a notice about whether or not those methods will work.)
04:42
<@ToxicFrog>
(which, from the programmer's point of view, is functionally indistinguishable unless you're doing deep VM wizardry)
04:42
<@ToxicFrog>
...hmm.
04:42
<@McMartin>
(oh wate)
04:42
<@ToxicFrog>
There doesn't seem to be a way for the deserializer to figure out where it came from.
04:42
<@ToxicFrog>
(yeah, yeah)
04:43
<@McMartin>
(yeah. This is a "take advice from me with a grain of salt" marker, really, because I'm closer to the VM than the language.)
04:43
<@McMartin>
(Java Generics in particular are totally beyond me because they vanish at the VM level at present.)
04:44
<@ToxicFrog>
Hmm. Ok, I can't make the semantics the same without some wacky select()oid hackery.
04:44
<@ToxicFrog>
So I'll settle for MessagePassingSocket.recv(), MPS.send() and MPS.reply()
04:44
<@McMartin>
Ah well
04:45
<@McMartin>
You can solve it later with an extra layer of indirection.
04:45
<@ToxicFrog>
Indeed.
04:46
<@ToxicFrog>
(the issue here is that for true identicality, I need MessagePassingThread.recv() to block until it recieves a message from any MessagePassing(Thread|Socket), and for replying to that message to send thread-to-thread or over the network as appropriate)
04:46
<@McMartin>
(Hmm, yes.)
04:47
<@ToxicFrog>
(at which point, communication wise, there's no difference between a thread on this machine and a thread on another machine except that the latter requires you to explicitly ask for a connection before you can send to or recieve from it)
04:48
<@ToxicFrog>
(Maybe I should just implement an Erlang VM in Java...)
04:48
<@McMartin>
(Not Easier)
04:53
<@ToxicFrog>
(yeah. ;.;)
04:53
<@ToxicFrog>
Hmm. One would think that there's some kind of generic select()oid in Java that lets me block on both a queue and a set of sockets, and returns when any of them are hot.
04:55
<@ToxicFrog>
Hmm. There's Selector, but that requires SelectableChannels.
04:55
<@ToxicFrog>
Not only is SerializeableQueue not one, it's not an interface, so I can't even subclass SQ and add it.
04:56
<@ToxicFrog>
Maybe I should just implement the entire ITC mechanism with sockets under the hood.
04:56
<@ToxicFrog>
But this means serialization/deserialization overhead on every single goddamn message pass.
05:01
<@McMartin>
I don't recommend it
05:02
<@McMartin>
Though it is very enterprisey.
05:02
<@McMartin>
=P
05:02
<@ToxicFrog>
Feh.
05:04
<@ToxicFrog>
I could busywait, but ew.
05:06
<@ToxicFrog>
...
05:06
<@ToxicFrog>
I could spawn a sister thread responsible for listening to sockets and putting stuff recieved from them in the queue.
05:08
<@McMartin>
home
05:08
<@ToxicFrog>
ta.
05:21
<@McMartin>
And back
05:29
<@ToxicFrog>
Keh. I can't even blame Java for this; I can't think of any language in which this is easy except the ones that have it intrinsically.
05:30
<@McMartin>
Synchronization Is Hard (tm).
05:30
<@ToxicFrog>
The hard bit is synchronizing on sockets and on other threads simultaneously.
05:30
<@ToxicFrog>
Without just going "all communication goes over sockets"
05:52 Darius [~vorn@ServicesOp.Nightstar.Net] has quit [Ping Timeout]
05:55 Darius [~vorn@64.252.41.ns-3279] has joined #code
05:56 Darius is now known as NSGuest-1138
05:58 NSGuest-1138 is now known as Darius
07:04 GeekSoldier|bed is now known as GeekSoldier|work
07:29 Darius is now known as Vornicus
07:59 Vornicus is now known as Vornicus-Latens
08:07 You're now known as TheWatcher
08:21 Thaqui [~Thaqui@Nightstar-26933.jetstream.xtra.co.nz] has quit [Ping Timeout]
08:24 Thaqui [~Thaqui@Nightstar-26933.jetstream.xtra.co.nz] has joined #code
08:24 mode/#code [+o Thaqui] by ChanServ
10:34 GeekSoldier|work [~Rob@Nightstar-4842.pools.arcor-ip.net] has quit [Quit: I quit!]
10:52 Chalcedon [~Chalcedon@Nightstar-2472.ue.woosh.co.nz] has quit [Quit: Gone]
11:08 GeekSoldier|work [~Rob@Nightstar-4842.pools.arcor-ip.net] has joined #code
11:12 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code
11:12 mode/#code [+o gnolam] by ChanServ
11:31 Attilla [~The.Attil@194.72.70.ns-11849] has quit [Quit: <Insert Humorous and/or serious exit message here>]
11:39 Attilla [~The.Attil@194.72.70.ns-11849] has joined #code
11:56
< jerith>
Spot the bug:
11:56
< jerith>
public String getPrefix(String uri) {
11:56
< jerith>
if( uri.equals(XMLConstants.XML_NS_URI) )
11:56
< jerith>
return XMLConstants.XML_NS_PREFIX;
11:56
< jerith>
if( uri.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI) )
11:56
< jerith>
return XMLConstants.XMLNS_ATTRIBUTE;
11:56
< jerith>
if( uri==null )
11:56
< jerith>
throw new IllegalArgumentException();
11:56
< jerith>
//...
11:56
< jerith>
}
11:56
< jerith>
I can't even fix it, because it's code generated by someone else's tool at compile-time.
11:57
< Vornicus-Latens>
cute
11:58
< jerith>
Note that I found it because Eclipse throws a warning.
11:59
< jerith>
I even fixed it, before I realised it was generated code.
12:00
< Vornicus-Latens>
Eclipse is awesome.
12:01
< jerith>
It is, but only for Java code.
12:01
< jerith>
Java /needs/ lots of static analysis and automated refactorings.
13:07 Kyrre [~Z@87.72.35.ns-3885] has quit [Ping Timeout]
13:09 Kyrre [~Z@87.72.35.ns-3885] has joined #Code
13:10 KarmaBot [~fark.off@87.72.35.ns-3885] has quit [Ping Timeout]
13:10 KarmaBot [~fark.off@87.72.35.ns-3885] has joined #Code
13:10 mode/#code [+v KarmaBot] by ChanServ
13:11 McMartin [~mcmartin@Nightstar-904.dsl.pltn13.sbcglobal.net] has quit [Ping Timeout]
13:13 McMartin [~mcmartin@Nightstar-904.dsl.pltn13.sbcglobal.net] has joined #code
13:13 mode/#code [+o McMartin] by ChanServ
13:22
< GeekSoldier|work>
i just started using eclipse for python.
13:22 GeekSoldier|work is now known as GeekSoldier
14:05
< jerith>
GeekSoldier: How's it working for you?
14:06
< jerith>
Two guys here use it for Ruby, but I prefer a normal editor
14:09
< GeekSoldier>
not too bad. I'm still getting used to it.
14:10
< GeekSoldier>
I like being able to have all my project files open in the same editor. I had been using IDLE for it before.
14:10
< jerith>
Ah.
14:11 * jerith hands GeekSoldier {emacs,vim} and ipython, which is the best Python dev system he has yet discovered.
14:17
< GeekSoldier>
golly... I don't think I've enough fingers for emacs.
14:25
< jerith>
Heh. It's not that bad once you get used to it.
14:26
< jerith>
And it's a price worth paying, IMHO.
14:26
< jerith>
But vim's also a good Python editor.
14:35 AnnoDomini [AnnoDomini@Nightstar-29100.neoplus.adsl.tpnet.pl] has joined #Code
14:35 mode/#code [+o AnnoDomini] by ChanServ
14:37
< MinceR>
hay
14:37 ReivClass is now known as ReivZzz
14:39
<@gnolam>
http://www.youtube.com/watch?v=Mal6XbN5cEg <- "QBasic Nerd"
15:00 ReivZzz is now known as ReivSLEP
15:10 Thaleon [~Matt_@70.91.160.ns-4029] has joined #Code
15:11 Thaleon [~Matt_@70.91.160.ns-4029] has quit [Quit: ]
15:26 AnnoDomini is now known as Jesus
15:26 Jesus is now known as AnnoDomini
15:43 Thaqui [~Thaqui@Nightstar-26933.jetstream.xtra.co.nz] has quit [Ping Timeout]
16:28
< jerith>
So, Java.
16:29
< jerith>
I have some code that uses .toGMTString(), which is deprecated.
16:29
< jerith>
Is there a drop-in replacement?
16:29
< jerith>
Google is being unhelpful in this regard.
16:31
<@AnnoDomini>
The Java documentation tells me it's been replaced with DateFormat.format(Date date).
16:33
< jerith>
But I'm not sure how to get a date in the right timezone.
16:33
< jerith>
I should probably RTFM, but it's Java and I'm tired. :-/
16:41
< jerith>
Bloody hell, now I know where Ruby gets it from!
16:41
< jerith>
'The format is locale independent and digits must be taken from the Basic Latin block of the Unicode standard. No daylight saving time transition schedule can be specified with a custom time zone ID. If the specified string doesn't match the syntax, "GMT" is used.'
16:42
< MinceR>
yay for proper error handling.
16:43
< jerith>
Because throwing a WrongTimezoneFormatYouBlitheringIdiotException is /clearly/ not the right thing to do there...
16:43
< MinceR>
clearly.
16:43
< jerith>
Although you can actually tell that you have an error there if you look and you have GMT.
16:44
< jerith>
Well if it's a user-specified string, you can't.
16:49
< jerith>
Although it's envvar based, so proper error handling is rather more difficult than throwing a WrongTimezoneFormatYouBlitheringIdiotException.
16:50
< jerith>
Oops, mischan.
16:51 gnolam is now known as gnoperkele
16:58 AnnoDomini is now known as AnnoDomini2|Dalek2
17:01 AnnoDomini2|Dalek2 is now known as AnnoDomini
17:21 You're now known as TheWatcher[afk]
17:57 Thaqui [~Thaqui@Nightstar-26933.jetstream.xtra.co.nz] has joined #code
17:57 mode/#code [+o Thaqui] by ChanServ
18:28 Vornotron [~vorn@64.252.44.ns-4484] has joined #code
18:29 Vornicus-Latens [~vorn@ServicesOp.Nightstar.Net] has quit [Ping Timeout]
18:33 You're now known as TheWatcher
18:38 Vornotron is now known as Vornicus
18:45 GeekSoldier [~Rob@Nightstar-4842.pools.arcor-ip.net] has quit [Ping Timeout]
18:45 GeekSoldier [~Rob@Nightstar-5400.pools.arcor-ip.net] has joined #code
19:25 Forj [~Forj@Nightstar-2472.ue.woosh.co.nz] has joined #code
19:25 mode/#code [+o Forj] by ChanServ
19:32 gnoperkele is now known as gnolam
19:35
< MinceR>
SSLServerSocketFactory sslserversocketfactory = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
19:35
< MinceR>
gotta love java.
19:39
< jerith>
No, you don't.
19:40
< jerith>
You can use Python instead.
19:40
< jerith>
Speaking of which...
19:40 * jerith goes to look at his Python code.
19:41
< MinceR>
i wish i could use python instead on tomorrow's class
19:41
< GeekSoldier>
yeah. I'm trying to do something, and it's gettin me steamed... convert an integer to a list... my grey matter is not working tonight. I shall prevail, though.
19:41
< jerith>
Umm... integer to list?
19:41
< jerith>
Do you want to put it into a list of one element?
19:41
< MinceR>
but just java isn't enough for them, they've got to use java 1.4
19:41
< jerith>
foo = [bar]
19:42
< GeekSoldier>
for example:
19:42
< jerith>
MinceR: Ugly loops. :-/
19:42
< GeekSoldier>
1234 -> [1,2,3,4]
19:42
< MinceR>
and ugly containers
19:42
< jerith>
Ah.
19:42
< GeekSoldier>
it will involve a loop and mod.
19:42
< GeekSoldier>
I'm getting it now.
19:43
< jerith>
Easier to go via a string, actually.
19:43 gnolam is now known as gnobitter
19:43
< GeekSoldier>
list[] = str(1234)?
19:44
< jerith>
[int(c) for c in str(a)]
19:44
< GeekSoldier>
I always forget the elegance of list comprehensions.
19:44
< jerith>
If you're looping over it, you may want to replace the square brackets with round and get a generator comprehension.
19:52 Forj [~Forj@Nightstar-2472.ue.woosh.co.nz] has quit [Quit: Gone]
20:05 GeekSoldier is now known as GeekSoldier|bed
20:06
< jerith>
'Night GS.
20:07
< GeekSoldier|bed>
goodnight.
20:07
< GeekSoldier|bed>
I solved my thingy. thanks for the help!
20:07
< jerith>
:-)
20:07
< jerith>
Yay for solved thingies!
20:41
<@McMartin>
MinceR: 1.4? That is unfortunate, though I don't quite trust 1.6 yet.
20:41
<@McMartin>
After awhile you get used to the boilerplate.
20:42
<@McMartin>
And you stop using long varnames since the typecasts are doing that for you. =P
20:43
< MinceR>
i don't get used to it since i avoid it most of the time. :>
20:43 * McMartin would recommend renaming sslSocketFactory something like "f".
20:53
< jerith>
Ugh. Why can't Python make everything return something?
20:53
<@McMartin>
It does.
20:53
<@McMartin>
"None" is a value.
20:54
< jerith>
" ".join(a.split().remove('baz'))
20:54
< jerith>
Now I have to use three lines and a temporary variable.
20:54
< jerith>
Because .remove() returns None instead of the array.
20:54
< jerith>
s/array/list/
20:55
<@McMartin>
Um
20:55
<@McMartin>
You don't want remove there
20:55
<@McMartin>
You want a filter
20:55
<@McMartin>
remove is destructive
20:55
<@McMartin>
" ".join([x for x in a.split if x != 'baz'])
20:55
< jerith>
I don't care, it's on a temporary array.
20:55
< jerith>
s/array/list/
20:55
< jerith>
Again.
20:57
< jerith>
Much as I like list comprehensions, that's not really a clean way to do it.
20:57 * jerith does it that way anyway.
21:32 Chalcedon [~Chalcedon@Nightstar-2472.ue.woosh.co.nz] has joined #code
21:33 mode/#code [+o Chalcedon] by ChanServ
22:48 KarmaBot [~fark.off@87.72.35.ns-3885] has quit [Ping Timeout]
22:49 Kyrre [~Z@87.72.35.ns-3885] has quit [Ping Timeout]
23:02 AnnoDomini [AnnoDomini@Nightstar-29100.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
23:03
<@McMartin>
I agree it's kind of a wart in the API, after some pondering of this, but I think on the whole I like it
23:03
<@McMartin>
Because it means I won't accidentally mutate something I was intending to hold constant, because the imperative routines all return None and can't be chained the way functionals can.
23:04 AnnoDomini [AnnoDomini@Nightstar-29029.neoplus.adsl.tpnet.pl] has joined #Code
23:04 mode/#code [+o AnnoDomini] by ChanServ
23:07 Attilla [~The.Attil@194.72.70.ns-11849] has quit [Quit: <Insert Humorous and/or serious exit message here>]
23:08
< MinceR>
afaik it's because they didn't want confusion regarding whether the value is changed or the result of the change is returned.
23:17 You're now known as TheWatcher[T-2]
23:20 You're now known as TheWatcher[zZzZ]
23:31 * McMartin makes Notepad++ understand P65, wonders how to export this.
23:34 Attilla [~The.Attil@194.72.70.ns-11849] has joined #code
23:41 * MinceR makes Notepad++ understand P90.
23:46 gnobitter is now known as gnolam
23:55
< Attilla>
By shooting it?
23:55
< MinceR>
that's the only way :>
23:56
<@ToxicFrog>
McMartin: find the rc files, publish the relevant lines?
23:57 * ToxicFrog reimplements Message as an abstract class
23:59
<@ToxicFrog>
Hmm.
--- Log closed Fri Sep 21 00:00:01 2007
code logs -> 2007 -> Thu, 20 Sep 2007< code.20070919.log - code.20070921.log >