« first day (2611 days earlier)      last day (2338 days later) » 

12:22 AM
$250 Amazon Key
why would anyone pay $250 so they can give away their key to strangers?
 
1:09 AM
I did not expect to read from a Swedish UN security council member "We are 14 against one" in regards to US declaring Jerusalem capital of Israel.
 
 
1 hour later…
2:22 AM
So, whats everybody working on?
 
nwp
I'm thinking about how to serialize editor operations such as "get text", "insert/remove text", "change text color/font" and "set hovertext" in a way that is understandable and maintainable.
 
Are you writing a scripting language?
 
nwp
No, an IDE.
 
Shouldn't you be using whatever parser your language uses? Or maybe that's too computationally expensive?
 
nwp
That's the idea. clang++ -fsyntax-only does the real work. Then there is a small wrapper that parses clang's output. But that wrapper needs to be notified that the text buffer changed, be able to request the text buffer content and eventually add red squigglies under the things clang complained about.
And all this goes through a pipe which is a bit tricky.
I considered using some RPC thing, but they seem overkill and not fit well for the problem.
Also I want to avoid having an event loop. Blocking reads and writes on pipes should suffice.
 
2:38 AM
I keep getting fucked over by some XML serialization bugs, seems to hard to get Qt to read/write a custom model into XML. Passed my "units", but keeps getting fucked over in production. I need a better file format, that can maybe open with excel or something...
@nwp co-routines are an easy way to write an event loop
 
3:09 AM
@Mikhail Excel uses (a breed of) XML as its native format (.xlsx). Well, technically, the xlsx is zip format, but most of what's in the zip file is xml.
 
I'm thinking the best strategy is to rewrite the xml parsing from Qt to the cereal serialization library. That should de-duplciate the read/write portion but it would require an intermediate representation of the data. Before, I looped over a Qt item model that returned variants, now I'll need to go XML->Qt.
One of the problems I got is that when I write Qt Variants, I attach the internal variant index to each item I write. Then I know exactly what type to convert when I read. Problem here is that the internal indexes change between debug/release and maybe recompile causing chaos.
 
3:39 AM
Is it worth it to spend time learning algorithms and data structures
I mean nobody uses them in projects anyway
I know it sounds so troll to say it but when is the last time you saw someone use a data structure in a real project? They just use basic OOP from what I've seen
 
You should learn domain specific structures
 
The only thing I see useful is learning design patterns for OOP...
 
Also OOP is the devil
 
Wut
By domain specific do you mean like Geometry vs Graph ?
Thanks I'll learn domain specific structures
 
Yes, or more specific, like these are the algorithms and associated structures used to solve clustering problems in image analysis
One thing they don't teach you, is that if you need to crank out a difficult algorithm, you might be given a few days or longer, in the real world.
 
3:42 AM
I need Geometry and mapping algorithms and data structures
As in Google maps related lol
 
Also learning without motivation is hard and possibly useless
 
If I don't use OOP what am I supposed to use? I'm using Java
 
Don't OOP ahead of time
 
Ok...
 
Also the C++ ecosystem is a lot more developed for TSP with numerous easy to use black boxes available.
Actually for most scientific computing
 
3:47 AM
I'm making an Android app not a research paper... But I guess I could always use C++
On the backend or something
Your right I'll do that
 
just do the whole thing in Qt
 
@Mikhail s/OOP/bad OOP/
 
soopbad oop
wise words
 
Except that most problems don't require OOP, so its almost an anti-pattern. Also much like the Devil, its tempting...
 
Indeed. Neither do most problems explicitely require functional/procedural programming. I'd hazard a fair part of it all is preference.
 
3:59 AM
@Mikhail Every language other than machine code is redundant. Most are useful anyway.
 
Its useful if you need to explicitly simulate something, like in game engines...
50% of the problem with OOP is that its easy to teach the keywords/syntax to kids, then they think that to write real code, they need to abstract everything...
Its immeasurably more valuable to have succinct code...
Also OOP almost never delivers on the promise of encapsulation, so you still get coupled classes, etc. At best you have a narrative in a psuedo-human language...
 
What do you think about using diagrams?
 
I use them a lot, although often on paper. Also use them a lot for multi-threaded code. Also draw my GUI, etc before making them...
 
I'm surprised if it's possible to make complex software without complex diagrams
 
Although upon careful inspection, a few of those classes are perfectly valid, as the user requires that you can undo stuff...
 
4:12 AM
That has from oop mostly the word "class".
 
