« first day (1042 days earlier)      last day (3922 days later) » 

9:01 AM
Partners don't steal each others Pizza!
 
Hm.
I wonder what the complement of a left-shift by 6 bits is...
 
Xeo
@R.MartinhoFernandes So for Asio, maybe we need a future-like fire-and-forget thing that doesn't rely on callbacks and can be composed. Composing the operations before handing them off to async_* functions works for 1-to-1 composes, but when_all and when_any can't easily be expressed through that, I think.
 
@FredOverflow Well, grounds for divorce, sure. I need absolute proof, maybe a webcam on top of cupboard...
 
@ThePhD What do you mean?
 
A right-shift by 6 bits?
 
9:06 AM
As long as no information is lost...
@MartinJames There are lots of reasons for divorces...
 
@FredOverflow Well, would have to be rotates, then.
 
Why do you want to shift left by 6?
 
@FredOverflow She looks really disturbed
 
@FredOverflow Why did the chicken cross the road?
 
@FredOverflow Uh. No reason, really. Just being dumb and trying to reverse this algorithm bit by bit..
 
9:07 AM
@FredOverflow Heh! Anne can watch what she likes and have multiple affairs, but she should really stay away from my pepperoni and jalapenos.
 
I wonder if I should start jogging...
 
Jogging? I that another kind of bitwise operation?
 
looks more like a titwise operation
8
 
Oh.. no, it's not..
@FredOverflow That really deserves stars two at a time :)
 
@MartinJames one start for each... bit? :)
 
9:12 AM
@FredOverflow Summat like that, yes. Please delete it now, it's disturbing..
Or
Post
A
 
@FredOverflow onebox, really? Whatever happened to just linking?
 
lot
so
it
 
scrolls
 
@ThePhD Get ready for pain. Your function is broken at the interface.
 
9:13 AM
@R.MartinhoFernandes q___q
What did I do now?
 
OK, that worked, together with reducing the height of my FF window.
 
Also, this is pretty cool: space.com/4271-huge-hole-universe.html
 
Oh, wait, it's an output iterator. Nevermind.
 
@Mysticial Turns out this guy is still mad
 
WTF is ReverseEncodeOneBytes then?
 
9:14 AM
What is OneBytes, anyway?
 
@jalf Is it time for a 'Yo momma' joke?
 
@Mysticial Downvote to lower then 2k again
 
@MartinJames You can scroll up from time to time, if you feel like it ;)
 
Why would you want to encode things reversed?!
 
@FredOverflow OneBytes, TwoBytes, OneByteses, TwoByteses, ...
 
9:16 AM
@R.MartinhoFernandes Encoding and decoding in reverse means I can read from the end of a byte sequence to the beginning.
Or, that's the hope anyhow.
 
@ThePhD You cannot read from an output iterator.
 
R#'s Ctrl+N owns.
 
(i.e. What you said only makes sense for decoding)
 
Well, obviously I won't be doing ti from an output iterator. There's a separate function for decode. ._.
 
@ThePhD Then... your question is moot. ReverseEncodeOneBytes is to be deleted.
 
9:18 AM
Okay.... what about ReverseDecodeOneBytes ?
 
That one will also not involve reverse iterators in any way.
Well, you could, but it doesn't really help a lot.
 
Are you lot lurching dangerously towards a fat_pointer again?
 
Suppose you have a function that decodes one code point. What you need is a "find previous starter byte" function, and then normal decode from that starter.
 
I can do that. I'm more curious as to if it's possible to decode from the back of a byte sequence.
 
I just told you how.
 
9:23 AM
I don't want to go backwards, then go forward.
I want to encode only going backwards.
Er, decode
 
@ThePhD You don't need to.
You can simply collect the bytes as you look back for the starter.
The maximum is four anyway.
Example (| marks the iterator position): given 24 C2 A2 E2 82 AC |. After "find previous starter you are left with 24 C2 A2 | E2 82 AC and E2 82 AC in a small array. Run decode in that small array, return. Next time, FPS leaves you 24 | C2 A2 E2 82 AC and C2 A2 in the scratch array. Decode the array, return. And so on.
 
Can I compose the code point value without giving the sequence to the forward decoder, though?
E.g. can I build the value while going backwards, from AC to 82 to E2
Without saving the bytes
 
Yes, that's possible.
Test if it's a continutation or starter byte. If continuation, drop the leading 10, put remaining bits as least significant in temp result, save current bit position. If starter drop the appropriate lead, do the same, return.
 
