code logs -> 2010 -> Sun, 28 Mar 2010< code.20100327.log - code.20100329.log >
--- Log opened Sun Mar 28 00:00:48 2010
00:21 * gnolam hops onto the refactor tractor.
00:28 You're now known as TheWatcher[T-2]
00:30 You're now known as TheWatcher[zZzZ]
00:36
< gnolam>
... ye gods I must have been sleep deprived when I wrote this.
00:57 Orthia [orthianz@Nightstar-ab97504e.xnet.co.nz] has quit [Ping timeout: 121 seconds]
02:15 AnnoDomini [annodomini@Nightstar-956c8dc6.adsl.tpnet.pl] has quit [[NS] Quit: It is quite late.]
02:25
<@Vornicus>
Hrm. Reiver isn't on. He has work to do and I havehelp to give him!
02:38
< gnolam>
Down to 38 errors. The refactoring is coming together!
02:39
< celticminstrel>
Let me guess. You started with 200+ errors?
02:48
< gnolam>
I started with 0 errors before I got on the tractor refactoring. ;)
02:48
< gnolam>
-refactoring
02:51
< gnolam>
Down to 0, but crashing.
02:51
< gnolam>
But that was expected.
03:15 Orthia [orthianz@Nightstar-f99462f0.xnet.co.nz] has joined #code
03:16 * Orthia curses fate.
03:16
< Orthia>
Guess what I've had. Power cut. >.<
03:16
<@Vornicus>
Oh, how nice.
03:16
<@Vornicus>
Okay, we've got 5 hours before I need to sleep, let's see how far we can get.
03:16
< Orthia>
OK
03:17 * Orthia is really sorry, but, y'know, power cut.
03:17
<@Vornicus>
I'm pretty sure we've figured out your FNF problem
03:17
< Orthia>
Oh yes?
03:17
<@Vornicus>
Orthia: if your brain is engaged, we can probably do every requirement except "melded by scripts", which isn't very pointful anyway.
03:18
< celticminstrel>
..."melded by scripts"?
03:19
<@Vornicus>
celmin: the assignment statement says "put together encode and pack via script instead of as program-internal."
03:20 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
03:20
< celticminstrel>
Isn't that automatically covered by reading from stdin and writing to stdout?
03:20
< Orthia>
celtic: They want the program to do it in four parts, to ensure no errors.
03:21
< Orthia>
AKA: Able to test that the code is doing everything it should.
03:21
< Orthia>
As for engaged - gimmie three seconds while I boot up eclipse and go ferret out an extra ration of brain pills.
03:22
<@Vornicus>
And your error in the FNF is: args[0] is by convention the program name. on line 32 change from int i = 0 to int i = 1
03:24
< Orthia>
... cunning
03:31
<@Vornicus>
Okay, so, first things first, let's test the encoder and decoder, since we've gotten them written.
03:33
< Orthia>
Right.
03:33
< Orthia>
... it's not making a new file. Hrn.
03:33 * Orthia hunts.
03:33
<@Vornicus>
Show me
03:35
< Orthia>
http://pastebin.starforge.co.uk/208
03:39
< gnolam>
Yay!
03:39
< gnolam>
Crashing fixed, code is approaching sanity.
03:39
< gnolam>
Now I just have to fix the texcoord reversal in a decent way.
03:42
< gnolam>
And now that's (sort of) fixed too.
03:42
<@Vornicus>
Orthia: I don't see anything wrong with that.
03:43
< gnolam>
End result: 3/5 of the previous code size, and at least twice as fast.
03:43
< gnolam>
(It's the model loader, so speed matters)
03:44
< Orthia>
Vorn: Well, I try to send it instructions and it's not doing anything.
03:44
< Orthia>
Perhaps I need to get some debugging stuff going.
03:44
<@Vornicus>
Probably?
03:44
<@Vornicus>
What kind of instructions are we talking about.
03:46
< Orthia>
HA
03:47
< Orthia>
System.out.println(i + ": " + args[i]); in the for loop (Before if statements) caught it
03:47
<@Vornicus>
?
03:47
< Orthia>
args[0] was the first arguement we gave it afterall.
03:48
<@Vornicus>
weird. So, uh...
03:48
<@Vornicus>
what's that mean for the FNF error?
03:49 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?]
03:49
< Orthia>
It means our code is being batshit crazy, because I do not understand how that couldn't work.
03:49
< Orthia>
0 C:\Test.txt
03:49
< Orthia>
1 -c
03:49
< Orthia>
Loading: File not found. Trying to find C:\Test.txt
03:51
<@Vornicus>
Case sensitivity?
03:52
< Orthia>
Nope.
03:52
< Orthia>
WTF.
03:52
<@Vornicus>
Very wtf.
03:52
<@Vornicus>
...wait, this is Java
03:52
< Orthia>
Vorn: ?
03:53
<@Vornicus>
it has security built in so it may not be able to look at C:\
03:53
< Orthia>
... eesh, okay
03:53
<@Vornicus>
drag the file to the directory the program is in and then try running it on a relative reference.
03:54
< Orthia>
What's the command for a relative reference?
03:54
<@Vornicus>
Just don't have C:\ or anything - the filename alone.
03:56 * Orthia pokes for McMartin hopefully.
03:56
< celticminstrel>
A relative reference is one without a leading slash.
03:57
< Orthia>
It's... just not working
03:57
< celticminstrel>
By the way, I assume you actually have a file called Test.txt in the root directory of the C drive?
03:57
< Orthia>
Yeah
03:57
< celticminstrel>
Okay.
03:57
< celticminstrel>
And where is the java class file?
03:58
< celticminstrel>
(Presumably in your Eclipse workspace folder?)
03:58
< Orthia>
C:\Documents And Settings\Yadda\Workspace\LZW\ is the mani directory. Class files are in there somewhere.
03:59
< celticminstrel>
Well, find the class file and put Test.txt in that directory.
03:59
< celticminstrel>
Then call the program with "Test.txt" as the file instead of "C:\Test.txt".
03:59
< Orthia>
The folder with LZW.class correct?
03:59
< celticminstrel>
Probably.
03:59
< celticminstrel>
That's the same folder as Main.class too, right?
04:00
< Orthia>
yeah.
04:00
< Orthia>
Still nothin'.
04:00 * Orthia sets on fire.
04:00
< celticminstrel>
The arguments are being received though?
04:00
< Orthia>
0 test.txt
04:00
< Orthia>
1 -c
04:00
< Orthia>
Loading: File not found. Trying to find test.txt
04:00
< celticminstrel>
Hm.
04:01
< celticminstrel>
How are you running the program?
04:02
< Orthia>
http://pastebin.starforge.co.uk/209
04:02
< Orthia>
Debug code highlighted for clarity.
04:02
< Orthia>
I am running it with Eclipses 'run' button, with arguements of "test.txt -c" (sans quotes)
04:03
< celticminstrel>
What's its working directory?
04:04
< celticminstrel>
I'm pretty sure Eclipse has options somewhere to set the working directory of the program.
04:04
< celticminstrel>
I'd guess it would be near the options for specifying arguments, but I haven't used it recently...
04:05
< Orthia>
${workspace_loc:LZW}
04:06
< celticminstrel>
Uh... okay, anyone have any idea what that means?
04:07
< Orthia>
Well, my project is currently in yadda\workspace\LZW\
04:07
< Orthia>
So I presume it's saying the LZW folder inside workspace.
04:07
< celticminstrel>
Is that where Test.txt is too?
04:07
< Orthia>
Yeah.
04:07
< Orthia>
I am going to hardwrite it to C:\test\ and see what happens.
04:07
< Orthia>
Still nope.
04:08
< Orthia>
This makes me suspect it is not where I am keeping stuff, but something wrong with how I am loading it.
04:08 * Orthia hunts.
04:10
< Orthia>
nope, just asks for a string. String tells it where to load the file. >.<
04:12
< celticminstrel>
What is e.getMessage() ?
04:12
< celticminstrel>
Probably won't help much though...
04:16
< celticminstrel>
Also, does the backtrace show anything useful?
04:16
< celticminstrel>
(that is, the e.printStackTrace() call)
04:17
< Orthia>
java.io.FileNotFoundException: C:\test\test.txt (The system cannot find the file specified)
04:17
< Orthia>
at java.io.FileInputStream.open(Native Method)
04:17
< Orthia>
at java.io.FileInputStream.<init>(Unknown Source)
04:17
< Orthia>
at java.io.FileInputStream.<init>(Unknown Source)
04:17
< Orthia>
at lzw.Main.main(Main.java:48)
04:18
< celticminstrel>
I suppose e.getMessage() would probably return "The system cannot find the file specified", then...
04:18
< celticminstrel>
Does the file C:\test\test.txt exist? I thought test.txt was elsewhere.
04:19
< Orthia>
I've got it sitting in half a dozen places. >_>
04:20
< Orthia>
No message, no cause displayed.
04:21
< celticminstrel>
So, it does exist then.
04:24
< celticminstrel>
Apparently, "file not found" will also be thrown if the file is actually a directory or if it cannot be opened for reading for some reason.
04:24
< celticminstrel>
I doubt the first one is an issue though.
04:25
<@Vornicus>
wtf mcwtf
04:25
< celticminstrel>
??
04:27
<@Vornicus>
This isn't making any sense at all. It /should/ find these, if they're there.
04:27
< celticminstrel>
I know!
04:28 * Orthia attempts to hit a Leeging Huge Channel for aid.
04:31 Attilla [Attilla@FBC920.482E2D.4224C9.452BFB] has quit [Client closed the connection]
04:36
< Orthia>
blarg
04:36
<@Vornicus>
blarg?
04:36
< Orthia>
Screw it, let's work on feeding the decoder info (main doesn't do anything to decoder yet), and then fiddle with the tree size.
04:37
< celticminstrel>
I would consider trying to run it from the command-line...
04:48
<@Vornicus>
I'd do decode(encode(in), out); or whatever if we're going to round-trip stuff.
04:52
< Orthia>
Vorn: That's not going to work too well for decoding real stuff though, is it?
04:57
<@Vornicus>
This is a round trip.
04:57
<@Vornicus>
If it /works/, then in and out will diff identical.
04:57
< Orthia>
For testing purposes?
04:58
<@Vornicus>
yes
04:58
<@Vornicus>
Assuming we ever get testing right.
04:58
< Orthia>
OK
04:59
< Orthia>
Aha, raises an interesting problem
05:00
< Orthia>
encode(in) returns an ArrayList<Integer>
05:00
< Orthia>
decode demands an Iterable.
05:00
<@Vornicus>
Which is an iterable<integer>
05:00
<@Vornicus>
(make sure decode is demanding the same!)
05:03
< Orthia>
HAH
05:03 * Orthia has fixed his commandline. Has now output test.txt.lzw !
05:03
<@Vornicus>
via roundtrip?
05:03
<@Vornicus>
How'd you fix it?
05:04
< celticminstrel>
Pretty sure it's one-way at the moment.
05:04
< Orthia>
No, I mean I have fixed the problem netirely. Haven't touched roundtrip just yet.
05:05
<@Vornicus>
How did you fix the command line?
05:05
< Orthia>
Java was being fussy about wanting //, not \\ or \
05:05
< celticminstrel>
Um, what?
05:05
< Orthia>
It wanted /, rather.
05:05
< Orthia>
I dunno. I poked, it worked, let's go~
05:06
< celticminstrel>
Ah, okay.
05:06
< celticminstrel>
I assume you mean the path separator?
05:06 Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Connection reset by peer]
05:06
< Orthia>
Yeah.
05:06
< Orthia>
Shrug.
05:08
<@Vornicus>
We can probably fix that too, but not right now!
05:08
< Orthia>
Agreed!
05:08
< Orthia>
So, first thing we want to do is craft a roundrobin?
05:09
< Orthia>
I totally don't care, I want to get the decompressor working, and we'll see where we go from there~
05:09
< Orthia>
Er. Not-caring is on the 'fixing the seperator bug'
05:10
<@Vornicus>
Yeah, roundtrip it.
05:10
<@Vornicus>
-r I'd say would be a good flag for it!
05:11
< Orthia>
snerk
05:11
< Orthia>
Yessir
05:11
< Orthia>
blarg
05:11
<@Vornicus>
blarg?
05:12
< Orthia>
This wants me to change compress from a boolean to a more powerful flag.
05:12
< Orthia>
Probably for the best, but eh
05:12 Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
05:12
<@Vornicus>
No, no. Two flags.
05:13 Syloqs_AFH is now known as Syloqs-AFH
05:16
< Orthia>
OK, but this doesn't solve the issue - how do we turn our ArrayList<Integer> into an Iterable<Integer> ?
05:16
< celticminstrel>
Isn't there a member function of ArrayList that returns an Iterable?
05:17
< celticminstrel>
^ or method, whatever.
05:17 * celticminstrel is more used to the C++ terminology.
05:17
<@Vornicus>
It's already an Iterable<Integer>
05:18
< celticminstrel>
Oh wait.
05:18
< celticminstrel>
Right, Iterable is not the same as Iterator. D'oh.
05:21
<@Vornicus>
You don't have to change anything
05:21
<@Vornicus>
ArrayList<Integer> implements Iterable<Integer> (among other things)
05:23
< Orthia>
Got it
05:23
< Orthia>
It was actually the lack of 'static' on the decoder that was throwing errors everywhere.
05:24
<@Vornicus>
decoder too should be static.
05:24
<@Vornicus>
wel, decode; methods are verbs!
05:24
<@Vornicus>
pack and unpack should also be static.
05:24
< Orthia>
nod.
05:28
< celticminstrel>
...wait, what?
05:28
< celticminstrel>
Why?
05:30
<@Vornicus>
because they take in streams of ints or bytes and send out streams of bytes or ints.
05:30
<@Vornicus>
They don't keep any cross-method state, nor do encode or decode.
05:31
< Orthia>
OK!
05:31
< Orthia>
So.
05:31
< Orthia>
How do I get decompress to actually print its output?
05:31
< Orthia>
It modifies the data in out, but does not actually return it.
05:32
<@Vornicus>
decode writes to out.
05:33
<@Vornicus>
if you have it sending to a file, the file will be filled.
05:33
< Orthia>
Oh. Huh. Cool.
05:35
< Orthia>
out.write(?);
05:35
<@Vornicus>
that's what it's doing /inside decode/
05:35
<@Vornicus>
You don't have to write anything to it yourself, just pass it to decode and it will do the writing.
05:36
< Orthia>
Does it know what filename to write to?
05:36
<@Vornicus>
You /passed it the OutputStream/
05:37
<@Vornicus>
It knows everything it needs to!
05:37
< Orthia>
Oh.
05:37
< Orthia>
Hm.
05:37 * Vornicus is having a hard time understanding why we're going over this /again/
05:38
< Orthia>
Mostly because it's so different to how the encoder does it, so it throws my brain.
05:39
< Orthia>
oh dear.
05:39
< Orthia>
Our decoder is not in fact outputting a perfect copy, then.
05:40
<@Vornicus>
:(
05:41
< Orthia>
In fact, our decoder is outputting exactly the same code our encoder is, if the gobblygook in these two files is anything to judge by.
05:42
<@Vornicus>
Okay, give me a trial run on TOBEORNOTTOBEORTOBEORNOT <--- as the target of the encode, then run the result of that back through the decoder.
05:42 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has left #code []
05:44
< Orthia>
... no, not exactly - the encoder is leaving a " " at the end the round robin is not. hm.
05:45
<@Vornicus>
the roundtrip is not leaving... what the fuck?
05:45
<@Vornicus>
I mean seriously?
05:46
<@Vornicus>
If the roundtrip is turning out okay then you should be fine. what's going on here?
05:47
<@Vornicus>
I have no ide what's going on at all. Does roundtripping give you the same thing as the original?
05:48
<@Vornicus>
If not, paste the roundtripped thing here.
05:52
< Orthia>
http://pastebin.starforge.co.uk/214
05:52
< Orthia>
er
05:53
<@Vornicus>
LZW.decode(LZW.encode(in),out)
05:53
<@Vornicus>
is roundtrip. You can't decode straight from an inputstream yet.
05:53
<@Vornicus>
This is what pack and unpack are for.
05:54
< Orthia>
Oh, I see. OK.
05:54
< Orthia>
Blarg. So I need to get pack and unpack working for this thing to work at all?
05:54
< Orthia>
"TOBEORNOTTOBEORTOBEORNOT" -> "ÕÐÃÆÐÓÏÐÕ"
05:55
<@Vornicus>
Is that roundtrip or just encode?
05:56
<@Vornicus>
(looks encode-y to me)
05:58 * Vornicus pokes Orthia.
06:00
<@Vornicus>
dammitall man I can't help you if you don't answer the questions I ask.
06:02
< Orthia>
That was roundtrip.
06:02
< Orthia>
This is the thing
06:03
<@Vornicus>
That doesn't look anything /like what roundtrip should do.
06:03
< Orthia>
"TOBEORNOTTOBEORTOBEORNOT" -> "ÕÐÃÆÐÓÏÐÕ "
06:03
< Orthia>
That's encode.
06:03
< Orthia>
This is what is making me go 'wtf'
06:04
<@Vornicus>
Okay, so, we're seeing encode and roundtrip do the same thing.
06:05
<@Vornicus>
system.err.println("Round tripping!") in the roundtrip flag setter and also in the roundtrip action.
06:05
<@Vornicus>
Then try roundtripping again
06:05
<@Vornicus>
(may have the wrong name though, hang on
06:06
<@Vornicus>
(no, err is right)
06:08
<@Vornicus>
If you see "Round tripping!" twice then you're okay.
06:08
<@Vornicus>
Well, "okay" in the sense that the error is in decode, not in the sense that there's no errors.
06:10
< Orthia>
yessir
06:11
< Orthia>
0 C://test//test.txt
06:11
< Orthia>
1 -r
06:11
< Orthia>
Roundtripping 1!
06:11
< Orthia>
Roundtripping 2!
06:11
<@Vornicus>
and then it gives you that. okay wtf, hang on
06:11
<@Vornicus>
Let's look at decode then!
06:11
< Orthia>
Aye aye, sir
06:12 * Orthia removes the Roundtripping debugs.
06:13
<@Vornicus>
Paste decode, we'll see what might be going on.
06:13
< Orthia>
Wait, I see it
06:13
< Orthia>
encoded adds a 0 on the end doesn't it
06:14
< Orthia>
And ASCII value 0 is a space.
06:14
< Orthia>
IIRC.
06:14
< Orthia>
That's the extra bit in the 'encoded' file
06:14 * Orthia pastes up, just thought he'd share that.
06:15
<@Vornicus>
0 is a null.
06:15
<@Vornicus>
And what you're suggesting says "decode is dropping the codes in, instead of the bytes we're supposed to be"
06:16 Tarinaky [Tarinaky@Nightstar-dc09c9a8.adsl.virginmedia.net] has joined #code
06:16
<@Vornicus>
So /paste decode/ and we can see if that's what's happening.
06:16
< Orthia>
http://pastebin.starforge.co.uk/215
06:16
< Orthia>
It was taking time to upload, sorry.
06:16
<@Vornicus>
Indeed, there it is.
06:16
<@Vornicus>
do not output.write(index)
06:17
< Orthia>
Remove, or modify?
06:18
<@Vornicus>
In that place, instead, "output.write(byteArray.toArray())"
06:19
< Orthia>
The method write(int) in the type OutputStream is not applicable for the arguments (Object[])
06:19 Serah [Z@2C3C9C.B2A300.F245DE.859909] has quit [Ping timeout: 121 seconds]
06:20
<@Vornicus>
agh, fucking thing
06:21
<@Vornicus>
for (byte b: byteArray) output.write(b);
06:21
<@Vornicus>
See if that works.
06:22
< Orthia>
… ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïð ñòóôõö÷øùúûüýþÿ
06:22
< Orthia>
06:22
< Orthia>
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnop qrstuvwxyz{|}~… ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïð ñòóôõö÷øùúûüýþÿ
06:22
< Orthia>
06:22
< Orthia>
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnop qrstuvwxyz{|}~… ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïð ñòóôõö÷øùúûüýþÿ
06:22
< Orthia>
06:22
< Orthia>
06:23
<@Vornicus>
Mother of shit
06:23
< Orthia>
er. Pardon the funky codes.
06:23
< Orthia>
I note that it starts getting symmetrical however
06:23
<@Vornicus>
what the hell just happened, that's not what's supposed to be in here!
06:23 RichardBarrell [user@Nightstar-58acb782.cable.virginmedia.com] has quit [Ping timeout: 121 seconds]
06:23
< Orthia>
However, I Think I Found Something
06:24
<@Vornicus>
??
06:24
< Orthia>
The system.out.println(index) we have?
06:24
< Orthia>
213 208 195 198 208 211 207 208 213 257 257 257 257 257 257 257
06:24
<@Vornicus>
what the shirt
06:25
< Orthia>
That much at least I feel is informative.
06:25
<@Vornicus>
...oh
06:25
<@Vornicus>
oh oh oh oh oh oh
06:25
<@Vornicus>
Line 42: s/index = //
06:26
<@Vornicus>
(C++: increment C, but for now give me the old value.)
06:26
< Namegduf>
Haha.
06:27 Serah [Z@5E691D.FC7C16.F8708C.94F74E] has joined #code
06:27
< Orthia>
Good news: Bug fixed. Bad news: It was hiding a second bug.
06:27
<@Vornicus>
Oh?
06:28
< Namegduf>
"A bug was hiding under the bug corpse!"
06:28
< jerith>
Such is usually the case.
06:28
< Namegduf>
Bad as snakes.
06:28
< Orthia>
Output: Still gibberish.
06:28
< Orthia>
System.out.println(index) now outputs:
06:28
< Orthia>
213 208 195 198 208 211 207 208 213 257
06:28
<@Vornicus>
Different gibberish?
06:28
<@Vornicus>
Only...once.
06:29
< Orthia>
Exactly.
06:29
< Orthia>
(Man, that was a useful spot to stick a debug command.)
06:29
<@Vornicus>
Okay, do me a favor and add System.out.println(currentIndex) immediately after each instance of encoded.add(currentIndex) in encode.
06:31
< Orthia>
yessir
06:32
< Orthia>
ok, one second, need to get a delination in there somewhere.
06:35
< Orthia>
213 208 195 198 208 211 207 208 213 257 259 261 266 260 262 264 End Encode Output
06:35
< Orthia>
213 208 195 198 208 211 207 208 213 257
06:35
<@Vornicus>
what...
06:36
< Orthia>
Latter being the system.out from the decoder system.out.println(); I left in there.
06:36
<@Vornicus>
Okay so for some reason decode is stopping at 257...
06:37
<@Vornicus>
oh, I think I see it
06:37
< Orthia>
Yus?
06:37
<@Vornicus>
previndex=workingindex should be previndex = index.
06:37
<@Vornicus>
Last actual line in decode
06:39
< Orthia>
No change in debug output
06:39
<@Vornicus>
You're right, that's not it.
06:39
<@Vornicus>
Take your debug and put it right at the top of the for loop.
06:40
<@Vornicus>
See if that changes anything.
06:41
< Orthia>
GOTCHA
06:42 * Orthia tweaked a setting in eclipse, and realised it was hiding a bit of the output by the debug stream.
06:42
< Orthia>
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 259, Size: 257
06:42
< Orthia>
at java.util.ArrayList.RangeCheck(Unknown Source)
06:42
< Orthia>
at java.util.ArrayList.get(Unknown Source)
06:42
< Orthia>
at lzw.LZW.decode(LZW.java:82)
06:42
< Orthia>
at lzw.Main.main(Main.java:64)
06:42
< Orthia>
0 C://test//test.txt
06:42
< Orthia>
1 -r
06:42
< Orthia>
213 208 195 198 208 211 207 208 213 257 259 261 266 260 262 264 End Encoded Output
06:42
< Orthia>
213 208 195 198 208 211 207 208 213 257
06:42
<@Vornicus>
AHA
06:42
< Orthia>
(Debug stream was too long, and clipping the first bit preciesly, by sheer fluke)
06:43
< Orthia>
(Fiddling the debug streams to make a single line each...~)
06:43
<@Vornicus>
...something Wrong is happening here.
06:43
< Orthia>
Yes.
06:43
<@Vornicus>
Okay, did you keep previndex = index?
06:43
<@Vornicus>
(because that's what it's supposed to be)
06:44
< Orthia>
yeah
06:45
< Orthia>
http://pastebin.starforge.co.uk/216 - it's line 92. (Added on a 'exited the decoder for loop' flag too, for future checking.)
06:46
<@Vornicus>
hrmng
06:47 Serah [Z@5E691D.FC7C16.F8708C.94F74E] has quit [Ping timeout: 121 seconds]
06:47
<@Vornicus>
change your debug: index + "/" + indexArray.size()
06:47
< Orthia>
yessir
06:49
< Orthia>
oh dear.
06:49
< Orthia>
213/257 208/257 195/257 198/257 208/257 211/257 207/257 208/257 213/257 257/257
06:49
<@Vornicus>
Yeah that's wrong.
06:49
< Orthia>
Very.
06:50
<@Vornicus>
Oh.
06:50
<@Vornicus>
That line I told you to change, the prevIndex setter
06:50
<@Vornicus>
just after the if, not within it
06:50
< Orthia>
OK
06:50
<@Vornicus>
Damn I shoulda noticed that one twenty minutes ago.
06:51
<@Vornicus>
hell, /days/ ago.
06:51
< Orthia>
You're tired, I appreciate the help
06:51
< Orthia>
Not your fault the power cut lost me half the afternoon (And the mornings work too, leading to the snafu on commandline instructions)
06:52
<@Vornicus>
How soon is this due?
06:53
< Orthia>
eheh. Five hours.
06:53
< Orthia>
I could possibly get away with handing it in late, aka tomorrow, but that'd be about it.
06:53 * Orthia doesn't want to kill you in the process >_>
06:54
< Orthia>
I will be happy if I can get this thing operational and commented. It's 75% of the mark, to hell with the bitpacker
06:55
<@Vornicus>
See how it does now.
06:55
< Orthia>
Do I leave the one inside the if also changed?
06:55
<@Vornicus>
No, kill the one inside the if.
06:55
< Orthia>
Completely?
06:55
<@Vornicus>
Only outside.
06:55
< Orthia>
OK.
06:57
< Orthia>
...hang on a second. You want me to remove line 92 completely? It's the only place we set prevIndex at all.
06:58 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
06:58 Derakon is now known as Derakon[AFK]
06:58
<@Vornicus>
....
06:58
< Serah>
Hi?
06:58
<@Vornicus>
That line /goes after the if/
06:58
<@Vornicus>
not in the if.
06:58
< Serah>
Oh. Reivercode ellipsis.
06:58
< Orthia>
oh!
06:59
< Orthia>
92 and 93 transposed.
06:59
<@Vornicus>
Thank you.
06:59
<@Vornicus>
Now try it.
07:00
< Orthia>
213/257 208/257 195/258 198/259 208/260 211/261 207/262 208/263 213/264 257/265 259/266 261/267 266/268 260/269 262/270 264/271 End Decode Output
07:00
< Orthia>
Now that the size is fixed, remove that bit
07:00
< Orthia>
213 208 195 198 208 211 207 208 213 257 259 261 266 260 262 264 End Encoded Output
07:00
< Orthia>
213 208 195 198 208 211 207 208 213 257 259 261 266 260 262 264 End Decode Output
07:00
<@Vornicus>
YAY
07:01
<@Vornicus>
Okay, and the roundtrip string result?
07:01
< Orthia>
gah, gibberish still!
07:01
<@Vornicus>
:(
07:01 * Vornicus beats it.
07:01
< Orthia>
Encode remains tiny
07:01
< Orthia>
It is something in decode that is going blargle.
07:03
<@Vornicus>
add this to the for loop at 87-88system.out.print((char)workingByte)
07:04 Rhamphoryncus [rhamph@Nightstar-8931f88f.abhsia.telus.net] has joined #code
07:05
< Orthia>
Oh dear. One second.
07:06
< Orthia>
http://pastebin.starforge.co.uk/217
07:06
< Orthia>
Kinda don't fit elsewhere~
07:07
<@Vornicus>
....whoa.
07:07
< Orthia>
Note the numbers
07:07
<@Vornicus>
Yeah.
07:08
< Serah>
Well, that sorta looks like ... eh, something.
07:08
<@Vornicus>
The numbers are technically overlads I think
07:08
< Orthia>
It would certainly explain the vast bloating.
07:08
< Orthia>
no, the numbers are from my other debugs which are present
07:08
< Orthia>
It's showing when it's iterating to the next step in the for loop outside.
07:08
<@Vornicus>
Oh, oh, I see
07:09
<@Vornicus>
wy is it putting 200 of those in there...
07:09
< Orthia>
It's spitting out Hyug Numbers of repeats of the same character.
07:09
< Orthia>
Betcha it's not 200, but 208, 213...
07:10
<@Vornicus>
wtf...
07:10
<@Vornicus>
wtf wtf wtf
07:10
< Orthia>
Windows lacks the tools to check really quickly, though.
07:10
< Serah>
It's not repeat-characters!
07:10
< Serah>
They just brought their families.
07:10
< Orthia>
(Note: The spaces are inserted deliberately.)
07:11
< Orthia>
Certainly explains the gibberish, mind.
07:11
< Serah>
Gibberish? You don't like T and his family?
07:11
<@Vornicus>
wtf wtf wtf
07:12
<@Vornicus>
wtf
07:12
< Orthia>
Serah: Not to be rude, but this is kind of a problem we need to focus on.
07:12
< Serah>
I'll shut up then.
07:12
<@Vornicus>
...switch 74 and 77, that's wrong anyway
07:13
< Orthia>
You sure?
07:13
<@Vornicus>
workingindex = index and workingindex = previndex? yes, certain. It's why you're starting with ? ? ? ? ? -- those are actually /nulls/
07:13
< Orthia>
Oh, right
07:14
<@Vornicus>
sorry, looking at the wrong one for a moment on the line numbers, but the statement remains
07:15
< Orthia>
Nulls gone
07:15
< Orthia>
Error remains
07:18
<@Vornicus>
why.... why would it do that.
07:19
< Orthia>
It seems that it is not iterating through, but looping endlessly on each byte. Then stepping onto the next one.
07:19
<@Vornicus>
inside the place where we set workingbyte and workingindex, print those two
07:19
<@Vornicus>
(after setting)
07:20
< Orthia>
Actually
07:20
< Orthia>
Where do we do anything to byteArray?
07:20
<@Vornicus>
Gimme those diagnostics and we'll see.
07:21
< Orthia>
Remove current diagnostic?
07:21
<@Vornicus>
Yeah
07:22
< Orthia>
HAH
07:22
<@Vornicus>
HAH?
07:23
< Orthia>
http://pastebin.starforge.co.uk/218
07:24
< Orthia>
213 208 195 198 208 211 207 208 213 257 259 261 266 260 262 264 End Encoded Output
07:24
< Orthia>
X213 X208 X195 X198 X208 X211 X207 X208 X213 X257 X259 X261 X266 X260 X262 X264 End Decode Output
07:24
< Orthia>
Line 83 is adding the X.
07:24
< Orthia>
Every single time.
07:25
< Orthia>
Which makes sense. Our index is not getting bigger than the size of the array we're adding to
07:26
<@Vornicus>
right, so that spot is fine.
07:26
<@Vornicus>
In the while loop?
07:26
<@Vornicus>
(say, 88)
07:27
< Orthia>
Oh. I had thought that was, y'know, a bug
07:27
< Orthia>
Our index was never getting bigger so it was never doing the Clever bit.
07:32
<@Vornicus>
(is it taking an age to paste?)
07:33
< Orthia>
yeah.
07:34
< Orthia>
213 208 195 198 208 211 207 208 213 257 259 261 266 260 262 264 End Encoded Output
07:34
< Orthia>
X213 X208 X195 X198 X208 X211 X207 X208 X213 X257 X259 X261 X266 X260 X262 X264 End Decode Output
07:34
< Orthia>
That's for while(workingIndex != 1)
07:34
< Orthia>
er, -1
07:36
<@Vornicus>
....what...
07:36
<@Vornicus>
ARG WHAT IS GOING ON
07:36
<@Vornicus>
Oh
07:36
< Orthia>
We're never calling if(indexArray.size() < index) {
07:36
<@Vornicus>
No, /inside/ the loop
07:37
<@Vornicus>
No, that is a special case, it won't show up here. Try "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" and it will show up
07:37
<@Vornicus>
You want your debug inside the loop, not after it.
07:38
<@Vornicus>
and tell me what workingByte and workingIndex are from that debug.
07:38
< Orthia>
Sec
07:39
< Orthia>
HAH
07:39
< Orthia>
NEW SYMPTOM
07:39
< Orthia>
God knows how but
07:40
<@Vornicus>
Showme
07:41
< Orthia>
http://pastebin.starforge.co.uk/220
07:41
< Orthia>
Because I have a massive string of aaaaaaaaaaaaaaaaaaa in the file now
07:42 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
07:43
<@Vornicus>
:(
07:43
< Orthia>
Also, even better, this is the output file it makes from a string of perfect a's:
07:43
< Orthia>
… ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïð ñòóôõö÷øùúûüýþÿ
07:43
< Orthia>
07:43
< Orthia>
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnop qrstuvwxyz{|}~
07:44
< Orthia>
Notice the third bit.
07:45
<@Vornicus>
It goes completely insane.
07:45
< Orthia>
In a perfect iteration of ASCII characters.
07:46
<@Vornicus>
Yeah, but that starts earlier.
07:46
< Orthia>
Yeah
07:46
< Orthia>
It's iterating something...
07:46
<@Vornicus>
no, no, no, batshit stupid dammit
07:46
< Orthia>
What've we done~
07:46 * Vornicus quite literally facepalms because this one is /dumbassed/
07:46
<@Vornicus>
Why are we iterative over byteArray?
07:46
< Orthia>
I had long wondered that. >_>
07:47
<@Vornicus>
workingString!
07:47
<@Vornicus>
Not byteArray!
07:47
<@Vornicus>
I AM DUMBASS, HEAR ME ROAR
07:47
<@Vornicus>
I look at the first half and go "that's a shitton of noise" and then I go "wait, that's all the letters in latin 1, in the right order,"
07:47
< Orthia>
snerk
07:48
< Orthia>
OK, so what am I changing where
07:48
< Orthia>
And does it fix the outofbounds error too?
07:48
<@Vornicus>
in paste 220: line 89 should be workingString, not byteArray, and that is it.
07:48
<@Vornicus>
the outofbounds error was fixed earlier by pushing the thing out to the center.
07:49
<@Vornicus>
out of the if, rather, I'm going to eat my own brains soon.
07:49
<@Vornicus>
So we had... rather a few bugs in our decoder.
07:49
< Orthia>
bzzt
07:49
< Orthia>
Line 83: workingByte = byteArray.get(workingIndex);
07:49
< Orthia>
Is still overflowing.
07:50
<@Vornicus>
:(
07:50
<@Vornicus>
This is on aaaaaaaaaaa
07:50
<@Vornicus>
?
07:50
< Orthia>
Correct
07:50
< Orthia>
Seemed a good use of it.
07:51
<@Vornicus>
TOBEORNOTTOBEORTOBEORNOT <--- try this again.
07:51
< Orthia>
Outputs fine
07:51
<@Vornicus>
YES
07:51
<@Vornicus>
Okay, now the crazy bits.
07:52
< Orthia>
Interesting
07:52
< Orthia>
213 208 195 198 208 211 207 208 213 257 259 261 266 260 262 264 End Encoded Output
07:52
< Orthia>
-1 84 213 -1 79 208 -1 66 195 -1 69 198 -1 79 208 -1 82 211 -1 78 207 -1 79 208 -1 84 213 -1 79 257 -1 69 259 -1 82 261 -1 69 266 -1 79 260 -1 78 262 -1 84 264 End Decode Output
07:52
<@Vornicus>
in the if at 76, I want to see index, prevIndex, and workingString.get(0)
07:53
< Orthia>
Numbers between the indexes (213 etc) are being generated from: System.out.print(workingIndex + " " + workingByte + " ");
07:54
< Orthia>
Again: You don't see them ever.
07:54
<@Vornicus>
use aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
07:54
< Orthia>
OK
07:54
<@Vornicus>
(aaaaaaa is our special case whacker. it whacks the special case. Several times.)
07:56
< Orthia>
You don't get any output
07:56
<@Vornicus>
No debug output even?
07:56
< Orthia>
0 C://test//test.txt
07:56
< Orthia>
1 -r
07:56
< Orthia>
226 257 258 259 260 261 262 263 264 265 266 265 End Encoded Output
07:56
< Orthia>
226
07:56
<@Vornicus>
(we know it excepts)
07:56
<@Vornicus>
.....oh
07:57
<@Vornicus>
<=, not <
07:57
<@Vornicus>
k is not an index in a thing k elements long.
07:57
< Orthia>
0 C://test//test.txt
07:57
< Orthia>
1 -r
07:57
< Orthia>
226 257 258 259 260 261 262 263 264 265 266 265 End Encoded Output
07:57
< Orthia>
226 -1 97 257 -1 97 258 -1 97 259 -1 97 260 -1 97 261 -1 97 262 -1 97 263 -1 97 264 -1 97 265 -1 97 266 265 End Decode Output
07:57
< Orthia>
Curious that it sits eternally on -1
07:57
<@Vornicus>
No it's not, you have that diagnostic in the wrong place.
07:58
< Orthia>
oh, right. Where to, sir?
07:58
<@Vornicus>
Check your actual output now.
07:58
<@Vornicus>
Inside the while loop, not after it.
07:59
< Orthia>
... close!
07:59
< Orthia>
The cat on the hat shat on the mat -> The cat on te ht st nt mt
07:59
<@Vornicus>
How close.
07:59
<@Vornicus>
...okay that's possibly the best fail I've ever seen.
08:00
< Orthia>
Because it is awesome, or because it's starting to look human-readable? >_>
08:00
<@Vornicus>
Heh.
08:01
< Orthia>
TOBEORNOTTOBEORTOBEORNOT -> TOBEORNOTOEREONT
08:01
<@Vornicus>
Ooh ooh saw that one before.
08:01
<@Vornicus>
Now how did that error appear when I saw it before.
08:03
< Orthia>
It looks like it's not encoding/decoding the compressed bits properly.
08:03
<@Vornicus>
Decoding; I've checked the encoding, you're getting that much right.
08:04
< Orthia>
ToTooToooTooooTo -> Tooooooooo
08:04
<@Vornicus>
Missing the first byte of each one...
08:04
< Orthia>
Bingo
08:04
< Orthia>
(Used that one as a diagnostic because you /know/ which bits are what)
08:06
<@Vornicus>
...which means we're actually missing the /last/ one in each step!
08:07
< Orthia>
right
08:08
<@Vornicus>
How is that possible though?
08:08
<@Vornicus>
workingString.add(0, workingByte); <--- after this line: System.out.print(workingIndex + "/" + (char)workingByte + " ");
08:09
< Orthia>
213 240 257 258 240 261 259 262 240 End Encoded Output
08:09
< Orthia>
-1/T 213 -1/o 240 -1/o 257 -1/o 258 -1/o 240 -1 111 -1/o 261 -1/o 259 -1/o 262 -1/o 240 End Decode Output
08:10
<@Vornicus>
But before the brace
08:10
< Orthia>
Did that.
08:11
< Orthia>
workingString.add(0, workingByte);
08:11
< Orthia>
System.out.print(workingIndex + "/" + (char)workingByte + " ");
08:11
< Orthia>
}
08:11
<@Vornicus>
...and that's what you got?
08:12
<@Vornicus>
weird weird weird
08:14
<@Vornicus>
94. indexArray.add(prevIndex), not workingIndex
08:15
<@Vornicus>
That's why it's always -1, because we're DOING IT WRONG
08:15
<@Vornicus>
My brain is pasted on, yay
08:15
< Orthia>
fixed!
08:16
<@Vornicus>
and.... worky?
08:16 * Orthia gets his ToTooTooos back!
08:16
<@Vornicus>
FUCKYEAH
08:16
< Orthia>
Now we have only one inconvinient final bit
08:16
<@Vornicus>
?
08:16
< Orthia>
Getting decode to function. Assumption here that "We'll leave that to the bitpacker" is no longer valid.
08:17
< Orthia>
And we can roundrobin and we can encode, but we cannot yet decode~
08:18
<@Vornicus>
Time to build a bitbacker.
08:18
< Orthia>
... serious? OK.
08:18
<@Vornicus>
bitpacker*
08:18
<@Vornicus>
Yeah, this is relatively simple.
08:18
< Orthia>
OK, let's do it.
08:18
< Orthia>
New package, or just new class?
08:19
<@Vornicus>
LZW class.
08:19
< Orthia>
OK
08:19
<@Vornicus>
static void pack(Iterable<Integer> encoded, OutputStream packed)
08:22
<@Vornicus>
we need to keep track of the number of bits we need to pack each value.
08:22
<@Vornicus>
Which means we need to know how many indices have been used.
08:23
<@Vornicus>
This happens to be... 257 + the number of codes we've used already.
08:23
<@Vornicus>
so for right now, max_index = 257. We also need threshold = 512, and bit_count = 9
08:25
<@Vornicus>
and, we'll need a place to put our bits. make it a long, we're going to need the room.
08:27
<@Vornicus>
Got all that?
08:27
< Orthia>
Not quite, Eclipse chose this very moment to become an asshole and not let me make new classes. One second.
08:27
<@Vornicus>
Not making a new class.
08:29
< Orthia>
Wait, we're using the LZW to bitpack as well?
08:29
< Orthia>
O-kay
08:29
< Orthia>
I presume we'll have a Really Cunning method of letting everything be used individually later on.
08:30
<@Vornicus>
Of course. Different mains.
08:30
<@Vornicus>
The point here is that it's all about LZW. A different compressor will use a different bitpacker.
08:30
<@Vornicus>
And this is what flags are for.
08:31
< Orthia>
OK
08:32
< Orthia>
I was going to say is it not more importaint to be able to tell the LZW how big the trie gets than getting the bitpacker working, but ok
08:32
<@Vornicus>
Size limits happen soon.
08:32
< Orthia>
OK, then.
08:32
< Orthia>
Do they remain even if bitpacker is not being used?
08:33
<@Vornicus>
They're actually relatively simple, you just have to let everything know that the size limits exist and what the clear code is.
08:34
<@Vornicus>
So let's get our first few fields ready; max_index, threshold, and bit_count. These tell us how many bits we need to use to write this statement.
08:34
<@Vornicus>
er, this code.
08:34
< Orthia>
OK
08:35
<@Vornicus>
Next we need a place to put our bits, probably a long, and then a thing that tells us how many bits we have in our bit bin.
08:36
< Orthia>
long = 0; I presume?
08:37
<@Vornicus>
yeah.
08:37
<@Vornicus>
doesn't really matter, we'll be using shifts and ors to get our stuff in.
08:37
< Orthia>
ew, ok
08:38
< Orthia>
Done
08:38
< Orthia>
You wish to see?
08:38
<@Vornicus>
It's bitfiddling!
08:38
<@Vornicus>
Yes please.
08:39
< Orthia>
hurry uuuuuup
08:39
< Orthia>
http://pastebin.starforge.co.uk/221
08:39
<@Vornicus>
Yay
08:40
< Orthia>
(I hope you don't mind the folding, it occoured to me I'd done it halfway through uploading)
08:40
<@Vornicus>
foreach over encoded.
08:41
<@Vornicus>
(so far so good.)
08:41
< Orthia>
OK
08:42
< Orthia>
Each integer we find, we...
08:42
<@Vornicus>
Inside this foreach we have to do a variety of things. 1. we insert the bits we just got on the small end of the bin.
08:43
<@Vornicus>
so first shift the bin left by bitCount, then or our integer with bin.
08:43
< Orthia>
OK
08:43
< Orthia>
What command am I using to shift bits?
08:43
<@Vornicus>
<<
08:44
< Orthia>
bin << bitCount; ?
08:44
<@Vornicus>
bin <<= bitCount;
08:45
<@Vornicus>
and then or is |, we'll augment it the same way
08:45
< Orthia>
OK
08:46
<@Vornicus>
Once that's in, we'll extract bytes until there's less than 8 bits in the bin. figure out the while loop then show me
08:46
<@Vornicus>
(the condition, rather, not the innards)
08:47
< Orthia>
I extract bytes by...?
08:48
<@Vornicus>
You'll see. Just write the condition and then show me the function so far.
08:49
< Orthia>
http://pastebin.starforge.co.uk/221
08:50
<@Vornicus>
don't forget bin |= e
08:50
<@Vornicus>
(and I assume you meant 222)
08:50
<@Vornicus>
(that goes just after the shift)
08:50
< Orthia>
Erk. Sorry.
08:50
< Orthia>
Impatient on the copy command.
08:50
<@Vornicus>
Anyway, inside the loop we need to pull off and write out bytes. We do this from the /big/ side, as we've been adding numbers to the /little/ side.
08:51
< Orthia>
OK
08:51
<@Vornicus>
Oh, and I should stomp bugs now. compare binPacked instead of bin, and we're using 8 instead of bitCount because we're wondering if we can pull off a byte.
08:52
<@Vornicus>
And also, add to binPacked the number of bits we've added to the pile.
08:52
<@Vornicus>
(before the loop)
08:52
< Orthia>
<= 8, or < 8?
08:53
< Orthia>
binPacked = binPacked + bitCount; ?
08:53
<@Vornicus>
< 8.
08:53
<@Vornicus>
And yes, but binPacked += bitCount works too
08:54
< Orthia>
OK.
08:54
< Orthia>
Then?
08:55
<@Vornicus>
Okay, anyway. inside the loop, we want to 1. update binPacked to reflect that we're about to remove 8 bytes, then use the new binPacked as a >> target to actually get 8 bytes. That last is hard, I'll write it for you: packed.write((bin >> binPacked) && 0xff)
08:56
<@Vornicus>
er, not &&, just &
08:57
< Orthia>
hah, not applicable to long
08:58
< Orthia>
I don't suppose we want an int instead
08:59
<@Vornicus>
oops
08:59
<@Vornicus>
packed.write((byte)((bin >> binPacked) && 0xff))
09:02
<@Vornicus>
Show me what you've got, anyway
09:05
<@Vornicus>
8 bytes? 8 bits.
09:08
< Orthia>
uploading
09:08
< Orthia>
223
09:08
< Orthia>
http://pastebin.starforge.co.uk/223
09:09
<@Vornicus>
And update binPacked (before we actually do the shift) to reflect that we've pulled out 8 bits.
09:11
< Orthia>
By subtracting 8?
09:11
<@Vornicus>
yes
09:11
< Orthia>
wait
09:11
< Orthia>
binPacked - 8 != removing 8 bits, does it
09:11
<@Vornicus>
binPacked -= 8
09:12
< Orthia>
It removes 1000
09:12
<@Vornicus>
No, no
09:12
<@Vornicus>
binPacked tells us how many bits.
09:12
< Orthia>
oh, right
09:12
<@Vornicus>
bin tells us what the bits are.
09:12
<@Vornicus>
(we don't actually need to remove the bits from bin, though - that's the point of the and
09:13
< Orthia>
while (binPacked < 8) {
09:13
< Orthia>
binPacked -= 8;
09:13
< Orthia>
packed.write((byte)((bin >> binPacked) & 0xff));
09:13
< Orthia>
}
09:13
<@Vornicus>
There you go.
09:13
<@Vornicus>
Okay, now, after the while, we need to update how many codes we can possibly have, and then possibly update the number of bits we're going to need to pack the next code.
09:14
<@Vornicus>
Passing each code in LZW increases the number of codes available by 1.
09:14
< Orthia>
maxIndex++; in the for loop then
09:15
<@Vornicus>
Yep. Then we have to see if maxIndex is too big.
09:15
< Orthia>
If(maxIndex > threshold) { bitcount++; threshold = threshold*2; }
09:16
< Orthia>
?
09:16
<@Vornicus>
yes, but I'd use threshold <<= 1
09:16
< Orthia>
Um, ok
09:16
<@Vornicus>
(just because it's a very bitfiddly thing. it doesn't really matter that much)
09:17
< Orthia>
then?
09:17
<@Vornicus>
And finally, when we're all done, we need to grab our last bits and drop them in.
09:18
< Orthia>
This requires Silly Trickery, no?
09:19
<@Vornicus>
after the for loop - obviously, because that's when we've run out of codes but may still have a few bits left - we're going to write one more thing to the output: (bin << (8 - binPacked)) & 0xff
09:19
<@Vornicus>
(byte)
09:19
<@Vornicus>
Not very silly.
09:23
< Orthia>
Type mismatch: cannot convert from int to boolean
09:23
< Orthia>
(byte)(bin << (8 - binPacked)) & 0xff;
09:24
<@Vornicus>
wtf
09:24
<@Vornicus>
(byte)((bin << (8 - binpacked)) & 0xff), get the whole thing
09:24
<@Vornicus>
and I don't see any booleans there!
09:26
<@Vornicus>
Paste me the function, I don't know what the hell's going on.
09:28 You're now known as TheWatcher
09:32
<@Vornicus>
:(
09:32
<@Vornicus>
I have to go to bed soon.
09:32
<@Vornicus>
If we can get pack working, then unpack is very simple from there.
09:33
<@Vornicus>
Like, we just reverse a few things.
09:33
< Orthia>
UPLOAD DARNIT
09:33
< Orthia>
http://pastebin.starforge.co.uk/224
09:33
< Orthia>
Geez.
09:33
< Orthia>
The problem then is we still need to get decode in the main working, and also the trie limiter
09:33
<@Vornicus>
...did that honestly take 8 minutes.
09:34
<@Vornicus>
Right, once we have unpack then decode in main will work fine - but we'll be replacing plain decode with unpack and decode.
09:35
<@Vornicus>
Oh. packed.write that stuff, otherwise it's, uh, not going to get you anywhere. Oh, and wrap it in an if (binPacked != 0)
09:35
< Orthia>
AHA
09:36
<@Vornicus>
(because no point in writing an empty byte)
09:36
< Orthia>
gottit
09:36
<@Vornicus>
And that's done.
09:36
<@Vornicus>
Now, unpack!
09:37
<@Vornicus>
has the same signature as encode.
09:38
< Orthia>
What, even the Iterable<Integer> ?
09:40
<@Vornicus>
encode, not decode
09:41
<@Vornicus>
And paste just your signature for that function.
09:42
<@Vornicus>
(oh, and use "packed" instead of "raw" for your stream name.)
09:42 Orthia [orthianz@Nightstar-f99462f0.xnet.co.nz] has quit [Ping timeout: 121 seconds]
09:43
<@Vornicus>
:(
09:50 Orthia [orthianz@Nightstar-783f7556.xnet.co.nz] has joined #code
09:50
< Orthia>
So that is why it was going slow
09:50
< Orthia>
%$#@!
09:50
<@Vornicus>
whew
09:50
< Orthia>
Sun[21:37] <Vornicus> has the same signature as encode.
09:50
< Orthia>
Sun[21:38] <Orthia> What, even the Iterable<Integer> ? It's not taking integers any more, but a byte stream, ya?
09:51
<@Vornicus>
encode, not decode
09:51 * Orthia sorry, Vorn! It took that long to get it working again :(
09:51
<@Vornicus>
(oh, and use "packed" instead of "raw" for your stream name.)
09:52
<@Vornicus>
We're taking a stream and giving a pile of integers, it looks exactly like encode.
09:52
< Orthia>
OK
09:52
<@Vornicus>
we'll just call is unpack, and use packed as our stream name, and that's the signature.
09:52
<@Vornicus>
Anyway paste me the signature (there's not much to that.)
09:53
< Orthia>
public static ArrayList<Integer> unpack(InputStream packed) throws IOException {
09:53
<@Vornicus>
There you are.
09:53
<@Vornicus>
Now, copy and paste the entire body of pack into unpack.
09:55
<@Vornicus>
Then we get to change it up.
09:55
<@Vornicus>
We need an ArrayList<Integer> called encoded, for one thing, and at the end we'll return it.
09:56
< Orthia>
heh, I'd already added that
09:57
<@Vornicus>
Okay, now we need to copy the largest-scale loop structure from encode() and replace the outer foreach loop structure with that. Just the pair of for-loop preambles and their matching brackets.
09:58
< Orthia>
The whilebytesread != -1 loop?
09:58
<@Vornicus>
And the one inside that.
09:58
<@Vornicus>
32-34 are the preambles
09:59
<@Vornicus>
make sure you match up the brackets - this will go in place of 110
10:00
< Orthia>
I don't want the bitshift operations any more, correct?
10:00
<@Vornicus>
No, you still want those
10:00
<@Vornicus>
We're just changing their direction a bit.
10:01
< Orthia>
are we replacing the while loop internally?
10:02
<@Vornicus>
The while loop? nope.
10:02
< Orthia>
OK
10:03
< Orthia>
http://pastebin.starforge.co.uk/225
10:03
<@Vornicus>
Okay. We can kill the if binPacked > 0 bit and what it does.
10:04
<@Vornicus>
...oh, jeez. and in both pack and unpack, the while loop should say > not <
10:05
< Orthia>
while(binpacked > 8) {
10:05
< Orthia>
?
10:05
<@Vornicus>
Yes
10:05
< Orthia>
done
10:05
< Orthia>
What 'if binPacked > 0' bit?
10:06
< Orthia>
Only one we have like that is if binPacked != 0
10:06
<@Vornicus>
That
10:06
< Orthia>
right
10:06
< Orthia>
nuked.
10:06
<@Vornicus>
now, 147-154.
10:06
< Orthia>
right
10:07
< Orthia>
Swap everything? >_>
10:08
<@Vornicus>
We have to switch: e becomes buffer[i]; bitCount and 8 switch wherever either appears; packed.write becomes encoded.add; we cast to int instead of to byte; and 0xff becomes ((1 << bitCount) - 1)
10:08
<@Vornicus>
Hey, you're good.
10:09
< Orthia>
hrn
10:09
< Orthia>
What size should we make buffer this time?
10:09
<@Vornicus>
1024 still works.
10:11
< Orthia>
binPacked += bitCount -> binPacked += 8;
10:11
< Orthia>
Yes?
10:11
<@Vornicus>
yes
10:11
<@Vornicus>
We're filling in bytes this time, and pulling off integers.
10:12 AnnoDomini [annodomini@Nightstar-3090c769.adsl.tpnet.pl] has joined #code
10:12 mode/#code [+o AnnoDomini] by Reiver
10:13
< Orthia>
Ah, ok
10:14
<@Vornicus>
Show me when that's done.
10:14
< Orthia>
Quick query, what is bytesRead now?
10:15
<@Vornicus>
Same thing as it was in encoded - it's the number of bytes we read into the buffer.
10:16 * Orthia hopes and prays he didn't miss anything in the substitutions.
10:17 * Orthia snerks, realising he was a little too thorough in his find/replace: line 160~
10:18
<@Vornicus>
yeah don't change that
10:18
< Orthia>
fixed.
10:18
< Orthia>
Anything else?
10:19
<@Vornicus>
That, I am pretty sure, is it.
10:19
< Orthia>
So now we need to beat the shit out of main(), and set up a seperate main(), and add in extra flags?
10:19 Rhamphoryncus [rhamph@Nightstar-8931f88f.abhsia.telus.net] has quit [Client exited]
10:20
< Orthia>
And have it set so we can encode, encode+pack, pack, decode, decode+unpack, unpack...
10:20
< Orthia>
I can handle the flags okay (thank you McM~), but the rest should be interesting.
10:20
<@Vornicus>
Beat the shit out of main(); we don't need roundtrip anymore, and c and d will go pack(encode()) and decode(unpack())
10:20
<@Vornicus>
Flags flags flags
10:20
< Orthia>
Yeah
10:20
<@Vornicus>
You don't technically need e p d or u alone.
10:21
< Orthia>
Yes I do; it's how it gets marked
10:21
<@Vornicus>
bah
10:21
< Orthia>
I was trying to warn of this earlier, but~
10:22
<@Vornicus>
okay, e and u should loop and println their things. I don't know how to do d and p, there doesn't seem to be a nice way to write strings?
10:22
<@Vornicus>
er, read strings
10:23
< Orthia>
stdin I think was our cunning plan there
10:23
<@Vornicus>
also use c ad x for compress and extract, not c and d, so d does decode.
10:23
< Orthia>
OK
10:25
<@Vornicus>
Arg, can't keep this up.
10:26
< Orthia>
Sorry Vorn :(
10:26
<@Vornicus>
I need to go to sleep, unfortunately, but I really want to see this through. Can we do the bit limiter tomorrow? It'll take a bit of explaining anyway.
10:26
< Orthia>
I was worried about that.
10:26
< Orthia>
Well, I can submit it late I suppose, sure
10:27 * Orthia checks the rules on late submissions.
10:27
<@Vornicus>
You can also submit it on time and then say "bit limiter: coming soon, honest"
10:27
< Orthia>
heh, ok
10:27
< Orthia>
In that case we need to get done, hm
10:27
<@Vornicus>
main.
10:27
<@Vornicus>
Figure out how to pull in integers from a file (preferably plaintext)
10:28
<@Vornicus>
and send out integers /to/ a file (same format)
10:28
< Orthia>
(This is why I was tempted to have a FileHandler class, idly)
10:29
< Orthia>
But forget that.
10:29
<@Vornicus>
You want something that will turn an iterable of integers into a file of return-separated numbers in ascii, and vice versa.
10:29
< Orthia>
Let's see if we can first get the bitpacker and unpacker to work seamlessly in our default All Steam Ahead operation.
10:29
<@Vornicus>
And I need sleep badly.
10:30
<@Vornicus>
Tell me how it goes, I can't but crash.
10:30
< Orthia>
Thank you Vorny, g'night!
10:31 Vornicus is now known as Vornicus-Latens
13:17
<@AnnoDomini>
http://bash.org.pl/612003/ <- "Perl is the only programming language that's equally readable before and after AES ciphering."
13:19
< Namegduf>
I dunno.
13:19
< Namegduf>
MUMPS.
13:19
< Namegduf>
Or, worse, the Object Orientated MUMPS.
13:22
< Namegduf>
Really, they're disturbingly comparable.
13:22
< Namegduf>
Perl declared "0 but true" an awesome construct.
13:22
< Namegduf>
MUMPS, one-letter variables and abbreviated code.
13:22
< Namegduf>
With no comments.
13:24 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
13:24 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
13:24 * TheWatcher eyes, mehs
13:26
< celticminstrel>
...why does my computer keep crashing!?
13:27
<@AnnoDomini>
Because you touch yourself at night.
13:27
< Namegduf>
Specifically, you need to use a less-overheating-to-decode codec on your porn.
13:29
< gnolam>
Pfft.
13:29
< gnolam>
It's obviously the Illuminati's fault.
13:29
< Namegduf>
That does seem more probable.
13:34
< celticminstrel>
It's a Mac. Macs don't crash (usually). Therefore I wonder if there might be something seriously wrong.
13:34
< Namegduf>
Ah.
13:34
< celticminstrel>
It always occurs when I tell the computer to sleep.
13:34
< Namegduf>
If it's totally random, and not preceeded by any configuration changes or upgrades, could be a hardware failure.
13:35
< Namegduf>
Ah, that's... hm.
13:35
< gnolam>
... HAH
13:35
< Namegduf>
A little bit in the back of my brain is going "I've heard of that"
13:35
< celticminstrel>
The screen never goes blank, and I can't wake it up.
13:35 * gnolam was forced to use iMacs with MacOS... 9? back in the day.
13:35
< Namegduf>
Mac OS 9 doesn't count
13:35
< Namegduf>
A lot of important stuff was cooperatively multitasked
13:35
< celticminstrel>
Well, I'm not using Mac OS 9. And when I did, crashing wasn't such a big deal.
13:35
< gnolam>
So the statement "Macs don't crash (usually)" was wonderfully... ironic... to me.
13:35
< Namegduf>
Reliability in such an environment is a joke.
13:36
< celticminstrel>
The statement "Macs don't crash (usually)" naturally assumes the Mac in question is running OSX.
13:36
< celticminstrel>
I know it didn't apply before that.
13:36
< Namegduf>
(Given that these were normal user processes, not vetted, safe stuff)
13:37
< gnolam>
Incidentally, this is why I don't trust a single good word said about modern Macs/OS X. Because the rhetoric is the exact same as for the utter shite that preceded it.
13:37
< celticminstrel>
Um. Except it's true. It doesn't crash (usually).
13:38
< celticminstrel>
This is from experience.
13:39
< Namegduf>
You know, Chrome took its sweet time getting the developer tools to work on Linux
13:39
< Namegduf>
But they're really handy now.
13:39
< Namegduf>
(Not so good as Firebug, but unlike Firebug, they don't seem to freak out at random/over dynamically inserted webapps)
15:07 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
15:18 Attilla [Attilla@FBC920.482E2D.4224C9.452BFB] has joined #code
15:18 mode/#code [+o Attilla] by Reiver
15:28
< Orthia>
For Vorn: http://pastebin.starforge.co.uk/227 and http://pastebin.starforge.co.uk/228
16:05
< celticminstrel>
You know, I probably would've made a lightweight class (or, in C++, a struct) and had an ArrayList of that rather than having two parallel arrays.
16:06
< celticminstrel>
Not that your/Vorn's way is bad, of course.
16:06
< celticminstrel>
It's perfectly fine.
16:08
< celticminstrel>
Orthia: What's with class Main, line 45?
16:10
< celticminstrel>
Should there be an "else" there?
16:14
< Orthia>
er, yes.
16:14
< Orthia>
tired. I sleep. Feel free to correct it, if you could.
16:34 Derakon[AFK] is now known as Derakon
17:02 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection closed]
17:23 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
18:17 Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has joined #code
18:20
<@Vornicus-Latens>
Reiver: your flags and actions don't match up.
18:20 Vornicus-Latens is now known as Vornicus
18:30 Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Connection reset by peer]
18:31
<@Vornicus>
Tasks that need doing: 1. fix your flags. 2. write a thing that handles reading and writing of integers as text. 3. get bit-limits working.
18:32 Tarinaky [Tarinaky@Nightstar-dc09c9a8.adsl.virginmedia.net] has quit [Ping timeout: 121 seconds]
18:33
<@Vornicus>
2 appears to be handled by InputStreamReader and OutputStreamWriter
18:33
<@Vornicus>
1 is just me beating you over the head. 3 is explanations
18:34 Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
18:35 Syloqs_AFH is now known as Syloqs-AFH
18:47 Tarinaky [Tarinaky@Nightstar-8266ffac.adsl.virginmedia.net] has joined #code
18:54 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: *hums* Can't stay now!]
19:35 Rhamphoryncus [rhamph@Nightstar-8931f88f.abhsia.telus.net] has joined #code
20:42 * AnnoDomini watches an instructional video on NHibernate. There's a slide with a chart entitled "I love Data (Graphs)".
20:51
< Bobsentme>
hehe
21:05 * Orthia awakens
21:07
< Orthia>
Vornicus: What is 3?
21:08
< Orthia>
Also, Vornicus: It sounds like our Iterable is the wrong thing to be using - it's convinient within the code, but Iterable and InputStream are apparently rather non-compatable.
21:08
<@Vornicus>
No, no
21:08
<@Vornicus>
Iterable is when you actually have numbers
21:08
<@Vornicus>
InputStream and OutputStream are for talking to files.
21:08
< Orthia>
OK
21:09
<@Vornicus>
You need to convert between them because you can't put numbers nicely directly into files.
21:09
<@Vornicus>
Another option is to use DataInputStream and DataOutputStream, which will give binary stuff but it requires less actual work.
21:11
<@Vornicus>
Only some though
21:13
< Orthia>
Either way, I just want to have it able to load and save files and call it good
21:13
< Orthia>
Partly because once we have that we can actually test our bitpacker.
21:14
<@Vornicus>
DIS and DOS I think then are our friends
21:14 Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Ping timeout: 121 seconds]
21:14
< Orthia>
OK
21:14
< Orthia>
What am I meant to be doing with them?
21:16
<@Vornicus>
Look at those; you can send off integers to those.
21:16
<@Vornicus>
and retrieve them.
21:16
<@Vornicus>
You'll see the methods; see what you can come up with.
21:16
<@Vornicus>
I have to go do something.
21:17
<@Vornicus>
I'mm be back in 45 minutes to an hour I think
21:17
< Orthia>
No problem, gives me a good time to find some breakfast
21:27 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
21:59
<@Vornicus>
okay, back
22:00
<@Vornicus>
42 minutes! muaha!
22:04 Serah [Z@2C3C9C.B2A300.F245DE.859909] has joined #code
22:05 Rhamphoryncus [rhamph@Nightstar-8931f88f.abhsia.telus.net] has quit [Client exited]
22:39
< Orthia>
39 minutes later, I return also. Blarg.
22:39
< PinkFreud>
blargh is dead. long live kakrafoon.
22:39
< Orthia>
(Realised today was rubbish day, and my rubbish at home hadn't been put out. It, uh, didn't make it out last week either... Was not fun. >.<)
22:40
< Orthia>
OK, so what the hell am I doing here Vorn
22:40
<@Vornicus>
I don't know, what the hell am you doing.
22:40
< Orthia>
Fixing flags, right.
22:40 * Orthia goes to fix flags.
22:42
<@Vornicus>
All right. You need the following flags: encode decode pack unpack compress extract
22:43
< Orthia>
We'll have all those crafted in a couple hours?
22:43
<@Vornicus>
They're mostly done, we just have to set them up.
22:43
<@Vornicus>
There's only one thing we need: a way of storing encoded-but-not-packed stuff.
22:44
< Orthia>
And figure out how to get the iterators working with loaded code.
22:44
<@Vornicus>
Right, that's not hard.
22:45
<@Vornicus>
This is one of the things this step will figure out.
22:49
< Orthia>
flagcatch written
22:49
<@Vornicus>
http://java.sun.com/javase/6/docs/api/java/io/DataInputStream.html http://java.sun.com/javase/6/docs/api/java/io/DataOutputStream.html
22:50 Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Connection reset by peer]
22:54 Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
22:55 Syloqs_AFH is now known as Syloqs-AFH
22:55 AnnoDomini is now known as Lance
22:56 Lance is now known as AnnoDomini
22:58
<@Vornicus>
Look specifically at readInt and writeInt
22:58
<@Vornicus>
We can wrap an inputstream (like a file) in DataInputStream and it will give us integers.
22:58
< Orthia>
Which we can then feed to an ArrayList<Integer>?
23:00
<@Vornicus>
Exactly.
23:01
< Orthia>
OK, need to figure out how to do that now then.
23:01
<@Vornicus>
What we're going to do is write a class that will do this for us: take an InputStream, wrap it in DataInputStream, and pull integers out. We'll also have the other way around.
23:01
< Orthia>
... So after all the 'Nah, we don't need a FileHandler class', we're writing a class afterall? :p
23:02
<@Vornicus>
Yes, but not for the thing you were writing a FileHandler class for.
23:02
< Orthia>
Awh
23:02
< Orthia>
OK
23:02
< Orthia>
So how am I doing this then
23:03
<@Vornicus>
Make a class, FileHandler works, and write two static methods - one to go from InputStream to ArrayList<Integer>, the other to go from Iterable<Integer> to OutputStream
23:04
<@Vornicus>
Same basic signature as encode and decode.
23:04
< Orthia>
Hm. Name?
23:05
<@Vornicus>
Dunno.
23:07
< Orthia>
streamToList and listToStream comin' right up
23:07
<@Vornicus>
See if you can write those without my help - they're not at all difficult.
23:13
< Orthia>
blarg, two hours
23:20
< Alek>
fark
23:20
< Orthia>
http://pastebin.starforge.co.uk/229
23:21
< Alek>
this win7 copy was supposed to be permanently activated, with no checks, but it checked and is now not-genuine. >_>
23:22
<@Vornicus>
Okay, there's the signature, now you need to convince the stream to let you pull ints from it.
23:22
< Orthia>
And this is something we need to do as a class instead of as a function elsewhere, ok
23:24 Alek [omegaboot@Nightstar-7ff8f4eb.il.comcast.net] has quit [[NS] Quit: fark]
23:26
<@Vornicus>
No, it's just it's a function but it doesn't make much sense to put it elsewhere.
23:26
<@Vornicus>
(and in Java, everything lives in a class)
23:27 Alek [omegaboot@Nightstar-7ff8f4eb.il.comcast.net] has joined #code
23:27
<@Vornicus>
(in the Real World, this thing would produce an Iterable that reads dynamically from the file, so you never have more of the file than you need.
23:28
< Orthia>
blarg
23:28
< Orthia>
I should be using a for loop or something here shouldn't I
23:29
<@Vornicus>
Yes.
23:35
< Orthia>
http://pastebin.starforge.co.uk/230
23:39
< Orthia>
Vornicus: What should be in the while loop?
23:39
<@Vornicus>
Well, first off, wrap your InputStream in a DataInputStream
23:40
<@Vornicus>
this will pull ints (as opposed to just bytes) worth of data from your thing.
23:41
< Orthia>
Wrap by typecast?
23:41
<@Vornicus>
Wrap by constructor.
23:41
<@Vornicus>
Read the things in DataInputStream, this should be reasonably obvious how it works.
23:42
< Orthia>
done
23:43
<@Vornicus>
(I'm doing this blind except for documentation here, you should be able to do the same)
23:43
<@Vornicus>
Anyway you can tell you're done when your InputStream is at eof.
23:49
< Orthia>
Is there a foo.EOF?
23:53
< gnolam>
Alek: Is it actually genuine though?
23:54
<@Vornicus>
actually looking at it I don't see a nice one. I think your only real bet is to catch EOFException
23:58
< Orthia>
http://pastebin.starforge.co.uk/231
23:59
<@Vornicus>
Nope.
23:59
<@Vornicus>
the -1 doesn't help you, you can't guarantee that you won't get -1 from your thing.
--- Log closed Mon Mar 29 00:00:49 2010
code logs -> 2010 -> Sun, 28 Mar 2010< code.20100327.log - code.20100329.log >