code logs -> 2007 -> Wed, 07 Mar 2007< code.20070306.log - code.20070308.log >
--- Log opened Wed Mar 07 00:00:51 2007
00:02 BlueTiger [BlueTiger@Nightstar-567.natsoe.res.rr.com] has joined #Code
00:07
< BlueTiger>
Okay, quick question for someone who works with MySQL a lot: With an application like a query browser that will make a lot of transactions with a database, is it better to open the connection and close it when the application is closed, or open and close it every time a query is performed?
00:08
<@Vornicus>
Generally the former, unless you're getting close to the connection limit.
00:08 MyCatHungers is now known as MyCatVerbs
00:09
< BlueTiger>
that's what I thought, I just wanted to be sure. :D
00:31 BlueTiger [BlueTiger@Nightstar-567.natsoe.res.rr.com] has quit [Quit: ]
00:47 ReivOut is now known as Reiver
00:51 Thaqui [~Thaqui@Nightstar-25354.jetstream.xtra.co.nz] has left #code [Leaving]
01:42 Reiver is now known as ReivClass
02:05 Mahal is now known as MahalOUT
02:05 Derakon [~Derakon@Nightstar-12737.sea2.cablespeed.com] has joined #code
02:06 gnolam [Lenin@Nightstar-13557.8.5.253.se.wasadata.net] has quit [Quit: Z?]
02:12 * Derakon rips massive chunks out of his game engine.
02:13
<@Vornicus>
It did seem too big.
02:14
< Derakon>
Well, it's more that I'm turning Niobium - a fully-general 2D game engine - into a more specific program. So a great deal of code is no longer needed.
02:14
< Derakon>
Like, say, the collision detection routines.
02:14
< Derakon>
(416 lines for the Polygon class? Gone)
02:14
<@Vornicus>
aha
02:15
< Derakon>
Mostly, though, I'm moving most of the asset creation code from C++ to Lua.
02:15
< Doctor_Nick>
Does anyone have an old version of Turbo Assembler?
02:16 Vornicus is now known as Vornicus-Latens
02:16
<@Vornicus-Latens>
Why would anyone have it? And mightn't IDA do at least part of what you need?
02:18
<@ToxicFrog>
Tasm? What for?
02:18
< Doctor_Nick>
IDA does not have a dos debugger
02:18
< Doctor_Nick>
I need Turbo Debugger and turbo debugger comes with TASM
02:19
<@ToxicFrog>
...I think it does.
02:19
<@ToxicFrog>
I know it has a DOS disassembler, and ISTR using the debugging features as well when working on ss1hr.
02:19
< Doctor_Nick>
can you point me to a version that does, then?
02:20
< Doctor_Nick>
because I haven't found it in the past 4 days
02:20
<@ToxicFrog>
I was using the windows build of IDA 5, IIRC.
02:20
<@ToxicFrog>
Or possibly IDA 4.1.
02:28 MahalOUT is now known as Mahal
02:55 MyCatVerbs [~mycatownz@Nightstar-379.dsl.in-addr.zen.co.uk] has quit [Quit: Reconnecting]
02:55 MyCatVerbs [~mycatownz@Nightstar-379.dsl.in-addr.zen.co.uk] has joined #code
03:42 Mahal is now known as MahalWork
03:51
< Derakon>
Any thoughts on reading the contents of a directory from within C++?
03:51
< Derakon>
Or within Lua, for that matter.
03:52
<@ToxicFrog>
Lua does not have it in the stdlib, but it's easy to bind if you're in POSIX.
03:52
<@ToxicFrog>
If you're in windows it's somewhat less easy to bind and wholly nonportable but still doable.
03:53
<@ToxicFrog>
From inside C++, again, if you're on POSIX, the functions you want are opendir, readdir, and closedir.
03:53
< Derakon>
Bahh...I'm trying to avoid OS-specific code.
03:53
<@ToxicFrog>
There is no wholly cross-platform way of doing this.
03:53
< Derakon>
I find that mildly surprising, but oh well.
03:53
< Derakon>
opendir, readdir, and closedir, huh?
03:53
<@ToxicFrog>
Basically, opendir, readdir, and closedir, or possibly ftw depending on what you want to do, will do it on BSD, OSX and Linux at least.
03:53
<@ToxicFrog>
(ftw is totally awesome; look it up)
03:54 * Derakon snerks.
03:54
< Derakon>
You realize the normal expansion of that, don't you?
03:54
<@ToxicFrog>
On windows, it's something like FindFirstFileEX, FindNextFile, and FindClose.
03:54
<@ToxicFrog>
Which, of course, is wholly signature and semantics incompatible with any of the POSIX functions mentioned above.
03:54
<@ToxicFrog>
And yes, I do, which is why I write that as 4tw.
03:55
<@ToxicFrog>
Because ftw is and forever will be File Tree Walk.
03:55
< Derakon>
Well, my use case here is that I want to load a bunch of Lua files from a known directory. So I just need the filenames.
03:55
<@ToxicFrog>
(you give it a path and a function. It calls the function on every file and directory under path, and recursively calls itself on every subdir)
03:55
< Derakon>
Or hell, if Lua supports "load all Lua files in this directory", that'd work too.
03:56
< Derakon>
That sounds handy for compartmentalizing my plugins...
03:56
<@ToxicFrog>
Tragically, it does not. I got around this with a bash script that generated a .loader.lua file in each dir that loaded everything in it and the .loaders for all its subdirs.
03:56
<@ToxicFrog>
It would, however, not be hard to bind ftw to Lua.
03:57
< Derakon>
I'm working on bootstrap logic right now, so it's all in C++.
03:57
<@ToxicFrog>
Indeed I can probably do it in under half a hour, counting the time taken to bind the struct stat.
03:57
<@ToxicFrog>
In that case you can use ftw directly.
03:57
< Derakon>
Right.
03:57
<@ToxicFrog>
I think mingw has an implementation.
03:57
< Doctor_Nick>
*sob*
03:57
< Derakon>
I'm on a Mac. *shrug*
03:57
<@ToxicFrog>
If not, I actually have a windows implemention of ftw kicking around which you can use for the windows release.
03:57
< Derakon>
Ooh, nice.
03:57
< Derakon>
Now, uh, what library is it in? ¬.¬
03:58
<@ToxicFrog>
(which I wrote for some SGOS-related stuff, but they won't mind if you use it)
03:58
<@ToxicFrog>
...what do you mean, what library?
03:58
<@ToxicFrog>
What includes/links do you need?
03:58
< Derakon>
I can't just invoke ftw without including its library file first.
03:58
< Derakon>
Yes.
03:58
< Derakon>
s/library/header.
03:58
<@ToxicFrog>
<ftw.h>
03:58
<@ToxicFrog>
And it's in libc, no special links are needed.
03:58
< Derakon>
That would make sense.
03:58
< Derakon>
Oh, really.
03:58
<@ToxicFrog>
This is mentioned in the man page.
03:59
< Derakon>
Normally I wouldn't think that the C++ headers would do that. They tend to be as minimal as possible.
03:59
< Derakon>
E.g. "we can't put print into the standard library! What if someone's writing an elevator controller?"
04:00
<@ToxicFrog>
..
04:00
<@ToxicFrog>
You've read sections 2 and 3 of the Manual, right?
04:00
<@ToxicFrog>
libc is huge.
04:00
<@ToxicFrog>
libstdc++ is huger.
04:00
< Derakon>
I, um, think I read them. Years ago.
04:01
<@ToxicFrog>
Ok, actually, libstdc++ is smaller than I thought.
04:01
<@ToxicFrog>
It's around 2.6MB.
04:01
<@ToxicFrog>
libc is 4MB.
04:02
< Derakon>
Fun times.
04:02
<@ToxicFrog>
This is still absurdly huge compared to Lua, but in fairness it does a hell of a lot more stuff.
04:04
< Derakon>
...can something in a directory be simultaneously a file and a directory?
04:04
< Derakon>
Or can I assume that "if (!(flags & FTW_F)) return;" will limit me to just files?
04:06
<@ToxicFrog>
Correct.
04:06
< Derakon>
Okay, good.
04:06
<@ToxicFrog>
You can also look at the stat structure for more detail.
04:19
< Derakon>
error: argument of type 'int* (World::)(const char*, const stat*, int)' does not match 'int (*)(const char*, const stat*, int)'
04:19
< Derakon>
So what exactly does it mean for the asterisk to be in parentheses, then?
04:19
< Derakon>
Or did I need to make it static...?
04:21
<@ToxicFrog>
I think that just means "I cannot be arsed to be put a name here, because it's a function pointer"
04:21
<@ToxicFrog>
You're passing a method in, yes?
04:21
<@ToxicFrog>
Is it static?
04:21
< Derakon>
It wasn't.
04:21
<@ToxicFrog>
It has to be.
04:21
< Derakon>
And now I forgot the depth field.
04:22
< Derakon>
Yeah, I figured that out when I said "Or did I need to make it static...?".
04:22
<@ToxicFrog>
Using non-static member functions as function pointers requires all kinds of wackiness to make sure that this is non-null.
04:22
< Derakon>
Because of course it won't have a handle on the class that the function is declared in.
04:24
<@ToxicFrog>
Yep.
04:27 ReivClass is now known as Reiver
04:28
< Derakon>
Man, manipulating strings in C++ sucks. ¬.¬
04:29
<@ToxicFrog>
You noticed.
04:30
<@ToxicFrog>
I have actually come to the conclusion that for any reasonable string manipulation, it is easier to call out to Lua~
04:30
<@ToxicFrog>
Indeed, even when writing in C, I tend to (ab)use Lua as a general-purpose hashing and string manipulation library.
04:30
< Derakon>
Heh.
04:33
< Doctor_Nick>
Derakon: I had to make my own string class in C++
04:33
< Doctor_Nick>
THAT sucked
04:33
< Derakon>
Heh. One of the more infamous programming assignments I had in college was called "chunky strings".
04:33
< Derakon>
Basically it required you to write a string library that represented strings in "chunks", to make modifications cleaner.
04:34
< Derakon>
So you had a linked list of variably-sized strings (where each element of the list had a fixed maximum size, and expansion required creating new chunks).
04:34
< Doctor_Nick>
linked lists was my next project
04:35
< Doctor_Nick>
it only took me an hour and a half to track down all the segfaults, which was a miracle in itself
04:35
< Derakon>
Heh.
04:36
< Derakon>
Okay, what the hell is the convert-string-to-uppercase function called in C++? >.<
04:36
< Doctor_Nick>
i forget
04:36
< Derakon>
Oh, they'll see it in a bit.
04:36
< Derakon>
Er, wrong channel.
04:36
< Doctor_Nick>
i think if you just do toupper(string) it'll do an automatic type conversion
04:37
< Derakon>
world.cpp:161: error: no matching function for call to 'toupper(std::string&)'
04:37
< Derakon>
/usr/include/ctype.h:130: note: candidates are: int toupper(int)
04:37
< Doctor_Nick>
whoops
04:39
< Doctor_Nick>
here's one way to do it: http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=2896
04:40
< Derakon>
That's ridiculous.
04:40
< Doctor_Nick>
you could also do a for loop
04:41
< Derakon>
Also absurd.
04:41
< Derakon>
There should be a built-in function to handle that kind of extremely basic string manipulation.
04:41
< Derakon>
But for the moment, I will simply require filenames to end in ".lua", case-sensitive.
04:42
< MyCatVerbs>
Derakon: it's fucking C, for chrissake?
04:42
< Derakon>
Even then.
04:42
< Derakon>
Also, C++.
04:43
< MyCatVerbs>
Derakon: what in the nine Hells made you assume that anything useful would be included?
04:43
< Derakon>
In a library!
04:44
< MyCatVerbs>
{int i=0; int x = strlen(y); for (int i=0;i<x;i++) { if(isAlpha(y)) y = toUpper(y); } } // done
04:44
< MyCatVerbs>
Erk, plz kill off the redefinition of i in that. Anyway. Done.
04:44
< Derakon>
Heh.
04:44
< Doctor_Nick>
doesnt toUpper automatically check if it's an alpha?
04:51
< MyCatVerbs>
Doctor_Nick: yes. But if you knew that, WHY DIDN'T YOU JUST WRITE THE -ONE LINE- FOR LOOP YOURSELF?
04:51
< Doctor_Nick>
im lazy :D
04:53
< MyCatVerbs>
...
04:53
< MyCatVerbs>
So why in the green blazes are you using C++ in place of something that doesn't suck?
04:53
< Doctor_Nick>
he's probably force to, mang
04:53
< Derakon>
me, I need the performance.
04:53
< Derakon>
I'm working on a game.
04:54
< Derakon>
And no, this is not an assignment; it's a personal project.
04:54
< MyCatVerbs>
Derakon: oh? 3D? Oodles of AI, pathfinding and heavy physics coming out of your ears? Low-end target platform?
04:54
< Derakon>
The last.
04:55
< MyCatVerbs>
Oh, what're you writing and what're you targeting?
04:55
< Derakon>
Also, a great deal of my code was already written, in C++, by me. I don't want to reimplement it.
04:55
<@ToxicFrog>
Derakon: concerning tolower:
04:55
< Derakon>
I'm doing my own take on the Escape Velocity series, and I'm targetting as many computers as I can.
04:55
<@ToxicFrog>
There's no function to convert an entire string to lowercase.
04:56
<@ToxicFrog>
However, there is strncasecmp.
04:56
< Derakon>
...that works. ¬.¬
04:56
<@ToxicFrog>
And strcasestr.
04:56 ErikMesoy|sleep is now known as ErikMesoy
05:01
< Derakon>
Okay, great. My program now loads all Lua files in the data/scripts directory, regardless of case, allowing for scripts to be in subdirectories.
05:06
<@ToxicFrog>
Isn't ftw appropriately named?
05:10
< Derakon>
Indeed.
05:10
< Derakon>
And now, Excite Truck.
05:12
< MyCatVerbs>
Derakon: or alternatively there's Write Your Damn Programs In Something That Doesn't Suck, Then Use Map.
05:12
< MyCatVerbs>
Y'know, just, uh, puttin' that out there... >_>
05:14
< Doctor_Nick>
MyCatVerbs-kun...
05:18 Doctor_Nick is now known as drnicksleep
05:34 drnicksleep [~fdsaf@Nightstar-1992.9-67.se.res.rr.com] has quit [Ping Timeout]
05:37 ErikMesoy [~ejm@Nightstar-12501.bb.online.no] has quit [Client exited]
05:55
< Derakon>
Who's Hattoy?
05:55
< Derakon>
Er, wrong channel. ¬.¬
05:56
< MyCatVerbs>
Derakon: kun?
05:56
< MyCatVerbs>
Dammit.
05:56
< Derakon>
"Kun" is a Japanese term of endearment.
05:58 * MyCatVerbs blinks.
05:58
< MyCatVerbs>
Thank you.
06:26 Derakon is now known as Derakon[AFK]
06:40 SleepingSoldier is now known as GeekSoldier
08:49 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Quit: ]
08:54 timelady [~romana@Nightstar-1075.lns4.adl2.internode.on.net] has joined #Code
09:10 timelady [~romana@Nightstar-1075.lns4.adl2.internode.on.net] has quit [Quit: run away! run away!]
09:39 You're now known as TheWatcher[wr0k]
11:07 gnolam [Lenin@Nightstar-13557.8.5.253.se.wasadata.net] has joined #Code
11:58 Schlock [~schlock@Nightstar-6915.hsd1.or.comcast.net] has left #code []
12:17 Reiver is now known as ReivZzz
12:18 Serah [~Z@87.72.36.ns-26407] has quit [Quit: .reloc]
13:01 Serah [~Z@Nightstar-28403.proxy2.balk.dk] has joined #Code
13:11 ReivZzz is now known as ReivSLEP
13:11 Vornicus-Latens is now known as Vornicus
13:18 MahalWork is now known as Mahal
13:59 ErikMesoy [~ejm@Nightstar-12501.bb.online.no] has joined #code
14:15 ErikMesoy is now known as Erik|sixarmedchibicatboy
14:43 Serah [~Z@Nightstar-28403.proxy2.balk.dk] has quit [Connection reset by peer]
14:46 Serah [~Z@Nightstar-28403.proxy2.balk.dk] has joined #Code
15:16 Mahal is now known as MahalSLEEP
15:18 Doctor_Nick [~fdsaf@Nightstar-1992.9-67.se.res.rr.com] has joined #code
15:25
< Doctor_Nick>
come on painkillers
15:27
< AnnoDomini>
Are you even a real doctor? :P
15:30
< Doctor_Nick>
no, but that doesnt stop me from filling perscriptions
15:30
< Erik|sixarmedchibicatboy>
Crud. My laptop screen bit is making cracking noises and splitting apart on the lower right.
15:31
< Erik|sixarmedchibicatboy>
It appears to be be built in such a way that I cannot take a screwdriver and fix it.
15:31
< Erik|sixarmedchibicatboy>
The whole thing is thoroughly integrated.
15:31
< Doctor_Nick>
so six arms does not make you more dextrious?
15:32
< Erik|sixarmedchibicatboy>
The arms are irrelevant to this.
15:36
< Erik|sixarmedchibicatboy>
I think I will shut down and attempt to dismantle this.
15:36 Erik|sixarmedchibicatboy [~ejm@Nightstar-12501.bb.online.no] has quit [Client exited]
15:42
< Doctor_Nick>
goddammit
15:43
< Doctor_Nick>
when I buy $470 worth of software i expect to get it AS SOON AS POSSIBLE YOU FUCKS
15:43
<@ToxicFrog>
Digital delivery 4tw, IMO.
15:43
< Doctor_Nick>
exactly
15:43
< Doctor_Nick>
but they dont do it
15:43
<@ToxicFrog>
Eat their liver.
15:43
< Doctor_Nick>
i want to =(
15:44 * Serah dances with ToxicFrog.
15:45 * ToxicFrog dances with Serah
15:47
< MyCatVerbs>
Doctor_Nick: fava beans anna nice chianti.
15:47 * Derakon[AFK] drops by for a moment to note that, good gravy, storing data in Lua is easy.
15:49
< Doctor_Nick>
anthony hopkins isnt returning my calls :(
15:49
<@ToxicFrog>
Derakon: you noticed :P
15:50
< Derakon[AFK]>
It's like combining the convenience of plaintext with the parsability of something!
15:51
<@ToxicFrog>
Great for serialization, too. And I think I've come up with a way to make that entirely safe!
15:53
<@ToxicFrog>
And now, ka-classes.
15:53
< Derakon[AFK]>
And work.
16:16 ErikMesoy [~ejm@Nightstar-12501.bb.online.no] has joined #code
16:32
< MyCatVerbs>
Offhand, could anyone tell me whether applets in java have the ability to open TCP sockets, please?
16:37 ErikMesoy [~ejm@Nightstar-12501.bb.online.no] has quit [Quit: going to ABELKONKURRANSEN finals http://abelkonkurransen.no/indexe.php best 20 in Norway! See you all in a few days.]
16:37 AnnoDomini [~farkoff@Nightstar-29026.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
16:37
<@ToxicFrog>
MyCatVerbs: yes, but you'll have to look up the actual API.
16:37
<@ToxicFrog>
Because I don't know it.
16:39
< MyCatVerbs>
ToxicFrog: thanks, just needed to know this project wouldn't be a total waste of time. I can find reference books, so no worries.
16:43 AnnoDomini [~farkoff@Nightstar-29514.neoplus.adsl.tpnet.pl] has joined #Code
17:07 AnnoDomini [~farkoff@Nightstar-29514.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
17:11 You're now known as TheWatcher[afk]
17:20 Derakon[AFK] [~Derakon@Nightstar-12737.sea2.cablespeed.com] has quit [Connection reset by peer]
18:10
<@Vornicus>
Hokay. time to practice more PS-fu
18:29 You're now known as TheWatcher
19:04 Thaqui [~Thaqui@Nightstar-25354.jetstream.xtra.co.nz] has joined #code
19:06
<@Vornicus>
fuuuck
19:07
<@Vornicus>
TF, that foreach doesn't work, broken onto multiple lines like that.
19:12
<@Vornicus>
...though it occurs to me that the rest of my Settlers project is more likely to be using rake, being, you know, in Rails.
19:13
<@Vornicus>
MCV: Java applets can open sockets, but usual security limits them to the host the applet is from.
19:18
< Doctor_Nick>
dammit
19:18
< Doctor_Nick>
it wont let me debug this program because it doesnt have a symbol table
19:30 AnnoDomini [~farkoff@Nightstar-29514.neoplus.adsl.tpnet.pl] has joined #Code
19:44 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
19:44 mode/#code [+o Chalcedon] by ChanServ
19:56 GeekSoldier_ [Rob@Nightstar-3728.pools.arcor-ip.net] has joined #code
19:58 GeekSoldier [Rob@Nightstar-3475.pools.arcor-ip.net] has quit [Ping Timeout]
20:01 GeekSoldier_ is now known as GeekSoldier
20:01 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout]
20:02 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
20:02 mode/#code [+o Chalcedon] by ChanServ
21:45 ReivSLEP is now known as ReivClass
21:49 timelady [~romana@Nightstar-9473.lns10.adl2.internode.on.net] has joined #Code
22:18 GeekSoldier is now known as SupineSoldier
22:23 timelady [~romana@Nightstar-9473.lns10.adl2.internode.on.net] has quit [Quit: run away! run away!]
22:25 You're now known as TheWatcher[T-2]
22:25 Doctor_Nick [~fdsaf@Nightstar-1992.9-67.se.res.rr.com] has quit [Quit: ]
22:27 You're now known as TheWatcher[zZzZ]
23:09 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has quit [Ping Timeout]
23:13 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has joined #code
23:13 mode/#code [+o ToxicFrog] by ChanServ
23:13 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has quit [Client exited]
23:14 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has joined #code
23:14 mode/#code [+o ToxicFrog] by ChanServ
23:35 Thaqui [~Thaqui@Nightstar-25354.jetstream.xtra.co.nz] has quit [Quit: This computer has gone to sleep]
23:37 Thaqui [~Thaqui@Nightstar-25354.jetstream.xtra.co.nz] has joined #code
23:52 ReivClass is now known as Reiver
--- Log closed Thu Mar 08 00:00:51 2007
code logs -> 2007 -> Wed, 07 Mar 2007< code.20070306.log - code.20070308.log >