0
Q: unable to convert c code to c++

user2090491I was looking for a piece of code which is able to test point inclusion in polygon. I found the following code which is written in c. I never worked with C, but I know a bit C++. could any one help me please to convert this code to c++? int pnpoly(int nvert, float *vertx, float *verty, float tes...

 
Snailpocalypse:
http://www.bbc.co.uk/news/science-environment-23798012
Also, this needs to be stopped, now.
http://stackoverflow.com/questions/18399209/to-what-extent-can-php-help-us-when-developing-desktop-application
 
9:32 AM
Do keep count of how far back you went, though. You wanna stop at four and produce an error immediately instead of... well, bad stuff.
 
Xeo
@R.MartinhoFernandes Wouldn't that just be the size of the scratch array?
Also, your thoughts on the Asio/future stuff?
 
Which brings me to... It might require some extra care to guarantee the reverse sequence is really the same reversed if some replacements are needed.
How do you apply replacements if you have an invalid input? One per byte? One per... whatever amount it took for the decoder to realise it's broken?
@Xeo Need to think about it.
 
Xeo
k
 
@ThePhD Actually, I'm certain that, in the presence of replacements, decoding backwards properly is a fucking mess.
I can produce an example later. Need to be elsewhere for a while.
 
@R.MartinhoFernandes have fun
 
9:49 AM
btw @ThePhD look at python.org/dev/peps/pep-0393 for internal representation stuff.
 
@CatPlusPlus I saw the presentation and several other videos. I'm up and up on that.
 
hmmm
I think I might have ballsed this up somewhat.
 
Consider F0 C0 C0 C0 C0. That would be U+10000 U+FFFD. You need an algorithm that produces U+FFFD U+10000 in reverse. You have no choice but going back and forth, I think.
Make that F0 C1 C2 C3 C4 for easier discussion.
 
Ahaha
Trying to restore 1GB SQL dump.
ERROR 2006 (HY000) at line 739: MySQL server has gone away
 
You need to go to C1 to find out that C4 is bad. Then emit the replacement and leave the iterator at C3 | C4.
 
9:58 AM
Decoding backwards is silly. Decode once and use an internal representation that doesn't require further byte-fiddling.
 
Xeo
@R.MartinhoFernandes Alright, I'm definitly in Berlin on the 30th
@DeadMG You? Fucking something up? Never happened before!
 
lol
well, I decided to use exceptions to report errors in my parser, which works really nice
 
Xeo
@CatPlusPlus Isn't that what normalization forms are for?
 
except when I try to code in error recovery, which in most functions involves a bunch of try/catch, and sometimes, just a try/catch on every function call that can throw.
 
Xeo
ew
 
10:02 AM
yeah.
 
Xeo
Make yourself some RAII-ific things
 
@Xeo Even normalised UTF-8 would require further proper start byte finding stuff when viewed backwards.
 
there's nothing re-usable to do in an RAII-ific thing.
 
Damn.
 
each error point needs it's own customizable cleanup.
 
10:03 AM
So, pick an internal encoding that doesn't require that.
 
Robot's right, this shit be hard. =/
@CatPlusPlus Even UTF32 wouldn't be quite so immune.
 
Monads and shit
 
Normalising is a different matter.
 
@R.MartinhoFernandes Yeah, I've been thinking about instead returning variant<correctresult, error>.
or optional<error> for functions that otherwise return void right now.
 
Also bind() with error collecting. :drool:
 
10:04 AM
Exceptions aren't good for applications that are meant to recover.
 
@ThePhD The issue isn't about that, it's about the scale of recovery points.
as long as I have just a couple, then it works just fine, since I don't have to manually code every propagation point, for example.
 
You should just write a error-returning version, and then an exception-throwing version.
 
but when I'm looking at at least attempting to recover at basically every single possible error point
exceptions aren't such a great model anymore.
 
@ThePhD Exceptions can be caught you know.
 
Xeo
10:06 AM
@CatPlusPlus Monoid on the Error?
 
the real question is
is boost::variant header-only.
 
@Xeo Something along the lines of ListT maybe.
 
ITT puppy discovers the error monad.
 
Xeo
@CatPlusPlus Didn't read about those Transformer things yet
 
@DeadMG I think so.
 
10:07 AM
@DeadMG Shouldn't it be tuple<result, diagnostics>?
For warnings and shizzle?
 
Or just write your own monad.
 
Xeo
@R.MartinhoFernandes tuple<optional<result>, diagnostics>? :P
 
@R.MartinhoFernandes Don't need to return warnings, I already have a function that handles them just fine.
 
tuple<optional<result>, optional<diagnostics>>
 
and I have a callback for errors too
 
10:08 AM
@Xeo They get unwieldy easily. A lot of time I prefer to write my own monad instead of stacking a zillion transformers.
 
Xeo
mh
 
I mean, if I didn't want to recover, I'd just leave it how it is
 
I won't shun them for a two-level thingy though.
 
Btw, did you see Alexandrescu's talk about this ?
 
Some transformers are pretty brittle.
 
10:09 AM
maybe I should just do that.
 
Unless error is involved.
That one is confusing.
 
nah
 
@StackedCrooked I know.
 
Of course ;)
 
