« first day (2141 days earlier)      last day (2798 days later) » 

9:00 PM
granted, this isn't one of those, but good practice is best at all times
 
@ChemiCalChems ah, yeah. Again, I think we agree it's best to avoid the whole pile of problems using namespace std brings with it :P
 
@jaggedSpire exactly
 
browsing the HBO-Go online repository, and searching for the first HBO hit series "Oz": error, type in at least 3 characters...
 
@TemplateRex what a fantastic search algorithm they have there, that they feel the need to force a minimum of three characters
 
@jaggedSpire classic keyhole problem
@jaggedSpire but also bad testing, at the very least someone should have made acceptance tests that all HBO series ever made can be found
 
9:05 PM
@TemplateRex oooh, thanks!
 
Hopefully at least they have the assumption that trailing spaces are to be ignored. "Oz " will do the trick
At the end of the day though, the keyhole problem is the result of how difficult it is to add support in comparison to how easy it is to remove. Also, communication protocols between humans are combinatorially complex, but many programming solutions approach parsing in a linear fashion.
 
@Aaron3468 it's about gratuitous limitations, and not being able to search for ones own TV series, is ludicrous. Even with 1 letter searches, they could easily show the top 10 most popular matches. It's a small database, not the entire IMDB (and even then, a simple trie would do the job)
 
user1804599
@fredoverflow Who needs polymorphic methods when you have path-dependent types? def id(a: {type T})(x: a.T): a.T = x
 
9:21 PM
@TemplateRex That is true, however they're probably relying on a naive search library like the one google uses. Much of the time, the limitations like that are a result of the underlying software/hardware stack rather than the end-developer. On the other hand, not accepting alternative input conventions is often the end-developer's fault.
Software abstraction layers make computers easier to use (eventually to the point that the unskilled user may easily navigate and use it for non-technical purposes), but it's a common assumption that the end-user will be equally technical and will find trivial fixes... trivial. Especially with commercial programs, this isn't the case
 
bringing the debate from elsewhere, but i hope to see valid arguments here
are we superior to animals or not?
if so, why or why not and in what aspect?
my argument, life is based on survival, and survival is not compatible with fighting over resources in large wars where people die
 
Superior in the sense that we have means to control and manage them in ways they cannot control and manage us. We often have the advantage in interaction with animals as a class. In individual events, it's often the other way around; most individual people are not well socialized with wild animals or able to fight/outrun them.
 
hm, good argument
still, i can't treat an animal in a condescending way
i'd rather treat him as one of my own than as a piece of shit
we are all star dust anyway
 
Ethical superiority? Sure, we're all equal. Except that we aren't really all equal and there's rarely penalties to exploiting that disparity. It's the penalties and consequences that force behaviour. Moral obligations have little control over behaviour.
 
@Aaron3468 morals can also be a way to self-enforce behavior because some acts make one feel very bad about oneself
 
9:31 PM
is it normal that doing anything with templates more complicated than a bog simple generic function induces the feeling of wanting to kill oneself?
 
eg how many people would kill someone (eg for profit) if they would 100% get away with it
 
@TemplateRex You've hit the point. Ethics and morality are voluntary. Certainly they're a good sentiment because they often enforce symbiotic (mutually beneficial) relationships, but they're an opt-in system. Penalties and consequences are not an opt-in system.
 
@Aaron3468 ultimately, penalties also depend on the willingness of the people to enforce it, see e.g. jury nullification, civic disobedience
laws are voluntarily formed and enforced
 
@TemplateRex If I can overpower you (as a government can), and I choose to hit you every time you take money from your friend, are you able to opt out?
 
depends, maybe the government decides that if your friend is black, women, muslem, you can do so with impunity
 
9:35 PM
@redspah Yeah. Most every language induces that feeling the moment you want to do something that isn't simple
 
laws are nothing more than a collective voluntary agreement, more difficult to opt-out than morality, but still voluntary
 
Laws are voluntary ans there is a simple opt-out.
Except if you're in, say, Turkey, you can just move out.
 
@TemplateRex Laws are a much more of a grey area. Examine it from a more direct perspective; two organisms that may or may not be equal. From there you can build out to the grander concepts of law, morality, etc
 
Most governments won't prevent you from opting out of them.
 
@Aaron3468 I don't think pitbulls e.g. have morality, but dolphins/chimps might come close, elephants even
 
