--- Log opened Mon Oct 08 00:00:05 2007 |
00:10 | | Syloq [~Syloq@NetAdmin.Nightstar.Net] has joined #code |
00:10 | | Syloqs-AFH [Coder@NetAdmin.Nightstar.Net] has quit [Ping Timeout] |
00:11 | | Syloq is now known as Syloqs-AFH |
00:17 | | You're now known as TheWatcher[T-2] |
00:21 | | You're now known as TheWatcher[zZzZ] |
01:25 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Z?] |
04:52 | | Forj [~Forj@Nightstar-10836.ue.woosh.co.nz] has joined #code |
04:52 | | mode/#code [+o Forj] by ChanServ |
06:20 | | Vornicus [~vorn@ServicesOp.Nightstar.Net] has quit [Connection reset by peer] |
06:24 | | Vornicus [~vorn@Nightstar-28547.dsl.mrdnct.sbcglobal.net] has joined #code |
06:25 | | Vornicus is now known as NSGuest-1441 |
06:26 | | NSGuest-1441 is now known as Vornicus |
07:27 | | mode/#code [+o AnnoDomini] by ChanServ |
07:29 | | EvilDarkLord [~jjlehto3@Nightstar-2194.vipunen.hut.fi] has quit [Ping Timeout] |
07:30 | | EvilDarkLord [~jjlehto3@Nightstar-2194.vipunen.hut.fi] has joined #code |
07:31 | | Vornicus is now known as Vornicus-Latens |
07:31 | | EvilDarkLord is now known as NSGuest-1445 |
08:06 | | You're now known as TheWatcher |
08:16 | | GeekSoldier|bed is now known as GeekSoldier |
09:51 | | Chalcedon [~Chalcedon@Nightstar-10836.ue.woosh.co.nz] has quit [Quit: Gone] |
10:36 | | You're now known as TheWatcher[afk] |
10:42 | | Forj [~Forj@Nightstar-10836.ue.woosh.co.nz] has quit [Quit: Gone] |
11:03 | | MyCatSchemes [~rb6822@Nightstar-23512.cs.bris.ac.uk] has joined #code |
11:06 | | You're now known as TheWatcher |
11:21 | | MyCatSchemes [~rb6822@Nightstar-23512.cs.bris.ac.uk] has quit [Quit: Swim, swim, hungry!] |
11:27 | | MyCatSchemes [~rb6822@Nightstar-23512.cs.bris.ac.uk] has joined #code |
11:55 | | MyCatSchemes [~rb6822@Nightstar-23512.cs.bris.ac.uk] has quit [Quit: Swim, swim, hungry!] |
12:03 | | Vornotron [~vorn@64.252.71.ns-12695] has joined #code |
12:04 | | Vornicus-Latens [~vorn@Admin.Nightstar.Net] has quit [Ping Timeout] |
12:14 | | Kethal is now known as Raif |
12:26 | | Vornucopia [~vorn@64.252.76.ns-12762] has joined #code |
12:28 | | Vornotron [~vorn@64.252.71.ns-12695] has quit [Ping Timeout] |
12:29 | | NSGuest-1445 is now known as EvilDarkLord |
12:32 | | Vornotron [~vorn@Nightstar-8447.dsl.mrdnct.sbcglobal.net] has joined #code |
12:34 | | Vornucopia [~vorn@64.252.76.ns-12762] has quit [Ping Timeout] |
12:38 | | Vornucopia [~vorn@64.252.67.ns-5172] has joined #code |
12:40 | | Vornotron [~vorn@Nightstar-8447.dsl.mrdnct.sbcglobal.net] has quit [Ping Timeout] |
12:41 | | Vornotron [~vorn@64.252.80.ns-3719] has joined #code |
12:42 | | Vornucopia [~vorn@64.252.67.ns-5172] has quit [Ping Timeout] |
12:43 | | gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code |
12:43 | | mode/#code [+o gnolam] by ChanServ |
12:48 | | Vornotron [~vorn@64.252.80.ns-3719] has quit [Ping Timeout] |
12:48 | | Vornotron [~vorn@64.252.86.ns-13496] has joined #code |
12:53 | | Vornucopia [~vorn@64.252.83.ns-3939] has joined #code |
12:54 | | Vornotron [~vorn@64.252.86.ns-13496] has quit [Ping Timeout] |
12:56 | | Vornotron [~vorn@64.252.109.ns-13130] has joined #code |
12:57 | | Vornucopia [~vorn@64.252.83.ns-3939] has quit [Ping Timeout] |
12:59 | | Vornotron [~vorn@64.252.109.ns-13130] has quit [Ping Timeout] |
13:07 | | Thaqui [~Thaqui@Nightstar-26433.jetstream.xtra.co.nz] has quit [Quit: This computer has gone to sleep] |
13:40 | | MyCatSchemes [~rb6822@Nightstar-18127.cs.bris.ac.uk] has joined #code |
13:49 | | Reiver is now known as ReivZzz |
14:59 | | Vornotron [~vorn@64.252.8.ns-3016] has joined #code |
16:11 | | MyCatSchemes [~rb6822@Nightstar-18127.cs.bris.ac.uk] has quit [Quit: Swim, swim, hungry!] |
16:41 | <@ToxicFrog> | Aaaaaaaagh |
16:41 | <@ToxicFrog> | Fuck you, Java |
16:41 | <@ToxicFrog> | FUUUUUUUCK YOUUUUUUUUU |
16:42 | <@McMartin> | What now? |
16:42 | <@ToxicFrog> | I have a Map<String, String> |
16:42 | <@ToxicFrog> | headers. |
16:43 | <@ToxicFrog> | I want to see if Cache-control: no-cache. |
16:43 | <@ToxicFrog> | Intuitively, this is headers.get("Cache-control") == "no-cache" |
16:43 | <@ToxicFrog> | However, == is actually is, so instead I need headers.get("Cache-control").equals("no-cache"), which is ugly, but not that bad... |
16:44 | <@ToxicFrog> | Except that, unlike ==, if there isn't a Cache-control header, it throws a NullPointerException instead of evaluating to false. |
16:45 | <@McMartin> | Throw it in a try block. |
16:45 | <@McMartin> | It's not Approved Style (tm) and I wouldn't do it in an inner loop, but what the Hell, it's a homework assignment. |
16:45 | <@ToxicFrog> | Yeah, except that breaks the expression, which is: (foo || headers(bar) == baz || headers(moby) == frotz) |
16:45 | <@ToxicFrog> | If headers(bar) throws an exception, it never gets to headers(moby) |
16:46 | <@McMartin> | Oh, right, Java is not ML |
16:46 | <@ToxicFrog> | So then the exception handler needs to figure out which on threw, and reevaluate, and it's just goatfucking. |
16:46 | <@McMartin> | Object TFUtil.mapGet (Map map, Object defaultValue), imo. |
16:46 | <@ToxicFrog> | Oh, right. |
16:46 | <@ToxicFrog> | Or just subclass HashMap, even. |
16:46 | <@McMartin> | Screw subclassing HashMap. |
16:47 | <@McMartin> | Just implement Map to begin with. |
16:47 | <@McMartin> | Back it with a field. |
16:47 | <@McMartin> | Though I suppose it might be easier to do the subclass, unless HashMap turns out to be final. |
16:47 | <@ToxicFrog> | ...hmm. I can't actually see how to solve the problem in this way, though. |
16:47 | <@ToxicFrog> | I mean, I can solve the specific case of Map<String,String> by having it return "" |
16:48 | <@ToxicFrog> | But I can't solve the general case of Map<Object,Object>. |
16:48 | <@McMartin> | Two possibilities. |
16:48 | <@McMartin> | (1) I'm here saying "Be like Python and let the user pick the default value" |
16:49 | <@McMartin> | (2) In general you could also have static Object TFUtil.NOT_FOUND = new Object();, which is guaranteed to not be equals() to any other object. |
16:49 | <@McMartin> | Er. static final Object. |
16:49 | <@ToxicFrog> | Former is less likely to cause the type checker to flip out, I think, so let's go with that. |
16:50 | <@McMartin> | Oh, right. |
16:50 | <@McMartin> | Without type erasure you can still get ClassCastExceptions for anything besides equals(). |
16:52 | <@ToxicFrog> | Alright, it's working, thank you. |
16:52 | | * ToxicFrog adds some accurate, but snarky, comments to ProxyUtil.getFromMap() |
16:53 | <@McMartin> | It's what they get for exposing NULL. |
16:54 | | Vornotron is now known as Vornicus |
16:56 | <@ToxicFrog> | ... |
16:56 | <@ToxicFrog> | Alternately: |
16:56 | <@ToxicFrog> | "no-cache".equals(headers.get("Cache-control")) |
16:56 | <@McMartin> | True enough! |
16:56 | <@ToxicFrog> | I don't think that's a NullPointerException... |
16:56 | <@McMartin> | Nope. Constant Strings are neven NULL. |
16:56 | <@McMartin> | never |
16:57 | <@McMartin> | Having a Free Default is still a handy utility function, though. |
16:57 | <@ToxicFrog> | Yes, I know that, what I'm unsure about is whether String.equals(null) is one. |
16:58 | <@McMartin> | Oh. No. |
16:58 | <@McMartin> | Or it leeging better not be. |
16:58 | <@McMartin> | equals() is not allowed to do so by its contract. |
17:00 | <@ToxicFrog> | It's not. Excellent. |
17:10 | | MyCatSchemes [~rb6822@Nightstar-18492.cs.bris.ac.uk] has joined #code |
17:11 | | You're now known as TheWatcher[afk] |
17:34 | | McMartin is now known as McMartin[travels] |
18:13 | | AnnoDomini [AnnoDomini@Nightstar-29341.neoplus.adsl.tpnet.pl] has quit [Ping Timeout] |
18:19 | | AD [AnnoDomini@Nightstar-29699.neoplus.adsl.tpnet.pl] has joined #Code |
18:21 | | AD is now known as AnnoDomini |
18:24 | | You're now known as TheWatcher |
18:25 | | Kyrre [~Z@87.72.35.ns-26506] has quit [Connection reset by peer] |
18:30 | | Forj [~Forj@Nightstar-10836.ue.woosh.co.nz] has joined #code |
18:30 | | mode/#code [+o Forj] by ChanServ |
18:49 | | Kyrre [~Z@87.72.35.ns-26506] has joined #Code |
18:51 | | Forj [~Forj@Nightstar-10836.ue.woosh.co.nz] has quit [Quit: Gone] |
18:52 | | GeekSoldier [~Rob@Nightstar-4481.pools.arcor-ip.net] has quit [Ping Timeout] |
18:54 | | GeekSoldier [~Rob@Nightstar-6005.pools.arcor-ip.net] has joined #code |
19:10 | | GeekSoldier is now known as GeekSoldier|bed |
19:17 | | Vornotron [~vorn@64.252.124.ns-22028] has joined #code |
19:17 | | Vornicus [~vorn@ServicesOp.Nightstar.Net] has quit [Ping Timeout] |
19:21 | | Vornotron [~vorn@64.252.124.ns-22028] has quit [Ping Timeout] |
20:08 | | MyCatSchemes [~rb6822@Nightstar-18492.cs.bris.ac.uk] has quit [Quit: Swim, swim, hungry!] |
20:14 | | * ToxicFrog eyes |
20:14 | <@ToxicFrog> | NoSuchMethodError shouldn't be a runtime error unless I'm doing reflective or casting stuff, surely |
20:17 | | Vornotron [~vorn@64.148.10.ns-11316] has joined #code |
20:19 | | * Kyrre reflects ToxicFrog's spell. |
20:23 | | Vornotron is now known as Vornicus |
20:29 | <@ToxicFrog> | ...oh, screw you, HTTP |
20:32 | < Vornicus> | ?? |
20:35 | <@ToxicFrog> | Transfer-encoding: chunked |
20:41 | < Vornicus> | o...kay? |
20:41 | <@ToxicFrog> | TE: chunked divides the data into "chunks", each one of the form SIZE CRLF DATA CRFL |
20:41 | <@ToxicFrog> | Rather than just having a convenient Content-Length in the header. |
20:42 | <@ToxicFrog> | (and of course, if you specify Connection: close, it's allowed to do neither and instead signal EOF by close()ing the socket) |
20:43 | <@ToxicFrog> | And, you know, you'd think that Socket or InputStream or Reader or something would have a "read all data until EOF" method, but fucked if I can find it. |
20:43 | < Vornicus> | This sounds like something you want a library to handle. |
20:44 | <@ToxicFrog> | Yeah, except at least in theory I should already have a library to handle it, to wit, the entirety of java.io.* and java.net.* |
20:44 | <@ToxicFrog> | I can't use the convenient HTTP parsing parts of java.net (screw you, Xiang), but I can use the rest. |
20:45 | < Vornicus> | so, in short, this professor is forcing onto you all the weaknesses of Java without any of the strengths. |
20:45 | <@ToxicFrog> | Yeah, basically. |
20:46 | <@ToxicFrog> | I've sent mail to the TA (who is the one actually marking it) asking if we can at least use java.net.URL (RFC-mostly-compliant URL parsing) and java.util.SortedMap. |
20:46 | <@ToxicFrog> | If the answer is no, I can drop the course from the comfort of my home~ |
20:47 | <@ToxicFrog> | That said, there should be something, somewhere, that lets me take an InputStream or similar and turn it into a String or a byte[] or the like by reading until EOF. |
20:48 | <@ToxicFrog> | I have a hard time believing that Java, which has eighteen different kinds of automatically resizing array, does not have this. |
20:51 | | * Vornicus eyes. that is odd. |
20:52 | <@ToxicFrog> | ...there's java.io.Reader::read(java.nio.CharBuffer target), but CharBuffer is abstract and nothing implements it! |
20:52 | < Vornicus> | eew |
20:53 | < Vornicus> | Unfortunately even the "strength" of Java is pretty damn weak. |
20:53 | | Chalcedon [~Chalcedon@Nightstar-10836.ue.woosh.co.nz] has joined #code |
20:53 | | mode/#code [+o Chalcedon] by ChanServ |
20:57 | | * Kyrre hates Java. |
20:57 | | * ToxicFrog ponders. |
20:57 | <@ToxicFrog> | So. |
20:57 | | * Kyrre also wants to stab the coders of firefox in their thighs for coding their "update available" screen so damn badly. |
20:57 | < Vornicus> | So? |
20:57 | <@ToxicFrog> | I need to deal with bytes here, not chars. |
20:58 | < Vornicus> | Right |
20:59 | <@ToxicFrog> | This basically limits me to, hrm...InputStream::read(), read(byte[]) and read(byte[],int,int) |
20:59 | < Vornicus> | The middle one is probably what you want. |
21:00 | <@ToxicFrog> | It won't resize b[], though |
21:00 | <@ToxicFrog> | None of them will. |
21:00 | <@ToxicFrog> | So I need to wrap it in something that allocates storage as needed. |
21:00 | <@ToxicFrog> | ArrayList<byte>, possibly. |
21:01 | < Vornicus> | uh. |
21:01 | | * Vornicus examines. |
21:01 | < Vornicus> | Have you looked at java.io.ByteArrayInputStream.buf ? |
21:02 | < Vornicus> | oh, it's protected, nemmind |
21:02 | <@ToxicFrog> | ByteArrayInputStream is for reading from ByteArrays. |
21:02 | <@ToxicFrog> | It lets you turn a byte[] into an InputStream. |
21:02 | < Vornicus> | ah |
21:06 | <@ToxicFrog> | Why do Collections use add(), but Maps use put()? |
21:06 | <@ToxicFrog> | .. |
21:06 | <@ToxicFrog> | ... |
21:06 | <@ToxicFrog> | The fuck |
21:06 | < Vornicus> | ?? |
21:06 | <@ToxicFrog> | You can't use primitive types in generics?! |
21:06 | <@ToxicFrog> | Apparently, ArrayList<byte> is illegal |
21:06 | < Vornicus> | Agh |
21:07 | < Vornicus> | Try ArrayList<Byte>; I think it should box and unbox primitives automatically. |
21:09 | <@ToxicFrog> | Only sometimes! |
21:09 | <@ToxicFrog> | But I'll give that a go. |
21:09 | | * Vornicus wonders what the Java library would look like if they actually remade it to work properly. |
21:09 | <@ToxicFrog> | No, it won't unbox from Byte[] to byte[] |
21:10 | <@ToxicFrog> | Well, for one thing, the language wouldn't have primitives. |
21:10 | <@ToxicFrog> | A lot of library ugliness arises from Java's schizophrenia over what is, and isn't, an object. |
21:11 | <@ToxicFrog> | Such as, say, the nine different versions of java.util.Arrays::copyOf(), one for Object[] and one for each primitive type. |
21:11 | < Vornicus> | and by doing that you force operator overloads into the open... which they specifically said they didn't want to do, but I still think the argument is specious; misnamed methods are everywhere already. |
21:12 | <@ToxicFrog> | Not to mention that Java already has operator overloads; they just aren't exposed to anyone outside Sun. |
21:12 | <@ToxicFrog> | Really, they have the worst of all possible worlds; misuse of operator overloads built into the language, the inability for developers to use them, and it's still trivial to write totally unreadable code. |
21:12 | < Vornicus> | Then you'll probably end up with One True List, One True Set, and One True Map. |
21:15 | < Vornicus> | io and util probably see the most improvement from objectification. |
21:16 | <@ToxicFrog> | Yeah. |
21:24 | | * ToxicFrog eyes these headers coming back from Google |
21:24 | <@ToxicFrog> | [read-headers] K=nnCoection V=close |
21:25 | | Vornicus [~vorn@64.148.10.ns-11316] has quit [Ping Timeout] |
21:29 | | Vornicus [~vorn@64.148.10.ns-11316] has joined #code |
21:29 | <@ToxicFrog> | <ToxicFrog> [read-headers] K=nnCoection V=close <-- from Google |
21:30 | | Vornicus is now known as NSGuest-1459 |
21:31 | | NSGuest-1459 is now known as Vornicus |
21:31 | | * ToxicFrog asks his proxy for the U of G website and the world goes mad |
21:34 | < Vornicus> | Saw that. |
21:37 | | Vornicus [~vorn@64.148.10.ns-11316] has quit [Quit: Leaving] |
21:37 | | Vornicus [~vorn@64.148.10.ns-11316] has joined #code |
21:37 | | mode/#code [+o Vornicus] by ChanServ |
21:40 | <@Vornicus> | Apparently not even limiting the number of lines per window prevents a memory leak in this stupid thing. |
21:49 | | ReivZzz is now known as ReivClass |
21:54 | <@jerith> | A lot of load balancers rewrite Connection: headers. |
21:55 | <@jerith> | [jerith@jerith-lap1 ~]$ curl -I http://ec2.amazonaws.com/ |
21:55 | <@jerith> | nnCoection: close |
21:56 | <@jerith> | (The rest ommitted for space.) |
22:01 | | You're now known as TheWatcher[T-2] |
22:05 | | You're now known as TheWatcher[zZzZ] |
22:05 | <@ToxicFrog> | Why do they do that |
22:05 | <@ToxicFrog> | ? |
22:06 | <@jerith> | They want to keep it, but they don't want it to be interpreted or something. |
22:13 | | * ToxicFrog decides to work on his OO homework for a while instead...we get to write a roguelike. In Java. |
22:14 | <@jerith> | The pain. |
22:14 | <@Vornicus> | DO they at least let you use all the libraries you want? |
22:14 | <@ToxicFrog> | Yes. |
22:15 | <@ToxicFrog> | With the caveat that the final result must match the interface specified by the RogueTest package. |
22:15 | <@Vornicus> | That's not bad. |
22:51 | <@ToxicFrog> | The documentation on the existing framework we have to work in appears to be...sketchy. |
22:53 | <@gnolam> | For some reason, it always is. |
23:05 | <@ToxicFrog> | It would be nice, for example, to know what you can do with a DungeonView.Direction |
23:06 | <@ToxicFrog> | (trial and error says that "express diagonal directions" is not on the board, though) |
23:06 | <@ToxicFrog> | It would also be nice if the sample code weren't broken. |
23:07 | <@ToxicFrog> | By which I mean "even if you implement all the missing classes and methods correctly, the sample test code makes incorrect assumptions about the world model that lead it to generate a geometrically impossible map" |
23:07 | <@jerith> | Broken sample code is a standard feature of this kind of thing. |
23:08 | <@ToxicFrog> | Which would be fine if the prof hadn't said "after implementing Room and Hallway, you should be able to run RogueTest and have it work" |
23:25 | | * gnolam remembers the Java lab framework that assumed that arrays were 1-based. |
23:25 | | * jerith remembers the Java framework that... oh, yeah, that was this morning. |
23:26 | <@ToxicFrog> | ... |
23:26 | <@ToxicFrog> | Cannot find method: getContentsOfAdjacentRoom |
23:26 | <@ToxicFrog> | Why? Because it's actually getContentsofAdjacentRoom |
23:28 | <@Vornicus> | Sigh |
23:30 | <@ToxicFrog> | Aaargh |
23:30 | <@ToxicFrog> | So, we need to have player movement respect room and hallway boundaries |
23:32 | <@ToxicFrog> | At the moment, we do this by (KILL ME) asking the render layer what character is on screen in the cell we're trying to move to. |
23:32 | <@ToxicFrog> | If it's | or -, it's a wall, so we don't move. |
23:32 | <@ToxicFrog> | However! |
23:33 | | Thaqui [~Thaqui@Nightstar-26433.jetstream.xtra.co.nz] has joined #code |
23:33 | | mode/#code [+o Thaqui] by ChanServ |
23:33 | <@ToxicFrog> | The way we do this is with dungeon_view.getContentsofAdjacentSquare(player, dungeon_view.getElementRoom(player), direction) |
23:33 | <@ToxicFrog> | Note: getElementRoom |
23:33 | <@ToxicFrog> | If you're in a hall, this method throws a ClassCastException |
23:33 | <@Vornicus> | Cool. |
23:34 | <@ToxicFrog> | So what do you do? Well, the way I've found is to keep a Hallway current_hall around, and watch to see when the player goes through a door, and when they do, current_hall = (very ugly set of calls that retrieves the Hallway they just moved into) and it uses that instead. |
23:34 | <@Vornicus> | ;_; |
23:58 | <@ToxicFrog> | ... |
23:58 | <@ToxicFrog> | ... |
23:58 | <@ToxicFrog> | gCOAS never uses the room parameter. |
23:58 | <@ToxicFrog> | You can just go dv.gCOAS(player, null, direction) |
23:59 | <@Vornicus> | ...one would think that compilation would catch unused parameters. |
--- Log closed Tue Oct 09 00:00:12 2007 |