code logs -> 2007 -> Sat, 31 Mar 2007< code.20070330.log - code.20070401.log >
--- Log opened Sat Mar 31 00:00:59 2007
00:20 Derakon [~Derakon@Nightstar-12737.sea2.cablespeed.com] has joined #code
00:20 mode/#code [+o Derakon] by ChanServ
00:22
<@Derakon>
I believe I've found a source for my random-photos requirement. Wikipedia is a trove of public-domain imagery.
00:29
<@Vornicus>
yeah
00:31
<@Derakon>
See e.g. http://en.wikipedia.org/wiki/Image:Polarlicht_2.jpg
00:31
<@Derakon>
Actually, I should probably be able to get plenty just by trolling the pictures of the day.
01:19
<@Vornicus>
That is incredible.
01:51
<@McMartin>
Aha
01:51
<@McMartin>
I knew it had to be in there somewhere.
01:51
<@Derakon>
Enzephenebeh?
01:52 * McMartin finds the codecs.{utf_8, latin_1}_{en,de}code() functions in the Python library.
01:52
<@Derakon>
Had an encoding problem?
01:52
<@Derakon>
I hate those.
01:52
<@McMartin>
Type errors, actually.
01:52
<@Derakon>
Ah.
01:52
<@McMartin>
Which are Really Hard To Find because the data and my locale are both UTF-8.
01:52
<@McMartin>
So lots of stuff that shouldn't work does.
01:53
<@Derakon>
Heh.
01:53
<@Derakon>
Change your locale?
01:53
<@McMartin>
That would involve installing additional locales that I do not want to bother with~
01:53
<@Derakon>
Fair enough.
01:53
< Doctor_Nick>
!roll 1d20
01:53
< KarmaBot>
[Doctor_Nick] rolled 1d20: (14) = 14.
01:53
< Doctor_Nick>
i win
01:53
<@Derakon>
!roll 1d27
01:53
< KarmaBot>
[Derakon] rolled 1d27: (2) = 2.
01:53
<@Derakon>
Bah.
01:53
< Doctor_Nick>
ho ho
01:54
<@Vornicus>
McM: there's also decode/encode themselves, which take parameters.
01:54 * Derakon adjust to the d20 range, gets a 15. Hah!
01:54
<@McMartin>
Vornicus: But not the right ones.
01:54
<@Vornicus>
huh.
01:54
<@McMartin>
They take "what do you do when you get errors" parameters.
01:54
<@McMartin>
There's a ridiculous list of codecs, but I could not winkle out exactly how one, you know, specified the encoding one wanted to use.
01:55
<@McMartin>
Basically, I'm reading in an XML file full of UTF-8, and thus getting a nice list of u''-based strings.
01:55
<@McMartin>
I process these and then want to dump them safely.
01:55
<@McMartin>
u'' is, however, UCS-2 or UCS-4 depending on how your Python was compiled.
01:55
<@McMartin>
Printing respects the terminal's current locale.
01:55
< Doctor_Nick>
l:
01:56
<@McMartin>
So. utf8-encoding them gets me octet strings of type str, which I can dump happily.
01:57
<@McMartin>
And will do so regardless of current locale.
01:58
<@McMartin>
(Also, the default encoding for str appears to be "7-bit ascii" D:)
02:46 ReivZzz is now known as Reiver
02:48 * Derakon eyes his timed hooks function, which seems rather clunky (not to mention non-operable).
02:50 Janus [~Cerulean@Nightstar-10302.columbus.res.rr.com] has quit [Quit: So if babies come from your belly button, why do I have one..?]
02:51
<@Derakon>
...right, I forgot the "self." again.
02:51
<@Derakon>
I'm too used to classes having their fields automatically be in-scope for member functions.
02:54
<@McMartin>
Blargh.
02:54
<@McMartin>
For some reason bt.ocremix.org is flaking on me.
02:54
<@Derakon>
What're you downloading now?
02:54
<@McMartin>
It seems to be giving random data in response to scrape requests.
02:54
<@McMartin>
I'm not.
02:54
<@McMartin>
I'm seeding some of the AVIs I got from tasvideos.
02:54
<@Derakon>
And they use bt.ocremix.org?
02:54
<@McMartin>
And the OCR torrents that are already done are freaking out.
02:55
<@McMartin>
Because they can't decide whether or not there are enough seeds or not, because the scraping is giving them random results.
02:55
<@Derakon>
Ahh.
02:55 * McMartin force-stops them.
03:00 * McMartin does feel kind of silly seeding a torrent of total size < 5MB.
03:00
<@Derakon>
Which TAS would that be for?
03:01
<@McMartin>
The Monopoly one.
03:01
<@Derakon>
Heh.
03:01
<@McMartin>
Which currently has 1 seed.
03:01
<@McMartin>
(Which isn't me, as my share ratio is already >1, and there are no peers at present.)
03:07
<@Derakon>
Idly, I recommend the SNES Umihara Kawase speedruns.
03:08
<@McMartin>
My downstream is consumed by OO.o at the moment.
03:08
<@Derakon>
No rush.
03:08 * McMartin has also been going the AVI route so that he can inflict them on others.
03:08 * McMartin has a big spindle of otherwise useless CD-Rs.
03:08 * Derakon nods.
03:09
<@McMartin>
Nobody wants the Hyper Knuckles TAS. >_>
03:09
<@Derakon>
I have that one...
03:09
<@Derakon>
I should be seeding it right now, in fact.
03:09
<@McMartin>
No need.
03:09
<@McMartin>
There are 10 seeds and no peers.
03:09
<@McMartin>
9.
03:10
<@Derakon>
Ahh, that's what you meant.
03:10 * McMartin managed to get the ratios for all the others he has > 1.
03:10
<@Derakon>
I read "Nobody *has* the Hyper Knuckles TAS."
03:10 * McMartin watched that one this morning.
03:10
<@McMartin>
The bonus stages were the best part.
03:10
<@Derakon>
Jumping backwards FTW?
03:11
<@McMartin>
Or just randomly wandering backwards
03:11
<@McMartin>
Or for casually ignoring all obstacles due to proper jump timing
03:11
<@McMartin>
Well
03:12
<@McMartin>
OK, Flying Battery 2 was better in the Knuckles run than in the Sonic and Tails one, too.
03:12
<@Derakon>
...heh...I want to see a ninja game where the protagonist wears Standard Ninja Garb so as to blend in with his enemies.
03:13
<@McMartin>
zomgninja?
03:13
<@McMartin>
... Hee. If you wiigii-ify "zomg" you get "zing".
03:13
<@Derakon>
Nice.
03:14
<@Vornicus>
zingbubha
03:14
<@Derakon>
There was a pretty decent "pacifist" TAS of Revenge of Shinobi, but I think it got obsoleted.
03:15
<@Derakon>
Or maybe it was Shinobi 3.
03:15
<@Derakon>
It's the one that includes a jetski, whichever.
03:15 * McMartin hees at OCR again.
03:16
<@Derakon>
Enzephenebeh?
03:16
<@McMartin>
The Peer:Seed ratios on these are 2:23 and 5:34.
03:16
<@Derakon>
Wow.
03:16
<@McMartin>
("You get to drink from... the fire hose")
03:16
<@Derakon>
One of the stages in this game is called "Union Lizard".
03:16
<@Derakon>
And I'm picturing Godzilla with a picket sign.
03:17
<@McMartin>
What game is this?
03:17
<@Derakon>
Shadow Dancer. Not especially great.
03:17
<@Derakon>
It's a ninja game in the rescue-hostages-from-guys-with-boomerang-shields style.
03:17
<@Derakon>
Also, that samurai's crotch is way too obvious.
03:18
<@McMartin>
... boomerang shields?
03:19
<@Derakon>
You haven't played the original Shinobi then, I take it.
03:19
<@Derakon>
Or, in fact, any of the Shinobi games before they taught ninjas to do things other than jump and throw shurikens.
03:22
<@McMartin>
It's been a long, long time.
03:22 Takyoji [~Takyoji@Nightstar-25511.dhcp.roch.mn.charter.com] has joined #code
03:22
<@McMartin>
I remember the first one in the arcade, but just remember chucking kunai and ducking ninja stars.
03:22
<@Derakon>
Well, basically they're "walk right through this level, killing enemies and touching hostages to free them" games.
03:23
<@Derakon>
Notable features include: zomgninja, most levels have two "floors" you can jump between, and most hostages are guarded by big guys with boomerang shields.
03:23
<@McMartin>
It's the term "boomerang shield" that's puzzling me. It reflects your shots? It's shaped like a boomerang?
03:23
<@Derakon>
When thrown, it returns.
03:24
< Takyoji>
There's something that's been boggling my mind for quite a while now...
03:24
< Takyoji>
What are interfaces? (not User Interfaces)
03:24
<@Derakon>
Gorilla. Right there. See?
03:25
<@Derakon>
(Don't mind me)
03:25
< Takyoji>
sorry for butting in..
03:26
<@Derakon>
No worries.
03:26
<@Derakon>
On-topic generally trumps off-topic.
03:26
<@McMartin>
Takyoji: I'll need more context for that.
03:26
<@Derakon>
Anyway, my memory's a bit hazy, but ISTR that interfaces are basically "if you define these functions for your class, then you can work with this other useful class".
03:26
<@McMartin>
Are we talking Java Interfaces or APIs in general?
03:27
<@Derakon>
"Interface" is also a general OO design term, McM.
03:27
< Takyoji>
I'm using PHP / C# but I just need to understand the general ideas of interfaces
03:27
<@McMartin>
Derakon: Yes, but in Java "interface" is a keyword.
03:27
<@McMartin>
And there are VM ops associated with it.
03:27
<@Derakon>
Point.
03:27
<@McMartin>
Takyoji: This is like asking "What's up with libraries?"
03:28
<@McMartin>
I'm assuming here that you mean APIs. (Application Programming Interface)
03:28
<@McMartin>
In which case, the API of a library is the set of functions, classes, data structures, etc. that are exposed to the user.
03:28
<@McMartin>
Which is to say, knowing what those functions do means you know how to use the library.
03:29
<@McMartin>
If you want more specific answers, you'll need to ask a more specific question.
03:29
<@McMartin>
(In Java, "interface" is a reserved word that essentially defines an abstract class and lets you cut across inheritance trees. These are not part of the "general ideas".)
03:32
< Takyoji>
So is an interface how the data is presented to another class?
03:32
<@McMartin>
It can be.
03:32
<@McMartin>
"Interface", the word, means "the place where two domains touch."
03:32
<@McMartin>
They can be classes.
03:32
<@McMartin>
They can be modules (this is where the API level is)
03:32
<@McMartin>
They can be the OS/Hardware interface.
03:32
<@McMartin>
They can be the human/computer interface ("user interface")
03:33
<@Vornicus>
They can be a network protocol. IRC defines an interface between clients and servers.
03:33
<@McMartin>
If you used "interface" when informally describing the public methods on a class, you would be understood.
03:33
<@McMartin>
If you can use it in a sentence to give context, this would likely be helpful.
03:34
<@McMartin>
As there are a number of related concepts that also use the word but force a specific meaning, such as "programming to the {X} interface"
03:37
< Takyoji>
I believe it is of making an interface of a class. Is that still quite broad yet?
03:38
<@Vornicus>
THat narrows it down considerably, and is close to the Java usage.
03:38
<@McMartin>
We'
03:38
<@McMartin>
We're getting closer now.
03:38
<@McMartin>
What is C#'s term for a method that only has implementations in subclasses?
03:38
<@Vornicus>
a class's interface is all the methods and properties it allows the outside world to touch.
03:38
<@McMartin>
C++ calls them "pure virtual", Java calls them "abstract".
03:38
<@Vornicus>
"abstract" I think.
03:39
<@McMartin>
To make an interface for a class, you make a new class that has all the bits you want the outside world to see as abstract methods.
03:39
<@McMartin>
You then make the original class subclass that abstract class.
03:39
<@McMartin>
Then the app uses the abstract class everywhere.
03:39
<@McMartin>
If you provide this more than once, depending on what the app is using the class for, it becomes a "View class".
03:40
<@Vornicus>
abstract, yes. And, everywhere except for where the objects get constructed.
03:40
<@McMartin>
Which you can also abstract away behind a factory method or something.
03:41
<@Vornicus>
indeed.
03:41
<@Vornicus>
but then the factory method is where the objects get constructed.
03:42
< Takyoji>
My C# book says "There are times when you may not want to create a new type, but you do want to describe a set of behaviors that any number of types might implement. For example, you might want to describe what it means to be 'storable' (capable of being written to disk) or 'printable'"
03:42
<@Vornicus>
interface is a keyword in C# too, same meaning
03:43
<@McMartin>
Those are the mixin cases. Does C# have multiple inheritance?
03:43
<@Vornicus>
I think so.
03:43
<@McMartin>
OK, so.
03:44
<@Vornicus>
Oh, it does not.
03:44
<@McMartin>
OK then, this is thus precisely like the Java case, then.
03:44
<@McMartin>
The problem goes like this.
03:44
<@McMartin>
You have 10 different classes.
03:45
<@McMartin>
5 of them are unrelated but happen to be, say, translatable into database tables.
03:45
<@McMartin>
The traditional way to deal with this is to have those 5 classes all share some superclass that includes the "translate me into database tables" method.
03:45
<@McMartin>
And then database routines take that superclass as an argument.
03:45
<@McMartin>
This is the "interface class" I described above, basically.
03:45
<@McMartin>
However. In Java, and, apparently, C#, you only get to inherit from one class at a time.
03:46
<@McMartin>
So, suppose in addition to this, you also have five classes amongst your 10 that can be drawn to the screen.
03:46
<@McMartin>
And that there is some overlap.
03:46
<@McMartin>
Now you either have to make an uber-super-class that could be either of those, and fails sometimes depending on type, which sucks...
03:46
<@Vornicus>
Other languages are like this too - Ruby can only 'inherit' one class, but can mix in behavior till the cows come home.
03:47
<@McMartin>
Or you end up not being able to get the ability to cast to one of these things as a type.
03:47
<@McMartin>
Enter "interfaces".
03:47
<@McMartin>
Interfaces are like classes but they define no methods, just method signatures.
03:47
<@McMartin>
If you inherit from (or implement, or mix in, depending on language) an interface, you are saying "I can be case to this interface type; I provide all its methods."
03:47
<@McMartin>
But it is not a "real" type in the sense of the objects having the same layout or anything.
03:48
<@McMartin>
Because of this, interface-based method calls can be slightly slower than regular method calls.
03:49
<@McMartin>
C# has a huge load of interface classes that you may want to implement in your own classes to make them work nicely with the underlying libraries.
03:49
<@McMartin>
I'll pull an example from Java, because I know it better.
03:49
<@McMartin>
If you have a sorted list of, say, book titles
03:50
<@McMartin>
You want to sort them, but you don't actually want to sort them in strict alphabetical order, because when you sort titles, you ignore "A", "An", or "The" if it's the first word.
03:50
<@McMartin>
So you have your book data class implement Comparable and then define the compareTo() function within it.
03:50
<@McMartin>
And now you can hand it off to the library's various comparison-based classes like TreeSet and OrderedList and have it all Just Work.
03:51
<@McMartin>
That's the most practical side.
03:51
<@Derakon>
I did such a thing to sort a map by its values. ¬.¬
03:52
<@McMartin>
The most theoretical side is "Multiple inheritance is full of spiders, but you can get most of the benefits with a minimal number of spiders if you insist that at most one of a class's superclasses actually define anything."
03:52
<@McMartin>
The spiders do not, alas, entirely disappear.
03:52
<@Derakon>
Do they get bitten by radioactive pigs?
03:52
<@Vornicus>
(in Ruby, you can define <=> and include Comparable, which is a mixin module, and it magically gives you < = > <= >= and !=)
03:53
<@McMartin>
In particular, if you implement two interfaces which have the same method guaranteed by them, despite the fact that there's no ambiguity about what it means, Wackiness is still likely to Ensue.
03:53
<@McMartin>
Because, sure, go() exists, which is all they demand
03:53
<@McMartin>
But go() probably means one thing when you're a Vehicle, and quite another when you're a Runnable.
03:54
<@McMartin>
So if you try to implement Vehicle and Runnable simultaneously, it's unlikely that go() will do what both of them want...
03:54
<@Derakon>
Thus, every function ever should have a unique function name. ¬.¬
03:54
<@McMartin>
... when exposed in an interface, yes.
03:54
<@Vornicus>
(a class that implements Runnable, in Java, is a class that when told to run() will create a thread and execute its go() method in that thread)
03:54
<@Derakon>
No exceptions!
03:55
<@McMartin>
No, you get namespaces in all other cases, Derakon.
03:55
<@Derakon>
No namespaces!
03:55 * Vornicus shoots Der.
03:55 * McMartin mangles Der.
03:55 * Derakon is shot and mangled, and rightfully so!
03:55
<@Vornicus>
But, I'm confused on how RUnnable works. It's an interface, right, so it can't define any behavior...
03:55 * McMartin still can't believe how many versions it took g++ to include demanglers in its error reporting.
03:56
<@McMartin>
Runnable defines run(), not go().
03:56
<@McMartin>
Thread implements Runnable.
03:56
<@McMartin>
Thread can also be initialized with a Runnable argument.
03:56
<@McMartin>
(At which point Thread.run() runs that)
03:56
<@McMartin>
... no, that's still wrong, I think.
03:57
<@Vornicus>
So you say Thread(a_runnable_object).run() and it goes?
03:57
<@McMartin>
To the API docks!
03:57
<@McMartin>
docs, too.
03:57
<@McMartin>
I think it might be Thread.start().
03:57
<@McMartin>
One moment
03:58
<@McMartin>
OK.
03:58
<@McMartin>
You do one of two things.
03:58
<@McMartin>
(a) Define a Runnable, build a thread with the Thread(Runnable) constructor
03:58
<@McMartin>
(b) Subclass Thread, override run()
03:58
<@McMartin>
(b.2) Build an instance of your subclass however
03:59
<@McMartin>
Once you do this, you then call Thread.start() on the constructed Thread, and it spawns, calls run(), and then cleans itself up once it's done.
03:59
<@McMartin>
Runnable can also be used for argumentless lambdas~
04:00 * Vornicus remembers writing some Swing, in order to pass in a function you had to instantiate an anonymous one-shot class inheriting from an abstract class.
04:06
<@Vornicus>
It was made of ;_; and is one reason most languages let you define functions outside of classes.
04:09
<@Derakon>
Um, is Knuckles *supposed* to not fight a boss in Carnival Night Zone 2?
04:09
<@McMartin>
Statically type-checking them gets annoying.
04:09
<@McMartin>
Derakon: ... I don't remember.
04:09
<@McMartin>
He definitely isn't in Lava Reef 2.
04:10 * Derakon nods.
04:10
<@Vornicus>
McM: true, that.
04:10 * Doctor_Nick type-checks McMartin in the kidneys
04:13 * Derakon takes a moment to wonder why all of the second acts in S3 have water, and why none of the acts in S&K do.
04:16
<@McMartin>
Water is boring~
04:17 McMartin [~mcmartin@Nightstar-5796.dsl.pltn13.sbcglobal.net] has quit [Quit: Reboot for kernel upgrade]
04:17 * Derakon blinks.
04:18
< Doctor_Nick>
thats probably the reason
04:18
<@Derakon>
I was more reacting to his sudden disappearance.
04:19
<@Derakon>
I'll grant that water can be annoying, though.
04:19
< Doctor_Nick>
it WAS annoying!
04:20
<@Derakon>
Kinda renders the water shield pointless, though.
04:21
<@Vornicus>
man, I had forgotten how relaxing operator overloads in Python were.
04:21
< Doctor_Nick>
you could bounce!
04:21
<@Derakon>
Which was more or less pointless.
04:21
< Doctor_Nick>
but what was really annoying
04:21
< Doctor_Nick>
was that carnival zone level
04:21
< Takyoji>
So let's say I want to add properties to a class, how would I do so? Would I have to make an abstract class?
04:21
< Doctor_Nick>
with the barrel
04:21
<@Derakon>
Heh.
04:21
< Doctor_Nick>
PUSH DOWN
04:21
<@Derakon>
Yeah, that stymied a lot of players.
04:21
<@Derakon>
Takyoji: do you control the class in question?
04:22
<@Derakon>
Because if so, you could just...add the propreties to its definition...
04:22
< Takyoji>
I mean, like for something that's already preset in a DLL... like a TreeNode in a TreeView widget of a form
04:22
<@Derakon>
You could create a class that inherits from it.
04:22
<@Vornicus>
If you don't, well, you have to subclass it, and that will suck when you get around to throwing it through the gamut.
04:24
< Takyoji>
would I use "class SpecialTreeNode : TreeNode"?
04:24
<@Derakon>
Depends on your language.
04:24
< Takyoji>
and define the extra properties within?
04:25
<@Vornicus>
C# or C++ looks like that, yes
04:26
<@Vornicus>
...and, arg, even looking at my games folder makes me want to write too many games.
04:26
< Takyoji>
Then would I have to make the objects of the derived class correct?
04:26
<@Derakon>
Heh.
04:26
< Takyoji>
to have the special property
04:26
<@Derakon>
Yes.
04:26
< Takyoji>
k
04:27
< Takyoji>
I know I keep asking questions, but I'm still quite very new to OOP
04:27
<@Derakon>
Don't worry about it.
04:27
< Takyoji>
What is the 'virtual' keyword for?
04:27
<@Derakon>
Indicates something that doesn't actually exist.
04:27
<@Derakon>
A virtual function is not implemented in that class.
04:27
<@Vornicus>
Um
04:27
<@Vornicus>
Weaker
04:28
<@Derakon>
Am I misremembering?
04:28
<@Vornicus>
A virtual function may be implemented, but it is allowed to be overridden.
04:28
<@Derakon>
Ah, right. Sorry.
04:28
<@Vornicus>
a /pure/ virtual function is also known as abstract, and is not implemented in the class where it is declared.
04:28
< Takyoji>
Which would be helpful in what type of scenerio?
04:29
<@Derakon>
If you want the function to be overridable by classes that inherit from you.
04:29
<@Vornicus>
Takyoji: C++ and C# are the only languages I'm aware of that don't make methods virtual by default, and it's /annoying/
04:29
<@Derakon>
(That's why I thought "virtual" meant "doesn't exist", idly)
04:29
< Takyoji>
ahh
04:30
< Takyoji>
And you use 'abstract' to overwrite?
04:30
<@Vornicus>
No
04:30
<@Derakon>
You use abstract to indicate that the inheritor *must* implement the function, because you do not.
04:30
<@Vornicus>
abstract is "I haven't implemented this, I'm just telling you what it should look like"
04:32
< Takyoji>
ahh
04:32
< Takyoji>
And the last thing I need to know is generics
04:32
<@Derakon>
Generics are like C++ templates, right Vorn?
04:32
<@Derakon>
Except presumably without the syntax suck.
04:33
<@Vornicus>
generics, or templating, allows you to define a class (usually of a general type known as a "container") that can handle any kind of object, which the programmer can then use safely with an individual class.
04:33
<@Vornicus>
To show you what I mean, I'll show you some Java.
04:33
<@Derakon>
Sometimes the objects must implement certain functions to be used in the class. For example, a generic "SortedList" class must be able to compare the elements in it to order them.
04:34
< Doctor_Nick>
anyway
04:34
<@Vornicus>
This is how you made a List of Integer objects in Java 1.4:
04:34
< Doctor_Nick>
S3&K was the swan song for 2d platformers
04:35
<@Vornicus>
List list_of_integers = new ArrayList()
04:35 McMartin [~mcmartin@Nightstar-5796.dsl.pltn13.sbcglobal.net] has joined #code
04:35 mode/#code [+o McMartin] by ChanServ
04:35
<@Derakon>
WB McM.
04:35
< Doctor_Nick>
DID IT WORK MCMARTIN
04:35
<@Vornicus>
McM! Explain templates! I'm bad at it
04:35
<@McMartin>
Macros on crack?
04:36 * Derakon facepalms.
04:36
< Doctor_Nick>
its a great way to make you want to die
04:36 * Vornicus beats Doctor_Nick for impertinence.
04:36 * Derakon drops Mecha Sonic on Nick.
04:37 * Derakon also notes that Vorn's example should be more like "List<Integer> list_of_integers = new ArrayList<Integer>();"
04:37
<@Vornicus>
Der: I'm showing 1.4 first.
04:37
<@Derakon>
This saves you from having to cast the result of every accessor.
04:37
<@Vornicus>
Then I'll show 5
04:37
<@Derakon>
Ah.
04:39
<@Vornicus>
then to add something to the list you just go list_of_integers.add(my_integer), and then to retrieve something you go (Integer)(list_of_integers.get(i)) for some i.
04:39
<@Vornicus>
Now, there's two problems with this.
04:39
<@Vornicus>
1. every time you get something from the list you have to remember to cast it to an integer,
04:39
<@Vornicus>
2. if you accidentally put a non-integer into the list, you get an error not when you put it in, but when you pull it out.
04:40
<@Vornicus>
So, java 5 provides a generics facility.
04:40
<@Vornicus>
Instead of the thing I showed above, you instead use List<Integer> list_of_integers = new ArrayList<Integer>();
04:42
<@Vornicus>
...which is a bit wordy, but now if you try to put something that can't be turned into an Integer into the list, you get an error right there (and I think you might not even be able to compile, which is even safer), and you don't have to remember to cast things as you pull them out.
04:42
< Takyoji>
What do you specifically mean by 'cast'?
04:42
<@Vornicus>
I odn't know how it works in C#, but it should be about the same way.
04:42 McMartin_ [~mcmartin@Nightstar-8368.dsl.pltn13.sbcglobal.net] has joined #code
04:42 McMartin [~mcmartin@Nightstar-5796.dsl.pltn13.sbcglobal.net] has quit [Operation timed out]
04:42
< Takyoji>
Yea, I believe it is
04:43
<@Vornicus>
to "cast" an object is to try to convert it to another type.
04:43
< Takyoji>
oh, k
04:43
<@Derakon>
For example, you can cast a double to an integer to discard the stuff after the decimal, roughly.
04:43
< Takyoji>
ahh
04:43
<@Derakon>
The objects you get out of Vorn's first example are Objects, not Integers - you have to tell Java that they're Integers or else it won't let you do things like add them to other Integers.
04:44
<@Vornicus>
The most common kind of cast is an implicit cast - multiplying an integer by a float will cast the integer into a float in order to properly multiply them.
04:45
< Takyoji>
And what are delegates and events?
04:46
<@Vornicus>
An event is, really, just a method with a special name.
04:46
<@Vornicus>
It is a method that is called when something special happens.
04:47
<@Derakon>
For example, when the user hits a key on the keyboard, you can have a function handleInput() called.
04:47
< Takyoji>
So a delegate is a function that is raised when an event occurs?
04:47
<@Vornicus>
No, an event is.
04:47
< Takyoji>
So I have it backwards?
04:47
<@Vornicus>
A delegate is... I really can't describe it.
04:48
<@Vornicus>
An event is a method called when an event (like keyboard input, a window being minimized, or any of a thousand other special things that can happen) happens.
04:49
<@Derakon>
In pseudocode, you'd define, say, "static int handleKeyboardInput(struct keyboardInput)" as a function, and then call "registerEventForKeyboardInput(handleKeyboardInput);"
04:49
<@Derakon>
You're passing the function as an argument to another function, note.
04:50
< Doctor_Nick>
ughhh
04:50
< Doctor_Nick>
i forgot how frustrating the bonus levels were
04:50
<@Derakon>
Heh.
04:51
< Doctor_Nick>
not nearly as much as sonic 2, though
04:51
<@Derakon>
I still submit that the only reasonably playable Sonic bonus levels were in Sonic 1 and Sonic Rush.
04:51
<@Vornicus>
Sonic 3's was the sphere, right?
04:52
<@Derakon>
Yeah.
04:52
<@Derakon>
Same as S&K.
04:52
<@Vornicus>
Sonic 2 was the halfpipe of hate, and sonic 1 was a giant pinball machine.
04:52
<@Derakon>
Sonic 1 was the psychedelic turning thing.
04:52
<@Vornicus>
yeah
04:52
<@Derakon>
No flippers or anything.
04:53
<@ToxicFrog>
Sonic 1 was, IMO, much less playable than Sonic 3's.
04:53
<@Vornicus>
I couldn't stand Sonic1's.
04:53
< Takyoji>
And as a side question.. how would you think I could make the PHP engine pause between questions? IE, step debugging
04:53
< Takyoji>
I mean
04:53
<@Derakon>
Well, Sonic 3/S&K was playable, sure, but it wasn't very *interesting*.
04:53
<@Vornicus>
"pause between questions"?
04:53
< Takyoji>
And as a side question.. how would you think I could make the PHP engine pause between commands? IE, step debugging
04:53
<@ToxicFrog>
Derakon: given a choice between interesting bonus levels xor solvable bonus levels, I'll choose the latter~
04:53
<@Vornicus>
There should be a debugger in with the standard PHP tools.
04:54
< Takyoji>
I accidentally type the wrong word at times rather than making an actual typo ;P
04:54
<@ToxicFrog>
The S3&K bonus levels are theoretically (and in most cases practically) solvable on the first try if you're good enough.
04:54
<@ToxicFrog>
The S1 bonus levels are augwtf.
04:54
<@Derakon>
Heh.
04:54
<@Derakon>
'Course, the S1 bonus levels don't actually *do* anything.
04:55
<@Vornicus>
That said, you should be doing lots of testing, and using as short methods as sanity permits.
04:55
<@ToxicFrog>
That too.
04:55
<@ToxicFrog>
Chaos Emeralds 4tw, provided the music has been dealt with~
04:55
<@Derakon>
S1 had Chaos Emeralds!
04:55
<@Derakon>
Just only six of them. Kinda useless that way.
04:55
<@ToxicFrog>
Yes, but they didn't - yes.
04:56
< Doctor_Nick>
anyway
04:56
<@Vornicus>
And they didn't do anything except get you, like, a tiny useless piece of ending.
04:56
< Doctor_Nick>
to continue this trend of reliving my childhood
04:56
<@Derakon>
IIRC instead of Robotnik juggling the ones you didn't get, he was jumping on the wreckage of one of his machines.
04:56 Takyoji [~Takyoji@Nightstar-25511.dhcp.roch.mn.charter.com] has quit [Connection reset by peer]
04:56
< Doctor_Nick>
im going to see TMNT 2
04:56
<@Derakon>
Have fun.
04:56 Takyoji [~Takyoji@Nightstar-25511.dhcp.roch.mn.charter.com] has joined #code
04:57
<@Derakon>
(Idly, I have implemented timered hooks for FlatCosmos, so my classes no longer need handle their own timers. Woot)
04:57
<@ToxicFrog>
So, yeah. Much harder than the S3 ones ^ no useful reward of any kind -> lose
04:58
< Takyoji>
I mean, we're trying to work on a PHP script editor which would be able to also parse the scripts commands one by one where it pauses inbetween a command and you click a button for it to do the next one, and press it again for it to preform the command after that
04:58
<@Derakon>
This is part of why I have a save state of S2 right after unlocking Super Sonic.
04:58
<@ToxicFrog>
S2's can die in a fire.
04:58
<@ToxicFrog>
I couldn't be arsed to finish them even with savescumming.
04:59
<@Derakon>
Waugh...my savestate is broken. >.<
05:01
<@ToxicFrog>
(I find that after playing S3&K, I am incapable of enjoying S1 or S2. Since between them they have about a paragraph of interesting storyline, this works out ok.)
05:02
<@Derakon>
...you're playing Sonic games for the storyline?
05:06 McMartin_ is now known as McMartin
05:07 * McMartin beats Mega Man ZX.
05:07
<@Derakon>
Congrats.
05:08
<@ToxicFrog>
Derakon: well, the storyline and the hyperactive spindash acrobatics.
05:08
<@ToxicFrog>
And S3&K is Inherently Superior in the latter department as well.
05:08
<@ToxicFrog>
The point is, if they actually had storyline, I would be compelled to play them.
05:08
<@ToxicFrog>
But all they have is a markedly inferior version of the gameplay present in the game that does have storyline.
05:09
<@ToxicFrog>
So I have no urge to play the earlier games.
05:09
<@Derakon>
Eh. In my opinion, the level design in S2 is of quite high quality, up until you hit Oil Ocean.
05:09
< McMartin>
I liked Oil Ocean itself.
05:09
< McMartin>
20:56 <@Derakon> IIRC instead of Robotnik juggling the ones you didn't get, he was jumping on the wreckage of one of his machines.
05:10
< McMartin>
YDNRC. He's jumping up and down on the word "END".
05:10
<@Derakon>
Oops.
05:10
<@ToxicFrog>
Derakon: Chemical Plant is where I gave up in disgust.
05:10
<@ToxicFrog>
Never got to Oil Ocean.
05:10
<@Derakon>
Um, what's wrong with Chemical Plant?
05:11
<@Derakon>
The underwater climb was a bit tricky, but not game-ending.
05:11
< McMartin>
S1 lacks spin-dash and thus is unplayable.
05:11
<@ToxicFrog>
Underwater climb + suddenly non-supporting sections of pipe
05:13
<@ToxicFrog>
And now, adventures! Ta
05:13
< McMartin>
Actually, I don't recall particularly minding the S2 late game, either, except for Death Egg itself, which can die in a fire.
05:14
<@Derakon>
"Here, fight two bosses with no rings!" Yeah, that sucked.
05:14
< McMartin>
I don't remember much of Flying Fortress.
05:15
< McMartin>
Sky Chase was filler, but I didn't mind it.
05:15
<@Derakon>
It's mainly just long.
05:16
<@Derakon>
And with inexplicable gunner chickens.
05:18
< McMartin>
He switched to moles later on.
05:19
<@Derakon>
I've never really understood Robotnik robots that themselves look like animals.
05:22 * Derakon fires up Blender, to doodle.
05:22 Derakon is now known as Derakon[Blended]
05:36 McMartin [~mcmartin@Nightstar-8368.dsl.pltn13.sbcglobal.net] has quit [Connection reset by peer]
05:41 McMartin [~mcmartin@Nightstar-8368.dsl.pltn13.sbcglobal.net] has joined #code
05:41 mode/#code [+o McMartin] by ChanServ
05:53
<@Derakon[Blended]>
Well, that was fairly relaxing, and I got some interesting concepts, but ultimately the mesh was too horked to save.
05:53 Derakon[Blended] is now known as Derakon
06:17 Vornicus is now known as Vornicus-Latens
06:20 Thaqui [~Thaqui@Nightstar-12000.jetstream.xtra.co.nz] has quit [Connection reset by peer]
06:49 Derakon is now known as Derakon[AFK]
06:51 Takyoji [~Takyoji@Nightstar-25511.dhcp.roch.mn.charter.com] has quit [Quit: Leaving]
08:12
<@ToxicFrog>
Hah! Vindication!
08:12
<@McMartin>
?
08:13
<@Reiver>
?
08:13
<@ToxicFrog>
I posted to the GPG forums about how the random race selector seems to be obsessed with giving me Cybran (7 games, all Cybran so far) and some statistical analysis.
08:13
<@ToxicFrog>
Among the responses were at least three "lol that's not how stats works lol, you suck" posts.
08:14
<@ToxicFrog>
Earlier today, GPG posted "err, yeah, we kind of forgot to seed the random number generator as of build 3220. Oopsies. Fixed for the next patch."
08:18
<@Reiver>
Whee!
08:18
<@Reiver>
The lol u suck crowd will, doubtless, simply avoid to make comment.
08:18
<@ToxicFrog>
So, yes, 3220 introduced the problem. The Lua io and os libraries were taken out for security reasons. However, the os:time() was being used to seed the RNG in Lua, so someone took out the seeding and forgot to put something in the engine to seed it. Anyway, the long and short is, this will be fixed in the next patch.
08:18
<@ToxicFrog>
-- squidbot
08:18 * jerith grins.
08:18
<@Reiver>
io and os libraries were taken out for security reasons?
08:19
<@McMartin>
"This mod for SupComm formats your hard drive."
08:19
<@jerith>
Apparently their unit tests don't cover the RNG...
08:19
<@Reiver>
...OH.
08:19
<@Reiver>
Right, then.
08:19
<@Reiver>
>.>
08:19
<@ToxicFrog>
McMartin: yes, because 'io' includes 'read and write anything on the hard drive' and 'os'
08:19
<@ToxicFrog>
includes 'execute totally arbitrary code'
08:19
<@ToxicFrog>
Err.
08:19
<@ToxicFrog>
Reiver.
08:19
<@Reiver>
So, uh
08:20
<@Reiver>
You can't write scripts to read in or write out extra game files?
08:21
<@jerith>
Perhaps they provide libraries to get at approved game directories?
08:25
<@ToxicFrog>
Reiver: you have access to 'import' for loading additional Lua code.
08:25
<@ToxicFrog>
A 'sandbox' for storing arbitrary data without stomping the host filesystem is implemented in vcs and should be available with the next patch.
08:29
< Doctor_Nick>
!list
08:29 Doctor_Nick was kicked from #code by Syloq [Idiot. Go to DalNet and look for your porn.]
08:29 Doctor_Nick [~fdsaf@Nightstar-27777.rag-a.fsu.edu] has joined #code
08:29
< Doctor_Nick>
aw, thats not a command?
08:30
<@Reiver>
Oh. Nice, then.
08:30
<@Reiver>
Nick: Oh, it /is/ a command.
08:31
<@Reiver>
It's a command that gets you booted.
09:00
< Doctor_Nick>
go idea
09:44 Doctor_Nick [~fdsaf@Nightstar-27777.rag-a.fsu.edu] has quit [Ping Timeout]
11:53 Thaqui [~Thaqui@Nightstar-12000.jetstream.xtra.co.nz] has joined #code
11:53 mode/#code [+o Thaqui] by ChanServ
12:09 Derakon[AFK] [~Derakon@Nightstar-12737.sea2.cablespeed.com] has quit [Connection reset by peer]
12:58 Mahal is now known as MahalBedd
13:09 Serah [~Z@87.72.36.ns-26407] has joined #Code
13:09 mode/#code [+o Serah] by ChanServ
13:26 Thaqui [~Thaqui@Nightstar-12000.jetstream.xtra.co.nz] has left #code [Leaving]
14:41 Serah [~Z@87.72.36.ns-26407] has quit [Quit: Don't try to read the quit message, that is impossible. Instead only realize the truth; "there is no quit message" and you will see it is not you who read the quit message but the quit message who reads you.]
15:03 Reiver is now known as ReivZzz
15:09 Vornicus-Latens is now known as Vornicus
16:20 Serah [~Z@87.72.36.ns-26407] has joined #Code
16:20 mode/#code [+o Serah] by ChanServ
18:21 Serah [~Z@87.72.36.ns-26407] has quit [Connection reset by peer]
18:22 Serah [~Z@87.72.36.ns-26407] has joined #Code
18:22 mode/#code [+o Serah] by ChanServ
19:19 Doctor_Nick [~fdsaf@Nightstar-27777.rag-a.fsu.edu] has joined #code
19:35 AnnoDomini [~farkoff@Nightstar-28930.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
19:36 KBot [~karma.bot@Nightstar-29558.neoplus.adsl.tpnet.pl] has joined #Code
19:36
< KBot>
KarmaBot v1.19. online and ready. Type "!help commands" for command list.
19:37 KarmaBot [~karma.bot@Nightstar-28930.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
19:37 KBot is now known as KarmaBot
19:40 AnnoDomini [~farkoff@Nightstar-29558.neoplus.adsl.tpnet.pl] has joined #Code
19:40 mode/#code [+o AnnoDomini] by ChanServ
20:02 Janus [~Cerulean@Nightstar-10302.columbus.res.rr.com] has joined #Code
22:02 Janus [~Cerulean@Nightstar-10302.columbus.res.rr.com] has quit [Quit: Jouets de Dieu, jouets de jouets, les jouets de me, na?tre Clair enfant voire.]
23:44 MahalBedd is now known as Mahal
23:45
< Doctor_Nick>
man
23:45
<@AnnoDomini>
Woman.
23:46
< Doctor_Nick>
duck
23:46
<@AnnoDomini>
Goose?
23:46
< Doctor_Nick>
NO YOU FOOL
23:47
< Doctor_Nick>
so
23:47
< Doctor_Nick>
doctor who
23:47
<@AnnoDomini>
Who you callin' a foo', foo'?
23:47
< Doctor_Nick>
I called noone a foo!
23:48
<@AnnoDomini>
Not "foo". "Foo'".
23:48
< Doctor_Nick>
are we going to start fighting about these foos of yours?
23:48
< Doctor_Nick>
have we truly become, foo fighters?
23:48
<@AnnoDomini>
<_<
23:56
<@McMartin>
> PITY FOOL
--- Log closed Sun Apr 01 00:00:59 2007
code logs -> 2007 -> Sat, 31 Mar 2007< code.20070330.log - code.20070401.log >