9:39 PM
And naturally, a lot of our behaviour is also determined by normative influences, things which alter our perception of normal behaviour.
Thought experiments lead me to believe that normative influences have a stronger effect on most people's behaviour than their own morality (mostly because normative influences help inform that morality)
 
This FOIA request is one for the record books. https://www.aclumaine.org/sites/default/files/aclumaine_foaa_08252016.pdf (h/t @maloneyfiles) https://t.co/wSEmfsc0Z9
 
nwp
> 64 bytes from 8.8.8.8: icmp_seq=38 ttl=56 time=208507 ms
why did I ever leave home
 
How bad is it to call delete on a pointer to a heap-allocated POD struct which you do not have the definition for? (i.e. "deletion of pointer to incomplete type 'foo'; no destructor called")
Assuming there's no behavior in the destructor, is it okay for it not to be called?
 
nwp
if UB happens but nobody checks, is it still c++?
4
 
@caps not sure if P0137R1 doesn't screw that up
@nwp there's always UB and usually nobody checks, so...
@johnregehr @spun_off I too can typically tell at a glance if code has undefined behavior. I say yes every time, and I'm typically right.
 
9:53 PM
hm
you know, I've encountered resource leaks on multiple occasions from questioners who forget to call a C-style api's resource release function in one spot or another
and I can't find a question about "how do I easily apply RAII to a c-style interface so my c-style resource is cleaned up automatically?", when the answer is something I wind up typing out in those kinds of questions
 
@jaggedSpire A custom deleter for unique_ptr
 
@caps obvs
 
What is RAII
 
I'm wondering if I should write a question/answer pair so I can just link to it when I encounter the problem instead of typing the whole thing out again
 
nwp
inb4 complaining about the absence of unique_handle
 
9:57 PM
@Darkrifts An acronym that doesn't make sense, but means to use classes for resource management instead of trying to manage resources by hand.
 
meh unique_ptr does it all right by itself
RAII is how you get easy exception safety
 
@jaggedSpire Reusable solutions are good practice ;)
 
@Aaron3468 yep. but it's so simple, someone has to have written it up before
 
Though I'd prefer to write a short article and copy/edit it as new answers to reap upvotes
 
:P
I'm more about the answer/upvote ratio myself
my language-lawyer answer:upvote ratio is 3:59 ^_^
 
10:00 PM
That's neat
 
it pleases me
If I posted a self-answer about C APIs and using unique_ptr as a resource handle, would anyone here be willing to critique it?
 
@Darkrifts Think of it as "SBRM" (stack bound resource management) and the meaning will probably be more apparent.
 
@Darkrifts { MyClass hi = MyClass(); } //hi is destructed here in most cases because stack scope has changed
 
@jaggedSpire So you only need one more answer (and 320 up-votes) to match Jon Skeet's ratio in that tag...
 
@JerryCoffin do you think if I pray to John Skeet I'll be favored by the rep gods and get a better ratio?
looks up required materials for altar
 
10:14 PM
@jaggedSpire If you prey upon Jon Skeet, the gods will probably ignore you.
 
I'm mostly proud of it because I'm pretty sure it's my best answer:upvote ratio in a tag I have more than one answer in. I'm well aware I am but a worm to the upper crust of rep society. Do you guys have soirees?
@JerryCoffin :P
 
@jaggedSpire if sample size is 6, you'll need quite a few more to establish a confidence above 50%
 
alas, sample size is 3 at the moment
 
@jaggedSpire Seriously, it is a pretty high ratio. Soirees? Guys never have soirees--at the risk of sounding sexist (which I undoubtedly am), I'm pretty sure you need at least one lady involved to get a soiree. If it's all guys, you're most likely going to be sitting around a garage eating pretzels and drinking beer.
 
@JerryCoffin lol
but that doesn't sound fancy-schmancy. Perhaps going yachting?
 
10:20 PM
@jaggedSpire That's the whole point. Fancy-schmancy inevitably involves women in some way or other.
 
TIL
 
> fancy-schmancy: Sitting around a table [!!] drinking Glenfiddich 50 and eating caviar
Becuz drinking caviar is for the filthy rich
 
you see, I get all my understanding of upper-crust society from batman comics and my sister's high-school friends so it's sort of...warped
especially since my sister's been out of high school for...ten years?
 
Ven
o/
 
@Aaron3468 Except in Russia, where quite average people go and catch fish, and prepare caviar from the eggs. Most of the best caviar is made as a cottage industry and eaten locally.
 
Ven
10:32 PM
@jaggedSpire first off it's jon
 
