code logs -> 2010 -> Sun, 24 Jan 2010< code.20100123.log - code.20100125.log >
--- Log opened Sun Jan 24 00:00:25 2010
00:08 AbuDhabi [annodomini@Nightstar-31830a38.adsl.tpnet.pl] has quit [[NS] Quit: On your dropship hull // I planted a melta bomb // Blood for the Blood God]
00:37
< gnolam>
Hmm.
00:38
< gnolam>
To start bolting some gameplay onto the ocean renderer, try out some new cool rendering effects, or to start working on the neat little artillery-game-with-a-twist idea I just had, that is the question.
00:39
<@McMartin>
Why not have the first and last be the same thing? =D
00:39 You're now known as TheWatcher[T-2]
00:39
< gnolam>
Hmm. It's actually almost crazy enough to work. :)
00:42 You're now known as TheWatcher[zZzZ]
00:57 MyCatVerbs [mycatverbs@Nightstar-7fff4244.bb.sky.com] has quit [Ping timeout: 121 seconds]
01:21 Alek [omegaboot@Nightstar-3ffc02c7.emhril.sbcglobal.net] has joined #code
01:51 Attilla [Attilla@FBC920.0EA685.99523D.9E28A9] has quit [Connection reset by peer]
01:53 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
02:08 Thant [Thant@Nightstar-63cb80a6.cable.ntl.com] has joined #code
02:15 Derakon [Derakon@Nightstar-5abd3ac9.ca.comcast.net] has joined #code
02:15 mode/#code [+o Derakon] by Reiver
03:04 * McMartin pokes at Project Euler #149
03:04
<@McMartin>
I bet I could make this more efficient with arrays, but I'm not entirely sure I can be arsed
03:06
<@McMartin>
Since it will be likely faster to just run the inefficient list-based one.
03:07
< Thant>
heh
03:07
< Thant>
i've just got to the point in openGL where i need to start doing vertex arrays
03:07
< Thant>
i wept
03:08
<@McMartin>
Heh
03:08
<@McMartin>
If your models don't move, they're fantastic
03:08
<@McMartin>
Sable just has one vertex array for the entire world and just reindexes and retransforms it to render every ship and shot
03:08
< Thant>
oh
03:08
< Thant>
shiiiit
03:08
< Thant>
i'm doing a games computing course
03:08
< Thant>
so i just have to make a scene in C++ using openGL ( only a second year)
03:09 * McMartin nods
03:09
< Thant>
and i've decided to do a really shitty version of mordor
03:09
<@McMartin>
Heh
03:09
< Thant>
it's due in 5 days, not started it yet
03:09
< Namegduf>
Hmm.
03:09
< Thant>
and i'm cacking bricks
03:09
< Namegduf>
But one does not simply render Mordor.
03:09
<@McMartin>
One does not simply ROCK into Mordor
03:09
<@Derakon>
You have to powerslide.
03:09
<@McMartin>
Sable was my graphics final; we had to do a high-speed interactive project.
03:18
<@McMartin>
And, that's #149 down. It's its own fault for being so much easier than its neighbors.
03:21 * Vornicus hasn't gotten around to actually doing 105, even though he's already written most of the code.
03:22
<@Vornicus>
though the code is... scary.
03:23
<@McMartin>
I just wrote a map using slice functions with $ as the operator
03:23
<@McMartin>
So, I have a list x
03:24
<@McMartin>
map ($x) [f1, f2, f3, f4] applies each f to the list x and returns a list of results, one per function
03:24
< Namegduf>
I've never done any Project Euler stuff. One day, though, I want to do it all in assembly.
03:24
<@Derakon>
You wouldn't be the first.
03:25
< Thant>
so what IS project euler?
03:26
<@Derakon>
After Cain killed Able, he went and founded a capitalist utopia?
03:26
<@Derakon>
Er, mischan.
03:26
< Thant>
wat
03:26
<@McMartin>
Thant: It's a collection of math and programming problems.
03:26
<@McMartin>
http://projecteuler.net
03:26
<@Derakon>
Thant: My comment was in response to someone suggesting an Ayn Randian rewrite of the Bible.
03:27
< Thant>
hahaha
03:27
< Thant>
that would more be, cain killed able, all the while everyone other than cain and able were sub-human mutants
03:27
< Thant>
and any women existed purely for the gratification of cain
03:27
< Thant>
god i love atlas shrugged
03:27
< Thant>
even the stupidly long speech >.<
03:28
< Thant>
gotta ask what #fleet is about though
03:28
<@Derakon>
Random conversation.
03:28
<@McMartin>
Not much; it's a social community channel.
03:28
< Thant>
fair enough
03:28
<@McMartin>
And a "pre-existing community" variety.
03:28
<@Derakon>
McM put it better~
03:29
<@McMartin>
Er, of the
03:29
< Thant>
i'll steer clear then :(
03:30
<@Derakon>
Ehh, it's not meant to be a clique.
03:31
<@McMartin>
I didn't claim it was - however, on The Wider Internet, the line the between "pre-existing community" and "clique" is thinner than one would generally expect.
03:31
<@Derakon>
Oh, yes.
03:31
<@Derakon>
I was mostly trying to say that just because you weren't there at the start doesn't mean you aren't allowed in.
03:31
<@Derakon>
...I think I got all those negations right.
03:31
<@Vornicus>
They range from (the first one) "the sum of all the numbers from 1 to 1000 that are divisible by 3 or 5", to "find all the triplets of integers whose sum is less than 120000, that, when used as distances along lines 120 degrees apart, the end points form a triangle with integer side length"
03:31
<@Vornicus>
It looks right, Der
03:32
<@Derakon>
My brain's a bit fuzzed right now.
03:32
<@Vornicus>
(which is one of the recent ones McM solved and I looked at and went "oh duh" but haven't actually written the code for because I haven't gotten actually to that one yet.
03:32
<@McMartin>
Because Random Internet People tend to not have "this collection of people has been interacting for years" lead to "Perhaps I should be circumspect therein and attempt to adapt to the local culture while here"
03:32
<@Derakon>
Whee exhaustion.
03:33
<@Vornicus>
There's technically a channel on this network dedicated to Project Euler - #projecteuler - but it's not well populated. On the other hand at least four of the people in this channel have solve 100 or more project euler problems.
03:34
<@Derakon>
I'm at around 95 or so, IIRC.
03:34
<@Derakon>
I should solve a few more.
03:34
<@Vornicus>
Oh, I thought you'd hit 100.
03:34
<@Derakon>
No, I haven't.
03:34
<@Derakon>
I got a job before making it all the way~
03:34
<@Vornicus>
well. At least three, then.
03:35
< Thant>
mcMartin
03:35
< Thant>
you mentioned sable earlier
03:36
< Thant>
does it have a website?
03:36
< gnolam>
Derakon: and now, Seb has turned your brain into porridge.
03:37
<@McMartin>
Thant: It did, but I haven't restored it after my account died
03:37
< gnolam>
Yes, Derakon has dared gaze into Abdul al-Sebastian's Pythonomicon.
03:37
< Thant>
darn
03:37
< Thant>
i wanna see it
03:37
< Thant>
:P
03:37
<@McMartin>
I can try to restore it later tonight if you'll still be online
03:37
< Thant>
probably wont be
03:38
< Thant>
it's about 3:40 am here
03:38
< gnolam>
Thant: so what was wrong with vertex arrays? :)
03:38
<@McMartin>
Well, then the next time you're on it should be up.
03:38
< Thant>
that would be cool
03:38
< Thant>
i've not started using it atm gnolam
03:38
< Thant>
but i checked out the lecture notes on it
03:38
< Thant>
and cacked bricks
03:38 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has left #code []
03:39
< gnolam>
It's easy. In some ways, easier than immediate mode (glBegin()/glEnd()).
03:39
< Thant>
as i understand it you make 2 arrays, one for the vertex co-ords and 1 for the ID for the vertex, and then when you make the command you call the ID's out or some such?
03:39
< Thant>
like 4 co'ords in 1 array, then 1-4 in the other, then in the command you might do the command then 1,4,2 or w/e to connect 1 to 4 to 2?
03:41
< gnolam>
The easiest version is you just fill an array with your vertices (and another for normals if you use them, ditto for texture coordinates, colors and the like). Then you just pass it to glVertexPointer(), call glDrawArrays() and you're done.
03:41
< gnolam>
The slightly more complicated version is to have it indexed.
03:41
< Thant>
see now this is why i wish i didn't skip my last 4 computer graphics and games programming lectures
03:41
< Thant>
last i remember we were just starting lightning
03:41
< Thant>
now it's all texturing and arrays
03:41
< Thant>
and i'm like OH CHRIST WHAT
03:42
< gnolam>
In the above, I should have said something like "your vertices for every single triangle".
03:42
<@Vornicus>
I need to find a 3d graphics course.
03:42
< gnolam>
In indexed mode, you first fill an array with "possible" vertices, and then give your triangles as indices into that array.
03:42
< Thant>
we've got a indian bloke teaching us, he has 2 masters degrees and a doctorate
03:42
< Thant>
and he still mixes up words
03:42
< Thant>
so half the time i dunno what the shit he is on about
03:42
< Thant>
xD
03:43
< Thant>
i think i get you gnolam
03:43
< Thant>
though it's a bit early for that kinda thinking
03:43
< Thant>
xD
03:43
<@Vornicus>
cuz I tried dealing with the Red Book and it just didn't fucking help.
03:44 * Vornicus randomly looks at the most recent Euler problem. Oh. My. God. That's just scary.
03:48
< gnolam>
My explanatory skills aren't at their peak at 0440.
03:48
< gnolam>
But... yeah.
03:50
< Thant>
xD
03:53
< gnolam>
(The reason that indexed mode is faster is that you can save on and reuse a lot of data that would otherwise have to be duplicated. To draw a cube with raw vertices, for example, you would have to send in 6*2*3*3 = 108 floats. In indexed mode, you only need 8*3 = 24 floats for the vertices and then 6*2*3 = 36 indices.)
03:59
< Thant>
ahh
03:59
< Thant>
fair enough
04:00
< Thant>
i've heard a interleaved array is better than having separate arrays
04:00
< Thant>
unfortunately
04:00
< Thant>
i have no idea what that means
04:00
< Thant>
xD
04:01
< gnolam>
Indexed vs unindexed gave a speedup factor of about ~2.5 in my ocean renderer. :)
04:01
< gnolam>
(And with VBOs vs plain old vertex arrays it was a full order of magnitude, heh)
04:03
<@Vornicus>
VBOs?
04:03
< gnolam>
Vertex Buffer Objects.
04:03
<@Vornicus>
oh, those video-card-side arrays.
04:03
< gnolam>
How You Should Render In OpenGL Nowadays(TM).
04:03
<@Vornicus>
yes?
04:03
< gnolam>
Exactly.
04:04
<@Vornicus>
'k, not going insane.
04:04
< gnolam>
Thant: With interleaved arrays you combine data from different arrays into one by intermingling them round-robin.
04:06
< Thant>
ah
04:06
< Thant>
i see
04:06
<@Vornicus>
So you'd have, instead of xyzxyzxyzxyz uvuvuvuv ijkijkijkijk, xyzuvijkxyzuvijkxyzuvijkxyzuvijk
04:06
< Thant>
so you'd include both the index and the co-ords into the 1 array?
04:07
< gnolam>
What Vornicus just said.
04:07
<@Vornicus>
I think more along my thing, but I think I misnamed my normal vector coordinates.
04:08
< gnolam>
Eh, naming's arbitrary anyway. :)
04:08
<@Vornicus>
The primary advantage of interleaved arrays is that you can effectively pass a whole vertex, including such things as texture coordinates and normals, around as a struct.
04:09
< gnolam>
As for which one is actually faster, that has varied wildly.
04:09 * Alek smacks down.
04:19 zippthorne [mike@Nightstar-289e06ac.ri.cox.net] has joined #code
04:21
< Alek>
installed.
04:21
< Alek>
updated.
04:21
< Alek>
should I get cracking on the book, or should I go to sleep? >_>
04:23
< Alek>
the interesting thing about roguelikes....
04:24
< Alek>
as far as I can tell, once you have the game working, there isn't really much to stop you from changing the display mechanism from roguelike characters to tiles, sprites, or even full-on rendering, in top-down, 3/4, 3rd person, or even first-person.
04:24
<@Vornicus>
Alek: if you've done it right, you are correct.
04:24
< Alek>
XD
04:25
<@Vornicus>
The primary difficulty is getting art.
04:25
< Alek>
true dat
04:27
< Thant>
my eeepc can go fuck itself >.<
04:28
< Thant>
i take it home for christmas, works fine on networks
04:28
< Thant>
bring it back
04:28
< Thant>
all sorts of crazy errors
04:28
< Thant>
cant validate, no DHCP, etc etc etc
04:28
< Thant>
and if i change the network encryption type it wont let me disable the authentication i need to
04:28
< Thant>
i've reset the tcp/ip stack, done all sorts of shit
04:29
< Thant>
just gonna throw it out the window when i wake up tomorrow and be done with it xD
04:29
< gnolam>
Alek: that's true for pretty much any game, if you've designed it right. :)
04:29
< Thant>
wall of text over
04:29
< gnolam>
Sounds like it's time for an OS reinstall.
04:30
< Thant>
hahahahaha
04:30
< Thant>
it was a ridiculous ballache to put XP on my eee anyway
04:30
< Thant>
it came with xandros on it
04:30
< Thant>
USB installs wouldnt work
04:30
< Thant>
it has no cd drive
04:30
< Thant>
network installs wouldnt work
04:30
< Thant>
etc etc
04:30
< Thant>
turns out it had a hidden partition which basically fucked over any install attempts
04:31
< Alek>
I think they did that on purpose.
04:31
< Thant>
yarr
04:31
< Alek>
hmmmmm
04:31
< Alek>
I wonder if you could make, say... Crysis... into a playable Roguelike. >_>
04:32
< gnolam>
s/fucked over any install attempts/to provide an OS recovery system.
04:32
< gnolam>
Err
04:32
< gnolam>
That didn't make any sense
04:32
< gnolam>
s/which basically fucked over any install attempts/to provide an OS recovery system.
04:32
< gnolam>
was what I meant.
04:33
< gnolam>
And that one saved me quite a few times when I was tinkering with my EEE in the beginning (before I switched it to first EEEbuntu, then stock Ubuntu, then Xubuntu). :)
04:33
< gnolam>
Managed to put mine in an unbootable state within 24 hours of purchase.
04:33
< Thant>
i did that too
04:33
< Thant>
accidently fucked the MBR
04:33
< Thant>
not that the hidden partition helped any with that
04:35
<@McMartin>
Oh hey, you're still around
04:35
<@McMartin>
Let me see if I can find Sable for you
04:37
< Thant>
blame gnolam
04:37
< Thant>
he is the devil
04:38
<@McMartin>
Hrm
04:38
<@McMartin>
I'm finding Old versions.
04:39 PinkFreud [WhyNot@NetworkAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
04:39
<@McMartin>
Sweet! It's on the Wayback machine.
04:39
<@McMartin>
http://web.archive.org/web/20080312105440/http://www.stanford.edu/~mcmartin/sabl e/
04:39
< Thant>
stanford?
04:40
< Thant>
thats a total hot-shit uni isn't it?
04:40
<@McMartin>
...sure.
04:40
< Thant>
i thought it was supposed to be in the realms of like
04:40
< Thant>
havard
04:40
< Thant>
and the like
04:40
< Thant>
what do you call it
04:40
< Thant>
ivy league?
04:40
<@McMartin>
Yeah, you see that occasionally
04:40
<@McMartin>
SF Bay Area has good schools
04:41 * McMartin did his grad work there.
04:41
< Thant>
cool
04:57
< Alek>
ok, first problem.
04:58
< Alek>
the program works, but the display window closes as soon as it displays the last line. this is windows' standard behavior with console windows. I need to find the command to make it wait for a keypress before it finishes. -_-
05:00
< Alek>
:O what's Windows Azure now?
05:11
< Alek>
you know, I wonder when someone's gonna make a pseudocode language. XD
05:11
<@Vornicus>
Python,
05:15
<@Vornicus>
http://www.google.com/search?q=executable+pseudocode
05:20
< Alek>
mmm, sounds good.
05:20
< Alek>
in other news, I STILL need to use a "pause" command in my code before return 0;
05:20
< Alek>
:(
05:23
<@Derakon>
Run it from the commandline and you'll be able to see whatever errors you generate just fine.
05:25
< Alek>
yeah, I'm in VS.
05:26
<@Derakon>
VS and Windows both have commandlines.
05:26
< Alek>
it shows the build/compile errors just fine, but closes the console window before I can see the results of the run. -_-
05:26
< Alek>
and I can't be arsed to do it from commandline. XD
05:26
< Alek>
so many directories.
05:26
<@Derakon>
Right, so if you ran the program you've com...well, fuck off then.
05:27
< Alek>
lol
05:27
<@Derakon>
Sorry, but complaining about an issue you can't be arsed to fix when you know the trivial solution gets you zero respect from me.
05:27
< Alek>
sorry
05:28
< Thant>
xD
05:28
< Alek>
I just think that it'd be more trivial to insert a "pause" than to type in all the commands and paths in CLI.
05:28 * Alek shrugs.
05:29
< Alek>
my command-line days are currently far behind me. :(
05:33
< Alek>
ok, cin.get works. just can't use spacebar. XD
05:43 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?]
05:43
< zippthorne>
but.. tab completion
05:44
<@Derakon>
Windows' tab-completion sucks.
05:44
< zippthorne>
Still?
05:44
<@Derakon>
Since it will autocomplete any string to the alphabetically-first match for that string. And if it's wrong, then you get to hit tab repeatedly until it lands on the one you want.
05:45
<@Derakon>
Whereas bash will list the items that matched your string, and then you can lengthen the string to refine it, or you can hit tab to start cycling through them.
05:45
<@Derakon>
Which makes tab-completion for directory exploration much more straightforward.
05:45
<@McMartin>
... that's not what my bash does
05:45
<@McMartin>
tab goes as far as it can and then complains
05:45
<@McMartin>
Gives the list, and then waits for disambiguation
05:45
<@McMartin>
Repeated tabs just spams the list at you
05:45
<@Derakon>
Oh, you're right.
05:46
< zippthorne>
All bash does for me is bang the system bell if it's not an exact match, and *maybe* grace me with a list of options
05:46
<@McMartin>
zip: You need to hit tab twice for the list.
05:46
< Thant>
mine just pops up with what it thinks i want
05:46
<@Derakon>
I have audible alerts turned off anyway.
05:46
<@Derakon>
Maybe it was zsch that did the cycling...
05:46
< Thant>
i dont have to press shit
05:46
< Thant>
also
05:46
< Thant>
notepad++ is delicious
05:46
<@McMartin>
v. yes
05:47
<@McMartin>
It has few competitors on the Windows side.
05:47
<@Derakon>
vim and emacs~
05:47
< zippthorne>
emacs isn't a text editor
05:47
<@Derakon>
Well, point.
05:47
<@McMartin>
Windows Emacs sucks.
05:47
< zippthorne>
all emacs sucks
05:47
<@McMartin>
vim is inferior to a great many things
05:47
<@McMartin>
Emacs has the only decent haskell modes I've found
05:47
< zippthorne>
yeah, but the things that emacs is better at, so is openoffice
05:48
<@McMartin>
... Notepad is better than openoffice for everything but being a bad powerpoint
05:48
< zippthorne>
well, cat is better than all of 'em ;)
05:49
< Thant>
OpenOffice has a wordcounter and a spellchecker
05:49
< Thant>
it is the only reason i use it
05:49
< Thant>
and i only use it for essays and the like
05:49
< Thant>
oh and it exports straight to PDF
05:49
< Thant>
thats good too
05:49
<@McMartin>
Well, I'm usually on a Mac, so I can export *anything* to PDF
05:49
< Thant>
well
05:50
< Thant>
poop to you
05:50
< Thant>
:P
05:50 * Vornicus is the kind of guy that has actually used pretty much all the features of MS Word and Excel.
05:50
<@McMartin>
print-to-PDF stuff is common on Windows too
05:50 * Vornicus knows better than to call OpenOffice anything but complete shit.
05:50
<@McMartin>
I wonder if OO.o has fixed duplex/multiple copies yet
05:50
< zippthorne>
Has vornicus used excel's matrix operations for grading sheets?
05:50
<@McMartin>
Back in '08 at least, when you printed 2 copies of a 3 page document duplex, it printed the first page of the second copy on the back of the last page of the first copy.
05:51
<@Vornicus>
zippthorne: I have used Excel's matrix operations.
05:53
< zippthorne>
Well I think they work out pretty well for doing weighted averages.
05:53
<@Vornicus>
(and pretty much every other kind of operation; haven't much touched the financial stuff, but that's about it.
05:57
<@Vornicus>
On the Word side I have used such esoteric tools as conditional formatting on the way through a mail merge, and vertical-full-justified.
05:58
< zippthorne>
Ok that's pretty neat. I'd never thought to combine them
05:59
<@Vornicus>
Actually those two were in the same document - I made a Magic: the Gathering card list with all the various text in it.
05:59
<@Vornicus>
And each card's name was in the color of the card.
06:01
<@Vornicus>
It was like 3 columns or something, and I got mad because the bottoms were all ragged, so I cleaned it up using vertical-full-justified (Page Setup/Layout/Page/Vertical Alignment/Justified) so that they'd match up nicely.
06:05
<@Vornicus>
I've also used VBA to script Excel and Access, but it's not something I do much.
06:06
<@Vornicus>
Come to think of it I don't remember how I managed to convince it to keep card data together. Or, you know. /if/ I did.
06:32 Derakon is now known as Derakon[AFK]
07:48 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
08:01
< Alek>
ugh.
08:01
< Alek>
what in C++ corresponds to the old GETKEY?
08:01
< Alek>
cin.get only takes alphanumerics and ENTER.
08:02
<@Vornicus>
YOu can still use C's stdio.
08:06
< Alek>
actually, cin.get takes ANY key, but you STILL have to press enter afterwards. -_-
08:06
< Alek>
stdio... I'll have to check that, thanks.
08:08 AnnoDomini [annodomini@Nightstar-dc440d6f.adsl.tpnet.pl] has joined #code
08:08 mode/#code [+o AnnoDomini] by Reiver
08:08
< Alek>
aha, cstdio
08:08
< Alek>
and getchar
08:08
< Alek>
ty
08:09
<@Vornicus>
You may however be better off grabbing something like SDL and raiding it only for its delicious key-event meats.
08:10
< Alek>
lol
08:10 * Vornicus isn't kidding!
08:10
< Alek>
I only need a "Press any key to continue" command to end my command-window programs.
08:11
< Alek>
KISS
08:13
<@Vornicus>
well okay, if that's what you're aiming at, then SDL is a bit more than you need!
08:14
< Alek>
ok, same functionality as cin.get. it still doesn't do DICK until you press enter. -_-
08:18
<@Vornicus>
:/
08:28
<@AnnoDomini>
Get curses.
08:28
<@AnnoDomini>
Curses are good.
08:32
< Alek>
?
08:32
<@AnnoDomini>
A library.
08:37
< Alek>
in windows, visual studio?
08:37
< Alek>
doesn't look like it's standard. >_>
08:40
<@AnnoDomini>
It's not standard, but it's portable.
08:41
< Alek>
hrm.
08:41
< Alek>
and it prevents using the standard C++ IO library. -_-
08:41
< Alek>
and it's platform-dependent.
08:41
< Alek>
thanks, but no.
08:41
< Alek>
according to the sources, "Press Any Key" cannot be done right.
08:41
< Alek>
at least not in C++.
08:42
<@AnnoDomini>
Use assembly to do it. :p
08:44
< Alek>
eh, I'll just use system(
08:44
< Alek>
"PAUSE") for now.
08:47
< Alek>
night
09:28 Rhamphoryncus [rhamph@Nightstar-a62bd960.abhsia.telus.net] has quit [Client exited]
09:53 You're now known as TheWatcher
09:54 * McMartin does a full two pages of pencilwork on Euler #147.
09:54
<@McMartin>
Almost there...
09:57 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection closed]
10:18
<@McMartin>
That's the third page.
10:18
<@McMartin>
One nice thing about doing math on a pad is that the Haskell can almost be read right off it.
10:18
<@Vornicus>
Heh
10:41 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
10:51 Vornicus is now known as Vornicus-Latens
11:04
<@AnnoDomini>
AFTER COUNTLESS EXPERIMENTS, ALL RESULTS PROVE NEGATIVE!
11:05
<@AnnoDomini>
Then, I find out that parametrised statements give different output formats in PHP5 than regular mysql queries.
11:05 * AnnoDomini ATOMIC RAGE.
11:15 * McMartin continues to fail to regret not learning PHP
11:15 * McMartin solves #147.
11:15 * McMartin omgslep.
11:41
<@AnnoDomini>
Or I'm doing this completely wrong.
11:42
<@AnnoDomini>
Now that I think about it, it returns 1, which might be the number of rows returned.
12:21 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
12:34 Attilla [Attilla@FBC920.0EA685.99523D.9E28A9] has joined #code
12:34 mode/#code [+o Attilla] by Reiver
12:54 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
13:14 Alek [omegaboot@Nightstar-3ffc02c7.emhril.sbcglobal.net] has quit [Connection reset by peer]
13:17 Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has joined #code
13:20 Alek [omegaboot@Nightstar-3ffc02c7.emhril.sbcglobal.net] has joined #code
13:32 zippthorne [mike@Nightstar-289e06ac.ri.cox.net] has left #code []
14:26 ErikMesoy [Erik_Mesoy@Nightstar-15cf6c0a.bb.online.no] has joined #code
14:45 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
14:48 MyCatVerbs [mycatverbs@Nightstar-7fff4244.bb.sky.com] has joined #code
14:48 mode/#code [+o MyCatVerbs] by Reiver
15:34 Tarinaky [Tarinaky@Nightstar-a055766b.adsl.virginmedia.net] has quit [[NS] Quit: Leaving]
15:35 Tarinaky [Tarinaky@Nightstar-a055766b.adsl.virginmedia.net] has joined #code
16:20 Thant [Thant@Nightstar-63cb80a6.cable.ntl.com] has quit [Client closed the connection]
16:49
<@AnnoDomini>
Damn it.
16:49
<@AnnoDomini>
I'm trying to load up form fields with values retrieved from the database.
16:50
<@AnnoDomini>
But one field is a description in English, which means it's bound to contain apostrophes.
16:50
<@Derakon[AFK]>
This is what HTMLEncode is for.
16:50 Derakon[AFK] is now known as Derakon
16:50
<@AnnoDomini>
Somehow, after getting the data through a basic select from mysql, I'm getting everything before the first apostrophe.
16:51
<@AnnoDomini>
Derakon: Elucidate.
16:51
<@Derakon>
HTMLEncode turns, for example, "<" into "&gt;". It basically turns any potentially-dangerous character into a safe string which, when rendered by a browser, will generate the original unsafe character.
16:52
<@Derakon>
...actually, "<" is "&lt;". My bad.
16:52
<@Derakon>
So basically, you HTMLEncode everything that you put into the database.
16:53
<@Derakon>
If you're getting an incomplete string out of MySQL, then I suspect you inserted an incomplete string into MySQL.
16:53
<@Derakon>
Hrm...actually, don't use HTMLEncode to insert stuff into a database. Use proper argument binding.
16:53
<@Derakon>
I mean, you can still use HTMLEncode if you want, and it has lots of valid uses, but to solve the problem of properly handling unsafe characters in the context of MySQL, you want to be using proper binding instead of string concatenation.
16:54
<@Derakon>
Are you using PHP?
16:54
<@AnnoDomini>
Yes.
16:54
<@Derakon>
OK.
16:54
<@AnnoDomini>
But the deal here isn't inserting stuff into the database. I have parametrised queries for that, which work.
16:54
<@AnnoDomini>
I'm trying to get stuff out, which somehow manages not to work.
16:55
<@Derakon>
And you've verified that you have the complete content of the string in the DB, including the bits after the first apostrophe/
16:55
<@Derakon>
s/\//\?/
16:55
<@AnnoDomini>
Yes. It's all there.
16:55
< celticminstrel>
Um, forward slash doesn't need to be escaped...
16:55
< celticminstrel>
Oh wait.
16:55
<@Derakon>
Bahhh. I just woke up.
16:55
<@Derakon>
AnnoDomini: that doesn't sound possible to me.
16:55
< celticminstrel>
Maybe it does in the context of sed.
16:56
<@AnnoDomini>
Derakon: Me too.
16:56
<@Derakon>
I'm not aware of any situation in which doing "SELECT * FROM TableName" won't get you the entire field.
16:56
<@Derakon>
CelticMinstrel: given that I'm using '/' as a delimeter between the search and replace fields, it does need to be escaped in that context.
16:57
< celticminstrel>
I noticed that after I spoke.
16:58
<@AnnoDomini>
This is very strange. If I echo the field somewhere else, it gets out entirely.
16:58
<@AnnoDomini>
But if I put it into the... wait.
16:58
<@AnnoDomini>
I think I know what's wrong.
16:59
<@AnnoDomini>
<input blabla value='<?php echo $whatever; ?>' >
16:59
<@AnnoDomini>
It's the HTML that breaks.
16:59
<@Derakon>
Ah, yes, that's where you use HTMLEncode.
16:59
<@AnnoDomini>
It's right there in the source, even.
16:59
< celticminstrel>
I see what's wrong.
16:59
<@Derakon>
http://php.net/manual/en/function.htmlentities.php
17:00
< celticminstrel>
The apostrophe is closing the attribute value.
17:02
<@AnnoDomini>
That doesn't help.
17:03
<@AnnoDomini>
htmlentities() doesn't convert apostrophes.
17:03
<@AnnoDomini>
...at least not without any optional arguments given.
17:03
<@Derakon>
Oh wait, my bad. http://www.php.net/manual/en/function.htmlspecialchars.php
17:03
<@Derakon>
I thought the function name was off.
17:04
<@Derakon>
(See also: just woke up)
17:04
<@Derakon>
(See also also: haven't worked in PHP in about a year)
17:06
<@AnnoDomini>
That still doesn't work.
17:06
<@Derakon>
Well it should. Take a look at the source using htmlspecialchars and see how it's different and what's breaking it now.
17:08
<@AnnoDomini>
htmlspecialchars($smth, ENT_QUOTES) works.
17:09
<@Derakon>
Per the documentation, if you always use " in your HTML you should be fine...but setting ENT_QUOTES seems wise regardless.
17:11
<@AnnoDomini>
Thanks.
17:16 Kazriko [kaz@Nightstar-e09690fa.client.bresnan.net] has quit [Connection closed]
17:17
< celticminstrel>
I actually like to use ' in my HTML. It needs less Shift key.
17:18
< Tarinaky>
\o/ I got look almost working!
17:19 You're now known as TheWatcher[afk]
17:32
<@AnnoDomini>
Derakon: What's PHP's function that returns the current time?
17:35
<@AnnoDomini>
Nevermind. I think I've found it.
17:37
<@Derakon>
http://lmgtfy.com/?q=php+current+time
17:37
<@Derakon>
:)
17:38
<@Derakon>
The PHP documentation is generally pretty good and easy to Google.
17:41 Derakon is now known as Derakon[AFK]
18:04 Rhamphoryncus [rhamph@Nightstar-a62bd960.abhsia.telus.net] has joined #code
18:15 Kazriko [kaz@Nightstar-e09690fa.client.bresnan.net] has joined #code
18:15 mode/#code [+o Kazriko] by Reiver
18:36
< Alek>
lol
18:36
< Alek>
hm.
18:36
< Alek>
had a thought.
18:37
< Alek>
if you use commands specific to other OSes when compiling on your own OS, in C++, will they still compile? will they still run on those other OSes? and will they do something on your own OS, or will they be skipped?
18:38
< Alek>
also, does C++ have a way to identify what OS your code is running in?
18:38
< Alek>
got a couple thoughts regarding the "press any key" dilemma, ya see.
18:41
< gnolam>
Define "commands specific to an OS".
18:41
< Alek>
like system("PAUSE"), which is apparently Windows-specific.
18:42
< gnolam>
That will still compile.
18:42
< Alek>
if you're compiling it in Linux?
18:42
< gnolam>
Yes.
18:42
< gnolam>
system() is a standard call.
18:42
< Alek>
and will the code then run right in Linux? in Windows?
18:43
< Namegduf>
No, because it's Windows-specific.
18:43
< Namegduf>
However, that's a weird case.
18:43
< Namegduf>
The general rule is: If it's a platform specific function, it won't compile on other platforms.
18:43
< Namegduf>
In this case it's a platform specific external command, which will compile everywhere, but fail to work on other platforms.
18:44
< gnolam>
All system() does is issue the specified string as a command. It has no idea what that string means. That's the OS's job to figure out.
18:46
< gnolam>
And no, there's no function in C++ itself to determine what OS your program is running under.
18:46 Derakon[AFK] is now known as Derakon
18:46
< gnolam>
Also: remember that discussion about using system() versus actually /doing it right/? :P
18:46 MyCatVerbs [mycatverbs@Nightstar-7fff4244.bb.sky.com] has quit [Ping timeout: 121 seconds]
18:54
< Tarinaky>
In C++ is it possible to sort a list?
18:55
< gnolam>
sort()? :P
18:56
<@Derakon>
Writing your own sort routines is not too complicated, for that matter.
18:56
<@Derakon>
And it's excellent practice.
18:56
< Tarinaky>
That'd do it. What operators do I need to overload to sort a list of classes?
18:56
< Tarinaky>
Oh. Wait. Damn >.<
18:56
< Tarinaky>
Just realised. It's a list of pointers :/
18:57
< Tarinaky>
Each tile has a list of contents. When that tile is drawn the most 'important' object in that tile gets drawn.
18:57
< Tarinaky>
So I want to make sure the most important item is always on top.
18:57
<@Derakon>
You can pass a comparison function to sort, you know.
18:57
< gnolam>
http://www.cplusplus.com/reference/stl/list/sort/
18:58
< ErikMesoy>
I second the notion of writing your own sort.
18:58
< gnolam>
(BTW, when you have a question regarding std::lists and not any other kind of list, say so explicitly. Regular conversation does not use namespace std.)
18:59
< Tarinaky>
I did specify C++.
18:59
< Tarinaky>
std::list is the only list in standard C++ :p
19:00
<@Derakon>
No, it isn't.
19:00
<@Derakon>
There's an infinite number of lists in C++.
19:00
<@Derakon>
Because you can always write your own.
19:00
<@Derakon>
And in fact may well have if this was a school assignment.
19:00 You're now known as TheWatcher
19:02
< Tarinaky>
Derakon: But they're not specified by the standard.
19:02
< Tarinaky>
:x
19:02
<@Derakon>
So? You asked how to sort a list.
19:02
<@Derakon>
Nothing about standards in that question.
19:02
< Tarinaky>
Fiiiine.
19:02
< Tarinaky>
>.>
19:02
<@Derakon>
:p
19:08
< Tarinaky>
I don't understand how to use the template <class Compare> void list::sort ( Compare comp ) form. Does anyone have a specification for what compare should take and return?
19:09
<@Derakon>
"Comparison function that, taking two values of the same type than those contained in the list object, returns true if the first argument goes before the second argument in the specific order (i.e., if the first is less than the second), and false otherwise."
19:09
< Tarinaky>
Cheers.
19:09
<@Derakon>
It's right there in the documentation...
19:09
< Tarinaky>
Not the documentation I was looking at :/
19:09
<@TheWatcher>
Tarinaky: http://www.cplusplus.com/reference/stl/list/sort/
19:10
<@Derakon>
That's what Gnolam linked a few minutes back.
19:10
<@TheWatcher>
hah, I should read backscroll >.>
19:10
< Tarinaky>
Oh! It does say that.
19:10
<@Derakon>
And it's what I assumed Tarinaky was reading.
19:10
< Tarinaky>
Lawl.
19:10
< Tarinaky>
I'm a colossal idiot.
19:10
<@Derakon>
Ah. Reading comprehension++
19:15
<@AnnoDomini>
Gnar. This $stmt->prepare() is failing without a clear reason.
19:16
<@AnnoDomini>
Am I limited with the amount of parameters or something?
19:16
< ErikMesoy>
It's because you touch yourself at night.
19:18
<@Derakon>
How do you mean, "without a clear reason"?
19:18
<@Derakon>
What's the error logs say?
19:18
<@AnnoDomini>
How do I access error logs for it?
19:18
<@Derakon>
They should be in your server logs.
19:18
<@jerith>
It's PHP. You don't get error logs.
19:19
<@Derakon>
False!
19:19
<@Derakon>
On *nix, check /var/log/httpd
19:19
<@jerith>
Not useful ones, IME.
19:19
<@AnnoDomini>
Derakon: No such file or directory.
19:19
<@Derakon>
Hrmph.
19:20
<@Derakon>
Well, they should exist somewhere.
19:20
<@AnnoDomini>
I have phpmyadmin installed. Can I find logs there?
19:20
<@jerith>
/var/log/apache2/*error*?
19:22
< Alek>
actually, I meant, will the program in general work on other OSes?
19:22
<@jerith>
AnnoDomini: phpmyadmin is a web-based admin thing for MySQL.
19:22
< Alek>
and will the OS-specific command issue an error or just get skipped or what?
19:22
<@AnnoDomini>
jerith: I see lots of favicon spam.
19:22
< Alek>
and I repeat, does C++ have a way to identify what OS your code is running in?
19:22
<@Derakon>
Alek: using system() and expecting cross-platform functionality is not especially bright.
19:23
< gnolam>
[19:45] <gnolam> And no, there's no function in C++ itself to determine what OS your program is running under.
19:23
<@Derakon>
system() will return an error code when it runs, but the program won't crash outright.
19:23 * Tarinaky grumbles because it doesn't seem to be working right :/
19:23
< Alek>
Derakon: I'm just wondering if I can make a pause.h library with pause calls for all the OSes. >_>
19:23
<@Derakon>
AnnoDomini: yeah, there's lots of spam in those logs in general. grep -v will let you omit certain lines.
19:23
<@Derakon>
Alek: ...use the goddamned command line.
19:23
<@Derakon>
This is way less complicated than you're trying to make it.
19:23
<@jerith>
Alek: There are a set of mostly standard #defines you can use at compile-time, iirc.
19:23
< Alek>
lol
19:24
<@Derakon>
The problem you are trying to solve is one you have yourself created.
19:24
< Alek>
I can think of TONS more uses for the pause function, actually.
19:24
<@AnnoDomini>
Derakon: The last errors seem to be from 5 days ago.
19:24 * Alek shrugs.
19:24
< Alek>
jerith: yes?
19:24
<@Derakon>
AnnoDomini: hrm. That's odd.
19:25
<@jerith>
Alek: I don't know what they are offhand. I've seen them when reading other peoples' C/C++ code, though.
19:25
< Alek>
well, people use curses, I gather, but that means using different IO code, too.
19:25
<@jerith>
Although they might be set by autoconf or something.
19:26
< Alek>
I REALLY miss GETKEY. :(
19:38
< Tarinaky>
Cheers for the help. I think I have it working.
19:40
<@AnnoDomini>
Hmm. It's not because of null arguments. I've even fixed the missing variable. :/
19:40
< Alek>
huh.
19:41
< Alek>
how about getenv looking for system variables specific to the various OSen?
19:41
<@Derakon>
That's a pretty terrible hack.
19:41
<@AnnoDomini>
Why do you need this to be portable?
19:42
< Tarinaky>
Just use #defines.
19:42
< Tarinaky>
Compile the code for the correct OS based on those defines.
19:42
< Tarinaky>
That's the normal way of doing it :/
19:44
< Alek>
cause I'm wondering about a custom pause library, cross-platform. :P
19:44
< Tarinaky>
>.< AnnoDomini My code has more characters than yours and still does less :/
19:45
< Tarinaky>
3100 words!
19:46
< celticminstrel>
To pause, #include <ctime>, get the current time add something to it, then do a "while(curTime < destTime)" loop.
19:47
< celticminstrel>
Something like that, anyway.
19:47
<@Derakon>
...
19:47
<@Derakon>
That's a busywait loop that's basically implementing sleep() with more CPU activity.
19:47
<@Derakon>
Windows "pause" is "wait for a keystroke, then continue".
19:47
< celticminstrel>
Okay, use sleep() then.
19:47
<@Derakon>
And Alek is using it so he can see what errors his program generates before its console window closes, because he can't be arsed to run his program from the commandline.
19:47
< celticminstrel>
Oh, right. Actually, I don't think there's a way to do that with the standard library.
19:48
< celticminstrel>
Make the program write the errors to a file, then.
19:51
< Alek>
I want to see ALL the output before it closes, not just errors.
19:51
< Alek>
and I'm still at about "Hello World" level.
19:51
< Alek>
¬_¬
19:52
< celticminstrel>
I think there's a way to duplicate a stream?
19:53
< celticminstrel>
So that, for example, everything you send to standard output also goes to the file.
19:53
<@Derakon>
If you're still at the Hello, World level, why are you at all worried about cross-platform compatibility? You have more fundamental issues to busy yourself with.
19:53
< Tarinaky>
Alek: The easiest way is to wrap your program in a batch/shell script that hangs after completion :x
19:53
<@Derakon>
That's basically what he's doing.
19:54
< Tarinaky>
exec foo;read KEY
19:54
<@Derakon>
The actual easiest way is to just run the program from the commandline.
19:54
<@Derakon>
You get all your output that way, no problems, no hacks.
19:54
< Tarinaky>
I dunno. I think "exec foo;read KEY" is simpler :/
19:54
< Tarinaky>
Since you might forget~
19:55
< Tarinaky>
Actually. I think the exec breaks that.
19:55
< Tarinaky>
Oh well.
19:56
< Alek>
I'm worried about making it transferable to later programs.
19:56
< Tarinaky>
Don't be.
19:56
< Alek>
ehh.
19:56
< Tarinaky>
It's more effort to be worried about portability than to just develop for one system.
19:57
< Alek>
it's just, going to command line every time I want to build, compile, and run, when I'm writing in the GUI, is a LOT of effort.
19:57
< Tarinaky>
Alek: Then use a script as a wrapper!
19:57
< Alek>
I guess I'll just use system() for now. >_>
19:57
<@Derakon>
How is it a lot of effort?
19:57
<@Derakon>
Alt-tab to the commandline, up arrow, enter.
19:58
< Alek>
entering the commands and paths for all the different programs I'm trying? >_>
19:58
< Tarinaky>
If you think that's effort I'm writing in a GUI and running a command line debugger on an app running in a third window!
19:59
< Alek>
all right, thank you.
20:01
< Alek>
hm. it's just bugging me, that if this is how it is, I can't see how key-based control works in games. at least, not without other libraries getting involved. -_-
20:01
<@Derakon>
Answer: other libraries get involved.
20:06
< Alek>
thought as much.
20:06
< Alek>
bah.
20:07
< Tarinaky>
http://ars.userfriendly.org/cartoons/?id=20100124 << Old but it amused me.
21:16 Searh [Z@26ECB6.A4B64C.298B52.D80DA0] has joined #code
21:16 Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Client closed the connection]
21:33
< Bobsentme>
php / sql question for the room:
21:34
< Bobsentme>
The page I'm building goes through and fills in the drop downs as they appear on the page. It doesn't close the connection to the db until the last drop down is filled in.
21:34
< Bobsentme>
Is this highly insecure and ultimate a dumb move?
21:35
<@TheWatcher>
You mean as you're generating the page?
21:36
<@TheWatcher>
If so, that's the normal way to do it
21:37
< Bobsentme>
yes, as the page is generating.
21:37
< Bobsentme>
Ok, wanted to make sure it wasn't a bad practice.
21:37
<@TheWatcher>
You don't /want/ to close and reopen database connections any more than you need to as it can be an expensive operation
21:38
< Bobsentme>
Well, I was more or less thinking of one connection at the top, where it pulls the query info, and then closes the db, and THEN generates the page / drop down. But I wasn't sure if that'd work or not.
21:39 * Bobsentme is just trying to keep from building bad habits before they start.
21:39
<@TheWatcher>
Open your database connection once, usually near the start of your script, and close it just before the script exits
21:57
<@McMartin>
One problem to dodecahedrality!
21:58
< Bobsentme>
He's coding normality again, isn't he?
21:59
< Bobsentme>
(I told you not to get the word of the day calender for christmas, but Nooo, you just HAD to do it.)
21:59
<@McMartin>
(Project Euler tracks your progress with platonic solids)
21:59 Rhamphoryncus [rhamph@Nightstar-a62bd960.abhsia.telus.net] has quit [Client exited]
22:09 ErikMesoy is now known as ErikMesoy|sleep
22:21 Zedidiah [zag@Nightstar-d0088b95.or.comcast.net] has quit [Client closed the connection]
22:21 Zedidiah [zag@Nightstar-d0088b95.or.comcast.net] has joined #code
22:21 Searh [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Ping timeout: 121 seconds]
22:24 AnnoDomini [annodomini@Nightstar-dc440d6f.adsl.tpnet.pl] has quit [[NS] Quit: They're more like giant cherries...]
22:56 Bobsentme [Bobsentme@Nightstar-79f8b1cd.livnmi.sbcglobal.net] has quit [[NS] Quit: databases created by idiots aren't really databases. They're problems wrapped in enigmas, covered in stupidity.]
23:07
< Tarinaky>
So what you're saying is women are databases created by idiots?
23:14 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
23:14 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
--- Log closed Mon Jan 25 00:00:28 2010
code logs -> 2010 -> Sun, 24 Jan 2010< code.20100123.log - code.20100125.log >