code logs -> 2011 -> Sat, 31 Dec 2011< code.20111230.log - code.20120101.log >
--- Log opened Sat Dec 31 00:00:32 2011
00:07 Netsplit *.net <-> *.split quits: Alek, Namegduf, himi, Syloqs-AFH, Kindamoody[zZz], AD[Shell], sshine, ToxicFrog, Derakon[AFK], Reiver
00:08 Netsplit over, joins: ToxicFrog, himi, Kindamoody[zZz], AD[Shell], Alek, Reiver, Namegduf, Derakon[AFK], sshine, Syloqs-AFH
01:02 Rhamphoryncus [rhamph@Nightstar-14eb6405.abhsia.telus.net] has quit [Client exited]
01:11 You're now known as TheWatcher[T-2]
01:14 You're now known as TheWatcher[zZzZ]
02:03 PinkFreud [WhyNot@NetworkAdministrator.Nightstar.Net] has joined #code
02:19 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
02:19 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
02:35 gnolam [lenin@Nightstar-202a5047.priv.bahnhof.se] has quit [[NS] Quit: Z?]
02:58 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
02:58 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
03:07 Derakon [chriswei@Nightstar-a2330ab4.ca.comcast.net] has joined #code
03:07
< Derakon>
Hey McM, have you done anything with PyQt?
03:07
< Derakon>
Apparently I have to install Qt separately.
03:07
< Derakon>
And installing PyQt itself requires installing SIP first. :\
03:11
< Derakon>
Holy fuck the Qt installer is 1.3GB.
03:11
< Derakon>
It's a window manager!
03:11
< Derakon>
How in blazes does it justify that kind of filesize?
03:12
< Tamber>
If it was /just/ a window manager, then that'd be excessive; but: "...a cross-platform application framework..."
03:13
< Tamber>
(And isn't it KDE that's the window-manager/desktop environ; which just happens to be written in Qt?)
03:13
< Derakon>
Feh...
03:15
< Tamber>
But, by all means; don't let inconvenient things like details get in the way of a rant :)
03:15
< Derakon>
Heh.
03:21 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
03:25 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
03:27 Attilla [Obsolete@Nightstar-5a27386a.as43234.net] has quit [Ping timeout: 121 seconds]
03:28
< McMartin>
I haven't done anything with PyQt
03:28
< McMartin>
And yes, Qt is more like Foundation + Cocoa + Carbon + OpenGL + LaunchServices.
03:28
< McMartin>
You will not be distributing every Qt DLL with a shipped product, normally, just QtCore, QtUI, and maybe QtOpenGL or QtNetworking.
03:29
< Derakon>
Okay.
03:29
< Derakon>
Yeah, I had it in mind that Qt and Wx were solving the same problem.
03:29
< Derakon>
And apparently it's more that Qt is a vast superset of Wx, but I've only ever heard of people using it for what Wx also does.
03:29
< Derakon>
Also: finally lost a game to your Expert AI just now.
03:29
< McMartin>
Heh
03:30
< Derakon>
It also spent a good two-three times longer thinking about its turns than usual.
03:30
< McMartin>
As in "you've been crushin git" or "it takes a fuck-off long time"?
03:30
< McMartin>
Also, I've now cleared Green Hill and Chemical Plant in Sonic Generations.
03:30
< Derakon>
Nominally the former.
03:30
< Derakon>
But this game it was the latter.
03:30
< Derakon>
(I think I've played 4-6 games against it, something like that)
03:30
< McMartin>
So far this game is an abject apology for every game since S3&K.
03:30
< Derakon>
Hee.
03:30
< Derakon>
What's the Chaos Emerald bonus round mechanism?
03:32
< McMartin>
I haven't hit any bonus rounds yet.
03:32
< McMartin>
Dropping the whole bonus round mechanic would *qualify* as an abject apology for same.
03:32
< McMartin>
Also, shorter All The Dialog So Far:
03:33
< McMartin>
<Tails> This plot is stupid, Sonic.
03:33
< McMartin>
<Sonic> Is it really any stupider than [Plot of Sonic and the Secret Rings] or [Plot of Sonic Colors]?
03:33
< McMartin>
<Tails> I suppose not.
03:33 * Derakon snerks.
03:33
< Derakon>
I hear that Sonic Colors is actually rather good.
03:33
< McMartin>
It is.
03:33
< McMartin>
It was also written by the Happy Tree Friends dudes.
03:33
< McMartin>
Oh, also:
03:34
< Derakon>
But I've already bought two Wii games that I can't play because my Wii isn't set up because I haven't moved my bed out of the media room because the bedroom has no floor.
03:34
< McMartin>
<Sonic> [Green Hill Zone] looks really familiar for some reason.
03:34
< Derakon>
No!
03:34
< McMartin>
<Tails> I dunno, I don't recognize it. I keep getting horrible flashbacks whenever I look at the Chemical Plant zone, though!
03:36
< McMartin>
The first two levels in 3D are without exception the best Sonic 3D levels I've ever played.
03:36
< McMartin>
(I believe I'm only missing Sonic PS3, Sonic Unleashed, and Sonic Colors here)
03:37
< McMartin>
To the point where I'm going "dude, did it take you this long to learn or have you been holding out on us"
03:38
< McMartin>
The skill system from Secret Rings is back, which is bad, but the laning controls from Secret Rings are part of your 3D moveset, which is unspeakably awesome.
03:38
< Derakon>
http://www.nerfnow.com/comic/328
03:39
< Derakon>
(Re: figuring out what fans want)
03:39
< McMartin>
Heh. I happen to know What Went Terribly Wrong for me, and I'm curious whether or not this will address it in a way that works.
03:40
< McMartin>
Sonic's big problem is that the game moves so fast that every action is a leap of faith, more or less
03:40
< McMartin>
This means (which they forgot in Sonic Rush) that you have to rig the game so that basically all moves are safe.
03:40
< McMartin>
Once you notice that, though, all illusion of challenge disappears, and you can't really go home again.
03:41
< McMartin>
They "solved" this in 3D by slowing the game down and turning it into a gigantic scavenger hunt.
03:41
< McMartin>
However, the 3D levels so far have the old 2D mindset, AFAICT, and the scavenger hunt is more along the lines of the bonus stage warp rings in S3&K, just, uh, without the bonus stages.
03:41
< McMartin>
Also, no boss fights yet, not sure how that's going to work out.
03:41 * Derakon takes a moment to mutter at the Qt installer, which can't even put qmake into your path correctly.
03:43
< Derakon>
ISTR that Sonic Adventure 1 handled the transition to 3D reasonably well, though it also had a horribly glitchy physics engine.
03:44
< McMartin>
I had Many Complaints about it, to the point that I considered, prior to this, Sonic Heroes to have gotten the formula the closest to right.
03:44
< Derakon>
(Also it had some rather undesirable play modes)
03:44
< McMartin>
(Also, Tails's play mode should have been Sonic's, considering.)
03:44
< Derakon>
My memories are colored by nostalgia.
03:44
< McMartin>
(Since it was his mode that was the one that was actually about going fast.)
03:44 Kindamoody[zZz] is now known as Kindamoody
03:45 * Derakon eyes the PyQt build, which keeps spitting out a warning "This version of Mac OS X is unsupported".
03:45
< Derakon>
And yet the build continues.
03:45
< McMartin>
Hum.
03:45
< Derakon>
I guess it assumes I'm cross-compiling?
03:45
< McMartin>
I dunno
03:45
< Namegduf>
I liked the first two Sonic games for the Genesis.
03:45
< McMartin>
Qt has had some major changes on Mac.
03:46
< McMartin>
Namegduf: Sonic Generations is the first 3D Sonic game I've played that seems to retain the design sensibility of the 4 Genesis ones.
03:46
< Namegduf>
They mixed free running with platform segments, and direction selection to collect more rings/other shinies well.
03:46
< McMartin>
Right. And everything is a leap of faith, and all of them are safe.
03:46
< McMartin>
They just may be slower overall or not have as many goodies.
03:46
< Namegduf>
Outside the platform bits.
03:47
< Namegduf>
Those are willing to kill (or let you fall and repeat)
03:47
< McMartin>
Right
03:47
< McMartin>
But those almost always began with a tall wall that stopped you cold, and then a springboard that parked you at the beginning of the platform sequence.
03:47
< Namegduf>
But yeah.
03:47
< Namegduf>
Yeah.
03:47
< McMartin>
So far (though, again, only four acts in) this is hewing to that control.
03:48
< Namegduf>
That's good.
03:48
< McMartin>
And the 3D stuff, for the first time, is every inch as reckless in the free-running parts.
03:48
< McMartin>
We'll see if that holds up.
03:48
< Derakon>
One nice thing about the early Sonic games being that if you know the layout, or are a TASer, you can make some phenominally fast runs.
03:48
< McMartin>
Yeah. That's where what passes for the challenge lies.
03:48
< McMartin>
And they've got time-and-score rating for the 2D bits now too, so this is a good backport.
03:49
< McMartin>
That said, the game very clearly assumes that both (a) you played the early 2D and early 3D games and thus need no introduction to everything and (b) you have been nursing various grudges since at least 1999 and possibly 1992.
03:50
< Derakon>
Hee.
03:50
< McMartin>
I'd estimate that 80% of the dialog is fourth-wall-breaking, including the fact that Old-Timey Sonic has no lines whatsoever.
03:50
< Derakon>
Is there a bit where you get to blow up one of the barrels from Sonic 3's Carnival Night Zone?
03:51
< McMartin>
I'm going in cold, so I don't know!
03:51
< McMartin>
I hope so!
03:51
< McMartin>
It had its own option on their voicemail hintline.
03:51
< McMartin>
(I never had trouble with it, to be honest)
03:51
< McMartin>
If my memory of the soundtracks is right, though, I'll be hitting up Sky Sanctuary next.
03:51
< Derakon>
I never got to play S3K as a kid.
03:52
< McMartin>
I consider S3K the best of the series.
03:52
< Derakon>
IIRC the first time I encountered it as an adult was with an emulator and savestates so I did some very precise jumping.
03:52
< McMartin>
The easy way is just to walk up next to them and spin-dash under the things.
03:53
< Derakon>
?don't they start out flush with the ground?
03:53
< McMartin>
Depends on which part you're stuck in.
03:53
< McMartin>
But there's one where they act like ceiling and floor crushers, alternating
03:53
< McMartin>
And I just did a sequence of dashes and was done with it.
03:53
< McMartin>
... I wonder if they're going to do 2D versions of the Dreamcast games.
03:53 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
03:54
< McMartin>
I will laugh at this if so.
03:54
< Derakon>
One thing I'll say for Sonic Adventure: fighting Perfect Chaos worked a hell of a lot better than Doomsday Zone from S3K.
03:54 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
03:55
< Derakon>
Super Sonic generally works better from a behind-the-shoulder perspective, I suspect.
03:55
< Derakon>
Or at least zoomed out.
04:01 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
04:01 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
04:17
< McMartin>
Perfect Chaos is one of the things that pissed me off, though this was admittedly entirely for story reasons~
04:17
< McMartin>
Some of this may be because I beat Tails's sequence last.
04:18
< McMartin>
Tails's final boss sequence involves RACING ROBOTNIK TO A FUCKING NUCLEAR BOMB so as to defuse it before he sets it off in a suicidal act of defiance.
04:18
< McMartin>
YAY YOU SAVED THE CITY
04:18
< McMartin>
Now we can have Perfect Chaos fuck its shit up *entirely* in a cutscene so Sonic can get the spotlight.
04:19
< McMartin>
Oh hey, that's right
04:19
< McMartin>
No Robotnik so far
04:19
< Derakon>
He'll show up eventually, I'm sure.
04:19
< McMartin>
The villain is some evil force that has sucked all the life and joy out of the entire Sonic series, including retrospectively.
04:19
< McMartin>
So, uh, I guess we're fighting the personification of Sonic Team here.
04:19
< Derakon>
Pfft
04:20
< McMartin>
The thing is, this *is* by Sonic Team
04:20
< McMartin>
I'm terrified, waiting for the other shoe to drop
04:20
< McMartin>
But the opening is extremely strong, so let's get that much at least out there
04:24
< McMartin>
Oh, right, there's also some moral ambiguity.
04:24
< McMartin>
Because the other thing the villain does is kidnap the entire supporting cast.
04:24
< Namegduf>
And if you defeat the villain.
04:24
< Namegduf>
That means you unleash that terror back upon the world.
04:24
< Namegduf>
I don't think I could play that.
04:24
< McMartin>
Actually, it appears beating stages does that.
04:25
< McMartin>
It's not *quite* character introduction order, but I'm OK with Tails showing up before Amy.
04:25
< Namegduf>
What a delightful subversion of the idea that completing a stage should leave you feeling rewarded
04:25
< Namegduf>
Rather than like you hate yourself a little for the things you do.
04:25
< Namegduf>
:P
04:26
< Derakon>
Uh, I thought Tails was introduced before Amy?
04:26
< Derakon>
He showed up first on one of the Game Gear games, before Sonic 2 came out, IIRC.
04:26
< McMartin>
Amy was introduced in Sonic CD, which came out before Sonic 2.
04:26
< McMartin>
Oh, hm.
04:26
< McMartin>
I know the bonus screen for 100%ing Sonic CD is a picture of Tails with "see you next game", and I thought that was the Foreshadowing.
04:26
< McMartin>
In that case, maybe so.
04:27
< McMartin>
Clearing Sky Sanctuary looks like will rescue Knuckles, which I guess I'm OK with.
04:27
< McMartin>
Since I didn't start hating him until SA2 and that wasn't really his fault.
04:28
< Derakon>
Hm, Wikipedia says his debut was in Genesis Sonic 2, so I guess either my info was wrong or the hordes of nitpicky Sonic nerds out there haven't kept Wikipedia up to date.
04:28
< McMartin>
Amy Gets No Respect is a fine and upstanding tradition in the games.
04:29
< McMartin>
Though my favorite moment in the Grim 3D Era was actually involving her.
04:29
< McMartin>
In Sonic Heroes there are team battles you take against each other.
04:29
< Derakon>
Ah, I remember this anecdote.
04:29
< McMartin>
One of them is Team Sonic vs. Team Amy, as the Stalker corners her prey.
04:29 * Stalker totally corner McM.
04:30
< McMartin>
When I was playing as Team Amy, I switched to Amy and had her hurl herself at Sonic at top speed, as is of course her wont.
04:30
< McMartin>
The AI controlling Sonic proceeds to leap off the top of the building, and Tails and Knuckles follow.
04:30
< McMartin>
Ring out, victory, you win, proceed, etc.
04:30
< McMartin>
This was probably an AI glitch.
04:30
< McMartin>
But I like to think it wasn't. :)
04:31
< Derakon>
My main memory of Sonic Heroes is playing it for too long one weekend and, on trying to go to sleep, seeing streaking primary colors on the insides of my eyelids all night.
04:31
< Namegduf>
XD
04:31
< Namegduf>
That's how you tell you're playing right.
04:31
< McMartin>
My ranking of the Grim 3D Era seems to be almost backwards from the standard accepted fan ranking.
04:31
< Derakon>
Which puts SA2 inexplicably first.
04:31
< McMartin>
Which seems to be SA2 > SA1 >> Shadow ~= Heroes
04:31
< Namegduf>
I hate them all
04:32
< Namegduf>
SA2 was funnish
04:32
< Derakon>
I liked SA1, but then again, nostalgia.
04:32
< McMartin>
While mine is Heroes >> SA1 >> SA2 with Shadow off on the side because it is Not A Sonic Game, it's Ratchet And Clank At 80 MPH
04:32
< Namegduf>
I refuse to even look at SHadow
04:32
< Derakon>
I found SA2 tedious and terrible.
04:32
< Derakon>
(They stuck Tails in a mech walker, they made the detection radius for Knuckles' mode pathetically tiny, and Sonic wasn't that much better than before)
04:32
< McMartin>
Shdaow is interesting for a number of reasons, and actually retroactively redeemed some of SA2's more stupid bits.
04:32
< McMartin>
(Knuckles' mode continued to exist which was unforgivable)
04:33
< Namegduf>
Yes, but he's not interesting because he's called Shadow.
04:33
< Namegduf>
That's pretty fatal.
04:33
< Namegduf>
There must be a meme for backlash against a perceived attempt to make something "edgy".
04:33
< Namegduf>
Well, I'm all that one.
04:33
< Namegduf>
I'm serving as its earthly avatar when it comes to that game.
04:33
< McMartin>
Heh
04:34
< McMartin>
Shadow is mostly fun for redeeming Gerard.
04:34
< McMartin>
And also implying Shadow exists due to fatally misinterpreting a random background detail from the Sky Sanctuary stage of S3K.
04:35
< Derakon>
That being?
04:35
< McMartin>
There's a picture of the Doomsday Zone in the Sky Sanctuary stage.
04:35
< McMartin>
Knuckles misinterprets it because he thinks Super Sonic is the *attacker* in that fresco, which drives about 2/3 of the plot of S3K.
04:35
< Derakon>
Ah, yes.
04:36
< Derakon>
I actually hadn't picked up on that misinterpretation.
04:36
< McMartin>
Gerard, on the other hand, had just failed to create the Ultimate Life Form that channels the power of the Master Emerald etc, and having just gotten alien support for curing his granddaughter's case of Space AIDS by promising that the aliens could totally invade in 50 years...
04:37
< Derakon>
(I figured that Knuckles had just been directly duped by Robotnik, as seems to happen at least every other game anyway)
04:37
< McMartin>
... and oh, by the way, the cure for Space AIDS also requires a gigantic fuck-off orbital laser cannon that can totally waste that invading force you're about to send, nothing to see here, move along...
04:37
< McMartin>
(which he then programs to turn on Earth after the nominal good guys shoot his granddaughter in the face, way to go, guys, see also entire plot of SA2...)
04:38
< Derakon>
The Sonic setting is kinda messed-up.
04:38
< McMartin>
... at any rate, at this point he appears to have found the Sky Sanctuary, facepalmed, and said "oh right, duh, the problem here is that I didn't make Biolizard a flying hedgehog."
04:38
< McMartin>
Thus Project Shadow.
04:39
< McMartin>
(This is my interpretation of the events in the game and largely unsupported by canon: however, Gerard's triple-cross is definitely canon because it drives the plot of both SA2 and Shadow.)
04:40
< McMartin>
I do find it odd that the two games I've played that are rated E10+ involve, respectively, the nominal good guys shooting a 12-year-old girl in the face in the opening cutscene, and a lengthy sequence where you have to be the equivalent of a pole dancer for a crazy AI.
04:41
< McMartin>
Who has also apparantly just discovered the AI equivalent of wanking.
04:43
< ToxicFrog>
...the latter being Portal 2, I take it?
04:44
< ToxicFrog>
Also, I haven't finished Shadow and probably never will at this point.
04:44
< ToxicFrog>
Also also, I kind of ignored Sonic Generations because I assumed it was a re-release of Sonic 1 through 3K or similar. It's sounding like I should actually check this out now.
05:12 Stalker [Z@Nightstar-5aa18eaf.balk.dk] has quit [Ping timeout: 121 seconds]
05:35 cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has quit [[NS] Quit: Well, most things get better when I kick them!]
05:40 eckse is now known as eckce
05:40 eckce is now known as eckse
05:44 * Vornicus tries to remember how to postscript.
05:46
< iospace>
postscript
05:46
< iospace>
?
05:47<~Vornicus> postscript: language originally designed for printers. It's built to draw stuff.
05:48 eckse is now known as eckce
05:48<~Vornicus> Right now I'm trying to get my depixelization program to write postscript files for drawing.
05:48
< iospace>
ah...
05:54<~Vornicus> But really I don't know whether that's sane. What I really want to know is why the shit I have this one spare edge and I can't even find it in my list of known edges.
05:57 cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has joined #code
06:02 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has joined #code
06:07 iospace is now known as iosleep
06:09 eckce is now known as eckse
06:11
< sshine>
I've only done SVG.
06:14<~Vornicus> svg is in a sick twisted sense a descendent of postscript
06:16 * Vornicus pokes at it. The anomaly isn't even anywhere near the start point, so it's not an edge case of the degenerate-removal algorithm.
06:18
< McMartin>
TF: So far, the first six levels have been mixed 2D and 3D versions (with hilarious terrible lo-fi versions of the soundtrack in the 2D versions of the Dreamcast->PS2 era games) of Sonic 1, 2, 3&K, Adventure, Adventure 2, and Heroes.
06:18
< McMartin>
So far Speed Highway and Seaside Hill have been the most murderous stages.
06:23 * Vornicus finds the spot in the list of edges.
06:25<~Vornicus> I don't know, this isn't making any sense.
06:27 * Vornicus wonders. Could it be float precision? Not likely, we're using known perfect values, and they're not repr()ing different.
06:28 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
06:30 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
06:34<~Vornicus> Aaaand it's coming out of the merge as true. what is going ON here.
06:34 Derakon [chriswei@Nightstar-a2330ab4.ca.comcast.net] has quit [[NS] Quit: Leaving]
06:34 celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has quit [Connection closed]
06:35<~Vornicus> er. Python is telling me that the two ends of the degenerate section are true, and thus should have been caught, in all the dozens of times it got checked.
06:36<~Vornicus> are equal, not are true
06:36<~Vornicus> --has it gotten checked dozens of times?
06:40<~Vornicus> It seems like it should have been, but that may be the last remnants of an error that happens a lot but generally gets obscured by later calls to the degenerate remover.
06:41<~Vornicus> The degenerate remover is looking to be more likely as the correct place to look, but I'm not sure how to go about fixing it.
06:46<~Vornicus> On the other hand I don't even know how this degenerate edge didn't end up being removed!
06:53<~Vornicus> GOtcha.
06:54<~Vornicus> Add an else so I don't advance the cursor when I've found a degenerate.
06:55<~Vornicus> Okay, that bug solved.
06:56 * Vornicus now tries to figure out the next piece of code he needs to write.
07:02<~Vornicus> Hmmm... separating subpolygons.
07:04<~Vornicus> Possibly removing straight-corner vertices but I'm not sure that's wise, there's lots of things later that need to deal with it.
07:05<~Vornicus> or may.
07:11 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
07:16 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
07:16
< jerith>
What are you actually building?
07:18 eckse [eckse@Nightstar-a7ee14de.dsl.sentex.ca] has quit [Client closed the connection]
07:19<~Vornicus> RIght now i'm building a thing that takes a bunch of adjacent polygons and merges them into a single large polygon. The larger program is to draw a DROD room, with somewhat smoothed corners so it's easier to tell what things connect to each other.
07:20
< jerith>
Ah, right.
07:22 * Vornicus goes about uploading another image, with progress.
07:30<~Vornicus> http://www.flickr.com/photos/7861878@N06/6605223235/in/photostream there.
07:34 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
07:57 Vash [Vash@Nightstar-8697fea9.wlfrct.sbcglobal.net] has quit [[NS] Quit: I<3craft Vorn!]
08:00 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
08:06 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
09:15 ErikMesoy|sleep is now known as ErikMesoy
09:44 You're now known as TheWatcher
09:47 * Tamber steps through the time machine with an axe, brutally murders whoever was responsible for the brain-damage that is PS/2 scancodes.
09:51
< Tamber>
"Let's assign keycodes by rolling dice!"; okay, I hate you, but I can deal with that. "A key such as, say, has a byte-wide scancode, (A has 0x1C)", okay. "Prefix the scancode with 0xf0 to signify key-up.", oh, nice and easy. "Extended keys have their makes prefixed with 0xE0"; makes sense. "Extended key-up is 0xE0 0xF0, not '0xF0, 0xE0' like ...
09:51
< Tamber>
... you expected.", ... *grr*
09:52
< Tamber>
"And, just to /really/ fuck you up, we took something /really/ strong before assigning scancodes to things like print-screen and pause."
09:52
< ErikMesoy>
assign how?
09:52
< Tamber>
As far as I can tell, so far, there seems to be no rhyme or reason to the linking of "key on keyboard" and "keycode"
09:54
< Tamber>
Also: Print screen make: 0xe0, 0x12, 0xe0, 0x7c; Print screen break: 0xe0, 0xf0, 0x7c, 0xe0, 0xf0, 0x12; Pause make: 0xe1, 0x14, 0x77, 0xe1, 0xf0, 0x14, 0xf0, 0x77; thankfully there's no break for that one. -.-
09:56 Kindamoody is now known as Kindamoody|out
09:56
< Tamber>
Sometimes keys that are next to eachother have sequential scancodes. Mostly, they don't.
09:57
< Tamber>
There's probably some logic to this that I'm failing to see; or at least, that's what I'm going to keep telling myself.
09:58
< Tamber>
(For example, the scancodes for the 1, 2, 3 and 4 keys: 0x16, 0x1E, 0x26, 0x25.) I'm really hoping that the chart I'm using for this is horribly, horribly wrong, and someone's laughing at me.
10:03 Attilla [Obsolete@Nightstar-5a27386a.as43234.net] has joined #code
10:18 ErikMesoy1 [Erik_Mesoy@5E691D.066EBC.4D6A05.55E49D] has joined #code
10:19 ErikMesoy [Erik_Mesoy@5E691D.066EBC.4D6A05.55E49D] has quit [NickServ (GHOST command used by ErikMesoy1)]
10:19 ErikMesoy1 is now known as ErikMesoy
10:25 gnolam [lenin@Nightstar-202a5047.priv.bahnhof.se] has joined #code
11:19 You're now known as TheWatcher[afk]
12:11 Rhamphoryncus [rhamph@Nightstar-14eb6405.abhsia.telus.net] has joined #code
12:28
< Rhamphoryncus>
http://altdevblogaday.com/2011/12/24/static-code-analysis/ via notch
12:30
< Rhamphoryncus>
"There was a paper recently that noted that all of the various code quality metrics correlated at least as strongly with code size as error rate, making code size alone give essentially the same error predicting ability. Shrink your important code."
12:32
< Rhamphoryncus>
Assuming that's talking about functions it would imply the error rate is quadratic with the size of the function, not linear...
12:54 * ErikMesoy has finally bought SpaceChem (75% off on Steam for Christmas) and is engaged in GLORIOUS NERD RAGE.
13:06 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
13:08 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
13:26
< Attilla>
I bought that but idk if my lappy will be fine with it or not, either way I should probably restart it for then anyway
13:32
< McMartin>
It's about as technologically undemanding as games get these days
13:32
< gnolam>
Except that it's got a spectacularly unnecessary minimum resolution requirement.
13:33
< gnolam>
So it's unplayable on many netbooks.
13:33
< McMartin>
Some of the later production levels need that or scrollbars.
13:33
< ErikMesoy>
For all that it's technologically undemanding it still threatened to make my laptop overheat until I throttled it by about -80%.
13:46 iosleep is now known as iospace
13:50
< Rhamphoryncus>
opengl ftw?
13:55
< McMartin>
Pretty sure that it's using GDI.
13:55
< McMartin>
The Mac Port is using Cocoa#, so it's almost certainly a canvas widget of some kind.
14:06 Kindamoody|out is now known as Kindamoody
14:25 celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has joined #code
14:28 cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
14:32
< ToxicFrog>
Tamber: the reason scancodes are so fucked is backwards compatibility, basically.
14:33
< ToxicFrog>
S1 scancodes (used by the IBM XT) were basically a row/column location and a keyup/keydown flag.
14:34
< McMartin>
Incidentally: The other shoe never dropped; I beat Sonic Generations this morning and it's at minimum decent all the way through.
14:35
< ToxicFrog>
S2 scancodes (used by the AT and kept by PS/2 keyboards) are totally different but still mostly make sense given the new keys etc, except that PS/2 keyboards can also generate XT scancodes if asked.
14:35
< McMartin>
And I laughed very hard at every cutscene involved in the final boss fight, the ending, and the post-credits sequence.
14:35
< ToxicFrog>
And then modern PS/2 keyboards add all kind of new keys (media/browser control, windows key, menu key, etc) but aren't allowed to change the old scancodes.
14:35
< celticminstrel>
I opened up Eclipse in Java 7, and I'm barely getting any lag now when switching to it despite it having been open for awhile.
14:36
< celticminstrel>
Only issue was it was raising NPEs when building one project, so I had to turn off automatic builds.
14:36
< ToxicFrog>
So the actual rationale for scancode assignment is "row/column order for the older keys, then scancodes assigned in the order the keys were added to the keyboard"
14:36
< ToxicFrog>
(the USB HID standard throws this all out and has its own protocol for communicating with keyboards)
14:37
< celticminstrel>
Minecraft on the other hand seems to have thrown security exceptions...
14:37
< ToxicFrog>
Attilla: SpaceChem will run on damn near anything if you have the screen space for it.
14:37
< ToxicFrog>
Also, the save files are actually sqlite3 databases and are compatible across all four versions, so you can just stick them in dropbox no problem.
14:38
< celticminstrel>
Huh.
14:38
< celticminstrel>
Interesting.
14:39
< celticminstrel>
And SpaceChem is also $2.50... so tempting to just grab those two...
14:40
< McMartin>
SpaceChem is insanely high quality.
14:40
< celticminstrel>
(The other being Universe Sandbox, since I didn't mention that in this channel yet.)
14:40
< McMartin>
It does risk a "and then celticminstrel was never seen again" incident though
14:40
< ToxicFrog>
(Universe Sandbox I have been told is an inferior version of Space Engine, which is free)
14:40
< celticminstrel>
I've already risked that with Sims 3. :P
14:41
< celticminstrel>
Which I got in the store so I could actually run it on my Mac.
14:41
< ToxicFrog>
(on the other hand, SpaceChem is arguably puzzle game of the year, and spacechem for $2.50 would be deal of the year if we weren't in the middle of the Steam holiday sale where such things are commonplace)
14:41
< celticminstrel>
ie, not off Steam.
14:41
< celticminstrel>
Heh.
14:42
< ToxicFrog>
I have 30 hours logged in it, and I've spent at least as much again playing it on the laptop under linux.
14:42
< celticminstrel>
Both of them also have a giftpile achievement, so I could get free stuff...
14:42
< McMartin>
IT'S A TRAP
14:42
< celticminstrel>
Heh.
14:42 * celticminstrel must google Space Engine now, will be back in a minute.
14:43
< ToxicFrog>
The SpaceChem giftpile achievement is pretty easy (it's basically "complete the first non-tutorial chapter")
14:43
< ToxicFrog>
I'm told the Universe Sandbox one is can also be trivially achieved by (for example) moving Earth's orbit out to 100au or so.
14:45
< celticminstrel>
Space Engine doesn't sound identical to Universe Sandbox, but I suppose that could be just because a different spin was put on their respective descriptions...
14:45
< ToxicFrog>
AIUI, Space Engine is a pure "fly around the universe looking at things" simulator, while Universe Sandbox has some limited orbit-altering tools and the like.
14:46
< ToxicFrog>
But if that's what you want you might as well go the whole hog and get Solar 2~
14:46
< celticminstrel>
Solar 2...?
14:46
< ToxicFrog>
You are a (asteroid|planetoid|star|solar system).
14:48
< celticminstrel>
On the other hand, Windows.
14:48
< ToxicFrog>
You fly around (performing tasks for god|cultivating a starfaring species in your bluebelt|collecting as many planets as you can|hurling stars into lifebearing worlds)
14:48
< ToxicFrog>
So is Universe Sandbox, so...
14:48
< celticminstrel>
Yeah.
14:49
< celticminstrel>
I do sort of have access to a Windows computer, or I could try running Steam under WINE, but both require me to remember my Steam password and are also somewhat inconvenient. <_<
14:50
< ToxicFrog>
In any case, this is irrelevant, because you should be playing SpaceChem instead~
14:50
< celticminstrel>
Heh
14:52
< ToxicFrog>
It has a demo if you're at all on the fence about it, which doesn't get you into the really brainmelting stuff but gives you a good idea of how it plays.
14:52
< McMartin>
Speaking of the really brainmelting stuff, have you faced XOTHOTHOR yet?
14:53
< ToxicFrog>
I'm still on BA SHOGTH
14:53
< McMartin>
I managed to conduct a perfect defense agains tboth BA SHOGTH and XOTHOTHOR.
14:54
< celticminstrel>
Rock of Ages and Jamestown were the other two I considered buying in order to do the giftpile achievement (I didn't buy them though).
14:54
< McMartin>
Jamestown you should have picked up with HIB 4, tbh. >_>
14:54
< McMartin>
(Jamestown is also excellent)
14:54
< McMartin>
I've heard Rock of Ages gets old fast.
14:55
< McMartin>
Oh hey I should probably go get the Audiosurf achievement.
14:55
< celticminstrel>
It didn't sound highly interesting, no.
14:55
< McMartin>
ROCK BEATS EVERYTHING.
14:56
< celticminstrel>
...Jamestown sounds really odd.
14:57
< McMartin>
It's Baby's First Bullet Hell.
14:58
< McMartin>
In all the positive senses of the term.
14:59
< celticminstrel>
I'm on the fence less because I'm not sure I want it and more because money... though it's not even that much; I definitely have sufficient money.
14:59
< celticminstrel>
For SpaceChem at least. Jamestown I'm not sure if I want it.
15:00 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
15:00
< ToxicFrog>
Rock of Ages is a fun casual game in the "I feel like spending ten minutes playing Katamari vs. The Entirety Of European Nobility" sense, but not something that will hold your attention for hours at a time, yeah.
15:04
< ToxicFrog>
If you're really that on the fence about SpaceChem, I think I have a few gift copies left~
15:04
< celticminstrel>
Oh, SpaceChem has DLC that has additional content?
15:04 * celticminstrel actually just now clicked Add to Cart. <_<
15:04
< ToxicFrog>
61 Corvi, yeah.
15:04
< McMartin>
I didn't like what I played of 61 Corvi, tbh.
15:04
< ToxicFrog>
Honestly, it's skippable.
15:05
< celticminstrel>
63 Corvi.
15:05
< celticminstrel>
It's only 50? though. <_<
15:05
< ToxicFrog>
The keys really are right next to each other~
15:05
< celticminstrel>
Huh?
15:05
< ToxicFrog>
If you want more once you finish the main game, ResearchNet is built in to all versions of the game and offers a selection of the best fan- and developer-created levels.
15:05
< ToxicFrog>
And the new game mechanics that show up in 63 Corvi also show up in a lot of ResearchNet levels.
15:05
< ToxicFrog>
So the only reason to get it is for the storymeats.
15:05
< celticminstrel>
But 50?.
15:06
< ToxicFrog>
Which, while intruiging, aren't really a focus of the game.
15:06 ErikMesoy [Erik_Mesoy@5E691D.066EBC.4D6A05.55E49D] has quit [Ping timeout: 121 seconds]
15:06 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
15:07
< celticminstrel>
Now should I checkout or take up TF's offer... <_<
15:09 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has joined #code
15:09
< ToxicFrog>
Turns out I was wrong anyways.
15:09
< ToxicFrog>
It's HIB 2 I have leftovers of, not SpaceChem.
15:10
< celticminstrel>
Okay, that decides for me! :P
15:11
< ToxicFrog>
If you want a copy of Cortex Command (ahahahahahahahahahahahaha) I've got you covered~
15:13
< celticminstrel>
Heh.
15:13
< celticminstrel>
What's HIB?
15:15
< ToxicFrog>
Humble Indie Bundle.
15:16
< ToxicFrog>
HIB 2 was {Braid,Cortex Command,Machinarium,Osmos,Revenge of the Titans}
15:16
< ToxicFrog>
So, looking back on it, basically the worst one to get multiple copies of~
15:20
< celticminstrel>
Ah.
15:20
< celticminstrel>
Was Cortex Command bad or something?
15:21
< ToxicFrog>
Mu.
15:21
< ToxicFrog>
It's still in development and has been since, IIRC, 2003.
15:22
< ToxicFrog>
It looks like it'll be really cool when it's finally released in 2047.
15:26
< celticminstrel>
Ah, heh.
17:09 Attilla [Obsolete@Nightstar-5a27386a.as43234.net] has quit [[NS] Quit: ]
17:17 Attilla [Obsolete@Nightstar-5a27386a.as43234.net] has joined #code
17:24 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
17:30 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
18:08<~Vornicus> Okay. THe big problems right now are separating polygons into compounds, (possibly) turning straight groups of edges into single ones, and (definitely) figuring out how to add pits in there.
18:08<~Vornicus> Once I've got pits I have all the static level elements figured out.
18:19<~Vornicus> hm... I suspect my best bet - since there are things that go over pits and then over regular floor, but not over walls - is to do "pits vs non-pits" and "walls vs non-walls" graphs separately, and layer the second on top of the first when rendering.
18:40
< AD[Shell]>
i^2
18:40
< AD[Shell]>
Shit just got real.
18:40 * Vornicus patpats AD
18:41 * AD[Shell] is patpatted.
--- Log closed Sat Dec 31 19:14:07 2011
--- Log opened Sat Dec 31 19:14:15 2011
19:14 TheWatcher[afk] [chris@Nightstar-3762b576.co.uk] has joined #code
19:14 Irssi: #code: Total of 28 nicks [1 ops, 0 halfops, 0 voices, 27 normal]
19:14 Irssi: Join to #code was synced in 44 secs
19:21 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
19:24 Kindamoody is now known as Kindamoody|out
19:26 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
20:49
< Tarinaky>
I have a question.
20:50
< Tarinaky>
For log in code for a MUD, should I store all the user accounts in memory in a tree or just store them all in a file and access the file as needed?
20:50
< Tarinaky>
Obviously the first is faster but will use up more memory.
20:50<~Vornicus> Use a proper database and let it decide.
20:51
< Tarinaky>
I don't know how to use a proper database.
20:51
< Ling>
A single file per player is what SocketMUD does, I think other MUDs do the same
20:52 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
20:52<~Vornicus> Though to answer the question more completely: on modern hardware, if your MUD is expected to have less than 10k users, the question is moot.
20:52 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
20:52
< Tarinaky>
I can't expect a dedicated server.
20:53
< Tarinaky>
So I'm not sure 'on modern hardware' applies.
20:53<~Vornicus> OKay, let's put it this way.
20:53
< Ling>
Player objects are probably <1kB, 10k player objects is <10MB
20:56<~Vornicus> --what ling said, but also this: your primary concern is neither speed nor memory.
20:56 cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has joined #code
20:59<~Vornicus> Well, it's neither disk read speed, nor the amount of memory the thing takes up: it's complexity, and persistence. Use a hash table, and while you're at it, make sure that every actual change gets stored to disk.
20:59<~Vornicus> Both of these things would be perfectly taken care of with even an SQLite database.
21:00<~Vornicus> It will make the complex memory-or-disk decisions for you, AND will make sure that everything gets done right.
21:01 eckse [eckse@Nightstar-e0fc8261.dsl.sentex.ca] has joined #code
21:02 Vash [Vash@Nightstar-8697fea9.wlfrct.sbcglobal.net] has joined #code
21:05 * Tarinaky pokes sqlite with a long stick.
21:08<~Vornicus> It has APIs for pretty much every language.
21:29<~Vornicus> What language are you writing the mud in?
21:36 RichardBarrell [mycatverbs@Nightstar-4ad9b0c6.bb.sky.com] has joined #code
21:40
< Tarinaky>
Python, using Twisted.
21:41<~Vornicus> Then you've got sqlite as a standard library
21:47
< celticminstrel>
Yup.
21:48
< Tarinaky>
Does it matter if I'm using Twisted?
21:48<~Vornicus> No.
21:50
< Tarinaky>
Okay.
21:50
< Tarinaky>
So next question is... How the hell do I use SQL, lol.
21:53
< ToxicFrog>
Stored procedures.
21:53
< celticminstrel>
Uh, no.
21:56<~Vornicus> http://sqlite.org/lang.html has sql as understood by sqlite; http://docs.python.org/library/sqlite3.html#module-sqlite3 has how to talk to sqlite via python
21:59<~Vornicus> Generally, you need to create tables (structs), including how the tables link to each other; then you use insert, select, update, and delete queries to describe what you're doing to the tables.
22:04
< Tarinaky>
I... don't understand http://sqlite.org/lang.html
22:04
< Tarinaky>
It's pretty impenetrable :/
22:05<~Vornicus> Okay, let's do it this way: what do you want to store?
22:05<~Vornicus> (I will then write for you a query)
22:06
< Tarinaky>
Unique user names with some kind of password.
22:06<~Vornicus> Okay.
22:07 * celticminstrel would probably use the username as the primary key, though I suppose that's a bad idea or something.
22:07
< Tarinaky>
celticminstrel: That's what I was thinking. But I have no idea if you can even do that with databases.
22:08
< celticminstrel>
Why not?
22:08
< Tarinaky>
Because all the examples I've ever seen use integer keys.
22:09<~Vornicus> CREATE TABLE users (user_name TEXT PRIMARY KEY, user_password TEXT);
22:09<~Vornicus> you can use text as primary keys but it's not generally advisable.
22:10
< ToxicFrog>
Tarinaky: usually because it's really easy to guarantee every row gets a unique key that way.
22:11
< ToxicFrog>
s/unique/unique, immutable/
22:11
< ToxicFrog>
Sure, usernames are both now, but what about a year from now when you implement name changes?
22:11<~Vornicus> or CREATE TABLE users (user_id INTEGER PRIMARY KEY ASC, user_name TEXT UNIQUE, user_password TEXT);
22:12
< Tarinaky>
Okay... How do I know if the table needs creating?
22:12
< Tarinaky>
Or whether it exists already?
22:12<~Vornicus> Generally you'll build your database's tables during the build process.
22:12<~Vornicus> But: CREATE TABLE IF NOT EXISTS users...
22:12
< Tarinaky>
What does 'build process' mean in the context of python?
22:13
< Tarinaky>
Or by build process do you mean "as I write the code"?
22:14<~Vornicus> Not really: you want a deploy script that sets up the database is you want, before the thing starts.
22:14
< Tarinaky>
Oh, I see.
22:15
< Tarinaky>
So... INSERT ummm...
22:15
< Tarinaky>
INSERT INTO ?
22:17<~Vornicus> So now that you want to insert something: INSERT INTO users(user_name, user_password) VALUES ('vorn', 'password');
22:17<~Vornicus> Use this with the second one there; this will let user_id get filled automatically.
22:18
< Tarinaky>
Oh, what does 'ASC' mean?
22:18<~Vornicus> it means it will automatically assign values in ascending order.
22:19
< celticminstrel>
Is that in the standard?
22:19<~Vornicus> It's in SQLite
22:20
< celticminstrel>
So, nonstandard extension?
22:21<~Vornicus> Possibly. I don't know what's standard for autonumbering, but it seems like every db does it differently.
22:22
< celticminstrel>
It does... I dunno if there is a standard for it...
22:22
< Tarinaky>
Presumably it doesn't mater how it's auto-incremented.
22:22<~Vornicus> Oh, and you'll actually not want to store passwords in cleartext; you'll want a salted hash.
22:22
< Tarinaky>
As long as it is.
22:22
< Tarinaky>
Vornicus: I got that.
22:22
< Tarinaky>
Although I was going to stick with plaintext for a while just to get it working at all >.>
22:23<~Vornicus> This is a security thing and I don't actually know how to do that, but at about this point I should be directing you to the parameterized expressions thing in the API
22:23
< Tarinaky>
Does the datatype need to be something different for a hash?
22:23<~Vornicus> No, it'll be text still.
22:23<~Vornicus> Because your hashes will come out as strings.
22:24
< Tarinaky>
Okay.
22:24<~Vornicus> SPeaking of security, let's switch over to parameterized expressions.
22:24<~Vornicus> Because sql injection is bad, mmkay?
22:25
< Tarinaky>
INSERT INTO users VALUES (?,?)
22:25
< Tarinaky>
err users(user_name,user_password)
22:25<~Vornicus> Just like that. And then your second parameter to your execute will be a list of objects to replace the ?s with
22:26
< Tarinaky>
How do I do SELECT, and how do I make things relational?
22:27
< Tarinaky>
Like if I want 1 user : many characters
22:28<~Vornicus> All right, let's build a character table
22:30<~Vornicus> CREATE TABLE characters (character_id INTEGER PRIMARY KEY ASC, user_id INTEGER FOREIGN KEY REFERENCES users.user_id, character_name TEXT UNIQUE, class_id INTEGER, race_id INTEGER);
22:30
< Tarinaky>
FOREIGN KEY REFERENCES ?
22:30
< Tarinaky>
Oh. REFERENCES users.uder_id
22:30<~Vornicus> "this is a key into a different table, and this is the table and column it talks about"
22:30
< Tarinaky>
Nm >.>
22:32<~Vornicus> This is by no means a complete table; class_id and race_id should reference into your semi-static data tables about race and class information, for instance, and there are probably other things like demographic and descriptive statistics that might go in there too (religion, birthdate/age, height and weight...)
22:34
< Tarinaky>
I don't, really, want to even think about what a character 'is' atm.
22:34
< Tarinaky>
Because I'm not that far along.
22:34<~Vornicus> So now, to see all the characters and their users, by name: SELECT user_name, character_name FROM users JOIN characters ON user.user_id = character.character_id ORDER BY user_name, character_name;
22:35
< Tarinaky>
Okay, I think we jumped a bit too fast there.
22:35<~Vornicus> That was a lot of stuff, yeah.
22:35
< Tarinaky>
So... SELECT a,b returns a tuple?
22:35<~Vornicus> Yes.
22:36
< Tarinaky>
okay... what does JOIN do?
22:36<~Vornicus> JOIN joins to tables, by the relationship given
22:36
< celticminstrel>
Is JOIN inner or outer by default?
22:36<~Vornicus> Inner, as it should be.
22:36
< Tarinaky>
What does that even mean?
22:36<~Vornicus> We'll get to that.
22:36
< Tarinaky>
Okay.
22:36
< celticminstrel>
I've always been explicit on that.
22:37<~Vornicus> oh, damn, sorry, blew that
22:37<~Vornicus> SELECT user_name, character_name FROM users JOIN characters ON user.user_id = character.user_id ORDER BY user_name, character_name;
22:37<~Vornicus> (it's been a while)
22:38<~Vornicus> what it says now is that it should match up each row in the characters table with the row in the users table that has the same user_id
22:39
< Tarinaky>
Doesn't character.user_id already specify that it links to user.user_id?
22:39
< Tarinaky>
That seems a little... redundant.
22:40<~Vornicus> It does, buuuut there's some wicked tricks we can play, and I'll show you one later.
22:40
< Tarinaky>
Okay.
22:40<~Vornicus> However, in this case, we can also say ...FROM users NATURAL JOIN characters ORDER BY...
22:41
< Tarinaky>
How would you go about adding a list to a character?
22:41<~Vornicus> Which joins tables by equality on all named columns they share.
22:41
< Tarinaky>
For an inventory for example.
22:41<~Vornicus> The same way we added a list of characters to a user.
22:42
< Tarinaky>
Ahah. Derp.
22:42<~Vornicus> Each inventory item will get its own row in another table, and it will say who carries that item.
22:44<~Vornicus> anyway, let's get back to the select query, because there's one last part that we haven't directly talked about, and then there's several more things you'll want to be able to do with it.
22:45<~Vornicus> the last bit in the current query is ORDER BY: ours says that it sorts by user name and then breaks ties in that by sorting on character name. In a it's just like making your sort key (a la sort()) the tuple (user_name, character_name)
22:46
< Tarinaky>
Aye. I got ORDER BY.
22:46<~Vornicus> ALl right. Now let's talk about the remaining things. FIrst off, WHERE
22:47<~Vornicus> SELECT character_name FROM users NATURAL JOIN characters WHERE user_name = 'vorn' ORDER_BY user_name;
22:47<~Vornicus> Wow. Out of practice.
22:47<~Vornicus> SELECT character_name FROM users NATURAL JOIN characters WHERE user_name = 'vorn' ORDER BY character_name;
22:49<~Vornicus> the WHERE clause filters individual rows; only those characters owned by 'vorn' -- note that I don't have to display it -- will appear in this query.
22:50<~Vornicus> SELECT user_name, count(*) FROM users NATURAL JOIN characters GROUP BY user_id ORDER BY count(*) DESC, user_name ASC;
22:51<~Vornicus> GROUP BY aggregates rows together; in this case, this query will list all the users, and the number of characters each one has, in descending order by character count and then in ascending order by user name.
22:52
< Tarinaky>
Err... I don't think I got that.
22:52
< Tarinaky>
How does it know what to count?
22:52<~Vornicus> count(*) counts the existence of entire rows.
22:53
< Tarinaky>
Rows of which table?
22:53<~Vornicus> Of the joined table.
22:54
< Tarinaky>
What 'is' the joined table
22:54
< Tarinaky>
+?
22:54<~Vornicus> the joined table is "users NATURAL JOIN characters". It's what you'd see if you just did "SELECT * FROM users NATURAL JOIN characters;"
22:56
< Tarinaky>
Yeah... but what does that look like exactly? Is it (user_id, user_name, user_password, character_id, character_name) repeated for every permutation of user and character that share the same user_id key?
22:56<~Vornicus> Pretty much, yeah.
22:56<~Vornicus> Though more likely it will have users.user_id and characters.character_id, and of course you can more explicitly namespace each column name.
22:58<~Vornicus> count isn't the only aggregate thing, consider this: SELECT user_name, sum(gold) FROM users NATURAL JOIN characters GROUP BY user_id ORDER BY sum(gold) DESC, user_name ASC;
22:59<~Vornicus> Which (assuming gold is a field on the characters table) says how much gold all of each users' characters have accumulated.
22:59
< Tarinaky>
I thought SELECT a,b returned (a,b)?
22:59<~Vornicus> sure.
22:59
< Tarinaky>
Surely it's returning how much gold the user's accumilated between all characters?
23:00<~Vornicus> RIght, that's what I said, in iddferent words.
23:00
< Tarinaky>
I read what you said as a character-by-character break down.
23:00
< Tarinaky>
"all of each users' characters have accumulated"
23:00<~Vornicus> Sigh
23:00
< Tarinaky>
Sorry >.<
23:01<~Vornicus> Anyway.
23:01<~Vornicus> Sometimes we want conditions on our group-bys too, but they come in two flavors.
23:03<~Vornicus> If we want to know, for instance, only those users with five or more characters, we use "HAVING" - we're grouping and then filtering. SELECT user_name, count(*) FROM users NATURAL JOIN characters GROUP BY user_id HAVING count(*) >= 5 ORDER BY count(*), user_name;
23:04<~Vornicus> If we want to know how many elves each user has, we use WHERE - we filter and then group. WE can use both if we want to.
23:05<~Vornicus> SELECT user_name, count(*) FROM users NATURAL JOIN characters NATURAL JOIN races WHERE race_singular_name = 'elf' GROUP BY user_id ORDER_BY count(*), user_name;
23:08<~Vornicus> Do you see how those two work?
23:08
< Tarinaky>
I think so.
23:08
< Tarinaky>
But I'm not sure.
23:08
< Tarinaky>
HAVING is for aggregates.
23:09
< Tarinaky>
Oh wait.
23:09
< Tarinaky>
No.
23:09
< Tarinaky>
I get it now.
23:09
< Tarinaky>
WHERE depends on the character side of the join, HAVING depends on the whole joined table.
23:09<~Vornicus> Nope.
23:10
< Tarinaky>
>.<
23:10<~Vornicus> you had it the first time: HAVING is for aggregates.
23:11
< Tarinaky>
Stupid question: How do I escape the quote marks for python's benefit?
23:12<~Vornicus> Inside "", use \" to get a literal "; inside '', use \' to get a literal '
23:13
< Tarinaky>
... cur.execute("SELECT * FROM accounts")
23:13
< Tarinaky>
... print cur.fetchall()
23:13
< Tarinaky>
SyntaxError: invalid syntax
23:13<~Vornicus> Include a ; at the end of the statement, that might be it.
23:13
< Tarinaky>
It accepted the insert without a ;
23:14
< Tarinaky>
It's definately a Python syntax error
23:14<~Vornicus> I don't know what's going on then; I don't see any errors there.
23:14<~Vornicus> Paste full code.
23:16
< Tarinaky>
http://pastebin.com/GTHWqQjU
23:16
< ToxicFrog>
...does the cursor let you enter partial commands like the REPL?
23:17
< ToxicFrog>
I've been bitten by that in the REPL before ('INSERT ...' produces no error...because it's waiting for the rest of the command; then I do 'SELECT foo;' and it concatenates that with the INSERT and has a crazy)
23:17
< Tarinaky>
But I executed 3 commands.
23:17
< Tarinaky>
And the third threw the error.
23:18
< ToxicFrog>
Oh
23:18
< ToxicFrog>
Hang on
23:18
< Tarinaky>
If it was the second that threw the error that'd be one thing...
23:18
< jerith>
The first has a semicolon.
23:18
< ToxicFrog>
That's a Python error, not an SQL error.
23:18
< jerith>
The second doesn't.
23:18<~Vornicus> Actually the third one is what I'm expecting to throw if it's a repl error
23:18
< ToxicFrog>
And it even tells you exactly where the error is
23:18
< ToxicFrog>
File "<stdin>", line 4
23:18
< ToxicFrog>
print cur.fetchall()
23:18
< ToxicFrog>
^
23:18
< ToxicFrog>
SyntaxError: invalid syntax
23:18
< jerith>
The db layer might be throwing a SyntaxError.
23:18
< Tarinaky>
jerith: That would seem like a silly thing to do.
23:18<~Vornicus> Py3 or py2?
23:19 * Tarinaky facepalms.
23:19
< ToxicFrog>
If you're using Python 3, this is because print() is a global function, not a keyword.
23:19
< jerith>
Tarinaky: Sure, but it's legal.
23:19
< ToxicFrog>
print(cur.fetchall())
23:19
< jerith>
Oh, p3.
23:19
< jerith>
*py3
23:19<~Vornicus> also what's the with's for?
23:20 * jerith assumes "python" means 2.x and python 3 is invoked explicitly.
23:20
< Tarinaky>
jerith: I made that assumption to.
23:20
< Tarinaky>
Thanks for sorting that newbie error, lol.
23:20
< ToxicFrog>
What does 'with' do, anyways
23:20
< ToxicFrog>
?
23:20
< Tarinaky>
It's been throwing me for a loop all evening.
23:20<~Vornicus> TF: with actually does this
23:21
< Tarinaky>
Apparently it's a sugar for exception handling.
23:21
< jerith>
No, it's a context manager.
23:21
< Tarinaky>
Ah. The documentation I skimmed over mentioned try-catch-finally blocks.
23:22
< jerith>
What it actually /does/ depends on the thing you're "with"ing.
23:22
< jerith>
The implementation calls magic methods on the object at the start and end of the block.
23:22
< jerith>
So you can use it for exception handling if you want.
23:23
< jerith>
In this case, it's probably doing transaction management.
23:24
< ToxicFrog>
Aah.
23:25
< jerith>
http://effbot.org/zone/python-with-statement.htm
23:28<~Vornicus> Okay, last two clauses on SELECT
23:29<~Vornicus> these go at the end, and they're called LIMIT and OFFSET
23:29
< ToxicFrog>
jerith: nifty.
23:29 * ToxicFrog goes to get curry ingredients.
23:30
< Tarinaky>
Question: What, exactly, locks SQLite?
23:30
< Tarinaky>
Is it connect?
23:30<~Vornicus> connect, if you're in the default exclusive mode.
23:30
< Tarinaky>
How do I make sure it's unlocked in a timely manner?
23:30
< jerith>
Tarinaky: SQLite's transaction management is... primitive.
23:30<~Vornicus> LIMIT is for when you only want to see a few things; OFFSET is for when you want to skip.
23:31<~Vornicus> So if you're making a forum and want to display 30 posts per page, you'd do SELECT .... LIMIT 30; for the first page, and SELECT ... LIMIT 30 OFFSET 30 for the second.
23:31
< Tarinaky>
I only have a single program using the database - but the program is using an async lib I don't really understand to create sessions for each user.
23:35<~Vornicus> ANd that mostly covers the basics; but I should mention two things that came up.
23:35<~Vornicus> THe first is "inner" and "outer" joins
23:36<~Vornicus> Usually what you want is an inner join; this gives you only those things that match up exactly and nothing else. But sometimes, you want to see those things that don't have any exact matches.
23:36<~Vornicus> Like, what if in addition to all the user-character pairs, you wanted to see all the users that don't have any characters?
23:39
< Tarinaky>
Would I be better off having an object that holds the connection to the db and passing messages to that?
23:40<~Vornicus> Might be a good idea.
23:41<~Vornicus> For this scenario, we use the LEFT OUTER JOIN - actually the only kind of outer join that's available in sqlite; for the RIGHT OUTER JOIN you'll need to fudge, and for the full OUTER JOIN you're kind of stuck but there's not much call for it anyway.
23:42
< Tarinaky>
What have we been using for NATURAL JOIN?
23:42<~Vornicus> it's an inner join; that is the default and the one you want.
23:42<~Vornicus> usually.
23:43<~Vornicus> if we want to see all users and their associated characters, AND all users without characters, we do this: SELECT user_name, character_name FROM users NATURAL LEFT OUTER JOIN characters;
23:45 Derakon[AFK] is now known as Derakon
23:45<~Vornicus> (a right join here, if we could do that in sqlite, would list users and associated characters, and characters without users, but not users without characters; a full outer join would show both "without"s
23:49<~Vornicus> the other topic, and why that thing seems redundant, is something a little crazier: CREATE TABLE person (person_id INTEGER PRIMARY KEY ASC, name TEXT, mother_id INTEGER FOREIGN KEY REFERENCES person.person_id);
23:50<~Vornicus> SELECT person.name, mother.name FROM person JOIN person AS mother ON person.mother_id = mother.person_id;
23:53<~Vornicus> gives a list of each person and that person's mother.
23:53
< Tarinaky>
But not Motherless Persons.
23:54
< Tarinaky>
So how much of SQLite is 'in memory'?
23:54
< Tarinaky>
Or rather, the database is in memory.
23:55<~Vornicus> AS much as it decides it needs
23:56
< Tarinaky>
How does it make that decision?
23:59<~Vornicus> Dunno. There's lots of things involved.
--- Log closed Sun Jan 01 00:00:30 2012
code logs -> 2011 -> Sat, 31 Dec 2011< code.20111230.log - code.20120101.log >

[ Latest log file ]