@Ven oh dear do you think that will displease the rep gods terribly
 
Ven
i've heard them mumble something about you clicking your rep tab
2
 
@Ven ;_;
I'm back down to compulsively checks 78 unclicked rep
 
@jaggedSpire If you really want the high ratio, do like Nemo did for a while, and go bounty hunting. Answer:upvote ratio: 6:1388.
 
@JerryCoffin goggles
 
Ven
10:35 PM
@jaggedSpire so you did click it? :P
 
did you know there's a keyboard shortcut feature? I was playing with it and hit the rep-clicking key :(
 
Ven
I have a tip for you: find a job you hate, and you'll spend your day idlily looking at SO
@jaggedSpire no; what is it?
 
@Ven cursed
@Ven profile>profile & settings>preferences>near the bottom
it's neat, just be aware that when they have a button labeled achievements it should be labeled destroy all my beautiful green rep that I've worked to gather for months on end without so much as a by-your-leave
 
@JerryCoffin TIL
@jaggedSpire As I say, disable it by making a browser plugin. Never cry again
 
but how would I test to make sure that it works
 
Ven
10:43 PM
ty
 
np bby <3
 
@Aaron3468 Yeah--I got kind of a lecture when I hinted at the possibility of buying some caviar in a store once. My fiance of the time (who was Russian, in case that wasn't obvious) rather looked down her nose at it and told me that if we were going to have caviar, we'd get a lot better than that, and we wouldn't get it from a store either.
 
What kind of monster assumes I want to overwrite code on a line instead of inserting!???
@JerryCoffin I see... I can understand where that perspective comes from though when there's a cottage industry. OTOH, 'fiance of the time' has a bit of a bitter taste
 
@JerryCoffin awh :(
 
@Aaron3468 It certainly did at one time, but I've had quite a bit of time to get over it...
Rereading that, the "lecture" (in particular) sounds like she was being a little nasty. The reality is quite the opposite: she was very nice about it, and really was saving an ignorant tourist from making an expensive mistake.
 
10:50 PM
oh okay
 
It takes a while to get over the inevitable sense of having betrayed expectations. Glad to hear you worked through that mess
@JerryCoffin I usually read the word as 'a long unsolicited discussion/explanation', so I don't usually see it as negative, but words are open to interpretation so the clarification is welcome
Speaking of betrayed expectations, it's so much more difficult to write code when typing in the middle of the line overwrites the code that's already okay. I was not raised on a typewriter.
 
@Aaron3468 what menace to society is responsible for this miscarriage of justice do you think
 
miscarriage-return
2
 
11:07 PM
@Borgleader hey bby
 
hey <3
 
god I love smart pointers
 
smart is the new sexy
 
mmm
 
11:19 PM
People are just terrible at following procedure, hence allowing the computer to follow procedure for you
 
Ven
A.K.A. "Programmers are human"
 
"makes me sad in my pants" is my favorite phrase today
 
@Mikhail Being fair, he's at least sort of right, given the definition of a smart pointer he uses. "Create a base class for all your objects (let's call it RefObj). This base class holds a reference count integer that tracks how many things are referencing it." Yup, a giant monolithic hierarchy is a completely broken approach to pretty much everything (exception handling being nearly the only...exception).
 
Ven
inherit shared_ptr -- can only work
 
@JerryCoffin There is one application that might be interesting to consider. I had a problem with pointers being lost to the ether, and used the custom destruction mechanism in std::unique_pointer to patch memory leaks. If the object destroyed of its own volition that was a memory leak and I threw an exception.
 
11:27 PM
@Mikhail Seems like a non sequitur to me (i.e., sounds interesting, but has nothing to do with a reference counter as the root of a monolithic hierarchy).
 
@Ven The Very Best of Ideas
 
I like the idea, but there shouldn't be a hierarchy. It just needs to be a referenceManager that has increment and decrement functions, and perhaps pointers to objects registered. The hierarchy is bad because it tightly couples to every unrelated module you code while a separate object doesn't
 
Ven
@jaggedSpire I'm fairly we have that at work. We also have some classes inheriting vector..
 
@Mikhail Memory management is hard is a fucking understatement. I'm saying this because of the shit that I've had to deal with in my Pi program.
 
Ven
admittedly we don't all deal with your type of issues, @Mysticial.
hopefully.
 
11:31 PM
@Mysticial Solution: Eat apple pie instead
 
The problems that I ran into in the Pi program are the memory leaks and such. It's memory allocation overhead, fragmentation, and checkpointing.
 
or just use the arc-tangent function to compute Pi like normal people!
 
You can't keep on allocating and deallocating massive buffers because the OS needs to zero them and remap page tables.
I can't use a simple pool because the allocations are coming in different sizes.
So the only way is to preallocate some large contiguous region. And use some resource heap.
But then you get hit with fragmentation - which makes it really difficult to put calculate upper-bounds on how much memory you need.
But this method doesn't work when the "memory" is actually "disk". Because copying stuff around defraggnig is really slow.
 
Yeah, I've been battling with the demons of large memory pools for the last few years. The real thing that messed me up was that my pre-allocated memory pool needed to also lock when either the producer or consumer encountered errors.
 
And checkpointing is difficult if all you need to save an entire file that's terabytes large.
 
11:35 PM
Yeah or just fucking testing the code, like of my stuff takes days to run...
In the future we'll use erlang
 
@Mikhail I'm tempted to paraphrase the old line to get: "Functional is the future of programming. Always has been and always will be."
 
So as optimized as the Pi program is. There is a fair amount of memcopies that are the result of defragging the heap.
@Mikhail I've recently started thinking about how to attack the problem in a NUMA-ish architecture. And the whole "preallocate/manually vs. allocate" basically fucked everything up.
I'm thinking about a "far memory" interface backed by either interleaved NUMA memory, interleaved disk, or interleaved NUMA as cache for disk. And it's a fucking nightmare.
 
I can imagine how terrible it must be, using the HDD as a giant file against the will of the OS that just wants you to put up with its overhead
Especially if you start using multiple HDDs to store the data... Frick, now I have a lot more perspective on how difficult what you're doing is
 
@Aaron3468 That's why that doesn't work on the disk. When the program makes checkpoints, only a small amount of data needs to be saved. If the data is on a massive file with the data spread out in it, you'd need to either checkpoint the entire fucking file, or copy it out - which is very expensive.
So my Pi program does the contiguous/manual memory management when working in ram. But on disk, it allocates separate files for every object.
 
It sounds like you practically need a custom OS -- or very clever code -- for what you do...
 
11:46 PM
@Aaron3468 I'm not sure difficult is exactly the right word here. The problem is more that it's one program that has to work at a lot of different levels of abstraction, including a number that most programmers rarely never encounter. They're typically hidden by the OS, and for many programmers, that's hidden again by a virtual machine.
 
or by the FS, aka RAID
 
@Mikhail I was lumping that in with the OS, but yes.
 
@Aaron3468 That actually won't help. The fragmentation thing is fundamental. The OS resolves it by paging. But managing the page-table isn't free.
 
Exactly, and I presume the reason writing a custom OS as a module is a poor solution, is that it becomes platform dependent.
 
The same thing applies to files on the disk. But since disk access is slow anyways, the bookkeeping for that is negligible.
The only overhead-free solution is to design the algorithm so that it doesn't fragment.
IOW, if you're calling a function that returns 3 things, you preallocate those 3 things before you call it. That function can trash the upper part of the memory all it wants for scratch memory, but you know it will be freed when it returns.
 
11:51 PM
@Mysticial See, it really is just as simple as the linked web page said it was. :-)
 