^Yes, that's true. I guess, the real problem is that the Opthalmologyrecords are different classes than the phrenology records. Most of those classes are required for display logic...
 
I didn't make that picture
 
That's a relief, I was wondering if I had just hand waved hours of work with a blunt statement.
 
Another issue is that functions to access data are statically typed, for example, getReccordsAsPatient() would work better if it were getReccords(int role
That way you can simply pass around the role object and mutate functionality at the database level rather than a switch statement in every caller
Also using getters and setters doesn't scale well to large programs. One reason to use getters and setters is to invoke GUI changes, but when you need to make many changes, you need to "batch" gui events for performance reasons...
 
@hexicle Probably isn't. I draw quite a few pictures too, but my ambition leans heavily toward using them to figure out ways to avoid complexity.
 
 
1 hour later…
5:38 AM
So close yet so far ...
 
6:20 AM
Better find a kayak!
 
 
1 hour later…
7:26 AM
Was sailing
Could have gotten a kayak but might be hard to find a docking spot over there
 
train a porpoise for the porpoise of crossing, and charge fare
 
purpose
as
 
 
2 hours later…
sbi
9:51 AM
Please critique the following:
A std::deque is a mix of std::vector and std::list: It has a list of chunks within which it stores its content. Within these chunks, the elements are contiguous. I have an API which takes begin/end pointers into an array. Using the above assumptions, I can pass it chunks of the elements, rather than individual elements.
I have come up with this code in order to find a range of contiguous elements within a std::deque (or any other container, FTM):
// Beware, uncompiled code ahead!
template<typename It>
It get_contiguous_range(It begin, It end) {
    It range_end = begin;
    while(range_end != end)
        if(&*begin + 1  == &*range_end)
            return range_end;
    return end;
}
Do my initial assumptions hold? Is the implementation correct? Anything else I missed in this?
Sigh. Of course, this comparison must be the other way around. I also forgot the increment of range_end: (&*(begin + 1) != &*range_end++). I failed to properly refactor this when I prepared the code for pasting here. And, equally of course, I saw this mere after the timeout for editing your messages ran out...
@Horttanainen: Sorry, I screwed this up when boiling down. :-/
Arg! I also forgot the increment of begin.
sigh
 
@sbi Maybe post the code again?
 
sbi
I shouldn't post uncompiled code before 11am.
 
@sbi obvious UB when dereferencing range_end.
 
sbi
@EuriPinhollow while(range_end != end)?
@Horttanainen Yeah. Just let me make sure I transform it correctly, this time.
 
No, it does not prevent it.
&*range_end - here.
Depends on whether you will pass an actual end of container to this function of course.
 
sbi
10:02 AM
I fail to understand this. This line will only be executed when range_end != end. What am I missing?
 
end being not equal to range_end does not prevent range_end from being end iterator dereferencing which is UB.
 
I missed that
 
sbi
How can an iterator that's not equal end be an end iterator??
 
OH WAIT
I c.
Sorry, I missed that.
No UB here.
 
@EuriPinhollow I understood that you were concerned about user passing end as begin and begins as end? Doesn't this cause end being deferenced?
 
sbi
10:06 AM
@EuriPinhollow But it seems you got me on the right track re UB. The way I incremented range_end in the real code I would have incremented it right past end for empty sequences...
 
@Horttanainen this might be a problem too but that's totally not what I meant. I just was not attentive enough.
 
sbi
This is my current code:
// Beware, code still uncompiled!
template<typename It>
static It get_contiguous_range(It begin, It end) {
    if(begin == end)
        return end;
    It range_end = begin;
    while(++range_end != end)
        if(&*begin++ != &*range_end))
            return range_end;
    return range_end;
}
Damn, why can I never get this correct before I post this.
Now this looks like a for loop struggling to hatch from the code.
 
@sbi actually there is infinite loop in first version because range_end never changes.
 
sbi
@EuriPinhollow Yeah.
 
nwp
You could use if (&(*end) - &(*begin) == end - begin) to test if begin - end is contiguous and then binary-search the end of the range. Unless you get super unlucky with the memory layout.
 
sbi
10:13 AM
What? I'd rather be safe than lucky.
 
nwp
Checking every element it is then.
 
In case of doubt use brute force :P
2
 
sbi
Well, I will retreat to the hot tub now and will be back in about 30mins to check how you all dismantled my assumptions.
:)
 
nwp
Your assumption should still hold for any sequential container like std::list. You end up with continuous ranges of length 1 and lose out on whatever benefit you hope for with continuous ranges, but the algorithm should still produce the correct result.
 
