code logs -> 2014 -> Fri, 19 Dec 2014< code.20141218.log - code.20141220.log >
--- Log opened Fri Dec 19 00:00:48 2014
00:23
<@celticminstrel>
For speed, he copy-pasted a function, renamed it, and cut out parts of it.
00:41 Derakon[AFK] is now known as Derakon
03:25 Stumblinbear [Stumblinbea@Nightstar-jd9.012.239.67.IP] has joined #code
03:26 Stumblinbear [Stumblinbea@Nightstar-jd9.012.239.67.IP] has quit [[NS] Quit: Leaving]
03:29 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code
03:29 mode/#code [+qo Vornicus Vornicus] by ChanServ
03:31 simon_ [simon@Nightstar-2og823.pronoia.dk] has joined #code
03:31
< simon_>
hellos.
03:34
< simon_>
here's an idea: I have a set of elements with corresponding weights and quantities, e.g. [(Item,Weight,Count)], or [(ball,2,3),(lamp,3,3),(bottle,1,4)]. I am looking for an efficient, purely functional datastructure to host this set of things such that I can draw one item at randomness given those weights and subtract one from its count, eventually making it impossible to draw.
03:34
< simon_>
an inefficient solution is just a list. draw a random number between 0 and the sum of all Counts-1 and recurse the list, subtract the item from the list and return it.
03:35
< simon_>
an efficient solution would probably rely on a type of binary search tree that covers intervals rather than individual items. has anyone heard of such a thing? I see a Wikipedia article on something called an Interval tree, but the use-case is slightly different.
03:36
< simon_>
the immediate problem with such a tree is the rebalancing.
03:37
< simon_>
maybe it doesn't really need to rebalance.
03:40
<~Vornicus>
The list is pretty good.
03:41
<~Vornicus>
I mean - you have to reweigh it every time to get a good random number, but
03:41
< simon_>
yeah, but when the multiset/bag grows in number of different elements, the lookup grows.
03:41 Reiver [quassel@Nightstar-ksqup0.co.uk] has quit [Ping timeout: 121 seconds]
03:41
<~Vornicus>
This isn't something you typically get to to anything about
03:41
<&Derakon>
I rather suspect that any kind of "jumping" search will have the same big-O as a linear search.
03:42
<&Derakon>
Because the intervals are uneven and potentially antagonistic.
03:42
<~Vornicus>
You could treeify but that involves *actually figuring out the tree*
03:42
<~Vornicus>
and that means figuring out the - ever changing - split points
03:42
< simon_>
if I have a BST that covers an interval, I'd get O(lg n) assuming that the BST remains somewhat balanced.
03:42
<&Derakon>
You're trading a ton of complexity for a minor and possibly nonexistent efficiency gain.
03:42
< simon_>
yeah
03:42
< simon_>
totally.
03:43
< simon_>
I just thought it was interesting to have a BST cover an interval of things... I haven't seen that before.
03:43 Reiver [quassel@Nightstar-ksqup0.co.uk] has joined #code
03:43 mode/#code [+ao Reiver Reiver] by ChanServ
03:49
<~Vornicus>
I guess all told it's not *too* terrible to have a binary tree, but doing the rebalance would be silly
03:58
<@celticminstrel>
I wish the debugger would stop breaking.
04:04
<@celticminstrel>
Whee, I just used one breakpoint to enable another one!
04:04
<@celticminstrel>
So that the first doesn't trigger until the second has been hit once.
04:07
<@celticminstrel>
It still shows as disabled in XCode though.
04:13
<@celticminstrel>
Also it seems that if it's disabled when the debugger starts, XCode doesn't even tell the debugger about it.
04:13
<@celticminstrel>
I guess that makes sense though.
04:15 * celticminstrel is currently trying to make the text wrapping deal with words that are longer than the available space.
04:19 Netsplit *.net <-> *.split quits: @iospace, abudhabi, @Syloq, Xires, Attilla, grindhold, @Checkmate, @Reiver, @Orthia, VirusJTG, (+18 more, use /NETSPLIT to show all of them)
04:19 Netsplit over, joins: &Reiver, &jerith, @Orthia, &ToxicFrog, VirusJTG, &jeroud, @JustBob, @Checkmate, @gnolam, @iospace (+18 more)
05:06 Derakon is now known as Derakon[AFK]
05:10 Checkmate [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
05:26
<@celticminstrel>
Trying to think if I've missed any important text-editing key controls...
05:30
<~Vornicus>
load save undo redo find replace cut copy paste gotoline -- the barest basics
05:31
<~Vornicus>
oh, and select, end&beginning of word/line/file
05:32
<@celticminstrel>
Hm. This is for an edit text field, so load and save aren't needed... not sure if there's any point in find, replace, gotoline. I accounted for all the others. (Shift plus any navigation key for select.)
05:33
<@celticminstrel>
I also have select all and delete word.
05:34
<@celticminstrel>
(They aren't all implemented yet, but I've considered them and written the code to detect them.)
05:55 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
06:03 himi [fow035@Nightstar-dm0.2ni.203.150.IP] has quit [Ping timeout: 121 seconds]
06:31 Kindamoody[zZz] is now known as Kindamoody
06:36
<@celticminstrel>
On a tangentially related note, it would be nice if text editors were consistent on whether shift+arrow extends or shrinks the selection.
06:52
<@celticminstrel>
Hah, integration with Mac clipboard successful.
07:04 Turaiel is now known as Turaiel[Offline]
07:17 Xires is now known as ^Xires
07:26 Kindamoody [Kindamoody@Nightstar-180u8i.tbcn.telia.com] has quit [Ping timeout: 121 seconds]
07:31 ^Xires is now known as Xires
07:41 Kindamoody [Kindamoody@Nightstar-180u8i.tbcn.telia.com] has joined #code
07:41 mode/#code [+o Kindamoody] by ChanServ
08:14
<@celticminstrel>
The Edit menu is stealing my keyboard shortcuts. :/
08:14
<@celticminstrel>
And without actually calling the relevant menuitem/
08:14
<@celticminstrel>
^.
08:21
<@celticminstrel>
Well, by setting the menu to autoenable, I can at least get the keyboard shortcuts to work with a modal dialog onscreen.
08:22
<@celticminstrel>
The only problem is the menuitems really shouldn't be disabled when pressing their key equivalents is expected to do something.
08:23
<@celticminstrel>
But I think it's better than it not working at all.
08:31 Orthia [orthianz@Nightstar-obo.ne6.184.203.IP] has quit [Ping timeout: 121 seconds]
08:36 Orthia [orthianz@Nightstar-lca.o7s.224.119.IP] has joined #code
08:36 mode/#code [+o Orthia] by ChanServ
08:44 celticminstrel [celticminst@Nightstar-jeiu0g.dsl.bell.ca] has quit [[NS] Quit: KABOOM! It seems that I have exploded. Please wait while I reinstall the universe.]
08:54 himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code
08:54 mode/#code [+o himi] by ChanServ
10:22 Kindamoody is now known as Kindamoody|afk
12:26
< abudhabi>
Hmmm. Fast box. It takes only a second or so for an errant loop to fill up the Java heap with integers.
12:39
<@Tarinaky>
Remind me, I think I'm doing something stupid.
12:39
<@Tarinaky>
In C++, can you have function calls in the body of a unit of translation, i.e. to populate some global?
12:39
<@Tarinaky>
*global state
12:41
< abudhabi>
Unit of translation?
12:41
<@Tarinaky>
.cpp file
12:41
< abudhabi>
I don't see why not?
12:42
<@Tarinaky>
It appears to be getting confused and thinking it's a function declaration not a call
12:44
< abudhabi>
Are you trying to call a function directly from the top-level of the document?
12:44
< abudhabi>
I mean, outside of a function?
12:44
<@Tarinaky>
Yes.
12:44
< abudhabi>
Because that, I think, you can't do. You can declare and assign, but not call functions.
12:44 EvilDarkLord [jjlehto3@Nightstar-evu5hu.org.aalto.fi] has quit [Operation timed out]
12:44
<@Tarinaky>
I think I might have been writing too much Ruby
12:44
< abudhabi>
Best do it in main().
12:44
< abudhabi>
Or a dedicated setup function.
12:46 Kindamoody|afk [Kindamoody@Nightstar-180u8i.tbcn.telia.com] has quit [Ping timeout: 121 seconds]
12:47 EvilDarkLord [jjlehto3@Nightstar-evu5hu.org.aalto.fi] has joined #code
13:04
<@Azash>
āTo make matters worse, we saw distinct traces of local mist around several of the Puppet developersā
13:05 * Tarinaky headdesks.
13:05
<@Tarinaky>
Why are DLLs so smegging hard to use :/
13:09
<&McMartin>
Two reasons: (a) their init/deinit order is not fixed, much less topologically sorted by dependencies, (b) you're trying to use a compiled language like a scripting one, (c) if these are Windows DLLs, symbol table management is a pain
13:10
<&McMartin>
Three, three reasons
13:10
<&McMartin>
among the various reasons
13:10
<@Tarinaky>
I'm trying to import some functions from a DLL I wrote a month ago.
13:11
<&McMartin>
Did you do the WHATEVER_EXPORTS #define trick?
13:11
<@Tarinaky>
Yes, but it's giving me unresolved external symbol for the functions that are defined in the DLL
13:11
<@Azash>
14:10 <&McMartin> Three, three reasons < Ah, ah, ah, ah
13:11
<@Tarinaky>
I know the DLL 'works' because I can access the functions with Ruby and FFI
13:12
<&McMartin>
Which compiler?
13:12
<@Tarinaky>
Microsoft Visual Studio's C++ compiler... cl.exe I think?
13:12
<&McMartin>
OK
13:13
<&McMartin>
you are both (a) linking the associated .lib file and (b) ensuring that when the *client* uses it those functions are marked __declspec(dllimport) instead of __declspec(dllexport) like when you wrote it, right
13:13
<&McMartin>
The (b) thing being what WHATEVER_EXPORTS is designed to hide
13:13
<@Tarinaky>
(b) Yes.
13:13
<@Tarinaky>
(a) I /think/ so, but it's all hidden behind GUIs so I don't actually know what VS is doing
13:15
<&McMartin>
This one is not; there should be a property named something like "additional library dependencies" under Linker/Input if this DLL isn't part of the stuff you build when you hit Build, or under "Project References" if it *is* part of that stuff.
13:15
<@Tarinaky>
This DLL is part of the stuff build when I hit build.
13:15
<&McMartin>
OK. Make sure it's listed under References in the config.
13:16
<&McMartin>
That should suffice to have the .lib show up at link time (which you can check by going to Properties -> Linker -> Command line)
13:16
<@Tarinaky>
I'm not seeing it.
13:16
<&McMartin>
Add it
13:17
<@Tarinaky>
Cannot open input file.
13:19
<&McMartin>
Are you *sure* you're building it?
13:19
<&McMartin>
Now you've got "I'm trying to link in the code that calls the DLL but it isn't there"
13:19
<@Tarinaky>
Well the compiler output says it's building it.
13:20
<@Tarinaky>
And the actual .lib file is in the Release folder after a failed build.
13:20
<@Tarinaky>
I'm not sure I'm adding the lib to the dependencies in the right way though
13:20
<@Tarinaky>
brb a sec.
13:21
<&McMartin>
Ah
13:21
<&McMartin>
Yeah, you don't want to add it to "additional input libraries"; you want to add it to "Project references" which is actually in the other top-level properties section
13:21
<&McMartin>
(Assuming this is MSVS2013. If it's 2008, you have to go to a different dialog called "project dependencies" and check the box for the other project)
13:24
<@Tarinaky>
2012 I think
13:24
<@Tarinaky>
Wait so...
13:24
<@Tarinaky>
What the fuck am I doing?
13:28
<@Tarinaky>
I cant find anything for either additional inpuit libraries or project references
13:28 * Tarinaky is totally lost.
13:31
<&McMartin>
It should look vaguely like this: http://blogs.msdn.com/blogfiles/visualstudio/WindowsLiveWriter/FrameworkMultiTar getingforVCProjects_E3BC/clip_image002_2.jpg
13:31
<&McMartin>
(But not exactly, those are C# things)
13:33
<@Tarinaky>
Okay, I have that dialog open.
13:33
<@Tarinaky>
Then it's somewhere under Linker?
13:33
<&McMartin>
No, it's up at the very very top above everything
13:34
<@Tarinaky>
Above the dialog?
13:34
<@Tarinaky>
o.O
13:34
<&McMartin>
Er, no
13:34
<&McMartin>
There's a list of stuff on the left part of the dialog
13:34
<@Tarinaky>
Yes.
13:34
<&McMartin>
The "Framework and References" option is near the top of that list.
13:35
<@Tarinaky>
Ohhhh
13:35 * Tarinaky derps.
13:35
<&McMartin>
You need to go to it (or whatever the C++ name is, I forget) and select "Add Reference" or similar, and then add a reference to the project that produces the DLL you want to link in.
13:35
<@Tarinaky>
Still getting unresolved external symbol.
13:36
<&McMartin>
I'm sort of running out of useful things I can do from a distance, so here's the MSDN walkthrough: http://msdn.microsoft.com/en-us/library/ms235636.aspx
14:18 Checkmate [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code
14:18 mode/#code [+o Checkmate] by ChanServ
15:32
<@Tarinaky>
Update.
15:32
<@Tarinaky>
I needed to be using extern "C" __declspec(dllimport) and not _declspec(dllimport)
15:52
<@gnolam>
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=690b05 43a813b0ecfc51b0374c0ce6c8275435f0
15:56
<@Tarinaky>
Best patch ever.
16:12
<&McMartin>
Tarinaky: Ah, yes. I had missed that the library itself was written in C (or declared extern C). C++ symbols for function names include type info in them because foo(int x) and foo(double y) are different functions in C++ and can coexist.
16:13
<&McMartin>
gnolam: hooray
16:23 macdjord|slep [macdjord@Nightstar-r9vt2h.mc.videotron.ca] has quit [[NS] Quit: Tekeli-li! Tekeli-li!]
16:33
<@Tarinaky>
McMartin: I hadn't mentioned that because I didn't realise either.
16:33
<@Tarinaky>
Coworker spotted it
16:33 * McMartin nods
17:38 Reiver [quassel@Nightstar-ksqup0.co.uk] has quit [Connection closed]
--- Log closed Fri Dec 19 17:38:51 2014
--- Log opened Fri Dec 19 17:39:02 2014
17:39 TheWatcher [chris@Nightstar-ksqup0.co.uk] has joined #code
17:39 Irssi: #code: Total of 35 nicks [16 ops, 0 halfops, 0 voices, 19 normal]
17:39 mode/#code [+o TheWatcher] by ChanServ
17:39 Irssi: Join to #code was synced in 38 secs
17:39 Reiver [quassel@Nightstar-ksqup0.co.uk] has joined #code
17:39 mode/#code [+ao Reiver Reiver] by ChanServ
17:46
<&McMartin>
Incidentally, if you use git on Windows or Mac there's a security flaw that was patched yesterday. You should upgrade to 2.2.1 or 1.9.5.
17:46 celticminstrel [celticminst@Nightstar-jeiu0g.dsl.bell.ca] has joined #code
17:46 mode/#code [+o celticminstrel] by ChanServ
17:47
<&McMartin>
http://www.securityweek.com/apple-microsoft-github-release-updates-fix-critical- git-vulnerability
17:50
<@celticminstrel>
Well, I can update git, but not XCode.
18:15 Alek [omegaboot@Nightstar-c8t.a00.36.73.IP] has quit [Operation timed out]
20:00 Alek [omegaboot@Nightstar-c8t.a00.36.73.IP] has joined #code
20:00 mode/#code [+o Alek] by ChanServ
20:48
<@celticminstrel>
...so I now have two layers of binding.
20:48
<@Tamber>
kinky.
20:48
<@celticminstrel>
ie, I call std::bind, get a function out of it, then pass that into std::bind again.
21:06 Kindamoody|autojoin [Kindamoody@Nightstar-180u8i.tbcn.telia.com] has joined #code
21:06 mode/#code [+o Kindamoody|autojoin] by ChanServ
21:06 Kindamoody|autojoin is now known as Kindamoody
21:10
<&McMartin>
That's dangerously close to currying
21:12
<@celticminstrel>
Dangerously?
21:17
<&McMartin>
It's the adverb I'm used to applying to close
21:18
<@celticminstrel>
But that makes it sound dangerous!
21:19
<&McMartin>
Currying *is* dangerous. Once you've gotten to use it, every language that doesn't have it is a thorn in your side~
21:19
<@celticminstrel>
XD
21:21
<&McMartin>
(I suppose if I'm picking nits, it's not the curry that is so addictively delicious but instead the ability for partial evaluation, which of course std::bind totally is)
21:22
<@celticminstrel>
By which you mean when you bind some parameters but not others?
21:22
<&McMartin>
And get a callable back out of that, yeah
21:23
<&McMartin>
This gets completely nuts when you're using a language that makes heavy use of higher-order functions (Haskell, Clojure, the ML family) but it's Not Shabby in C++ either
21:23
<&McMartin>
I've been known to write my C++ "with a functional accent" though
21:26 * celticminstrel likes the new lambdas.
21:29
<&McMartin>
I haven't looked to closely at the new syntaxes
21:29
<&McMartin>
*too
21:30
<@celticminstrel>
One major difference from other languages I use with lambdas (like Python, JavaScript, or Java) is that the closure has to be specified explicitly.
21:30 * celticminstrel is counting anonymous inner classes as lambdas here.
21:55 * McMartin nods
22:02 Kindamoody is now known as Kindamoody[zZz]
23:34 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code
23:34 mode/#code [+qo Vornicus Vornicus] by ChanServ
--- Log closed Sat Dec 20 00:00:02 2014
code logs -> 2014 -> Fri, 19 Dec 2014< code.20141218.log - code.20141220.log >

[ Latest log file ]