@ThePhD That one is impossible to decode backwards from bytes unless you know the length of the sequence.
 
10:11 AM
@R.MartinhoFernandes ~Sigh~ Alright, you win.
 
You know, there's a reason I have decided to not tackle this matter yet in ogonek :P
 
fixed_vector<byte, 4> maxunits; while ( detail::trailing( *bytes ) ) maxunits.push_back( *bytes-- );
 
Btw, boost 1.54 added static_vector.
 
Huh. static is a better name than fixed
 
10:14 AM
static/dynamic, fixed/broken :D
 
It's *--bytes
 
@R.MartinhoFernandes q___q
 
You don't want to go around dereferencing end iterators.
 
Oh, right. Because .end() is after the thingy
 
To be on the safe side, just wrap them in reverse_iterators and use the normal idioms.
 
10:14 AM
Also, --bytes or ++bytes ? (reverse iterator)
 
@ThePhD Is it a reverse iterator or a just bidi one?
 
I would using something like rbegin and rend for backwards iteration.
 
Xeo
Btw, was the decision that the Left side of Either represents errors, rather than the Right side arbitary?
Or that "Right value" sounded nicer? :P
 
If it's a reverse one, it needs no special treatment: *bytes++ as usual.
 
@R.MartinhoFernandes I was having that design discussion earlier. Nobody really gave me a concrete answer.
 
10:15 AM
@Xeo Yes.
 
Xeo
It "Left anError" or has the "Right value"?
 
I wanted to know if I should make the user give me a reverse iterator, not a bidi one, so that I could use forward-iterator semantics.
 
@Xeo That's the reason, yes.
 
@Xeo I often prefer to put the type with the highest alignment first. (But template type order doesn't affect memory layout , silly me.)
 
Xeo
Wokay.
 
10:16 AM
It's mnemonic.
 
Xeo
@StackedCrooked We're not talking about C++ here :P
 
Lol
I think that, to be as fair as possible, expecting a forward iterator might not be a bad thing to do.
That way I only need forward iterator semantics throughout.
Rather than requiring -- and all the other pieces of bidi.
 
@ThePhD Dunno. If you ask me, I wouldn't expose this functionality.
 
10:18 AM
@R.MartinhoFernandes It's mostly for internal implementation of things like TrimEnd and friends.
 
@ThePhD Exactly. Keep it at that.
 
Morning
 
Also, would you consider Trim and other text-removal functions to work over grapheme clusters?
Or would you expect them to work over codepoints?
 
I would expect you to stfu bitchface
OHAI!!!!!!!!!!! :)))))))
 
@ThePhD some_text.erase(range);. Problem solved
 
10:20 AM
@LightnessRacesinOrbit You can do whatever you want to my face, Tomalak. <33
@R.MartinhoFernandes I don't understand.
Ah, well. Hm.
 
@ThePhD Why make a decision at all?
 
I wanted to have things like TrimEnd( 20 ), but I guess that's a legacy holdover from thinking in English. =/
 
Just provide functionality to remove bits and let the user find the right positions themselves.
 
TrimEndUntil( range ); <3
 
So, that would be some_text.trim_from(text.end() - 20) or similar.
(Maybe with advance or whatever)
 
10:22 AM
Hm. Well, okay.
@R.MartinhoFernandes My decoder_iterator doesn't really, uh, support bidi semantics yet. :c
 
IMO if at some point you take indices as arguments, it sucks.
 
That's one other reason for implement ReverseDecodeOneBytes
 