@Horttanainen and even if it was true it's not C++ style to prevent user from destroying the foot, just document the behaviour and fuck the shit up if requirements are not met.
 
nwp
10:26 AM
They made i = i++ + 1; not UB anymore. I'll have to be more careful when screaming UB.
7
On the other hand most questions like "is X UB in C++" can be answered truthfully with "it depends" and then you just conveniently take a break until the person asking the question goes away.
 
@sbi After thinking about it quite a while, it seems correct to me
 
sbi
Thanks, @nwp & @Horttanainen!
Generally, I am disappointed in you lot, though. I was assuming you pick this apart until it stinks. Now I'll have to find all the problems the hard way.
 
Actually, re-reading the original question, let's add a voice of reason - using just c++11 standard library. — sehe 50 secs ago
When you see the obvious answer to a question 3 years late
@sbi mandatory: use std::addressof instead of operator&
 
11:30 AM
@sbi Also, use standard algorithms: c++03 or c++11 or c++11-lambda or c++14 /cc @JerryCoffin
bbl
 
11:49 AM
@sehe nice
 
@sbi Oh. I think it stinks now :)
 
@sbi unfortunately your last paste doesn't work, it always returns ranges of size 1 :(
 
we still haven't doubled the number of algrithms in the standard library since C++98 :(
 
even with the parallel ones?
 
@Morwenn Which is a good sign of constraint
@melak47 Those are overloads
 
11:53 AM
@melak47 I was thinking about names, not overloads :p
 
ok ok :P
 
where's my std::minmax_element_and_is_sorted_until?
2
 
You forgot to propose it
 
couldn't settle on a good name
 
std::do_my_work_for_me
 
nwp
11:57 AM
Why does the if (auto v = 0; v) syntax not compile with while?
 
@Morwenn you can use std::next_permutation to sample good names. Let's just define the lexicographical ordered version as canonical: std::and_element_is_minmax_sorted_until
@nwp I hate that, yes
 
@nwp because it's only for if and switch :^) open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0305r1.html
heh, libstdc++/libc++ have boring deques (or really large chunks): wandbox.org/permlink/Coia2LZe3eTx344x /cc @sbi
 
@nwp I suppose because for(auto v = 0; v;) already exists
 
msvc's `deque` produces some interesting chunks though :D

1 element(s) [51, ] at [000001F32339057C, 000001F323390580)
3 element(s) [52, 53, 54, ] at [000001F323390250, 000001F32339025C)
1 element(s) [55, ] at [000001F32339025C, 000001F323390260)
3 element(s) [56, 57, 58, ] at [000001F32338FDA0, 000001F32338FDAC)
1 element(s) [59, ] at [000001F32338FDAC, 000001F32338FDB0)
4 element(s) [60, 61, 62, 63, ] at [000001F323390020, 000001F323390030)
 
IIRC msvc's deque is known to be kinda broken
 
12:08 PM
I can put the interesting in quotes if you prefer :P
 
12:40 PM
@Morwenn Because adding more algos is dumb; we can't compose the algos we have.
 
moar algos plz
 
meh; ranges plz
 
by the time I reach my deathbed I'll probably regret more things about human relations & stuff than about projects
 
nwp
1:55 PM
My most controversial technical opinion is probably that everything in C++ is pass-by-value. Everything that people call pass-by-reference only refers to what they mean, not to what actually happens.
Although arguably that isn't controversial, people usually all agree that I'm just wrong.
 
I stopped using the terms "pass-by-*" because no one understands what it means
A: hey dude, is X language pass-by-value or pass-by-reference?
B: yeah it's pass-by-value
A: *walks away with a misconception on how things work*
 
@nwp References are passed by reference.
 
nwp
What? No, that's the only thing you can refute without any interpretations because C++ does not allow references to references.
I don't even know what to call it when the types don't match. f(std::string); f("hello");. Pass by construction?
 
2:14 PM
@nwp you haven't played with lambda captures hard enough then
 
@nwp That's not what I meant. If you have f(int&) and then call int i; f(i); then i is clearly passed by reference.
 
nwp
@Puppy That's what I meant with "people call pass-by-reference to refer to what they mean". You mean to pass an int by reference, but you actually construct an int &.
But I guess you could argue that is the same thing.
 
C++ does not have the notion of constructing an int&.
you could certainly argue that that does make logical sense, which it may well do, but that is not what is written in the Standard.
 