@JerryCoffin what page?
 
> follow these simple steps:
1. When you need it, allocate it.
2. When you're done with it, free it.
 
@Mysticial The (idiotic) one that started this discussion.
35 mins ago, by Mikhail
for humor: http://www.codingwisdom.com/codingwisdom/2012/09/reference-counted-smart-pointer‌​s-are-for-retards.html
 
Oh.
 
The problem is that even though it's simple when stated generally like that, the amount of different types of memory/allocation schemes makes it incredibly difficult to manage all memory effectively.
 
11:56 PM
I was gonna say that it doesn't always work that well:
1. You don't always know the size of the thing you get back. (I know because I go out of my way to precompute how big they are. Hence why I mentioned gamma-function approximations the other day.)
2. You lose some ability to reuse memory - which for some algorithms causes the memory usage to go from `O(N)` to `O(N*log(N))`.
3. When you parallelize.
 
@Aaron3468 That almost makes it sound like it's usually easy, and there happen to be a few corner cases that are hard. The reality is that completely manual memory management implies memory mismanagement with just short of 100% certainty (i.e., in all but utterly trivial cases).
@Mysticial If somebody asked about when it didn't work on SO, I'd vote to close as too broad. The list is endless.
 

« first day (2141 days earlier)      last day (2798 days later) »