11 mins ago, by R. Martinho Fernandes
You know, there's a reason I have decided to not tackle this matter yet in ogonek :P
 
Well, if I come up with anything worth while (never ever going to happen) I'll let you know. :D
 
R. Martinho Fernandes - Tackle This Matter In Ogonek.mp3
 
10:24 AM
I think I have a pretty good idea of the subject, which means I know how fucked up it can be so I avoid it.
 
hmm.
 
Going by this strictly you shouldn't be implementing Unicode at all.
 
maybe the variant thing is a mistake, since it's just become apparent to me that I have no idea what to do.
 
Monads~
Drupal is a lot of fun.
 
10:26 AM
Monads are ez.
ezpzwz.
 
@DeadMG Without nice monad composing syntax, I believe you are just stuck with the same problem: boilerplate all over, just a different kind of boilerplate.
 
Database is full of tables called field_data_field_<field>
 
Add do-notation to Wide.
 
@CatPlusPlus Called it years ago.
 
10:27 AM
@StackedCrooked Not particularly, no. The only thing you'd be saving is a default constructor call (probably inlined)
 
Probably one of the first suggestions I made.
 
Moves are a little more expensive on strings than I thought they'd be, 'cause of SSO.
I mean, really only the tiniest smidgen.
 
But don't forget to use JavaScript or C syntax, since it's much clearer~
 
Xeo
haha
 
concurrent_queue of std::function cause huge amount of operator new and delete calls.
 
Xeo
10:28 AM
Only if you have huge function objects stored.
 
that's almost certainly an artifact of concurrent_queue.
 
@Xeo Right it should use small buffer.
 
and that your function object you're storing is pretty big.
 
However, callgrind shows me as the #1 source of operator new calls.
 
concurrent_queue isn't move-enabled unfortunately so you're gonna get ten trillion copies.
 
10:29 AM
Jul 12 '11 at 11:33, by Martinho Fernandes
What? No do-notation equivalent?
 
output iterators don't really have -- or any concept of -- do they?
 
Wasn't exaggerating with "years ago".
hehe
@ThePhD No.
 
Bleh. I should really use forward-iterator semantics then.
... BUT WAIT
I CAN'T
 
Xeo
@DeadMG std::function isn't noexcept-move enabled :<
 
10:30 AM
and that.
seriously, I can't believe there are basic Standard classes like that that are not noexcept move.
 
Xeo
@StackedCrooked The allocating kind, or the emplacement kind?
 
Silly me, I profiled a debug build.
 
if ++ means "go backwards" when in ReverseDecodeOneBytes, and then I pass the same iterator to DeconeOneBytes, then it'll be the wrong kind of iterator.
 
@StackedCrooked lol
 
Xeo
@StackedCrooked lol
 
10:31 AM
This means that I have to use -- semantics, in order to be consistent. Or store a array/vector.
 
@ThePhD Gosh no,.
 
Guesssss I'll just make a vector. Array. Thingy.
 
Today, I suck.
 
Use the abstractions.
17 mins ago, by R. Martinho Fernandes
To be on the safe side, just wrap them in reverse_iterators and use the normal idioms.
 
Xeo
@StackedCrooked Don't worry, @ThePhD is with you.
 
10:32 AM
I don't suck. q_q
 
Take normal ones, but wrap them in reverse ones.
 
Also it's almost 4 AM.
 
The reverse ones take care of using correct -- idioms for you.
 
Why are CMSes always so shitty.
 
@R.MartinhoFernandes So, ReverseDecodeOneBytes takes a forward iterator that goes backwards over the sequence. I'd have to use reverse_iterator<iterator_t> it( current ); before passing it to DecodeOneBytes.
Right?
Or am I missing something?
 
10:35 AM
No. It takes a bidi iterator. First thing you do is wrap it in a reverse one and use that to find the starters and stuff. To pass to DecodeOneBytes you pass rev.base().
 
@R.MartinhoFernandes What would you suggest?
 
@R.MartinhoFernandes That.... seems... so... counterintuitive? I guess.
So I'd call ReverseDecodeOneBytes( bytesequence.end() ) and then mutate it on the inside?
 
That's a broken interface.
 
There's a safety-checked version for babies later.
 
10:37 AM
I don't know what you mean by broken. :c Apparently.
 
You don't know if the iterator you were given is usable in any way whatsoever.
 