C++ references are not objects, but IMO the underlying problem is
28 mins ago, by milleniumbug
I stopped using the terms "pass-by-*" because no one understands what it means
 
pass-by-my home to say hi :D
 
2:28 PM
:3
 
@milleniumbug The bigger problem is that their actual meaning is pretty useless and most languages defy characterisation in this fashion.
for instance in C++ you can pass by value, you can pass by reference, you can pass references by value, you can pass values by reference, etc.
and in C# you can do pretty much all of those as well
it's simply not a useful way to define semantics
 
nwp
I fail so hard at gimp. Tuxpaint it is.
 
Python: rebind names to pointers
 
I wish there is a C++ feature to have unnamed variables for RAII purposes.
 
in Wide I extended the lifespan of temporaries to block scoep
 
2:39 PM
I'm writing some callback stuff and it's nice to have something like anon_raii_store_this_at_the_stack register_callback(...)
@Puppy Temporaries, so arguments and returns?
 
and just random temporaries if you make them
 
With anonymous/unnamed variables lock_guard problems would simply go away.
@Puppy I want those in C++. Or more realistically, for some specially tagged types.
 
that would be bad
better to have some syntax at the use site
 
The type itself would convey that.
I get that there's [[nodiscard]]
 
that would be terrible
template<typename F, typename G> void x(F f, G g) { auto z = f(g()); /* Random scope-wide effects, or not? */
 
2:47 PM
Just when a variable actually "hits" the block level. Like, /* anon_obj = */ f(g());.
 
that does not change the fact that I have no idea if f(g()) will perform that effect or not.
 
Where anon_obj's type is annotated accordingly.
@Puppy The function's signature, anon_obj_type f(), should communicate that
 
right, but I don't actually know what the function's signature is, since I'm in generic code.
 
I don't think this can be applied (usefully) to generic code. I mean, this is for stuff like lock_guard and "make sure to store my return value in the stack" use cases.
Such anonymous objects would also be safer from dangling pointers by making it impossible to take the address at the call site.
For my callback example, it should improve data locality by having something like store_at_the_stack callback_manager::register(auto&& cb). Well, it's actually possible to do now, but you need to always remember to assign the return value at the call site, which is error-prone.
 
3:31 PM
#define store_at_the_stack auto&& _anonymous_ ## __LINE__ ## __COUNTER__ =
or something :P
 
3:51 PM
owch, you have a callback_manager?
 
@sehe FWIW (probably not much), I think I'd do it more like this: coliru.stacked-crooked.com/a/ce060d446ac95ebd
@nwp That creates a temporary, which can be passed by either value or reference (to const), depending on how the function is declared/defined.
 
4:15 PM
@JerryCoffin I wouldn't :) The line
if (discont==begin) // single-element ranges count as contiguous
was very carefully crafted to remove the complexity penalty. If that weren't the goal then the code would absolutely have been coliru.stacked-crooked.com/a/479222e385355bee
I hate code that has mutable local state for no reason.
@Puppy gud joek, blok scoep!
 
@sehe I'm a bit confused about how this affects complexity. Unless we have something truly strange going on (== for the iterators overloaded to return some type for which you've overloaded &&) it's going to do short circuit evaluation, so using the &&, nothing else gets evaluated unless the discont==begin part yields true.
@sehe I do too. But being cleaner and more readable is a very good reason.
 
@JerryCoffin understanding the simpler condition is now trivial (even more so with the comment, which clarifies intent). The compound condition is hard to grok
Complexity of the code is irrelevant to the compiler, obviously.
@JerryCoffin It's not cleaner and certainly less readable ^^
It's only "cleaner" to the dogma of single-return.
To be honest, I'd consider using the handwritten loop instead then coliru.stacked-crooked.com/a/43388d245378dcb0
Other than that, I concur that being cleaner and more readable would indeed have been a very good reason :)
 
