--- Log opened Tue Dec 30 00:00:42 2014 |
00:26 | <@celticminstrel> | For now I've changed the subsystem to console so that I can see printf things. |
00:27 | <@celticminstrel> | The shaders are failing to compile because of 'unexpected $undefined at token "<undefined>"'. |
00:28 | <@celticminstrel> | This might not be super-important as they're only used for some small things, but it's still something I'll need to resolve eventually. |
00:43 | <@celticminstrel> | Hm, it looks like the thing here is that SFML needs to be built with precisely the version of Visual Studio you're compiling on, which means I'll need to compile it myself. >< |
00:43 | <@celticminstrel> | Though it uses CMake, so hopefully that won't be difficult... |
00:44 | <@celticminstrel> | ...or I could upgrade from 2.1 to 2.2. That's probably not going to have any breaking effects. |
00:47 | <@celticminstrel> | Maybe I should do that on the Mac side too. It seems to have a few new features and sounds like it could potentially fix that other dialog issue. |
00:49 | <@celticminstrel> | ...it says the binary download supports 10.7, so maybe I won't even need to compile it myself for once. |
00:50 | <&McMartin> | C++ in general is extremely sensitive to compiler versions - not only version but the settings used can matter |
00:51 | <&McMartin> | g++ (and clang when trying to interoperate) go to some effort to keep it stable, but MS does not |
00:51 | <@celticminstrel> | At first I had to compile it myself because the binary download was for GCC, not clang. Then with 2.1, there was both a GCC and a clang download, but the latter required 10.8+. |
00:52 | <@celticminstrel> | Now with 2.2, there's only a clang download, but it supports 10.7+. |
00:52 | <@celticminstrel> | As for the Windows version, 2.1 didn't provide a binary download for VS2013. |
00:53 | <@celticminstrel> | Maybe I did compile it myself. I can't remember. |
01:02 | <@celticminstrel> | Hm, after updating SFML, the shaders still fail to load but the error message is slightly different - it's at token "@" instead of "<undefined>". That doesn't really seem to help though... |
01:04 | <@celticminstrel> | And the other issue is fixed by linking debug binaries in addition to ensuring they were built in vs2013. |
01:06 | <@celticminstrel> | Aaand, perhaps not surprisingly, assuming a string's end() iterator points to a null-terminator turns out to be a bad idea. (At least, I'm assuming that's why it just crashed, since the error occurred in that vicinity.) |
01:08 | <@celticminstrel> | Works with clang, not with cl.exe. |
01:08 | <&McMartin> | end() is explicitly forbidden from being dereferenced. |
01:08 | | * celticminstrel already knew it was a bad idea but left it because it worked. |
01:09 | <&McMartin> | If you're dealing with an array, end() is the first pointer value that is a buffer overflow |
01:09 | <&McMartin> | Do you want back()? |
01:09 | <@celticminstrel> | No, I want end(). |
01:09 | <@celticminstrel> | I have a "filter" iterator which can be constructed either from an end() or from a begin(). |
01:11 | <@celticminstrel> | I implemented its equality check in terms of the underlying iterator. |
01:12 | <@celticminstrel> | The issue arises because, in the constructor, I'm checking whether there's anything that needs to be skipped. |
01:13 | <@celticminstrel> | Which is perfetly fine when it's a begin() iterator but bad news when it's an end() iterator. |
01:13 | <@celticminstrel> | And as far as I know there's no "is past the end?" function. :/ |
01:14 | <~Vornicus> | You can compare iterators |
01:15 | <@celticminstrel> | That means I need to have the container accessible. |
01:15 | <@celticminstrel> | I think. |
01:15 | <@celticminstrel> | ie, if(iter == str.end()) |
01:16 | <@celticminstrel> | Actually, I could link the code for this one. |
01:17 | <&McMartin> | If you want to iterate from the end to the beginning, use rbegin() and rend(), not end()-1 to begin(). |
01:18 | <@celticminstrel> | It's constructed here, with the class definition a bit further up: https://github.com/calref/cboe/blob/master/osx/dialogxml/dialog.cpp#L295 |
01:18 | <@celticminstrel> | I'm not iterating in reverse. |
01:18 | <@celticminstrel> | I probably have some sort of, uh, fundamental error here. |
01:18 | <@celticminstrel> | Maybe I could shift that skip to the dereference function? |
01:19 | <&McMartin> | dlogStringFilter seems like as written it can't possibly have a meaningful contract |
01:19 | <@celticminstrel> | Not entirely sure what you mean by that. |
01:20 | <&McMartin> | OK, so, I get the impression here that dlogStringFilter is some kind of custom iterator |
01:20 | <@celticminstrel> | Yes. |
01:21 | <&McMartin> | You should build it not from previously existing iterators, but from the collection it's made of. |
01:21 | <&McMartin> | That means that begin() and end() will be constructed differently |
01:21 | <&McMartin> | It's also not safe because if you build something that is made of nothing but non-space whitespace it will go screaming off into undeclared RAM |
01:22 | <@celticminstrel> | ...oh huh, you're right. |
01:22 | <&McMartin> | (ignoring that by passing it x.end() you are *starting out* in undeclared RAM) |
01:22 | <@celticminstrel> | So, how would begin() and end() be constructed? |
01:23 | <&McMartin> | So, first off, custom iterators are kind of a bad idea in the first place. |
01:23 | <&McMartin> | This is a string. Build a new string that executes the transform you want to execute. Use that string's iterators. |
01:23 | <@celticminstrel> | <_< |
01:25 | <@celticminstrel> | ...wait, I could just replace that hilited line with "content += dlogStringFilter(val)", couldn't I. (If dlogStringFilter were a function that processes the string.) |
01:25 | <&McMartin> | (Otherwise, a custom iterator is just a class that properly implements the ++ and -- operators and operator*.) |
01:26 | <@celticminstrel> | Okay, I can fix this. |
01:35 | <@celticminstrel> | It works! \o/ At least mostly. |
01:35 | <@celticminstrel> | The startup splash and tip dialog works, at least. |
01:35 | <@celticminstrel> | I'm not certain it'll be quittable... |
01:37 | <@celticminstrel> | It doesn't have menus yet. |
01:37 | <@celticminstrel> | That's the next step. |
01:43 | <@celticminstrel> | Actually, no, first I'm working on preferences. Because that doesn't involve Windows API. >_> |
02:50 | | Alek [omegaboot@Nightstar-c8t.a00.36.73.IP] has quit [Operation timed out] |
02:52 | | * celticminstrel tries to figure out how to make a window modal using Windows API. |
02:54 | | Alek [omegaboot@Nightstar-c8t.a00.36.73.IP] has joined #code |
02:54 | | mode/#code [+o Alek] by ChanServ |
03:55 | | Reivles is now known as Orthia |
04:01 | <@celticminstrel> | ...well, I can skip that for now, I guess. It's not a huge deal if the dialogs are modeless. |
04:02 | <@celticminstrel> | The only real issue would be that they might fall behind the main window. |
04:04 | | Turaiel[Offline] is now known as Turaiel |
04:25 | < simon_> | I've got a linear function f(x) = y. how do I optimize x*y? |
04:26 | < simon_> | sorry. I've got a linear function f(x) = a*x+b where a < 0. how do I optimize x*y? |
04:26 | < simon_> | (context: this is a demand curve in economics, and I'm trying to find the optimal price) |
04:42 | <~Vornicus> | xy = x(ax+b) --> ax^2 + bx; maximizing means finding the location of d/dx (xy) = 0, so 2ax + b = 0. This gives you x. |
04:44 | <~Vornicus> | ( = -b/2a ) |
04:48 | < simon_> | ahhh, of course. thanks :) |
04:49 | <~Vornicus> | This is, of course, optimal price for gross revenue; this does not (in itself) take into account COGS and other effects. |
04:50 | < simon_> | right. |
05:17 | | Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving] |
05:28 | | Kindamoody[zZz] is now known as Kindamoody |
05:59 | | Checkmate [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Ping timeout: 121 seconds] |
06:36 | | PinkFreud [WhyNot@NetworkAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds] |
07:51 | <@celticminstrel> | Okay, I have pretty much all the platform-dependent stuff written for Windows, except for menus. (Though, it's not yet tested.) Time to sleep. |
07:56 | | celticminstrel [celticminst@Nightstar-jeiu0g.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!] |
08:43 | | Turaiel is now known as Turaiel[Offline] |
09:31 | | Kindamoody is now known as Kindamoody|afk |
09:47 | | AverageJoe [evil1@Nightstar-2ofrtr.ph.cox.net] has joined #code |
10:02 | | Orthia is now known as Reivles |
10:34 | | Orthia [orthianz@Nightstar-n8uab4.callplus.net.nz] has joined #code |
10:34 | | mode/#code [+o Orthia] by ChanServ |
10:36 | | AverageJoe [evil1@Nightstar-2ofrtr.ph.cox.net] has quit [[NS] Quit: Leaving] |
10:38 | | Reivles [orthianz@Nightstar-n8uab4.callplus.net.nz] has quit [Ping timeout: 121 seconds] |
10:38 | | Orthia is now known as Reivles |
10:58 | | Checkmate [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code |
10:58 | | mode/#code [+o Checkmate] by ChanServ |
12:16 | <@Azash> | Urgh |
12:16 | <@Azash> | Need to assign a value to a variable |
12:17 | <@Azash> | So the way they did it? |
12:17 | <@Azash> | variable = { |
12:17 | <@Azash> | # 32-line k/v block |
12:17 | <@Azash> | }[index_var] || I18n.t('foo.bar.unknown') |
12:20 | < abudhabi> | I hate installing drivers. |
12:20 | < abudhabi> | That is all. |
12:30 | <@froztbyte> | reboot a few more times |
12:30 | <@froztbyte> | let the hate flow |
13:04 | < abudhabi> | It's not the reboots. It's the discontinued support for old hardware. It's the multiple possible devices on the same model. It's the humongous size of the device drivers. It's the lack of available all-in-one packs (at least for free). |
13:07 | | gnoLAN [lenin@Nightstar-oru2ae.priv.bahnhof.se] has joined #code |
13:14 | | * froztbyte really doesn't miss any of those problems |
13:50 | | Checkmate [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Connection closed] |
13:50 | | Checkmate [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code |
13:50 | | mode/#code [+o Checkmate] by ChanServ |
14:10 | <@Azash> | "return count == 1 ? true : false" |
14:38 | < abudhabi> | Ouch. |
14:38 | < abudhabi> | This C? |
14:40 | <@Azash> | Well, it's ruby so I added the return in order to make the implicit explicit |
14:40 | <@Azash> | But it's stupid anyway |
14:58 | < abudhabi> | Hmm. If this were PHP or something equally retarded, I'd guess that there could be A Reason. |
14:59 | <@Azash> | Well, not really, since it would still return the same truth value as the expression it checks |
15:00 | | thalass [thalass@Nightstar-9ai58o.bigpond.net.au] has joined #code |
15:00 | | mode/#code [+o thalass] by ChanServ |
15:25 | <@Azash> | https://www.youtube.com/watch?v=WrdrwiTlVoo |
16:15 | | thalass is now known as Thalasleep |
16:18 | | celticminstrel [celticminst@Nightstar-jeiu0g.dsl.bell.ca] has joined #code |
16:18 | | mode/#code [+o celticminstrel] by ChanServ |
17:36 | | Turaiel[Offline] is now known as Turaiel |
17:40 | | Turaiel is now known as Turaiel[Offline] |
17:45 | <@celticminstrel> | WinAPI is a nightmare compared to Cocoa. |
18:00 | <&McMartin> | This is a major part of why basically nobody uses it directly |
18:01 | <&McMartin> | WinForms is relatively clean |
18:01 | <&McMartin> | I still need to see what they've done to MFC since the horrible mess it was 20 years ago |
18:01 | <&McMartin> | Some of the Windows experts I talk to have mentioned ATL but it doesn't look directly on point |
18:03 | <@celticminstrel> | I wonder if it's safe to call AppendMenuA directly. (AppendMenu maps to AppendMenuW.) |
18:03 | <@celticminstrel> | The alternative is converting std::string to std::wstring. |
18:03 | <&McMartin> | It is |
18:03 | <&McMartin> | That's what they're for |
18:04 | <@celticminstrel> | Okay, that's probably better then, since converting the string would seem to be less portable. |
18:04 | <&McMartin> | Just keep it to ASCII - everything else is converted from the system's native code page and so will be garbage on, say, Russian Windows |
18:05 | <@celticminstrel> | I'm now trying to figure out what the third parameter to be. It's a UINT_PTR, but the docs say it should be the menuitem's ID. |
18:05 | <@celticminstrel> | (By docs I mean MSDN.) |
18:05 | | * McMartin tends to use UTF8-in-std::strings internally and then use MultiByteToWideChar |
18:05 | <&McMartin> | I'm afraid my work at the raw Win32 level has been restricted to messing with Spy++ to hack other applications' UIs as they run. |
18:05 | <&McMartin> | For actual Windows applications, I've only ever used Swing, WinForms, and various versions of Qt. |
18:06 | <&McMartin> | For whatever it is you're doing, if you can get away with raw Win32, Qt is almost certainly overkill, and WinForms and Swing are both in the wrong languages. |
18:06 | <@celticminstrel> | I found an example passing an integer, so I guess that's right. |
18:06 | <@celticminstrel> | Qt is definitely overkill. |
18:07 | <&McMartin> | re: "less portable": "The ANSI code pages can be different on different computers, or can be changed for a single computer, leading to data corruption. For the most consistent results, applications should use Unicode, such as UTF-8 or UTF-16, instead of a specific code page, unless legacy standards or data formats prevent the use of Unicode" |
18:08 | <&McMartin> | Note that AppendMenuW is taking UTF-16. |
18:08 | <&McMartin> | std::wstring may be UCS-4. |
18:08 | <&McMartin> | (I honestly don't remember) |
18:09 | <@celticminstrel> | I think wstring probably is UCS-4. |
18:27 | | Alek [omegaboot@Nightstar-c8t.a00.36.73.IP] has quit [Ping timeout: 121 seconds] |
18:38 | | Alek [omegaboot@Nightstar-c8t.a00.36.73.IP] has joined #code |
18:38 | | mode/#code [+o Alek] by ChanServ |
19:07 | | gnoLAN [lenin@Nightstar-oru2ae.priv.bahnhof.se] has quit [Ping timeout: 121 seconds] |
19:51 | <@iospace> | count(*) in a production script... where there already is a sum(Total) involved |
19:52 | <@iospace> | (total in this case is "Select 1 as Total where X...", so sum(total) will give you count(*)) |
20:09 | | Kindamoody|afk is now known as Kindamoody |
20:30 | <@celticminstrel> | It works! |
20:30 | <@celticminstrel> | Menus in my SFML window on Windows. |
21:01 | | Alek [omegaboot@Nightstar-c8t.a00.36.73.IP] has quit [Ping timeout: 121 seconds] |
21:12 | <@celticminstrel> | Okay, this is slightly weird. |
21:12 | <@celticminstrel> | Some of my drawing seems to be thrown off by the presence of the menubar. |
21:13 | <@celticminstrel> | (Assuming it's the menubar based on the fact that the amount it's off is about equal to the menubar height.) |
21:13 | <@celticminstrel> | But some of the drawing looks correct. |
21:14 | <@celticminstrel> | Hm, looks like it's just tiling images that's off... |
21:19 | | Alek [omegaboot@Nightstar-c8t.a00.36.73.IP] has joined #code |
21:20 | | mode/#code [+o Alek] by ChanServ |
21:49 | | Kindamoody is now known as Kindamoody[zZz] |
21:57 | | gnoLAN [lenin@Nightstar-oru2ae.priv.bahnhof.se] has joined #code |
22:00 | <@Reivles> | iospace: To be fair, those two can give different results, and occasionally count(*) is the intentional one |
22:01 | <@Reivles> | Depending on how the dialect handles NULLs in a given row, y'see |
22:01 | <@iospace> | it's counting the number of rows |
22:01 | <@Reivles> | right |
22:01 | <@iospace> | this is oracle |
22:02 | <@Reivles> | Which can be different to the number of rows that return a number from that subquery, unless it's inner-joined |
22:02 | <@celticminstrel> | Why would you use sum(total) instead of count(*)? |
22:03 | <@Reivles> | sum(total) with 'total' coming from a subquery with a where clause can let you count a specific subset of rows. You could also have used count(total), but hey ho big diff |
22:03 | <@iospace> | To be honest: I didn't write this |
22:03 | <@iospace> | for each row, the value represented as "total" will always be 1 |
22:03 | <@Reivles> | count(id key) can return every row that has data on that column |
22:03 | <@Reivles> | count(*) will return every row that is present, null values or otherwise. |
22:03 | <@iospace> | and there's no null rows here |
22:04 | <@Reivles> | So the WHERE in the total subquery is inner joined to the rest of the data set? |
22:04 | <@iospace> | basically it's "select sum(total) from (select 1 as total from table where..." |
22:05 | <@Reivles> | With no other tables in the top-level FROM clause? |
22:05 | <@iospace> | none |
22:05 | <@iospace> | no joins and whatnot |
22:05 | <@Reivles> | Right. |
22:05 | <@Reivles> | If I were to see code like that, where such efforts have been gone to in order to tease out a specific count vs a general count, I would suspect the code did something slightly different previously. Then the need for that was eliminated, and the editor that came along later made a minimum-difference edit. |
22:06 | <@Reivles> | Perhaps the initial code had nulls allowed to return too, etc |
22:06 | <@Reivles> | But when they changed the rules, they didn't change the statements. |
22:06 | <@iospace> | dunno |
22:06 | <@Reivles> | Slightly naughty for production code, sure |
22:06 | <@iospace> | this code is always suspect |
22:06 | <@Reivles> | But also a conservative change, which is good for production code~ |
22:06 | <@iospace> | this is the same company that wrote the 10k line c++ function |
22:08 | <@iospace> | and then had the gall to tell us "it's too complecated for you to touch!" |
22:08 | <@iospace> | *complicated |
22:08 | <@iospace> | anyway |
22:08 | <@iospace> | I'm going insane from staring at shit code |
22:08 | <@iospace> | I need to go home and relax |
22:36 | | McMartin [mcmartin@Nightstar-rpcdbf.sntcca.sbcglobal.net] has quit [Ping timeout: 121 seconds] |
23:05 | | celticminstrel [celticminst@Nightstar-jeiu0g.dsl.bell.ca] has quit [Connection closed] |
23:05 | | celticminstrel [celticminst@Nightstar-jeiu0g.dsl.bell.ca] has joined #code |
23:05 | | mode/#code [+o celticminstrel] by ChanServ |
23:22 | | Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code |
23:22 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
23:28 | | EvilDark1ord is now known as EvilDarkLord |
--- Log closed Wed Dec 31 00:00:58 2014 |