« first day (826 days earlier)      last day (4347 days later) » 

18:00
@melak47 Different use cases.
@melak47 atomic doesn't support transactions
@melak you cant do multiple calls atomicaly , I guess
while (!vec.empty()) vec.pop_back();
// abusing range-based for:
for(auto&& data : box.open()) {
    return;
}
// now do the same with the lambdas
box([&](std::string& data) {
    // what here?
});
-1
Q: C++ defining a number with linear combinations of 2 other numbers with minimum remainder

user1993301I want to write a program in C++: Given numbers l, m, n where m ≤ n ≤ l < 2^31 construct number l in linear combinations of m and n; such that the sum of their lengths(a*n + b*m) is at most l and as close to l as possible. If there are multiple solutions you should prefer the one which uses th...

go go go
18:03
@R.MartinhoFernandes what is return type of .open()
@R.MartinhoFernandes ok, but what does the code do? how it is different from box.open()
@R.MartinhoFernandes @jalf 's syntax was int n = atomic<int>([](...){...});
@StackedCrooked That does not do the same.
why would you use a loop for that
why not box.open() at the top of a block scope
18:05
@R.MartinhoFernandes It achieves the same goal.
@NoSenseEtAl It acquires the mutex, binds the protected data to the loop variable; executes the loop body exactly once; and releases it afterward.
@StackedCrooked Nope. It does not return from the current function.
@R.MartinhoFernandes ah the reference keeping stuff alive trick ?
@R.MartinhoFernandes Ah, I see.
{ box.open(); /* code */ } and move on
18:06
@LightnessRacesinOrbit Where is the data?
you have to add all the iterator shite for a loop that's not a loop
@R.MartinhoFernandes wherever you left it
your loop approach is not expressive or logical at all
@LightnessRacesinOrbit That's library code, it doesn't affect the user.
@LightnessRacesinOrbit IMO, only because I am abusing syntax.
Does anyone see anything wrong with the logic here?
btw another quick Q : in your opinion should std::range be bool testable implicitly aka should this be legal C++1y if (rng) {} or it should be enforced to if(! rng.empty())
18:08
I think the .open() should not be required. Just for (T & t : box) {} should suffice.
@LightnessRacesinOrbit The point is that you cannot grab the data without taking the lock. And taking the lock gives you the data in a variable that has the same scope as the lock. You never see the lock.
@StackedCrooked So? It still exists. Knowing that is sufficient to rile me.
double distanceBetweenLines= defaultPPI*inches;
damn
why is bacon so universally disgusting
18:09
@StackedCrooked No.
I tried that first.
But you need a temporary for this to work (that's what scopes the lock).
@NoSenseEtAl Hmmm. I'd say it should be legal
@DeadMG what is wrong with you
@R.MartinhoFernandes Ah yes. (Reminds me of my ugly FUTILE_LOCK which did the same. It was a macro that had two nested loops. One of them had a loop variable that scoped the lock.)
@LightnessRacesinOrbit me and my inner Haskell programmer(hates typing :P) agree :D
You need: the box, the open_box resource, and the cookie iterator.
That's why .open() is needed.
... and no sense of right and wrong
don't forget that
you need that
18:11
13 mins ago, by R. Martinho Fernandes
@NoSenseEtAl No. That's just madness. I'm joking.
@LightnessRacesinOrbit I know.
But I am a tiny bit serious.
Part of me really wants to use this.
btw regarding herbs transactions... should methods be called in transaction be always noexecpt. I mean I reckon it is hell to rollback that stuff if fourth out of 5 operation fails
robot
.NET's enumerators are T Current and bool MoveNext(), right?
18:13
win
because
I might need to work on this, but I think I might have the interface I need for ranges and streams.
user142019
lol
18:14
Find out more about auto insurance
T operator() = Current, explicit operator bool = MoveNext.
@LightnessRacesinOrbit What?
@LightnessRacesinOrbit yeah epic add
@R.MartinhoFernandes What what?
@LightnessRacesinOrbit What what wha.. ok I'll stop it.
18:16
bool operator()(T t) for "assignment", which is MoveNext too.
I hate to be repetetive, but seriously what about exceptions in those herb transactions... seems lik a big problem to me. (huraay found a problem with herbs Concurrent :P )
@DeadMG Haha, so you changed your mind about preferring Java's interface :P
@NoSenseEtAl The lock is acquired with RAII. No issue.
actually
I didn't
@R.MartinhoFernandes nah, just noexcept every function you write :P
the use case is the same- while(range) std::cout << range();
@NoSenseEtAl That is a separate matter. Good ole try-catch still works...
@NoSenseEtAl See Andrei's talk :P
monitor([](T& t) { try { do_stuff(); } catch(...) { rollback_stuff(); throw; } });
@StackedCrooked I dont like expected<T>
@R.MartinhoFernandes but dont you end up with a crapload of try catch for more than 2 operations, aka what if first fails, what if second fails, what if third fails...
@NoSenseEtAl Use RAII.
18:21
@NoSenseEtAl That's orthogonal to the synchronization problem.
hmmm
what is the difference between a forward range and an input range, anyway?
@R.MartinhoFernandes I dont see how RAII helps for transactions when it comes to operations, for lock obviously helps
@DeadMG It's multi- vs single-pass.
right
@deadmg there is andreis article about iterators - should apply to ranges
18:22
lolbulgaria
@NoSenseEtAl You construct an object that rollbacks on the dtor, depending on an internal flag. After success you set the flag to not rollback.
are output iterators copyable?
op_a();
rollbacker_a r_a;
op_b();
r_a.mark_success();
// can be beautified and shit
@R.MartinhoFernandes or you give to each method a lovely ref to atomic<bool> and you set it to true just before scope exit :D
@DeadMG like i said if you are into iterators check out andreis article
it is good
I trust robot over andrei
18:24
@DeadMG All iterators are IIRC.
@DeadMG Woah.
what?
@StackedCrooked That guy with gun looked highly confused after waving that gun.
What's what-y?
your "Woah"
18:26
FFFFFUUUUUU
I started work on the Unicode bidirectional algorithm today, but those fuckers are going to make changes to it for 6.3. :/
No, Unicode != UTF.
hmmm
UB if you try to go outside the range?
yes
Tis rather big.
And that is not all of it.
@R.MartinhoFernandes lol... ok but what is that you are trying to do with unicode
@R.MartinhoFernandes out of my league, but from what i see something like strings where s[5] is fifth char, not fifth code point
18:32
Meh, that is the least of my concerns.
Gimme a use case for operator[] for text.
@NoSenseEtAl I could write a string container that can do s[5] where it's the fifth code point, but why would I want to?
@DeadMG maybe my terminology is wrong because like i said im horrible with words, what I was saying that for example if every char is 2 utf-8 code points then is @R.MartinhoFernandes string would have s[17] starting at 34rd utf-8 code point btw never heard of collation before ,
there is no such thing as a UTF-8 codepoint, it would be a UTF-8 code unit.
@NoSenseEtAl My string won't have operator[] at all.
@DeadMG see im horrible
18:36
You suck.
user142019
web-routes is fawesome.
@R.MartinhoFernandes will it be immutable ?
@NoSenseEtAl Collation is sorting.
hmm
are there real use cases for, say, random-access write-only ranges?
@NoSenseEtAl I am still designing those bits. I want to support mutability, but I need to find the right set of valid operations. (But I don't plan on making op[]= one; I have no use case for it).
18:38
@R.MartinhoFernandes doh... now when you say it it is obvious, I was a wiki... and reading blah blah total ordering, blah
Dec 20 '12 at 9:41, by R. Martinho Fernandes
> So if you have a list of Aachen, Aabenraa, Zürich the correct Danish sort order is Aachen, Zürich, Aabenraa.
I like to quote this.
@R.MartinhoFernandes will you be doing something very diff to boost locale ? I mean maybe you can submit your work to be merged and enjoy immortality :)
@R.MartinhoFernandes we noticed
@NoSenseEtAl For now I am mostly overlapping work with the still work-in-progress Boost.Unicode.
There is some overlap with Boost.Locale, but not much.
@R.MartinhoFernandes so there is boost locale and boost unicode... Oh man... :)
I don't plan to really mess with locales until I have all canonical Unicode algorithms up and running.
Ogonek, while it may not be production ready, is far better than what I've come up with by a longshot.
Once I reach that point I will see whether I want to tackle the CLDR and tailored algorithms. I think that will be a lot messier than the messy things I am already dealing with.
@DeadMG I remember this being poorly documented in the standard, as well. I'm trying to remember what my exact gripe with this was, but it came down to obvious stuff not being explicitely specified
@R.MartinhoFernandes one algorithmic question: regarding your Danish sort... do you just switch what some binary value means so you can use normal machine instructuions for < ops, or you keep their values and do painfully slow comparisons ?
18:45
@NoSenseEtAl I don't do that sorting yet. And for that matter, I think no one does that sorting correctly, because it would bring little benefit for the effort/performance impact it takes (it requires keeping a list of all location names in Denmark).
@R.MartinhoFernandes wait, they sort locations differently from how they sort words ?
Nah. It's that Aabenraa is actually called Åbenrå (Å is somewhat interchangeable with double A; I don't know many details about that, since I know jack shit about Danish), and Å sorts after Z.
But Aachen, not being in Denmark, is not Åchen.
user142019
lol
FWIW, getting Aachen, Zürich, Åbenrå correctly sorted is easy, which is another reason to not care about "Aachen, Zürich, Aabenraa".
@NoSenseEtAl It's not really about locations -- it's keeping track of whether Aa is really Aa, or shorthand for Å (which, ultimately, you can't do with certainty, of course, especially if, for example, it's in a person's name).
user142019
18:49
So you need a database of words for sorting?
sweet zombie jesus, so much problems to do such a "simple" thing :D
Why is it suggesting what I'm already doing?
@R.MartinhoFernandes Hi?
user142019
@Alec Hi?
18:50
@Zoidberg Hi?
@NoSenseEtAl That's why I like to quote that example. It is so small and simple, and yet it shows how mindboggingly crazy this problem domain can be.
@Alec Read closer, and pay attention to the character before "BCLauncher" in the error message.
btw one quick Q regarding boost ASIO: from what i know it is kind of high level C++ lib, but it is also quite old lib... Is there any other newer more modern style nw lib(I know ASIO is not just about nw but that is what I care about )
Bint.
user142019
Boost.Asio is so verbose and overly complicated.
@NoSenseEtAl Btw, what is your native language?
@Croatian :D Sorry to dissapoint you but no weird letters in my country :)
btw do i get banned for saying croatian and not C++ :P
I defined each member in terms of a hypothetical three-iterator implementation
@NoSenseEtAl It's somewhat old, but updated quite regularly, so it includes support for movable objects, can use std::atomic, std::chrono when available, etc. In short: no -- nothing more "more modern" is available.
user142019
@NoSenseEtAl y u no write it yourself! :D
and, what I'm more impressed with, is that there is no UB unless you were given an empty range to begin with.
18:56
@Zoidberg will do, first i need to learn haskell then insert its x86output into inline asm aka extern haskell :P :D
which I need to deal with.
@JerryCoffin tnx for the info. I assumed that, but I wondered... for example friend recenlty said POCO seems easier to use for nw.... I said IDK my dear friend :D
or rather
I think that this range design requires a one-before-the-begin, rather than a one-past-the-end.
@NoSenseEtAl I'd say that asio may seem harder because it isn't a straightforward imperative design. I don't know if POCO supports asynchronous I/O though.
@R.MartinhoFernandes asio is pretty much when you get something on socket run this function(binding function to some event) ? Am i right ?
18:59
Yeah, you pass functions in.
@NoSenseEtAl Poco certainly has some good points, and it might work better for what you're trying to do. But, it's a more specialized library than ASIO (and if memory serves, it's actually built on top of ASIO).
@NoSenseEtAl My native language is pretty tame too. I was just curious because I like to collect these tidbits of craziness for when I need examples :)
@NoSenseEtAl You mean L followed by j is considered a separate letter on its own?
"enjoy"
19:02
@NoSenseEtAl Thanks.
Ah, I see. I knew of languages with similar stuff. Thanks anyway.
user142019
// I just want this.
Socket server;
server.listen("0.0.0.0", 1337, [] (Socket& client) {
    client.onData([&] (std::vector<unsigned char> data) {
        client.writeData(data);
    });
});
@NoSenseEtAl Do they sort "normally" as "L-followed-by-j" or in some other position?
Btw, the "nh" in my name is pronounced as "Nj" in your language ;)
hmm
At work only the receptionist gets that right :(
@R.MartinhoFernandes tbh IDK, i think they sort as a separate letter and that there isnt a single word that has l followed by j and not a single word that has n followed by j, also same for Dž
19:06
.NET's range model requires one-before-the-begin for simpler uses, whereas C++ iterators offer one-past-the-end.
the translation is not fun
@NoSenseEtAl Ok. I can check that myself if I get really curious.
Is there a way to get the file size from an ifstream other than seek(end) + tellg() ?
@DeadMG Yeah, I remember that when I wrote some in C#1. The constructed state is basically "empty".
@AndreiTita tellg() + seek(end)
@R.MartinhoFernandes tbh I think they are counted as a separate letter but you should check if you ever care :D
19:07
@AndreiTita Most platforms provide something, but that's about all you can do in portable code.
@R.MartinhoFernandes I don't think it requires any more complexity than the C++ model.
@R.MartinhoFernandes So you let the others call you a ho or what?
it's just defining one in terms of the other
Alright, thanks.
user142019
@StackedCrooked that's the same.
19:08
@LucDanton No. They use something like "Martino". FWIW, it's like "gn" in French.
Or ñ in Spanish.
What ho? Martinho!
user142019
Like Martienjo in Dutch. :P
> Other letters and digraphs of the Latin alphabet used for spelling this sound are ⟨ń⟩ (in Polish), ⟨ň⟩ (in Czech and Slovakian), ⟨ñ⟩ (in Spanish), ⟨nh⟩ (in Portuguese and Occitan), ⟨gn⟩ (in Italian and French), and ⟨ny⟩ (in Hungarian, among others).
user142019
user142019
^ this stuff is good
19:12
@Zoidberg Really? (How do you know?)
user142019
"Like" as in "very similar to".
user142019
(I know how Spanish ñ is pronounced, and you mentioned Spanish ñ.)
@R.MartinhoFernandes I agree with @Zoidberg
user142019
From El Niño and coño. :P
19:15
@Zoidberg The same, actually. At least judging from this nl.wiktionary.org/wiki/oranje
Aww man
Woot, more people can pronounce my name correctly.
Am I gonna have to devolve into GetWindow SetWIndow ? D:
user142019
¡Coño!
#include <Coño.h>?
user142019
19:20
lol
user142019
MS-DOS is offensive.
indeed
This discussion is growing too long and hard to follow. However it contains good information which should be integrated into the post. Please do that! — markus-tharkun 5 hours ago
How exactly am I supposed to do that lol
edit button?
Edit it into your answer?
user142019
19:22
I should write a web framework in C.
My question wasn't technical lol
@FredOverflow Hire an integrator.
wtf, why would you write anything in C?
fucking... is there no good way to get the proper PPI of a screen or did my picture print wrong?
@DeadMG Don't bother. Kid's not sane.
19:24
fair nuff
@DeadMG lol!
@R.MartinhoFernandes Should be a perfect fit -- two kids, both insane, but in different (nearly opposite) ways.
Woo!
I can finally seamlessly appeal to all your TERRIBLE space/tab conventions when I check into your repos: editorconfig.org
user142019
@DeadMG because I'm insane.
I once tried to write something in C. That was in 2007. I gave up quickly.
lol
19:32
What was it?
user142019
lolnoob
@FredOverflow I was tinkering with Windows API at the time. A small Windows application probably.
Lack of vector, string, map made me feel like a man with no arms and no legs.
Okay, maybe no arms and no legs, but C programmers have huge penises!
2
Hm, it appears popcorn isn't particularly unhealthy. Good, I just ate like 100g of popcorn.
user142019
19:36
One thing I dislike about F# is that the order of the source files in the Solution Explorer affects the compilation of the code.
@FredOverflow You cannot buy so little popcorn at the theater.
I don't understand why people have trouble with 'nh'
it's obvious to me
@LightnessRacesinOrbit Most native English speakers I have come across could not pronounce it if their life depended on it.
And as I learned recently, the same applies to native German speakers.
19:39
@R.MartinhoFernandes I made it myself. It's incredibly easy and cheap. Also, popcorn weighs almost nothing. 100g is quite much.
@FredOverflow Ok, I admit I have no idea how much a kilogram weighs (and that means I don't know about 100g either).
100g seem to equal 0.22 pound or something, dunno
100g of something really isn't much.
for foods, anyway
funny how trivial questions like "is for loop better than while" get piles of upvotes
Anyway, may large pot was completely filled.
19:43
@FredOverflow lol, that doesn't help.
@doug65536 Try "Should I write int* p or int *p?" ;)
@R.MartinhoFernandes What unit of measure to you use for weight?
@FredOverflow lol exactly
1lb = 454g IIRC
1lb = 0.454 kg
@FredOverflow I use "very light", "lighter", "light", "normal", "slightly heavy", "heavier", "fucking heavy".
the last enum covers quasars?
slight lol
19:52
@R.MartinhoFernandes I'm confused. Is "lighter" actually lighter or heavier than "very light"? Based on the sequence, it appears to be heavier, but using "lighter" to mean "heavier" just doesn't seem very intuitive. (likewise "heavier" vs. "fucking heavy").
Since this is stackoverflow: a prefix 'very' is more powerful that a postfix 'er' :P
user142019
lol subscripting syntax in F# this.Get.["/~{username}"].
user142019
Dat period.
sbi
sbi
@DeadMG Try 100g of this. That's a lot of tea.
19:58
too many "cute" languages that are way too full of cleverness to be used for serious development
100 g of hydrogen is a lot
user142019
@StackedCrooked What has more mass? 100g of hydrogen or 100g of lead?
sbi
sbi
@R.MartinhoFernandes Wait. Did you just say you "have no idea how much 1 kilogram weighs"?
Silly joker.
@JerryCoffin If I was writing it on paper I would have drawn two arrows in opposite directions starting from "normal". That would make it clearer.
sbi
sbi
19:59
@StackedCrooked That's not food. I think.
@sbi Haven't tried it tbh.

« first day (826 days earlier)      last day (4347 days later) »