@sehe No, it's cleaner because it's much easier to understand the exact circumstances under which the if statement is true. As you wrote it, my first reaction was to wonder whether the author really even understood the condition. My second reaction (if I didn't know better) would have been to wonder whether, perhaps, the author was something like a refugee from Pascal, and didn't realize that C and C++ guarantee short-circuit evaluation.
@sehe I guess if you find it more readable or cleaner, I can't really argue a matter of taste--but at best is most certainly is a matter of taste, not anything like a fact, to which an adverb like "certainly" could apply.
 
4:48 PM
@JerryCoffin Oh de gustibus then. I really didn't grok the compound.
@nwp most calling conventions don't actually "pass" anything, at all. They just "store things in a conventional layout on a (conceptual) stack".
So, there you have it. It's all values.
 
 
2 hours later…
let's corrupt our children /o/
 
6:57 PM
Making babies confused about the meaning of "this" at such an early age.
6
 
XD
 
They'll grow up brainy though...
 
@StackedCrooked JavaScript has "fat arrow" lambdas since 2015. They do not have a this of their own!
 
7:28 PM
@PrinceOwen "If you're odd then you think too much!"
 
8:01 PM
@Mikhail @JerryCoffin this is the diagram i drew github.com/hexicle/soctalk/issues/2
 
user1804599
8:38 PM
Postgres has an internal queue of cache invalidations. It processes this queue whilst waiting to acquire locks.
 
user1804599
This is a very nice idea.
 
user1804599
@fredoverflow I think the whole this fiasco is better solved by having explicit names for this in functions. For example: function foo.() { … }.
 
> OP: "I use a mutex"
> Me: "mutexes rarely work with async code"
> OP: "Oh sorry, I really use condition_variable, that's ok right?"
How to spot someone doesn't know what they're doing
@StackedCrooked Actually, babies are always confused about identity (this, that, me, you) in the first years of development
 
@rightfold The whole this fiasco is best solved by just not letting people randomly assign whatever shit they want to this
although, of course, if people didn't set random shit to this when given the option, it also wouldn't be such a problem
 
9:20 PM
@hexicle rename the class TitsChecker
@hexicle Also is there any reason you need a linehandler class? Compared to just putting the logic for handling lines in the timer thread wrapper?
@hexicle Also do you need a separate class to detect speech locale, or can you put the logic into a function? Or just integrate it with whatever other processing you're doing
 
> TimerRunner
'nuff said
 
He might need to extends Thread, though
 
9:41 PM
 
@sehe well that's a lot of rubbish
 
Can't meme yourself a job without knowing the buzzwords
 
10:05 PM
@ScarletAmaranth cheers
 
10:16 PM
it's fun, actually: "we should strive to keep our code simple"... and then what? Should I copy paste a fragment of code because someone doesn't know what lambdas are, or that you can assign them locally?
Should I remove features from the product that are in the spec because they are inconvenient to implement?
"keep our code simple" is fairly annoying advice IMO
I'd say "document your rationale for choosing one solution over the other in case you need to redo the cost/benefit analysis in the future"
because barely anyone introduces additional complexity because they like complexity. They have a reason, possibly a misguided one, to do it.
 
well that would be annoying as fuck as well
I don't care about your rationale for choosing X over Y
 
well, I also wouldn't care if it's something local
if it's an overall design of the system, then hell yes I'd like to know
 
10:33 PM
?
 
I was literally just typing out what I had...
 
then type that thing in the other room
 
You don't want someone to type something related to C++ in a C++ room. Ok.
 
oh stfu you're the second person who complains that their C++ question is moved to a room which specializes in answering C++ questions
 
10:36 PM
lol
 
Didn't know we needed two separate rooms for one language.
 
Dec 6 at 2:13, by jaggedSpire
Read the rules or UB will get you
 
10:50 PM
@milleniumbug It's not about the code. It's about the code.
Simple code is NOT code that avoids lambdas.
It's simple programs. That have few things that are liable to break. Few surprising performance gotchas. Etc.
 
@milleniumbug It's only because you hear the wrong thing. It's keep your programs simple. Keep your design simple. Keep your thinking focused.
 
Solar powered trees, only in Australia
 
Just don't buy into hype, cargo cult, dogma, convenience, YAGNI etc.
 
@milleniumbug I also found out that keeping code too simple can make it less understandable and readable.
 
11:00 PM
That's not what simple is.
 
s/simple/short/
 
Is KISS hype?
Also is YAGNI bad?
 
11:22 PM
@Telkitty Do you honestly believe trees outside Australia don't use photosynthesis?
@Mikhail Yes and no. On one hand, I'd tend to agree that many people (especially when first introduced to OOP) tend to try to over-generalize, so they often include huge amounts of cruft for which they have no conceivable use. On the other hand, YAGNI is often used as an excuse for ignoring things you absolutely know you're going to need, simply because you haven't quite gotten far enough for the tests to expose problems with fundamentally broken code.
@Mikhail Much like Kiss, it's not hype itself, but there's a whole lot of hype surrounding it.
 
Eating ants is a new hype
 
11:45 PM
#define private public
#define protected public
simplify your life
 

« first day (2611 days earlier)      last day (2338 days later) »