code logs -> 2011 -> Fri, 07 Oct 2011< code.20111006.log - code.20111008.log >
--- Log opened Fri Oct 07 00:00:02 2011
--- Day changed Fri Oct 07 2011
00:00 * Derakon gets a spam from someone trying to sell him CUDA stuff for Matlab. O_o
00:00
< Derakon>
That's...remarkably specific.
00:00
< Derakon>
I'm guessing they've been trawling the mailing lists I'm on? Maybe?
00:02
< Derakon>
Anyway, gotta run.
00:02 Derakon [chriswei@Nightstar-f68d7eb4.ca.comcast.net] has quit [[NS] Quit: leaving]
00:09
< celticminstrel>
So, it works; I just need to make sure that the selection hilite isn't included and then I can move on to reading an SVG file.
00:42 Attilla [Some.Dude@Nightstar-f29f718d.cable.virginmedia.com] has quit [Ping timeout: 121 seconds]
00:44 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has joined #code
00:59
< Rhamphoryncus>
ergh. #define int long long would break in so many ways x_x
01:01
< Rhamphoryncus>
Using structs for file formats is pretty nasty too. Can't actually do it in C, but people do it all the time :P
01:37
< celticminstrel>
Why can't you do it in C?
01:38
< celticminstrel>
And why would the #define break things?
01:48
<@ToxicFrog>
celticminstrel: as a rule redefining basic types is bad.
01:49
<@ToxicFrog>
That said, if your code is such that redefining int as long long actually breaks things, you should probably be using int32_t or similar instead of plain int.
01:49
<@ToxicFrog>
And you can totally use structs for on-disk formats in C, just don't store pointers in them or you are entering a world of pain.
01:50 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: ]
01:51
< Rhamphoryncus>
ToxicFrog: You can use it as a cache for a single process, but there's no formally defined format outside what that one process sees.
01:52
< celticminstrel>
(Obviously you'd need the #define to occur after any system headers though.)
01:52
<@ToxicFrog>
Rhamphoryncus: what?
01:52
< Rhamphoryncus>
If you're ever relying on padding, byte order, or whatever, you're not using C anymore. You're using an extension to C.
01:52
<@ToxicFrog>
I think we're using 'struct' and 'file format' to mean different things.
01:52
<@ToxicFrog>
Aah.
01:52
<@ToxicFrog>
Yeah, using structs for portable file formats is madness.
01:53
< Rhamphoryncus>
The only time I could imagine doing it is when there's a substantial performance benefit to mmapping the file and using it directly
01:55
<@ToxicFrog>
This is basically Every DOS Program Ever, for starters~
01:56 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code
01:56 * Rhamphoryncus mumbles about nazi
01:56
< Rhamphoryncus>
*s
01:58
< gnolam>
That would be GodWindows, not DOS.
01:59
< Rhamphoryncus>
I don't even know what the performance of mmap is on DOS. It's not even the same mmap.
02:01
<@ToxicFrog>
Does DOS even have mmap?
02:01
<@ToxicFrog>
But what I mean is, this technique is ugly but so, so convenient, and will work fine if all of the following conditions are met:
02:01
<@ToxicFrog>
- you're using C and can't or don't want to upgrade to a HLL
02:02
<@ToxicFrog>
- you're releasing binaries, not source, and (if you're releasing binaries for multiple platforms at all) binaries for different platforms won't need to share data
02:02
<@ToxicFrog>
- you don't plan to make significant changes or upgrades to the program in the future, or if you are, you don't care about preserving the old files
02:02
<@ToxicFrog>
Which used to be really common.
02:08
< Rhamphoryncus>
I guess
02:09
< Rhamphoryncus>
Most of my experience is on linux and with a fairly good understanding of what the specs actually mean. I can't fathom not putting a little bit of extra work into correct, portable code
02:09
< McMartin>
TF: DOS doesn't have mmap because DOS doesn't, per se, have processes -_-
02:10
< McMartin>
Unless you mean "mapping files", in which case, DOS tended to require hand-managing various sorts of 16-bit memory extension jackassery.
02:10
<@ToxicFrog>
Rhamphoryncus: yeah, so, first of all you're working on code that can reasonably be assumed to be cross-platform, and secondly, you have the luxury of writing code that will run on an actual OS.
02:11
<@ToxicFrog>
Neither of those hold if you're targeting DOS.
02:11
< Rhamphoryncus>
I'd do the same if I was on dos or even an embedded platform
02:12
< Rhamphoryncus>
No matter what size char is ^_^
02:12 Derakon[AFK] is now known as Derakon
02:12
< McMartin>
char is always one byte.
02:12
< McMartin>
char is not, however, always one character. -_-
02:14
< Rhamphoryncus>
How many bits is it? Hell, is it even bits?
02:17
< McMartin>
Every machine C has ever targeted has had an 8-bit byte.
02:18
< Rhamphoryncus>
bzzt, sorry, but thanks for playing :)
02:18
< McMartin>
Non-8-bit-byte machines haven't, to my knowledge, been mass-marketed since the Intellivision.
02:18
< McMartin>
Which C did not in fact target.
02:18
< McMartin>
(The PDPs don't count; they had 10-bit ROMs, but the RAM was 16-bit words.)
02:19
< Rhamphoryncus>
"mass-marketed" is the key word there. They're obscure, but they exist.
02:19
< McMartin>
The Intellivision was not obscure.
02:20
< Rhamphoryncus>
Afaik there's still such machines in production today for embedded market
02:20
< McMartin>
If you're writing C and targeting embedded, you should be targeting an ARM anyway.
02:20
< Rhamphoryncus>
http://en.wikipedia.org/wiki/36-bit is an example of a 9-bit byte
02:20
< Vornicus>
What drug addict builds computers where 8 bits is not a byte
02:20
< McMartin>
You can't address bits in C, anyway.
02:20
< McMartin>
(bitfields do not address fields, they translate to math.)
02:21
< McMartin>
In fact, on a lot of architectures, you can't sensibly address bytes.
02:21
< Rhamphoryncus>
http://stackoverflow.com/questions/2098149/what-platforms-have-something-other-t han-8-bit-char
02:22
< McMartin>
Yeah, it's pretty much safe to say that if they do that you're within your rights to blame them for running it.
02:22
< Rhamphoryncus>
McMartin: true, although there are of course bitwise ops
02:22
< McMartin>
Unless they're being retarded by saying "Win32 doesn't have an 8-bit char!"
02:22
< McMartin>
Which it doesn't, which is why you use TCHAR everywhere in Win32 code, not char.
02:22
< McMartin>
Because "char" is an 8-bit value.
02:23
< Rhamphoryncus>
My point is that it's a language variant to rely on 8-bit bytes. Which I don't mind in this case, I just keep in mind that it is a language variant.
02:23
< McMartin>
No, that's not something to keep in mind.
02:23
< McMartin>
If you're worrying about that, you're not worrying about things that actually matter.
02:24
< McMartin>
Alternately!
02:24
< McMartin>
"This is a program that takes UTF-8 input."
02:24
< McMartin>
Done.
02:24
< Rhamphoryncus>
I worry about all the fine print of C's defined/unspecified/implementation defined/undefined.
02:24
< McMartin>
UTF specifies that it gets its input as octets.
02:25
< McMartin>
Yes, and you shouldn't, because if someone needs to worry about it because it actually breaks something, porting it is their problem, not yours.
02:25
< McMartin>
Unless you have a 9-bit machine you're working on, in which case, use assembler.
02:26
< McMartin>
Worrying about whether chars are octets is an entirely different kettle of fish from worrying about whether chars are signed.
02:26
< McMartin>
The latter is something you can only rely on if you're fixing on two compilers.
02:26
< Rhamphoryncus>
this one case is not a big concern, but it helps understand the general insanity that is C types
02:26
< McMartin>
The thing is, you totally can fix on two compilers.
02:27
< McMartin>
Furthermore, if those two compilers disagree on something (C++ exception declarations, say), then you don't get to use that feature in portable code even if the standard says you can.
02:27 * Rhamphoryncus nods
02:27
< McMartin>
(Those two compilers are, of course, cl.exe and gcc)
02:29 * Rhamphoryncus ponders giving his language an octets type rather than a bytes type. (In name only. I have no intention of allowing non-8-bit bytes.)
02:29
< McMartin>
If you give a shit, define them in bit width.
02:29
< McMartin>
s8, i8, s16, u16, etc.
02:29
< McMartin>
Then have "int" be "whatever is fastest on the target platform"
02:29
< McMartin>
Lo, you have now reinvented stdint.h
02:30 Kindamoody[zZz] is now known as Kindamoody
02:30
< Rhamphoryncus>
Oh I don't mean individual integers. I mean an array type for networking and file I/O.
02:31
< gnolam>
*cough*icc*cough*
02:32
< gnolam>
(ICC == GCC /for the most part/, except when it's extremely annoying if it's not.)
02:33 gnolam [lenin@Nightstar-202a5047.priv.bahnhof.se] has quit [[NS] Quit: Z?]
02:35
< McMartin>
(This is why you don't have to fixate on icc~)
02:38
< McMartin>
Rham: Anyway, the main issue here is that you're more or less allowed to say "if you target something insanely exotic, it's up to you to make the runtime behave sensibly."
02:39
< McMartin>
A machine with 9-bit characters is going to have to have a bit-inserter inside the network driver, because the other machines out there sure as hell won't be serving up 9-bit chars, they'll be serving up UTF-8.
02:39
< McMartin>
At least if they know what's good for them.
02:39
< Rhamphoryncus>
Yes, but you have to know what insanely exotic is first. Most people stop at "it works for me".
02:39
< McMartin>
Yeah, so: x86, x64, PPC, ARM, THUMB~
02:39
< Rhamphoryncus>
(people will argue that "x[i++] = i++;" is okay.)
02:40
< McMartin>
(That's language, not machine)
02:40
< McMartin>
(That *can* be OK if you define evaluation order strictly enough)
02:40
< Rhamphoryncus>
in C :P
02:40
< McMartin>
(Which doesn't!)
02:41 * McMartin doesn't recall if Scheme guarantees left-to-right eager evaluation of arguments.
03:02
< celticminstrel>
What's icc?
03:14
< Vornicus>
http://en.wikipedia.org/wiki/Intel_C%2B%2B_Compiler
05:19
< celticminstrel>
I need to force a redraw of the window immediately so that I can eliminate the selection highlight from the output bmp.
05:19
< celticminstrel>
Is there a way to do this? Unsurprisingly, glutPostRedisplay+glFlush does notwork.
05:19
< celticminstrel>
(Technically I just need to update the buffer that glReadPixels reads from.)
05:22
< celticminstrel>
^not work
05:23
< celticminstrel>
In other news, the GLenum typedef is the worst thing ever invented.
05:23
< celticminstrel>
Or one of them.
05:25
< celticminstrel>
Maybe just call my drawing functions... why didn't I think of that...
05:26
< celticminstrel>
Yup, that worked. Feel free to ignore this monologue!
05:32
< celticminstrel>
Oddly, the bmp output is much darker than the original. No idea why that is, so I'll probably just have to leave it.
05:38 Janus [NSwebIRC@Nightstar-f1b7ad82.res.rr.com] has joined #code
05:38 kwsn is now known as kw-slee-n
05:45 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
06:04 celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has quit [Connection closed]
06:26 Derakon is now known as Derakon[AFK]
06:57 Vash [Vash@Nightstar-f03c5637.sd.cox.net] has joined #code
07:15
< Janus>
okay. World generation. Putting that on the Hard list
07:17
< Janus>
Also one of my pals convinced me to drop the minecraft clone. All it took was 5 back to back videos of clones already in progress, d'oh.
07:17 * Vornicus patpats
07:17
< Vornicus>
It might not be a good, you know
07:17
< Janus>
At least it's only 2 weeks of code going down the drain
07:17
< Vornicus>
marketable idea
07:17
< Vornicus>
But I bet you learned a lot.
07:18
< Janus>
Yeah, I suppose!
07:21
< Janus>
I'm going back to the 2D ... ecosystem thingy I think I showed you eons ago. Not sure how I'm gonna make it into a 'game' though
07:26
< Janus>
And yes. Whenever I told anyone about it, it always had this air of "... but let me explain how it's different please" bleck
07:38
< Vornicus>
heh
08:02 AnnoDomini [annodomini@60F158.737D66.CA1918.CC7562] has joined #code
08:14
< Janus>
I got. Um. Something so far. Something tells me if I understood basic math, this would be easier. http://goo.gl/yiz79
08:16
< Vornicus>
That....
08:17
< Vornicus>
Okay that appears to be a quairandom walk with curvature dependent on distance from the center.
08:17
< Janus>
... that is exactly what it is. You're good! xD
08:18
< Vornicus>
Not knowing what you're aiming at I can't really give much advice.
08:20
< Janus>
Um! Well, I guess I'm after uh. That line is supposed to represent the beginning surface. I think after that, I can have tunnels be wormed through out it, and do erosion stuff. I want it to sorta be like a discworld thing. Where the mountains are in the middle, with plains around it maybe
08:21
< Janus>
There will be a space turtle and some elephants under it.
08:22
< Janus>
Most of the stuff I know now though, is for height maps. Which wouldn't make very interesting terrain
08:24 * Janus has no idea how to mathimatically convey it though. What you seen was just me sticking a bunch of random/sin functions together until it stopped not working
08:24 Vash [Vash@Nightstar-f03c5637.sd.cox.net] has quit [[NS] Quit: I <3Lovecraft<3 Vorn!]
08:25
< Vornicus>
Hm...
08:29 * Janus looks at a terraria map. ... f-for reference!
08:30
< Vornicus>
Okay got a different one for you
08:30
< Vornicus>
Quasirandom walk
08:31
< Vornicus>
next slope is limited by two things: 1. a maximum slope based on distance from edge
08:31
< Vornicus>
2. a curvature limit.
08:32
< Vornicus>
Has a weakness: your curvature limit means you can't get pointy bits.
08:34
< Janus>
Hmmm... *tries to do that*
08:35
< Vornicus>
Hm. Maximum angle might be better, max it out at about 100deg and you'll have yourself the possibility of some really awesome cliffies
08:37
< Vornicus>
Oh oh oh. Small chance - higher towards the center - that you get a sudden turn towards sanity.
08:38
< Janus>
How's this? http://goo.gl/Fp77V
08:39
< Vornicus>
THat has potential. What the crap is going on at that point about 40% along?
08:39
< Janus>
Beats me. So far all of them have had something pha--er... something weird jutting out like that
08:40
< AnnoDomini>
Looks like one of those rock formations in America I once saw in a western.
08:40
< Vornicus>
Yeah, it's a hoodoo all right
08:41
< Vornicus>
But was this my method or something?
08:43
< Janus>
Yeah, I put a limitation on the slope max, and also put a limit on the maximum angle to 1.1 to -1.1 radians
08:44
< Vornicus>
Maximum angle here is the curvature?
08:45
< Janus>
Yeah. I'm imposin' a bunch of them back to back to see if any of them turn out strange
08:49
< Janus>
http://dl.dropbox.com/u/3108480/abunchofnonsense.png
08:49 * Vornicus wonders if it's possible to impose a limit on the maximum change in curvature without busting the slope demands.
08:50
< Vornicus>
Oh, very nice.
08:51
< Janus>
I've looked at the terraria maps though, and I've noticed it's almost always a straight heightmap
08:51
< AnnoDomini>
Are you doing this on a plotter?
08:52
< Janus>
The only points where it's not, are pretty isolated. Maybe it's doing the 'whole digging' as a seperate step, even for the surface.
08:52
< Janus>
Oh, nono! I'm just putting red pixels at every vertice in the graph
08:53
< Vornicus>
Caves are generally done in this by building random graphs
08:53
< Vornicus>
Der had some interesting work in that field
08:55
< Janus>
Would they be the same as the random walking thing? Though, without the bias to go right of course. Maybe with a random width and length too
08:55
< AnnoDomini>
Janus: The labels look handwritten.
08:56
< Janus>
Yeah, it's easier to just draw it with my tablet than mess with photoshops text thingy
08:56
< Vornicus>
Janus -- it wouldn't have any of the characteristics of a random walk, no.
08:58
< Janus>
Oh, who's Der, by the way?
08:58
< Vornicus>
Derakon
08:58
< Janus>
Oh! ... duh.
09:03
< Janus>
It seems to get more and more unstable the longer it goes on though, it seems.
09:04 * Janus tacked a zero to how long the graph needs to progress
09:04
< McMartin>
Heh
09:04
< McMartin>
When in doubt, multiply by ten~
09:06
< Vornicus>
Make your angle condition scalefree
09:06
< Vornicus>
So the amount of distance you get off a single segment is in direct proportion to the amount of angle you can get off it.
09:07
< AnnoDomini>
Janus: Put it on a logarithmic scale! :V
09:13
< Janus>
Oh, that's much better! ... it'll take some, um, processing before I can show. I increased it 100 times. And. The graph I made sucks, so it had to be 102400 pixels wide too
09:27
< Janus>
... I'm gonna make some tea
09:28 * Janus accidently photoshop. It's now throwing an error box every second that it's out of memory. It will do this 200 more times, because that's how many frames there are, and it doesn't know when to give in
09:29
< Janus>
... oh nevermind, it stopped at 180/200 and crashed. Well. Just take my word for it, it works. :[
09:30
< Janus>
Also, instead of proximity to the edge, I replaced it with biome stuff, so it gets jaggy and plainy based on that instead
09:30 Kindamoody is now known as Kindamoody|out
09:31 Attilla [Some.Dude@Nightstar-f29f718d.cable.virginmedia.com] has joined #code
09:31
< Janus>
Whoohoo! That's down then, for now! Now I can do caves!
09:33
< Janus>
And... after that. ... um. Figure out how to fill it in with rigid bodies. That will be, uh, fun.
09:34 gnolam [lenin@Nightstar-025a7b1e.dialup.ice.net] has joined #code
09:39 * Vornicus wants to seeeeeeeeee
09:41 AnnoDomini [annodomini@60F158.737D66.CA1918.CC7562] has quit [[NS] Quit: leaving]
09:50
< gnolam>
Vornicus: been binging on wood alcohol?
09:54
< Vornicus>
...whut
09:57 Vornicus is now known as Vornicus-Latens
10:00
< Janus>
There we go, finally! http://dl.dropbox.com/u/3108480/SurfaceScanTestHuge.gif
10:02
< Vornicus-Latens>
glory
10:05
< Janus>
Thanks! Got more done tonight than I would've ever thouzzz
10:06 Janus [NSwebIRC@Nightstar-f1b7ad82.res.rr.com] has quit [[NS] Quit: zzz]
10:06 AnnoDomini [annodomini@FFB3F3.4C5BE8.2014E2.DC0864] has joined #code
10:18
< gnolam>
Yay, the revised version actually works on the radiotherapy computers as well. \o/
10:48 Phox [Phox@Nightstar-3e5deec3.gv.shawcable.net] has joined #code
10:49 Fantastic_Phox [Phox@Nightstar-3e5deec3.gv.shawcable.net] has quit [Ping timeout: 121 seconds]
10:50
< gnolam>
Phox: shouldn't that be "Phantastic"? ;)
11:18 kw-slee-n is now known as kwsn
11:58 AnnoDomini [annodomini@FFB3F3.4C5BE8.2014E2.DC0864] has quit [[NS] Quit: Away!]
12:28 Rhamphoryncus [rhamph@Nightstar-14eb6405.abhsia.telus.net] has quit [Client exited]
12:41
< Tarinaky>
Okay. Stupid question. What's a 'plain association' (in the context of aggregation and composition)?
12:42
< Tarinaky>
This book doesn't seem to say.
13:06 gnolam [lenin@Nightstar-025a7b1e.dialup.ice.net] has quit [[NS] Quit: Je suis arrivé]
13:15
< TheWatcher>
Tarinaky: association is "Foo uses Bar", or "Foo is related to Bar", it's the least specific way of talking about the interaction of two objects
13:18 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has joined #code
15:12 You're now known as TheWatcher[afk]
16:38 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has quit [[NS] Quit: If the world didn't suck, we'd all fall off.]
16:57 Derakon [chriswei@Nightstar-f68d7eb4.ca.comcast.net] has joined #code
16:58
< Derakon>
So I added these two files to my project and now atcore.h (a third party library) is throwing syntax errors at me. I'm guessing I screwed something up. Any ideas? http://pastebin.com/TDTNG02x
17:07
< Derakon>
I guess it'd help to show atcore.h too. Here; first error is on line 12 with the AT_WC identifier. http://pastebin.com/xxHMt0nm
17:13
< Derakon>
...okay, that's weird. Replacing memhandler.h with nothingness and memhandler.c with just "#include "atcore.h"" still gets me the compile errors. What the heck.
17:20
< Tarinaky>
Why does the recommended book on UML for my course recommend using 'plain association' instead of Aggregation and Composition?
17:21
< Tarinaky>
Surely being more specific when you have the power to do so is a good thing... otherwise you'd never be specific.
17:34
<@ToxicFrog>
Derakon: what's the actual error?
18:02 Stalker [Z@Nightstar-5aa18eaf.balk.dk] has joined #code
18:11
< Derakon>
TF: "syntax error : identifier 'AT_WC'"
18:22 Stalker [Z@Nightstar-5aa18eaf.balk.dk] has quit [Client closed the connection]
18:22 Stalker [Z@Nightstar-5aa18eaf.balk.dk] has joined #code
18:25
<@ToxicFrog>
o.O
18:25
<@ToxicFrog>
What compiler?
18:26
< Derakon>
VS2008's nmake.
18:42
< Derakon>
...okay, that's a novel error. "cp: /Volumes/Users/Public/Documents/neo-dev/test.bat: Cannot allocate memory"
18:42
< Derakon>
(Trying to copy files off of a fileshare)
18:45
< Derakon>
Also really irritating, since I'm trying to get the updated files into my local Mercurial repo.
18:51
< Derakon>
And now I've somehow broken the fileshare entirely so I can't even mount the external drive.
18:51
< Derakon>
Fuck.
19:22 Kindamoody|out is now known as Kindamoody
19:22 * Derakon fixes the AT_WC identifier error via "#include "wchar.h"" before including atcore.h. WTF.
19:23
< Derakon>
I'm still getting "syntax error : 'string'" elsewhere in atcore.h though, which is weird because there aren't any strings!
19:23
< Derakon>
Just character arrays!
19:23
< Tamber>
But... that is a string...
19:30
< Derakon>
No, it's a wchar_t*.
19:30
< Derakon>
A string is a std::string.
19:30
< Derakon>
Or a Boost string or something.
19:30
< Derakon>
I.e. something actually sensible for handling text data.
19:33
< Tamber>
Welcome to C; a string is a char*
19:33
< Tamber>
:)
19:33
< Tamber>
Please deposit your sanity in the basket by the door. =p
19:34
< Derakon>
Allow me to quote from a GameDev.net sig: "If you are asking a question and your code contains "char*" then you have a bug. std::string roxxors the big one one one."
19:35
< Tamber>
Aheh.
19:35
< Tamber>
If you're using C++, maybe.
19:37
< Tamber>
If your header files have .h on them, most likely you're dealing with C (I believe the .h ext. was deprecated for C++); in which case, a string may also be an array of characters.
19:38
< Tamber>
In which case, the sig is completely and utterly irrelevant. :)
19:39
< Derakon>
That still does nothing to explain why the compiler is giving "syntax error : 'string'" when "string" doesn't appear in the file.
19:39
< Tamber>
I didn't say it did. =p
19:39
< Derakon>
So basically you'd rather snark than be useful. :P
19:39
< Tamber>
...wait, hang on.
19:39
< Tamber>
You're running C code through a C++ compiler?
19:39
< Tamber>
Is 'string' a reserved word?
19:40
< Derakon>
It'd better not be.
19:40
< Derakon>
As I said earlier, it's "std::string".
19:40
< Tamber>
Hum.
19:40 * Tamber shrugs. Doesn't use C++.
19:41
< Tamber>
But, anyway~
19:44
< Tamber>
Hmmm. So 'string' doesn't appear anywhere in atcore.h? Does it tell you where this syntax error occurs?
19:44
< Derakon>
Yes, on line 75. http://pastebin.com/xxHMt0nm
19:45
< Derakon>
(And "String" does occur, but even if you replace all instances of it with other words the same errors occur)
19:45
< Tamber>
*headscratch*
19:58 You're now known as TheWatcher
20:11
< TheWatcher>
Dera: ... maybe it's complaining about the "C", in the 'extern "C" __devlspec(dllexport)' it's replacing AT_EXP_MOD with... although I have no idea why it should, as VS2008 should allow that
20:23 Kindamoody is now known as Kindamoody[zZz]
20:34
< Derakon>
TW: removing the "extern "C"" allows compilation to complete, but will it work...
20:36
< kwsn>
guilty pleasures: finding ways to reduce how much code is used yet still doing the exact same functionality
21:03
< TheWatcher>
Derakon: ...
21:03
< TheWatcher>
I think my only response to that can be "Bwuh"
21:15 SchoolPhox [ccae3c5f@Nightstar-ef290c21.mibbit.com] has joined #code
21:15
< SchoolPhox>
So, riddle me this. I've got a matlab program, and part of it involves filling an array inside a for loop.
21:16
< SchoolPhox>
I'm told that if I initialize the array outside the for loop, then populate it inside, this cuts down on the computational overhead
21:17
< SchoolPhox>
That's compared against each iteration, adding another column to my matrix
21:17
< SchoolPhox>
Does matlab burn clock cycles when it has to redefine matrices?
21:17
< Tamber>
Could it involve reallocating memory every time?
21:18
< SchoolPhox>
Dunno. That's kind of what I'm asking.
21:18
< SchoolPhox>
Are Matlab matrices conticuous blocks of data?
21:18
< SchoolPhox>
*contiguous
21:19
< Derakon>
If it wants to be remotely efficient, then it'll be allocating the array as a single contiguous block, yes.
21:20
< Derakon>
This should be the kind of thing you can easily test, though. Just do 10k iterations of "allocate an entire array" vs. 10k iterations of "allocate array one column at a time".
21:20
< Derakon>
And time it and see which one's faster.
21:20
< SchoolPhox>
Ah, yeah, I suppose I could
21:20 * SchoolPhox goes to write a quick script for that kind of thing
21:21
< SchoolPhox>
Does Matlab feature some kind of timer or clock cycle counter?
21:22
< Derakon>
Ah ha, fixed my compilations problems by changing the filename from memhandler.c to memhandler.cxx.
21:22
< Derakon>
Go go magic filename-based behaviors!
21:24 SchoolPhox [ccae3c5f@Nightstar-ef290c21.mibbit.com] has quit [[NS] Quit: http://www.mibbit.com ajax IRC Client]
21:27 SchoolPhox_ [ccae3c5f@Nightstar-4fab16c5.mibbit.com] has joined #code
21:27
< SchoolPhox_>
10K was too small, so I went bigger
21:27
< SchoolPhox_>
Too big, I guess, because I locked up the machine
21:27 Stalker [Z@Nightstar-5aa18eaf.balk.dk] has quit [[NS] Quit: If the world didn't suck, we'd all fall off.]
21:27 SchoolPhox_ is now known as SchoolPhox
21:27
< Derakon>
Heh. Well done.
21:27
< Derakon>
You should probably free the array between each iteration. :)
21:27
< SchoolPhox>
Isn't there an emergency bailout button in Matlab?
21:28
< SchoolPhox>
I thought I remember hearing something about it
21:28
< SchoolPhox>
Nah, this was just testing the time with a pre-initialized array
21:28 * SchoolPhox deletes some of those trailing zeros
21:28
< SchoolPhox>
.... 1 billion
21:28
< SchoolPhox>
That's what I used. oops
21:28
< Derakon>
Careful with those orders of magnitude.
21:31
< Derakon>
Now I just have to figure out why the SWIG wrapper for my custom mini-library isn't finding the functions in it...
21:32 SchoolPhox [ccae3c5f@Nightstar-4fab16c5.mibbit.com] has quit [[NS] Quit: http://www.mibbit.com ajax IRC Client]
21:38 SchoolPhox_ [ccae3c5f@Nightstar-36f67fd0.mibbit.com] has joined #code
21:39
< SchoolPhox_>
Yus, verified. I don't really want to time it, but we're talking less than a second at 100K, versus 10 seconds~~ without a pre-initialized matrix
21:40
< Derakon>
:)
21:40
< SchoolPhox_>
It only required 3 crashes, too.
21:40
< Derakon>
Heh.
21:41
< SchoolPhox_>
I think I asked about a bailout button, but I crashed before I saw a response
21:41
< SchoolPhox_>
Is there one?
21:41
< Derakon>
You did, and I don't know.
21:41
< Derakon>
I try to avoid using Matlab if I can.
21:41
< SchoolPhox_>
Oh yeah? What do you use?
21:41
< Derakon>
Python.
21:42
< SchoolPhox_>
Ah. I've been looking at Sage a bit. It's supposed to be good, but I haven't had the time to start playing with hit
21:42
< SchoolPhox_>
*it
21:42 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
21:42 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
21:43 * Derakon looks it up.
21:43
< Derakon>
Heh, built on Python.
21:44
< SchoolPhox_>
I wouldn't doubt it. Python does it well, and I think Sage incorporates existing stuff when it can
21:47
< Derakon>
There's an extensive community dedicated to reimplementing Matlab in Python, more or less.
21:47
< Derakon>
It'd be silly to ignore them.
22:09 kwsn is now known as kw|GO_BREWERS
22:14
< Derakon>
Woo, now I'm calling the API successfully!
22:14
< Derakon>
And getting error codes back!
22:15
< Tamber>
Progress!
22:16
< SchoolPhox_>
You know, only in programming is an error a good thing
22:18
< Derakon>
It's the right kind of error!
22:18
< Tamber>
It is when it means you're getting to the point that it's /talking/ to you. =p
22:18
< Derakon>
As opposed to the one where the system is all "what the heck you aren't even speaking comprehensibly let alone making sense"
22:21 Rhamphoryncus [rhamph@Nightstar-14eb6405.abhsia.telus.net] has joined #code
22:24 SchoolPhox_ [ccae3c5f@Nightstar-36f67fd0.mibbit.com] has quit [[NS] Quit: http://www.mibbit.com ajax IRC Client]
22:33 * Derakon :wtc:s at his code.
22:33
< Derakon>
My "walk the API through its paces" program works fine. The program that actually tries to use the API is getting errors out, despite AFAICT doing exactly the same things.
22:33
< Derakon>
So clearly I'm missing something somewher.
22:33
< Derakon>
Er, somewhere.
23:21
< Derakon>
Ah. Strange.
23:21
< Derakon>
The first time I call this function, the string I pass along isn't null-terminated. The second time, it is.
23:21
< Derakon>
I'm calling it exactly the same way -- I just made the same call twice in a row.
23:23
< Derakon>
...because I'm operating with an old version of this file from before I fixed the null-termination issue. Good job Derakon.
23:23
< McMartin>
A mystery is solved
23:38
< Derakon>
Hey hey hey! Got a "timed out" error instead of the usual type! \o/
23:43
< Tamber>
\o/
23:53
< Derakon>
Ugh, initialization of this library can take anywhere from 3 to 30 seconds, even when done successfully.
--- Log closed Sat Oct 08 00:00:13 2011
code logs -> 2011 -> Fri, 07 Oct 2011< code.20111006.log - code.20111008.log >

[ Latest log file ]