code logs -> 2014 -> Fri, 14 Mar 2014< code.20140313.log - code.20140315.log >
--- Log opened Fri Mar 14 00:00:22 2014
00:33 Turaiel[Offline] is now known as Turaiel
00:38 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
00:38 mode/#code [+qo Vornicus Vornicus] by ChanServ
00:39 gnolam_ [lenin@Nightstar-d469ie.cust.bredbandsbolaget.se] has joined #code
00:39 gnolam [lenin@Nightstar-d469ie.cust.bredbandsbolaget.se] has quit [NickServ (RECOVER command used by gnolam_)]
00:39 gnolam_ is now known as gnolam
00:39 mode/#code [+o gnolam] by ChanServ
00:40 Azash [ap@Nightstar-25v57p.net] has quit [Operation timed out]
00:40 Azash [ap@Nightstar-25v57p.net] has joined #code
00:40 mode/#code [+o Azash] by ChanServ
00:40 simon__ [simon@Nightstar-2og823.pronoia.dk] has joined #code
00:40 simon_ [simon@Nightstar-2og823.pronoia.dk] has quit [Connection reset by peer]
00:40 Shiz [mark@Nightstar-3hueb6.shiz.me] has quit [Operation timed out]
00:41 Shiz [mark@Nightstar-3hueb6.shiz.me] has joined #code
00:42 Tamber [tamber@furryhelix.co.uk] has quit [Connection closed]
00:47 Tamber [tamber@furryhelix.co.uk] has joined #code
00:47 mode/#code [+o Tamber] by ChanServ
00:52 Thalasleep is now known as Thalass
01:09 Thalass is now known as Thalass_Kerman
02:32 VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has quit [[NS] Quit: Program Shutting down]
03:11 macdjord|afk is now known as macdjord
03:46 Kindamoody[zZz] is now known as Kindamoody
04:02 Derakon is now known as Derakon[AFK]
04:36 celticminstrel [celticminst@Nightstar-mhtogh.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
04:49 Harlow [harlow@Nightstar-9hnfdm.il.comcast.net] has joined #code
05:33 AverageJoe [evil1@Nightstar-fb1kt4.ph.cox.net] has joined #code
05:41 mac [macdjord@Nightstar-c0i1dq.cable.rogers.com] has joined #code
05:41 mode/#code [+o mac] by ChanServ
05:41 FurryHelix [tamber@furryhelix.co.uk] has joined #code
05:41 Vornotron [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
05:41 Netsplit *.net <-> *.split quits: Typherix, @Syloq, HearingEarDog, @Derakon[AFK], @froztbyte, @Orthia, @Vornicus, @macdjord, @Thalass_Kerman, Xon, (+10 more, use /NETSPLIT to show all of them)
05:42 Netsplit over, joins: JustBob
05:42 mode/#code [+o JustBob] by ChanServ
05:42
< Harlow>
why doe stat happen mcmartin?
05:43
< Harlow>
why does* that* happen.
05:44 ^Xires [xires@Nightstar-bir6q3.feedthetrolls.net] has joined #code
05:45 Xon [Xon@Nightstar-j72.ku7.252.119.IP] has joined #code
05:45 thalass [thalass@Nightstar-bk3u2d.bigpond.net.au] has joined #code
05:45 mode/#code [+o thalass] by ChanServ
05:45 simon [simon@Nightstar-2og823.pronoia.dk] has joined #code
05:45 froztbyte [froztbyte@Nightstar-frrora.za.net] has joined #code
05:45 mode/#code [+o froztbyte] by ChanServ
05:45 Namegduf [namegduf@Nightstar-lcgn9d.beshir.org] has joined #code
05:45 mode/#code [+o Namegduf] by ChanServ
05:46 HearingEarDog [abudhabi@Nightstar-7nkq9k.de] has joined #code
05:47 Orthia [orthianz@Nightstar-ufscb0.callplus.net.nz] has joined #code
05:47 mode/#code [+o Orthia] by ChanServ
05:48 Syloq [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
05:48 mode/#code [+o Syloq] by ChanServ
05:48
< Vornotron>
Apparently both the logs and I missed what Harlow is responding to
05:50 Turaiel [Brandon@Nightstar-vku52k.resnet.mtu.edu] has joined #code
05:50 Typherix [Typherix@Nightstar-n91qrf.lnngmi.sbcglobal.net] has joined #code
05:50 Derakon [Derakon@Nightstar-5fqf0m.ca.comcast.net] has joined #code
05:50 mode/#code [+ao Derakon Derakon] by ChanServ
05:53 ToxicFrog [ToxicFrog@ServerAdministrator.Nightstar.Net] has joined #code
05:53 mode/#code [+ao ToxicFrog ToxicFrog] by ChanServ
05:53 Kindamoody|autojoin [Kindamoody@Nightstar-180u8i.tbcn.telia.com] has joined #code
05:53 mode/#code [+o Kindamoody|autojoin] by ChanServ
05:53 AverageJoe [evil1@Nightstar-fb1kt4.ph.cox.net] has joined #code
05:53 Tarinaky [tarinaky@Nightstar-e99cts.net] has joined #code
05:53 mode/#code [+o Tarinaky] by ChanServ
05:54 Thalass_Kerman [thalass@Nightstar-bk3u2d.bigpond.net.au] has joined #code
05:56
< Shiz>
same
05:57
<&McMartin>
The last thing I said in channel was some time ago, about Gmail making consistently top-posted email threads easier to read
05:57
<&McMartin>
And it does it by autotrimming common suffixes within a thread.
05:59 Harlow [harlow@Nightstar-9hnfdm.il.comcast.net] has quit [Connection closed]
05:59 Harlow [harlow@Nightstar-9hnfdm.il.comcast.net] has joined #code
06:00
< Shiz>
i usually top-post when replying to emails
06:00
< Shiz>
am i hitler now
06:02
<&McMartin>
No; Gmail has deHitlered you.
06:02
<&McMartin>
IT'S THE AMAZING DEHITLERIZATION DEVICE
06:02
<&McMartin>
IN THE FUTURE, EVERYONE WILL BE HITLER FOR FIFTEEN MINUTES
06:02
<&McMartin>
BUT WITH THIS, WE CAN ENSURE IT IS ONLY FIFTEEN
06:03
<&McMartin>
"In the future everyone will be hitler for 15 minutes" -> "About 11,100 result"
06:04
< Vornotron>
so wait does that mean that everyone kills about 29 jews?
06:04
<&McMartin>
Depends on which 15 minutes, I suppose. You might be spending it invading Poland.
06:06
< Vornotron>
Oh, well.
06:13
< Shiz>
i use maila.pp though
06:13 Vornotron is now known as Vornicus
06:13 mode/#code [+qo Vornicus Vornicus] by ChanServ
06:15 himi [fow035@Nightstar-q9amk4.ffp.csiro.au] has quit [Ping timeout: 121 seconds]
06:48 RichyB [RichyB@Nightstar-c6u.vd5.170.83.IP] has quit [[NS] Quit: Gone.]
06:51 RichyB [RichyB@Nightstar-c6u.vd5.170.83.IP] has joined #code
06:56 AverageJoe [evil1@Nightstar-fb1kt4.ph.cox.net] has quit [[NS] Quit: Leaving]
07:08 FurryHelix is now known as Tamber
07:08 mode/#code [+o Tamber] by ChanServ
07:10 Harlow [harlow@Nightstar-9hnfdm.il.comcast.net] has quit [[NS] Quit: Leaving]
07:23 Erik [8f610223@Nightstar-obfcgl.mibbit.com] has joined #code
07:23 Thalass_Kerman [thalass@Nightstar-bk3u2d.bigpond.net.au] has quit [[NS] Quit: Leaving]
07:36 thalass_ [thalass@Nightstar-bk3u2d.bigpond.net.au] has joined #code
07:59 Red_Queen [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code
07:59 mode/#code [+o Red_Queen] by ChanServ
08:02 Turaiel is now known as Turaiel[Offline]
08:30 mac is now known as macdjord|slep
08:42 himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code
08:43 mode/#code [+o himi] by ChanServ
09:14 thalass_ is now known as Thalass_kerman
09:29 thalass [thalass@Nightstar-bk3u2d.bigpond.net.au] has quit [Ping timeout: 121 seconds]
09:44 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed]
10:08 mode/#code [+o RichyB] by ChanServ
10:09 Thalass_kerman is now known as Thalass
10:09 mode/#code [+o Thalass] by ChanServ
10:18
< HearingEarDog>
What's a good source to learn about FreeBSD? Preferably quickly?
10:31 Thalass is now known as Thalass|mmmovie
10:44 Kindamoody|autojoin is now known as Kindamoody
10:49 * TheWatcher vaguely ponders a crazy notion
10:51
<@TheWatcher>
take the contents of a project's .git/objects/[0-9a-f]{2}/ directories in date order, then use the characters in the filenames to dynamically generate content in a vertically scrolling shmup
10:52
<@TheWatcher>
Shoot your way through your commit history
11:06 Syka [the@Nightstar-v1o.172.131.1.IP] has joined #code
11:06 mode/#code [+o Syka] by ChanServ
11:34 Kindamoody is now known as Kindamoody|out
12:01 Syka [the@Nightstar-v1o.172.131.1.IP] has quit [Ping timeout: 121 seconds]
13:07 Turaiel[Offline] [Brandon@Nightstar-vku52k.resnet.mtu.edu] has quit [Ping timeout: 121 seconds]
13:08 Turaiel[Offline] [Brandon@Nightstar-vku52k.resnet.mtu.edu] has joined #code
13:09 ErikMesoy [Erik@Nightstar-6v0.mal.203.80.IP] has quit [Ping timeout: 121 seconds]
13:10 ErikMesoy [Erik@Nightstar-t5i7tl.80-203-18.nextgentel.com] has joined #code
13:11 ErikMesoy1 [Erik@Nightstar-6v0.mal.203.80.IP] has joined #code
--- Log closed Fri Mar 14 13:14:42 2014
--- Log opened Fri Mar 14 13:19:10 2014
13:19 TheWatcher [chris@Nightstar-ksqup0.co.uk] has joined #code
13:19 Irssi: #code: Total of 36 nicks [19 ops, 0 halfops, 0 voices, 17 normal]
13:19 mode/#code [+o TheWatcher] by ChanServ
13:19 Irssi: Join to #code was synced in 36 secs
13:20 Reiver [quassel@Nightstar-ksqup0.co.uk] has joined #code
13:20 mode/#code [+ao Reiver Reiver] by ChanServ
13:39 Thalass|mmmovie is now known as Thalass
13:57 Thalass is now known as Thalass|portal
14:07 Thalass|portal is now known as Thalaway
14:08
<&ToxicFrog>
New Mickens: https://www.usenix.org/system/files/1403_02-08_mickens.pdf
14:12
<&ToxicFrog>
"Here's what I leanred: never specify whether your tags should be static or floating. As soon as a single tag is released from the automatic layout process, the browser will immediately go insane."
14:16
< Erik>
that's like the third repost this week, maybe it belongs in topic?
14:16
< Erik>
Or maybe a link to the archive.
14:25
< simon>
here's a problem I heard: from a set of stocks, pick a subset (portfolio) that minimizes risk. twist: each stock comes from a country, and for the chosen subset, X% must come from country A, Y% must come from country B and Z% must come from country C. that is: the distribution constraint adds to the complexity of the problem, but I'm not sure how much.
14:25
< simon>
can anyone recommend an algorithmic approach that isn't meta-heuristics?
14:26
< simon>
it occurs to me that it might be too complex for dynamic programming.
14:26
< simon>
I'd probably want to try and look for small subsets with a low risk that live up to the country constraint and then try to build on those.
14:27
< simon>
(this isn't school-related - a friend's friend has this task at work, and she's apparently clueless about programming. yet I thought it was hard enough to be interesting.)
14:27
<&ToxicFrog>
Um
14:28
<&ToxicFrog>
How tight are the origin constraints?
14:28
< simon>
good question. I don't know.
14:28
< simon>
let's say it's +/- some percentage.
14:28
<&ToxicFrog>
Because it feels like the answer is, figure out the lowest number of stocks such that all the constraints are satisfiable, then pick the N lowest-risk stocks from those countries.
14:29
< simon>
ah yes
14:29
< simon>
I guess that's a pretty clear strategy.
14:29
<&ToxicFrog>
Like, if XYZ are 20 20 60, you need 5 stocks; get the single lowest-risk stocks from A and B and the three lowest-risk stocks from C.
14:29
<&ToxicFrog>
No need for anything fancy.
14:31
< Erik>
Agreed. From the superficial description, it sounds like the X% from country A just splits the problem into three subproblems of minimizing risk in each country
14:31
< Erik>
Where it might get complicated is if "risk" is calculated by distribution of stocks across types and types vary by country, meaning there's no such thing as low risk A stock by itself, only a low risk portfolio
14:31
< simon>
right. one would probably not want two seemingly unrelated stocks that happen to historically even each other out.
14:32
< simon>
hmm, right.
14:33
< Erik>
Do you have details on how "minimize risk" is supposed to be done?
14:33
<@TheWatcher>
to a long-lost friend." ahahahaha
14:33
< simon>
no. it was passed by word-of-mouth thrice ;)
14:34
< Erik>
ha
14:34
<@TheWatcher>
gah, stupid copy
14:34
< Erik>
Deja vu.
14:34
< Erik>
I swear we had the copy-from-PDF issue recently.
14:35
<@TheWatcher>
"Note that understanding the eighth error requires a Quija board, the eye of a newt, and the whispering of a secret to a long-lost friend." - all the more amusing because I'm currently dealing with bizarre javascript errors
14:38
<&ToxicFrog>
What a coincidence, so am I.
14:50 Thalaway is now known as Thalass
14:50 Thalass is now known as Thalasleep
14:50
<@Azash>
The question is, is anyone not?
14:58 ErikMesoy1 is now known as ErikMesoy
14:58 mode/#code [+o ErikMesoy] by ChanServ
15:10 * froztbyte isn't
15:10 * ErikMesoy isn't
15:15
<@RichyB>
Azash, I'm not! I'm currently worrying about an endianness issue of all things⦠in a body of Python code.
15:15
<@Azash>
Nice
15:15 * Azash finds the most hidden backend class that everything uses, notes that everything is done with raw SQL rather than activerecord, ffffffs
15:16
<@froztbyte>
RichyB: ahahahaha
15:16
<@froztbyte>
RichyB: tell me a story.
15:20 Derakon_ [Derakon@Nightstar-5fqf0m.ca.comcast.net] has joined #code
15:22 Derakon [Derakon@Nightstar-5fqf0m.ca.comcast.net] has quit [Ping timeout: 121 seconds]
15:23
<@RichyB>
It's a piece of code that's meant to store event records into levelDB and then play back ranges of events when asked for them. It's supposed to do this with range queries which, like all BerkelyDB clones, levelDB supports.
15:24
<@RichyB>
Thing is, like all BerkeleyDB clones, levelDB only supports bytestring keys and values. The values are not a problem here. The keys are 64-bit integers with a timestamp packed into the upper bits.
15:25
<@RichyB>
On the face of it, this should work quite well. You can walk any range of serialized keys inside levelDB, and that's equivalent to walking the same range of timestamps.
15:26
<@RichyB>
Small problem: the person who wrote this wrote, "key = struct.pack('Q', event_id)"
15:26
<@RichyB>
that⦠doesn't specify an endianness (stupidly). To make it even more fun, on i386 and amd64 (where this code runs), it defaults to little-endian.
15:26
<@RichyB>
So⦠the keys are all serialized to bytes in exactly the wrong order.
15:27
<@RichyB>
froztbyte, ^there's your story.
15:28
<@froztbyte>
hahahaaaa
15:28
<@froztbyte>
so lemme guess
15:29
<@froztbyte>
trying to find a way to fix this without rebuilding the whole keyspace? :)
15:36 himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds]
15:43
<@RichyB>
Nah, no way. I can fix it by just suspending access to the archived stuff for a while.
15:43
<@RichyB>
Take the broken thing down, move its archive out of the way, put a version with big-endian ints up.
15:44
<@RichyB>
Then I can rebuild the keyspace, stop the service, merge the rebuild keyspace with the temporary one, then start it again on the merged keyspace.
15:44
<@RichyB>
It's not awfully much data.
15:47
<@froztbyte>
ah
15:47
<@froztbyte>
k
15:59
<&ToxicFrog>
(morning standup)
15:59
<&ToxicFrog>
<me> EHD, Snapper, and Expos have been purged of unrighteousness.
15:59
<&ToxicFrog>
<boss> I hope that's the wording you're using in the weekly status report.
15:59
<@froztbyte>
haha
16:05
< HearingEarDog>
Dafuq. I install a new graphics card, and the box won't boot on grounds of the chipset heat sink not being connected.
16:15
< HearingEarDog>
OK. It was a clip not conducting electricity.
17:09
< HearingEarDog>
What the crap, Win7?
17:09 Derakon [chriswei@Nightstar-5fqf0m.ca.comcast.net] has joined #code
17:09 mode/#code [+ao Derakon Derakon] by ChanServ
17:10
< HearingEarDog>
Trying to install a driver not as administrator yields BSOD. No warnings, no nothing. BSOD.
17:10
< HearingEarDog>
And I have to specifically run the correct exec as admin, because running the thing that runs the setup won't do.
17:15
<&Derakon>
Whee writing C++ code again.
17:15
<&Derakon>
Handling datastructures the hard way! Ever so much fun.
17:16
<&Derakon>
...though I guess there's no real requirement to use an int** just because I'm handling multiple arrays of bits. Go go STL!
17:29 macdjord|slep [macdjord@Nightstar-c0i1dq.cable.rogers.com] has quit [Connection closed]
17:30 macdjord|slep [macdjord@Nightstar-c0i1dq.cable.rogers.com] has joined #code
17:30 mode/#code [+o macdjord|slep] by ChanServ
17:41
<&Derakon>
Hm. If I want to load an 800x600 of 4-byte ints from a binary ifstream object...
17:41
<&Derakon>
Currently I'm doing this:
17:41
<&Derakon>
ifstream handle(filename, ios::in | ios::binary);
17:41
<&Derakon>
int* buffer = (int*) malloc(800 * 600 * sizeof(int));
17:41
<&Derakon>
handle.read((char*) buffer, 800 * 600 * sizeof(int));
17:42
<&Derakon>
This appears to be causing a hang.
17:42
<&Derakon>
The file is 938KB and thus has plenty of space for that much data...
17:44
<&Derakon>
800 * 600 * 4 / 8 / 1024 / 1024 = .22MB per buffer.
17:45
<&Derakon>
Oh wait, shouldn't be multiplying by sizeof(int) in the read.
17:46
<&Derakon>
...still hangs though.
17:48
< [R]>
... malloc in C++...
17:50
<&Derakon>
What would you rather I use for manipulating bit buffers?
17:53 * Derakon durs, excises references to ints, gets something that runs, albeit incorrectly.
17:58
<&Derakon>
...okay, now I'm getting a crash when I call the push_back method on the vector I'm storing the buffers in.
17:59
<&Derakon>
http://pastebin.com/mwpV9b93
18:00
<&Derakon>
I'm getting up to buffer 6 (i.e. the 7th of 8 buffers), and getting output like this, very consistently:
18:00
<&Derakon>
Loading buffer 6
18:00
<&Derakon>
Allocated buffer
18:00
<&Derakon>
Read complete
18:00
<&Derakon>
Not done yet!
18:00
<&Derakon>
And then it crashes.
18:04
<&Derakon>
(Consequently, it appears to work fine if I load fewer than 7 buffers...)
18:06
<&Derakon>
Bleh. Gonna go eat lunch and come back to this later.
18:30
<&Derakon>
Right. It blows up even if I exclude the call to handle.read() (and thus am just infinitely mallocing buffers and pushing them onto a vector).
18:31
<&Derakon>
Reducing the buffer size doesn't change things.
18:32
<&ToxicFrog>
$ git5 diff --stat
18:32
<&ToxicFrog>
31 files changed, 258 insertions(+), 1222 deletions(-)
18:32
<&ToxicFrog>
:getin:
18:32
<&Derakon>
Heh. Nice.
18:32 * Derakon glares at his code.
18:32
<&Derakon>
Why can't I have more than 7 elements in this vector?
18:33
<&Derakon>
Er, 6.
18:34
<&ToxicFrog>
Do you have a full stack trace?
18:34 Vorntastic [Vorn@Nightstar-8ctg9t.sd.cox.net] has joined #code
18:35
<&Derakon>
I am...not especially familiar with Visual Studio.
18:35
< Vorntastic>
So I've been trying out sublime text for the past week or so. It just... okay, live highlighting of search results, where have you been all my life.
18:37
<&Derakon>
If I run in debug mode, then the program reads buffers from the file indefinitely; it never hits EOF.
18:41 * Derakon adds try/catch; evidently there's no exception occuring; the program just explodes.
18:43
< Shiz>
I didn't realisre git was at version 5.x nw
18:47 * Derakon googles for "vector push_back crash", finds a bunch of people fucking up memory allocation in various ways.
18:48
<&Derakon>
I don't think I'm screwing up my memory usage...
18:48
<&Derakon>
At least, I can't see how this could cause trouble:
18:48
<&Derakon>
char* curBuffer = (char*) malloc(numBytes);
18:48
<&Derakon>
handle.read(curBuffer, numBytes);
18:48
<&Derakon>
bufList.push_back(curBuffer);
18:49
<&ToxicFrog>
Shiz: it's not; git5 is a wrapper that provides stuff like integration with our code review tools.
18:50 macdjord|slep is now known as macdjord
18:50
<&ToxicFrog>
Derakon: run it in valgrind? Usually, "crashes in release builds but not in debug" means you're doing something unsafe, but in debug mode the memory layout and/or optimization strategy changes in such a way that it doesn't obviously break.
18:51
<&ToxicFrog>
I note that intermixing malloc and new is discouraged, but I don't think it's actually unsafe.
18:51
<&Derakon>
No idea how to use valgrind, and I don't really have the time to learn, alas.
18:51 * Derakon is composing a message for StackOverflow now.
18:51
<&Derakon>
(Only have 3 days to tidy up my work here)
18:52
<&Derakon>
There are no calls to new in this code.
18:53
<&ToxicFrog>
It's just 'valgrind <program> <args>', basically. This does assume you have a linux build you can test, though.
18:53
<&ToxicFrog>
Where does bufList come from?
18:53
<&Derakon>
Ha, no, I don't.
18:53
<&Derakon>
bufList is declared, globally, at the top of the file.
18:54
<&Derakon>
(I'm working with a set of libraries that are not only undocumented, but that a prior developer had to reverse engineer including doing stuff like string dumps, just to figure out what the function names and arguments are)
18:55
<&Derakon>
Here's the complete program: http://pastebin.com/hKK8xSBX
18:55
<&Derakon>
Well, except that I removed the definition of ReadRectangleFromFile, since it's not being called in this version.
18:57
<&Derakon>
I suppose one possible explanation is that the library has fucked something up.
19:01
<&ToxicFrog>
That's entirely possible. One of the nice things about C/++ is that an error in any part of your program can manifest as a totally unrelated crash later :D
19:01
<&Derakon>
Posted on StackOverflow: https://stackoverflow.com/questions/22413589/stl-vector-crash-on-push-back
19:04
<&Derakon>
For the time being, I'm going to pretend this isn't happening and just not generate files with more than 6 buffers.
19:09
<&McMartin>
Derakon: For the record, calling your buffer vector a buffer list makes me sad
19:09
<&McMartin>
... try making it a std::list, see if it still crashes >_>
19:09
<&McMartin>
... alternately, also try naming the vector's capacity() in your iteration
19:10
< Shiz>
doesn't C++ have a data type for bit vectors
19:10
<&McMartin>
std::vector<bool>
19:10
<&McMartin>
Does not play well with ifstream
19:10
< Shiz>
that's most definitely not what I meant
19:11
<&McMartin>
Are you sure?
19:11
< Shiz>
yes
19:11
<&McMartin>
It's specified in the standard as being implemented in a bit-packed format.
19:11
< Shiz>
interesting, but I recall an entirely seperate data type
19:11
<&McMartin>
OK
19:11
< Shiz>
I'd google for it if my internet was any better than 28.8kb/s dialup atm
19:11
<&McMartin>
It doesn't come to mind~
19:12
<&McMartin>
cplusplus.com/reference is pretty solid
19:12
<&McMartin>
bitset?
19:12
< Shiz>
http://www.cplusplus.com/reference/bitset/bitset
19:12
< Shiz>
yeah
19:12
<&McMartin>
Yeah, this is for, like, sets of option flags
19:13
<&Derakon>
McM: "'list': is not a member of 'std'" O_o
19:13
<&McMartin>
You do have to #include <list>
19:14
<&Derakon>
Ah. Weird that vector is available automatically.
19:14
<&McMartin>
No it's not
19:14
< Shiz>
^
19:14
<&McMartin>
You have to #include <vector>. One of your dependencies already is.
19:14
< Shiz>
if it is, it got implicitly included somewhere
19:14
< Shiz>
(relying on implicit includes is a Bad Thing(tm))
19:14
<&McMartin>
Anyway, vector only occasionally allocates memory; list does so every time
19:14
<&McMartin>
Maybe it will fail faster
19:15
<&McMartin>
(vector is a contiguous array that occasionally gets reallocated to be bigger)
19:15
< Shiz>
and list is a linked list
19:15
<&Derakon>
Ha, it didn't break in Release.
19:15
< Shiz>
i presume
19:15
<&McMartin>
(capacity() is the amount it can hold before a reallocation is necessary)
19:15
< Shiz>
doubly-linked probably
19:15
<&McMartin>
list is generally a doubly-linked list, yeah; the standard gives performance guarantees consistent with that.
19:15
<&McMartin>
(In particular, you don't get to do random access on one)
19:16
< Shiz>
well, you do, but you'll suffer
19:16
<&McMartin>
What I mean is, no operator[] like vector
19:17
<&Derakon>
Yeah, I had to rework the code that actually reads from the list a bit.
19:18
<&McMartin>
Also, re: "what should I use that isn't malloc?" new and delete[].
19:18
<&McMartin>
the [] in delete[] is important when new-ing arrays.
19:18
< Shiz>
is it?
19:18
< Shiz>
i think i read somewhere it mostly doesn't matter anymore
19:19
< Shiz>
with a modern STL
19:19
<&McMartin>
I don't mean STL
19:19
< Shiz>
er, modern runtime
19:19
<&McMartin>
I mean char *x = new char[100];
19:19
< Shiz>
rather
19:19
<&McMartin>
That would be nice, but you don't get to rely on that
19:20 Vornlicious [Vorn@Nightstar-8ctg9t.sd.cox.net] has joined #code
19:20 Vorntastic [Vorn@Nightstar-8ctg9t.sd.cox.net] has quit [Connection reset by peer]
19:20 Vornlicious [Vorn@Nightstar-8ctg9t.sd.cox.net] has quit [[NS] Quit: Bye]
19:21 Vorntastic [Vorn@Nightstar-8ctg9t.sd.cox.net] has joined #code
19:21 Vorntastic [Vorn@Nightstar-8ctg9t.sd.cox.net] has quit [Connection closed]
19:21
<&McMartin>
(He mentioned Visual Studio; he *definitely* doesn't get to as AFAIK all extant MSVSes are C++98)
19:21 Vorntastic [Vorn@Nightstar-8ctg9t.sd.cox.net] has joined #code
19:22
< Shiz>
VS has been targeting C++03 since 2005
19:22
< Shiz>
...
19:22
<&McMartin>
Er, yeah
19:22
<&McMartin>
What I mean is, C++11 and friends are on the roadmap but I think not done yet even in MSVS13
19:23
<&McMartin>
Sorry, brainfart on year of relevant standard~
19:23
< Shiz>
yeah
19:23
< Shiz>
I don't think any compiler fully implements C++11 yet
19:24
<&McMartin>
It wouldn't surprise me if C++11 dropped delete[].
19:24
<&McMartin>
But I don't know that it does
19:24
< Shiz>
apparently clang almost fully supports it
19:24
< Shiz>
almost
19:24
< Shiz>
http://clang.llvm.org/cxx_status.html
19:24
<&Derakon>
I remain worried that it works with std::list but not std::vector...
19:24
<&Derakon>
But oh well!
19:25
<&McMartin>
Derakon: Yes, that is concerning
19:26
<&McMartin>
The "dump capacity() on the vector" case is worth trying
19:26
<&McMartin>
Also you should leave a comment in the code saying "this explodes for reasons I don't understand argh" so next year the person looking at the code doesn't have to work this out on their own
19:26
<&Derakon>
Yep.
19:26
<&Derakon>
Already did that.
19:26
<&McMartin>
Good, good
19:28
<&McMartin>
You might also want to make while (TRUE) be while (handle.good())
19:28
<&McMartin>
(Also, the C++ keywords are 'true' and 'false'; TRUE and FALSE are Windows #defines)
19:28
<&Derakon>
Righto.
19:28
<&Derakon>
I have not worked in C++ in ages.
19:28 * McMartin nods
19:28
<&McMartin>
Other than that nothing jumps out as instantly fatal
19:28
< Shiz>
alternatively, TRUE and FALSE are PHP-isms
19:28
< Shiz>
:P
19:29
<&McMartin>
C was doing it way before PHP was
19:29
<&McMartin>
Or rather, C programmers were. C has no boolean type
19:29
< Shiz>
but it does
19:29
< Shiz>
#include <stdbool.h>
19:29
< Shiz>
which has the _Bool type
19:30
< Shiz>
(aliased to bool for convenience)
19:30
<&McMartin>
[mcmartin@iodine ~]$ less /usr/include/stdbool.h
19:30
<&McMartin>
/usr/include/stdbool.h: No such file or directory
19:30
<&Derakon>
Right, now I get to implement the input side of this project.
19:30
<&Derakon>
(The entire goal here is to get timewise dithering of a B&W image)
19:30
< Shiz>
then your implementation doesn't implement C99, McMartin
19:31
< Shiz>
mark@rhenium:~$ less /usr/lib/gcc/x86_64-linux-gnu/4.8.2/include/stdbool.h
19:31
< Shiz>
/* Copyright (C) 1998-2013 Free Software Foundation, Inc.
19:32
<&McMartin>
It doesn't by default, no.
19:32
<&McMartin>
Though I am running the same version of gcc you are.
19:32
< Shiz>
gcc --std=c99
19:32
< Shiz>
etc
19:33
< Shiz>
it will work ust fine
19:33
<&McMartin>
Yes, you have to say "--std=c99"
19:33
<&McMartin>
Most C code out there is C89 with // comments, IME
19:33
< Shiz>
just like you have to say --std=c++11 to get <threads>
19:33
< Shiz>
that doesn't mean C++ has no threads
19:33
< Shiz>
:P
19:33 macdjord [macdjord@Nightstar-c0i1dq.cable.rogers.com] has quit [[NS] Quit: "Too long have night and day warred, their false dichotomy plaguing this land. No more. I come now to put them both down, to usher in a new era of balance and peace. For now is the time of... /Twilight/. *And the Dusk shall Reign Eternal.*"]
19:33
< Shiz>
i also disagree
19:33
< Shiz>
mixed code/data is very common
19:33
< Shiz>
and a C99-ism too
19:34
<&McMartin>
"that doesn't mean C++ has no threads"
19:34
<&McMartin>
It means "C++ has threads, but you don't get to use them if you want your code to actually run in the customer's environment"
19:34
< Shiz>
only if you are unfortunate enough to work with legacy systems
19:34
< Shiz>
(I am not)
19:34
<&McMartin>
Well bully for you
19:35
< Shiz>
also
19:35
< Shiz>
C99 has been a standard for 15 years now
19:35
<&McMartin>
Programming does indeed get much easier when "works on my machine" means "ship it"
19:35
<&McMartin>
It has. It is still not widely preferred, ANAICT.
19:35
<&McMartin>
It's no Python 3, but it's also no Python 2.
19:35
< Shiz>
well, it's not fully implemented anywhere
19:36
< Shiz>
however, every major compiler out there has had stdbool.h for ages
19:36
<&McMartin>
I think the key is more "it's not actually *default* anywhere"
19:37
< Shiz>
well I'd hope you control at least *some* part of the build process when shipping a library
19:37
< Shiz>
like, which compiler flags get used
19:37
< Shiz>
even more so when shipping an application
19:44 Harlow [harlow@Nightstar-9hnfdm.il.comcast.net] has joined #code
19:54 * Derakon eyes StackOverflow.
19:54
<&Derakon>
Four responses; two of them are bitching at me for using malloc/free, one is suggesting that casting a size_t to a signed int might be problematic, and the fourth asks if I've tried compiling with debug symbols.
19:54
< Shiz>
it's almost like you asked your question in ##c++
19:56
<&McMartin>
I forget in MSVS if sizeof(size_t) is 8 or 4.
19:56
<&Derakon>
Regardless, a type error in a print statement seems unlikely to cause crashes.
19:56
< Shiz>
4
19:56
<&Derakon>
Especially since that print statement was added after the crashes started~
19:59 Kindamoody|out is now known as Kindamoody
20:02
<&Derakon>
(Oh, and one of them said I should be using a vector<char> to hold my bitfield)
20:05
<&McMartin>
Checking ifstream::read I don't see any unusual semantic wobbles
20:06
<&McMartin>
Unlike fread() it does seem to guarantee that the only thing that will cause a short read is an actual eof.
20:07 Vornlicious [Vorn@Nightstar-t5oper.sub-70-211-11.myvzw.com] has joined #code
20:10 Vorntastic [Vorn@Nightstar-8ctg9t.sd.cox.net] has quit [Ping timeout: 121 seconds]
20:19 Vorntastic [Vorn@Nightstar-7skpnk.sub-70-211-15.myvzw.com] has joined #code
20:21 Vornlicious [Vorn@Nightstar-t5oper.sub-70-211-11.myvzw.com] has quit [Ping timeout: 121 seconds]
20:26 Turaiel[Offline] is now known as Turaiel
20:28 * Derakon mutters at Windows' shitty console windows.
20:28
<&Derakon>
Default to an unresizable 80-character-wide width and a tiny history.
20:40
<&Derakon>
Bleh. The code seems to work, except it's not setting the right pattern on the DMD.
20:40
<&Derakon>
(DMD = digital mirror device, an array of micromirrors)
20:42
<&Derakon>
Oh, and sometimes it crashes when I change the pattern midflight. Hooray.
20:46 himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code
20:46 mode/#code [+o himi] by ChanServ
20:49
<&Derakon>
Argh. Okay. The way this works, and I don't really have the resources to completely rework it, is that we write the buffer to file from one process, then another process monitors the write-time of that file, and when it changes, the changes get read.
20:49
<&Derakon>
I've set up a loop so it waits until the write time of the file stops changing before trying to read it, and I threw in an extra 500ms wait at the end, but it still sometimes crashes.
20:51
<&McMartin>
Mmm, whole-wheat carnitas burrito.
20:51
<&McMartin>
Late lunch is late but large
20:53
<&Derakon>
Stupid file writes. Why can't you be atomic?
20:53
<&Derakon>
I guess I could use another file as an ad-hoc lock on accessing the first file...yeck!
20:54
<@Namegduf>
THere's a way to request an exclusive file handle, isn't there?
20:54
<@Namegduf>
You could just have it try to read, if blocked wait, try again, if blocked wait...
20:54 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
20:54 mode/#code [+qo Vornicus Vornicus] by ChanServ
20:54
<@Namegduf>
If you could do that.
20:54
<@Namegduf>
In the writing process.
20:54 Vorntastic [Vorn@Nightstar-7skpnk.sub-70-211-15.myvzw.com] has quit [[NS] Quit: Bye]
20:55
<@Namegduf>
I mean, writing process gets exclusive handle, reading process does the spinlock with snooze button.
20:55
<&Derakon>
Okay, so process A needs to be able to open the file, write some content to it, and close it.
20:55
<&Derakon>
Meanwhile process B is constantly asking "Has the file changed? Has the file changed?" and if it has, then it wants to open the file, read it, close it.
20:55
<@Namegduf>
Yep.
20:55 VirusJTG [VirusJTG@Nightstar-6i5vf7.sta.comporium.net] has joined #code
20:56
<@Namegduf>
So process A does its thing as the simple way but asks for concurrent read attempts to be blocked.
20:56
<@Namegduf>
Process B handles this by snoozing and trying again in a bit.
20:56 * Derakon looks up how CreateFile works again...
20:57
<@Namegduf>
If this is Windows, LockFileEx seems to be one of the things which gets you such a lock.
20:57
<&Derakon>
Mm. Actually, looks like I need to set up the exclusion on the Python side when I open the file for writing.
20:57
<@Namegduf>
There might be a flag you can give to CreateFile or one of its variants for one, though.
20:57
<@Namegduf>
Ah, yes.
20:58
<@Namegduf>
I found http://code.activestate.com/recipes/65203/ but if you're Windows-specific you might be able to just use the win32file package or something?
20:59
<&Derakon>
If I knew what to look for, yeah.
21:00
<&McMartin>
Always the trick
21:01
<&McMartin>
But yes, now that you mention it, this is one of the few places where Windows's infuriating file semantics are actually directly beneficial for your problem, since you can lock a file down so hard it can't even be read by others, even though you're only opening for reading
21:01 Kindamoody is now known as Kindamoody[zZz]
21:02 * Derakon blarghs.
21:02
<&Derakon>
This is all taking way too long.
21:02
<&Derakon>
http://docs.python.org/2/library/msvcrt.html
21:02
<&Derakon>
The "locking" function there is weird.
21:02
<&Derakon>
How do you lock part of a file?
21:02
<&Derakon>
I want to lock the entire thing!
21:02
<@Namegduf>
That's disturbing.
21:03
<@Namegduf>
And sounds kind of perverse.
21:03
<&McMartin>
Because a "file" is just a chunk of memory you mmap, right
21:03
<&Derakon>
Wut
21:03
<&McMartin>
So why not lock it in pieces
21:03
<&McMartin>
There's nothing particularly perverse about it
21:04
<&McMartin>
If you want to lock the whole thing, the Win32 thing to do is to not set any SHARE_* flags when opening it with CreateFileEx.
21:04
<&Derakon>
Remember: write from Python, read from C++.
21:04
<&McMartin>
The other bit is "you lock part of a file the same way you lock parts of memory"
21:05
<&Derakon>
Can I set that up so read fails while write is happening?
21:05
<&Derakon>
I mean, I can see in C++ the FILE_SHARE_* properties, but the docs say those apply to subsequent attempts to read/write after CreateFile is called.
21:06
<&McMartin>
If you mean "if a write is in progress, can I make attempts to open for reading fail", then absolutely
21:06
<&McMartin>
If you mean "can I make a write start and retroactively make reads fail", maybe but that sounds hard
21:06
<&McMartin>
And racy
21:06
<&Derakon>
No, let's assume that the latter isn't an issue.
21:06
<&Derakon>
Since it can only happen if the users click really fast.
21:06
<&McMartin>
I think you're better off having an open-for-read making open-for-write fail too.
21:07
<&Derakon>
The problem there being that CreateFile gets called before the loop starts since I need the handle to pass to GetFileTime.
21:07
<&Derakon>
Hang on...
21:07
<&McMartin>
waitasec
21:07
<&Derakon>
http://pastebin.com/nzWhrvj3
21:07
<&Derakon>
That's the C++ code that does the reading.
21:08
<&McMartin>
"You cannot request a sharing mode that conflicts with the access mode that is specified in an existing request that has an open handle. CreateFile would fail and the GetLastError function would return ERROR_SHARING_VIOLATION."
21:08
<&McMartin>
I think this means that if you CreateFile with dwShareMode as 0, it fails if someone else has it open already for any reason
21:08
<&Derakon>
Right, so, the thing is that the Python side doesn't set any restrictions on access to the file, AFAICT, and I don't know how to do so.
21:08
<&Derakon>
Hm...
21:08
<&McMartin>
I'm saying I think it doesn't need to
21:08
<&McMartin>
As long as C++ says MINE, ALL MINE, ALL MINE (all mine)
21:08
<&Derakon>
Lemme give that a shot then.
21:09
<&McMartin>
then whoever opens it first means the other can't.
21:09 Harlow [harlow@Nightstar-9hnfdm.il.comcast.net] has quit [[NS] Quit: Leaving]
21:10
<&Derakon>
Oh right, I remember the problem with that.
21:10
<&Derakon>
It meant that the Python side would never be able to update the file.
21:10
<&Derakon>
Since it's continually open to check if it's been changed!
21:10
<&McMartin>
Oh, does C++ never drop the...
21:11
<&Derakon>
Because I need to open a fucking handle just to get the modification time.
21:11
<&McMartin>
Is this XP or 7?
21:11
<&Derakon>
7.
21:12
<&McMartin>
OK, two possible solutions
21:12
<&McMartin>
(a) there's a FILE_READ_ATTRIBUTES permission you can ask for specifically instead of GENERIC_READ. I don't know how that interacts with sharing.
21:12
<&McMartin>
(b) You can tell a directory to notify you when a file inside it changes
21:12
<&McMartin>
But I've only done the latter in C#
21:13
<&Derakon>
Wouldn't the latter give me updates before the file is done being written?
21:13
<&Derakon>
I can't file MSDN docs on FILE_READ_ATTRIBUTES, bizarrely.
21:13
<&McMartin>
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364417%28v=vs.85%29.as px
21:13
<&McMartin>
It's hiding, one moment
21:14
<&McMartin>
http://msdn.microsoft.com/en-us/library/windows/desktop/gg258116%28v=vs.85%29.as px
21:14
<&McMartin>
This is a link or two deep from the CreateFile docs
21:14 macdjord [macdjord@Nightstar-c0i1dq.cable.rogers.com] has joined #code
21:14 mode/#code [+o macdjord] by ChanServ
21:14
<&Derakon>
Ultimately I'm not sure this will help though, since the problem is that while Python is writing the file, C++ is still free to read it.
21:15
<&Derakon>
We need the read to fail, not the write.
21:15
<&McMartin>
I'm *almost* positive that if Python is mid-write, then telling C++ to open it under exclusion will fail.
21:15
<&McMartin>
But let me check one of the Python extensions to see if it's better about this
21:15
<&Derakon>
"Under exclusion"?
21:15
<&McMartin>
There's one we use here
21:15
<&McMartin>
"Open this file with no sharing" + "someone is writing this file right now" = "No handle for you"
21:16
<&Derakon>
Right, so how do we achieve that without locking Python out of writing to the file?
21:16
<&Derakon>
(thanks for all the help, BTW)
21:17
<&McMartin>
We use http://sourceforge.net/projects/pywin32/ for our Python->win32 stuff
21:17
<&Derakon>
Hmm...did the FILE_READ_ATTRIBUTES + no sharing, and I'm not getting permissions errors Python-side. Promising.
21:17 * McMartin nods
21:17
<&McMartin>
In this case you'd be using two handles on the C++ side
21:18
<&McMartin>
pywin32 doesn't have out-of-module docs, it seems -_-
21:18 * Derakon mashes the "write to file" button a bunch, gets no crash \o/
21:19
<&Derakon>
So now I can get back to trying to figure out why the pattern I'm loading is incorrect.
21:19
<&McMartin>
win32api doesn't do what we wanted to try anyway, it seems
21:26 * Derakon eyes his program.
21:26
<&Derakon>
How can an unsigned int, that is itself the summation of other values cast to unsigned int, be "-60000" when printed?
21:27
<@ErikMesoy>
Magic in the print function
21:28
<&Derakon>
Incoming codespam.
21:28
<&Derakon>
}
21:28
<&Derakon>
bufSum += (unsigned int) curBuffer[i];
21:28
<&Derakon>
}
21:28
<&Derakon>
printf("Sum of buffer is %u\n", bufSum);
21:28
<&Derakon>
...I don't think that worked. Pastebin it is.
21:29
<&McMartin>
No, it worked
21:29
<&Derakon>
http://pastebin.com/tBUzRuya
21:29
<&Derakon>
It printed -60000 when I printed with "%d".
21:30
<&McMartin>
Yeah, that's expected; %d is always signed
21:30
<&McMartin>
%u is "supposed" to be right
21:30
<&Derakon>
Yeah.
21:30
<&McMartin>
http://www.cplusplus.com/reference/cstdio/printf/
21:30
<&Derakon>
Oh...wait, yeah, this is probably the wrong way to go about checksumming a bitfield.
21:30
<&Derakon>
Bleh. If it weren't Friday and I weren't hungry (stupid body! You had lunch three and a half hours ago!), I'd be more on top of my game.
21:32
<&McMartin>
You're in an alien environment. Don't be too hard on yourself
21:35
<&Derakon>
Heh.
21:35
<&Derakon>
I'm usually more at home when it comes to bit-twiddling, but mostly right now I'm just flying blind.
21:35
<&McMartin>
Yeah
21:35
<&Derakon>
It's hard to get good visibility into the state of 600x800 bitfields.
21:35
<&McMartin>
I see Mickens was linke this morning
21:36
<&McMartin>
"... I once declared a vector<list<string>> and the compiler errors caused the dead to walk amongst the living."
21:37
<&McMartin>
C++ lives in a super-uncomfortable space between bit twiddling and IFlyweightBridgeFactoryFactoryImpl
21:42
<&Derakon>
Bleh. I think my memory manipulation is correct, but I'm not getting the right pattern to show up.
21:42
<&Derakon>
This comes down to how to interact with the DMD...
21:48
<&McMartin>
There I think we can't help much -_-
21:48
<&Derakon>
Ah ha!
21:49
<&Derakon>
I'd forgotten to tell the DMD "Okay, now display it."
21:49
<&McMartin>
hee
21:50 * McMartin looks at some of this python code, -_-s at it
21:50
<&McMartin>
It's everyone's favorite facepalm bug, but fortunately it's in deadcode because it only runs on a branch that can't happen if the makefile that invokes it reaches that point. -_-
21:50
<&McMartin>
(if x in "blah": instead of if x in ["blah"]:)
21:50
<&Derakon>
Yessssss...progress! I can see things!
21:51
<&Derakon>
That plus a Clif bar have immensely improved my mood.
21:51
<&Derakon>
It's not the right things but it's things!
21:53 Red_Queen [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
21:53
<&Derakon>
Thanks again for your help, McM.
21:53
<&Derakon>
And TF earlier as well.
21:59
<&Derakon>
Right, so. http://derakon.dyndns.org/~chriswei/temp2/dmdtest.png
21:59
<&Derakon>
On the left is the user-specified pattern.
21:59
<&Derakon>
On the right is the pattern as actually displayed.
22:00
<&Derakon>
(Never mind the curved field of view)
22:00
<&Derakon>
I think I have some kind of endianness problem, maybe?
22:00
<&Derakon>
I mean, I'm clearly reading the right number of bytes, and they're in about the right place, but those stripes shouldn't be there.
22:02
<&Derakon>
On the flipside, if I white-out the entire input, then the stripes don't show up.
22:06
<~Vornicus>
I knew I had ADD but this is bad
22:06
<~Vornicus>
I was in the middle of unbuttoning my shirt and then I got distracted and forgot about it for 20 minutes.
22:09
< Turaiel>
Anyone care to help me sanity check some PHP and perhaps give me some suggestions?
22:14
<&Derakon>
Don't ask to ask, just ask.
22:14
< Turaiel>
I was looking for someone willing to help first, since I'd rather do it in PM.
22:17
<&Derakon>
Unless your code is private somehow, you'll get better results by engaging the channel as a whole.
22:17
<&Derakon>
Not, mind you, that my PHP is remotely up to snuff these days.
22:17
< Turaiel>
Alrighty then. http://pastebin.com/sSL1kWhx
22:18
< Turaiel>
I feel like it's full of bad practice, but I'm not sure what the best way to improve it is.
22:21
<&Derakon>
Stylistically, put spaces around your string concatenator operators IMO.
22:22
< Turaiel>
I usually do. That part was written quickly.
22:22
<&Derakon>
Why are you connecting to SQL way before you use the SQL connection?
22:23
< Turaiel>
Does that matter?
22:23
<&Derakon>
It's a good idea to only create objects shortly before they are used.
22:23
< Turaiel>
Should I only connect when I need to execute a query then, rather than maintaining a connection?
22:23
<&Derakon>
Keeps things that are related to each other closer together.
22:24
<&Derakon>
If you need the SQL object multiple times in the same page load, then there's no sense in reconnecting each time.
22:24
<&Derakon>
But you shouldn't create it until just before you first need it.
22:24
<&Derakon>
...also, that SQL parameter binding syntax makes me sad, but that's not your fault.
22:25
<&Derakon>
PHP may have some "construct a valid file path" function like Python's os.path.join(), which would make line 25 more cross-platform.
22:25
<&Derakon>
That's all I got. You aren't doing much fancy, and I'm glad you're binding your variables instead of constructing a query string manually.
22:26
< Turaiel>
This is the first time I've used the binding method
22:26
< Turaiel>
I wanted to actually do things correctly this time. That should prevent injection, correct?
22:26
<&Derakon>
Never ever ever construct query strings manually. Always bind parameters.
22:26
<&Derakon>
Yeah, the point of binding parameters is to automatically do all the necessary escaping to avoid getting your database ripped open.
22:32
<~Vornicus>
Yay Thank You For Doing Binding
22:36 * Derakon blarghs at C++ code some more.
22:36
<&Derakon>
On the theory that endianness is creating my issues, I created a second buffer to copy the first to.
22:36
<&Derakon>
But even if I just copy each byte straight across, the program crashes.
22:37
<&Derakon>
fixedBuf = (char*) malloc(bufBytes); for (int i = 0; i < bufBytes; ++i) {fixedBuf[i] = curBuffer[i]}
22:37
<&Derakon>
NB curBuffer was allocated the exact same way.
22:38
<&Derakon>
Hm, it doesn't crash if I don't free curBuffer afterwards. ._.
22:39
<&Derakon>
Bah, I give up.
22:40
<&Derakon>
Will tackle this next time.
22:46
<&McMartin>
OK, that's strong evidence that something, somewhere, is corrupting your heap
22:47
<&Derakon>
Hooray.
22:47
<&McMartin>
If you can get everything compiled with the MSVS debug heap, it uses a CCCCCCCC fill pattern for uninitialized memory and a DDDDDDDD pattern for freed memory
22:47
<&Derakon>
Could you /msg that to my other self, please?
22:48
<&Derakon>
I'm about to vanish.
22:48 * Derakon is out of brain juice anyways.
22:48
<&McMartin>
That being Derakon_?
22:48
<&Derakon>
Uh, yeah. The other Derakon, whatever he's called.
22:49
<&Derakon>
That's my home computer. It has logs.
22:49
<&Derakon>
(I guess it's logging this now, actually, so never mind!)
22:49
<&Derakon>
Anyway. *poof* and thanks again.
22:49 Derakon [chriswei@Nightstar-5fqf0m.ca.comcast.net] has quit [[NS] Quit: leaving]
22:49
<&McMartin>
(This was a major part of how we managed to track down that insane bug in the .h<->.dll mismatch last week here; a value was CCCCCCCC00000000, so we concluded "aha, this binary is being passed a 32-bit 0 when it expects a 64-bit value"
22:54
< Turaiel>
If anyone cares, I've updated the file. Ready for criticism. http://pastebin.com/izfR5Swq
22:57
< Turaiel>
Is it good practice to die() on errors, or is there something better I should be doing?
22:58
<&McMartin>
What's the execution context?
22:58
<&McMartin>
If it's a commandline script, die()ing on error is the expected behavior in Perl and C.
22:59
< Turaiel>
A web page POSTs to it
23:00
< Turaiel>
I guess it'd be better for me to set an error in $_SESSION and then return to the calling page.
23:34 thalass [thalass@Nightstar-bk3u2d.bigpond.net.au] has joined #code
23:34 mode/#code [+o thalass] by ChanServ
23:44 himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds]
23:57 himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code
23:57 mode/#code [+o himi] by ChanServ
--- Log closed Sat Mar 15 00:00:12 2014
code logs -> 2014 -> Fri, 14 Mar 2014< code.20140313.log - code.20140315.log >

[ Latest log file ]