Xeo
@DeadMG do-notation, d'uh.
@ThePhD There's a reason robot used ranges :D
 
@Xeo As if I'd know what that is
 
Xeo
@ThePhD It's not just a fucking "safety check".
 
There's a version that takes two iterators to check if it's invalid. This is the unchecked version.
 
10:40 AM
@DeadMG To be honest, I really don't know how such a thing might look in a more imperative language. Haven't though much about it. I think it's really worth having because there are no pretty workarounds for its lack (as you are witnessing right now, hehe).
@ThePhD And that gains you?
 
Xeo
@ThePhD A single iterator is worthless, period.
 
One will safely check against the iterator to make sure you haven't reached the end of the sequence. The other assumes you've already checked and/or know what you're doing.
 
@ThePhD It's not just that.
You will be advancing the iterator more than once.
Are you saying it assumes you already made a pass over the sequence and made sure it was a valid UTF-8 sequence?
Amazing.
 
@R.MartinhoFernandes Well, it might well be that such a thing would be implementable as a library in Wide when I finish the metaprogramming stuff, instead of needing to be a language feature. But since I have no idea what would solve the problem I'm having right now
 
@R.MartinhoFernandes Yes.
 
10:43 AM
I mean
 
Xeo
@DeadMG Okay, what exactly is your problem now that you have variant<result, error>?
 
@R.MartinhoFernandes You'd never know if the UTF-8 sequence is invalid until you actually find out its invalid by incrementing the iterator and reading the values... so what's changed?
 
@ThePhD Consider F0 C0. (just decoding normally forward to avoid orthogonal confusion)
You read F0. Fine. Now you need to read three more.
How do you know you don't have three more to read?
The only way to guarantee that is to make a first pass and do all the tests... (IOW to decode it first)
 
You don't.
This decoding function's job isn't to check for a valid sequence.
 
@ThePhD Then why does it produce replacement characters if it finds invalid bytes?
 
10:47 AM
It... doesn't?
None of the decode functions vomit out a replacement character. Encode does.
 
@Xeo Well, visiting a variant involves writing a local functor, it can't even be a lambda, so if I want to code a branch depending on whether the function I just called succeeded or not, then I'm looking at even more mess than try/catch.
 
Replacement characters are the most useful on decoding :S
 
I'm... confused. :c
 
the fact that I need actual logic rather than "propagate" is the issue, otherwise I could just code an operator that can be like, "Call lambda if success; propagate if not success" (or use exceptions which offer that logic for free).
 
10:48 AM
Replacement characters on encoding are a very rare occurrence (I wouldn't blame someone from going as far as calling it a bug).
 
Oh. I think I understand what you're saying.
 
Decoding F0 C0 is either an error or U+FFFD.
In your function, it's UB.
 
@R.MartinhoFernandes In this case, the assumption is the iterator given has enough space to keep going for the sequence it's going to encode.
 
@ThePhD My point is that there is no way to make that assumption unless you already decoded the sequence.
 
@R.MartinhoFernandes Yes, like if I was working on TrimEnd() inside of some text that already had been encoded properly and fixed up.
 
10:52 AM
@DeadMG Yeah, 'cept that gives you some CPS-y style.
 
@R.MartinhoFernandes Yeah.
I guess that
I could just always put the error on one side of the variant, for all variants.
then I could have like, bool success(variant&& t) { return t.which() == 1; }.
then just have massive if statement chains.
 
@DeadMG do-notation basically makes that look natural instead of CPS-y. Think C#'s async/await (except extensible).
 
@R.MartinhoFernandes Yeah, but it's still not actually appropriate because I need more than "propagate on error", I need "try to recover on error".
 
What more?
 
if I only needed propagation exceptions would do the job just fine
 
Thank you! I like it too. I should upvote that too. Oh wait :/ Cheers — sehe 1 hour ago
 
@DeadMG What's recovery like?
 
0
A: Drupal Database Structure - Efficient/Inefficient?

sceoYes. Drupal stores field content in individual tables so that it will be maximally flexible (for example, if you wanted to re-use those fields on other content types besides "organization" later), it is already in a multi-join table. The tradeoff is performance, which Drupal makes up for with cac...

Look at this post.
Look at this sentence.
Look at what I have to decipher.
 
@R.MartinhoFernandes Well, I check the last token and if it's one that I can accept, then I accept it and move on; else I propagate.
 

« first day (1042 days earlier)      last day (3922 days later) »