WTF Bites
-
@rhywden you just don't understand Common Core.
-
@rhywden Are they testing for teachers who don't pre-check the tests they put out?
The fun part is that the included solutions are even more wrong. For example, the answer to question number 2?
It's "Jazz".
-
@rhywden 'More Cars in the Country' is, IMO, Miles Davis' greatest album.
-
@rhywden Having looked up the sourceand it looks like the questions are mixed up between the graphs. This is one of 10 variants . The other variants have different graphs and the other graphs do include columns âCountryâ, âInterviewâ, âFishâ, âGerbilâ and â80sâ. Like if somebody generated the questions pseudo-randomly with some code, but threw the quantities from all the graphs into one bucket.
You also forgot to mention the âcorrectâ answers. In the same page, the reasonably sounding question âOf what colour are there exactly two carsâ gets the answer of âJazzâ, which somewhat breaks the idea that the columns from wrong sheets were included, because while there is a column with value 2 hereââredââthe column âJazzâ on the previous page has value 9. . The âcorrect answersâ for the previous two question do correspond to the values from previous versions though.
The fun part is that the included solutions are even more wrong. For example, the answer to question number 2?
It's "Jazz".Excuse me, that was answer 3 Answer to number 2 is âCountryâ.
-
@Rhywden from what I've seen of most teacher materials, this isn't so uncommon. The number of just plain wrong things people put out as "educational" is depressingly high. And the number of teachers that don't catch it...well...I'm afraid to ask.
-
@benjamin-hall Yes, but this one really takes the cake. Go, look. There is a page with 10 questions and for all of them either the question or the answer refers to something that is not in the graph and is utterly absurd in context. And there is
98 (the first is actually correct) more sheets with comparable quality.
-
@benjamin-hall Yes, but this one really takes the cake. Go, look. There is a page with 10 questions and for all of them either the question or the answer refers to something that is not in the graph and is utterly absurd in context. And there is 9 more sheets with comparable quality.
The first page for each type of task actually is correct, though. Someone probably messed up their iterators.
Maybe they used a language which has their iterators out of scope of the
for
loop?
-
@benjamin-hall I'll take one exemplary page with me and show it to my colleagues.
I predict many "Wat."s will be had, coupled with a number of WTF!s when I show them the suggested solutions.
-
@rhywden Yeah, I am seeing it now too. The first page is correct. Then they start to use items from the previous pagesâbut never the following pagesâand go wrongâeven if they actually happen to otherwise make sense (on the second page, âwhich program had exactly 2 commercial breaksâ has answer âJazzâ, which is from the right graph, but it had 9 according to it).
-
How many cars were a snake?
Were there more cars in country or more cars in yellow?
How big is the difference between the number of cars in a fish and the number of cars in an interview?
How many more cars are there in interview than in gerbil?
Are there less cars in the 80s than in a gerbil?I think I know who wrote that test:
-
@tsaukpaetra said in WTF Bites:
@ben_lubar said in WTF Bites:
@tsaukpaetra said in WTF Bites:
@anotherusername said in WTF Bites:
@lb_ Can you provide an example?
This method lacks await operators and will be run synchronously.
Yes, thanks visual studio, I'm doing this intentionally because the calling function requires an async method and I don't want to put in a dummy awaited task just for that!
You... do know that
Task.FromResult
exists, right?Nope!
And I must be doing it wrong, because the only way I can get VS to shut up about my usage of that is:
await Task.FromResult(true);
-
@tsaukpaetra said in WTF Bites:
@tsaukpaetra said in WTF Bites:
@ben_lubar said in WTF Bites:
@tsaukpaetra said in WTF Bites:
@anotherusername said in WTF Bites:
@lb_ Can you provide an example?
This method lacks await operators and will be run synchronously.
Yes, thanks visual studio, I'm doing this intentionally because the calling function requires an async method and I don't want to put in a dummy awaited task just for that!
You... do know that
Task.FromResult
exists, right?Nope!
And I must be doing it wrong, because the only way I can get VS to shut up about my usage of that is:
await Task.FromResult(true);
You're supposed to return the value from
Task.FromResult
. If your function returns aTask
instead of aTask<T>
, you can use any value. Some versions of .NET haveTask.CompletedTask
that's less confusing for that purpose.
-
- How many cars were a snake?
- Were there more cars in country or more cars in yellow?
- How big is the difference between the number of cars in a fish and the number of cars in an interview?
- How many more cars are there in interview than in gerbil?
- Are there less cars in the 80s than in a gerbil?
- Does dog have buddha nature?
-
@ben_lubar said in WTF Bites:
@tsaukpaetra said in WTF Bites:
@tsaukpaetra said in WTF Bites:
@ben_lubar said in WTF Bites:
@tsaukpaetra said in WTF Bites:
@anotherusername said in WTF Bites:
@lb_ Can you provide an example?
This method lacks await operators and will be run synchronously.
Yes, thanks visual studio, I'm doing this intentionally because the calling function requires an async method and I don't want to put in a dummy awaited task just for that!
You... do know that
Task.FromResult
exists, right?Nope!
And I must be doing it wrong, because the only way I can get VS to shut up about my usage of that is:
await Task.FromResult(true);
You're supposed to return the value from
Task.FromResult
. If your function returns aTask
instead of aTask<T>
, you can use any value. Some versions of .NET haveTask.CompletedTask
that's less confusing for that purpose.Error CS1997 Since 'MasterServer.RefreshStatus()' is an async method that returns 'Task', a return keyword must not be followed by an object expression. Did you intend to return 'Task<T>'?
Ah, apparently that's because it's been marked
async
.Now to replace all my early returns with this...
-
But that there stuff is one step above the shenanigans we pulled.
I admit to having a bit of a hold-my-
beercoffee--moment there. UDLs worse than goto? :why-not-both.cpp:
-
@onyx Here's something for you then:
// Compile with: g++ -std=c++11 -O2 file.cpp -static #include <cstdio> #include "evil.hpp" int main() { volatile int i = 0; 500_label; printf( "Hello %d\n", i ); if( i++ < 10 ) 500_goto; return 0; }
evil.hpp
#include <setjmp.h> template< char... > struct Env_ { static jmp_buf env; }; template< char... tChar > jmp_buf Env_<tChar...>::env; template< char... tChar > inline void __attribute__((always_inline)) operator ""_label() { // g++ refuses to inline a function with setjmp(). But let's not have that // stop us. __asm__ volatile( "1:\n" "movl %0, %%edi\n" "call _setjmp\n" "test %%eax, %%eax\n" "jne 1b\n" : : "g"(Env_<tChar...>::env) : "eax", "edi" ); } template< char... tChar > inline void operator ""_goto() { longjmp( Env_<tChar...>::env, 666 ); }
It "works". For some definition of "work". (Disclaimer: I don't ever recommend doing this.)
Filed under: Aiming for the front-page.
Sorry to ask but...
- What does evil.hpp do? It looks like a jump, but I don't do assembly
- How does that variadic template work? How does jmp_buf not do infinite recursion and how does it store each char on the struct?
-
WTF of my day: So, some of my pupils have to take a rather basic math test. Including the analysis of basic diagrams, y'know, pie charts, bar diagrams and stuff.
So I looked around a bit and found some sites which had practice materials for exactly this. One of those sites being named "www.commoncoresheets.de"
Now, I know that this common core bit is a more of a US'ian thing but they proclaimed that they had translated everything into German (and other assorted languages).
I'm not quite sure who exactly did the translation. Or maybe what. Could also have been a bunch of monkeys.
I mean, take this bar graph:
y-axis being the number of cars for a given colour, with the colours (x-axis) being: silver, red, white and yellow.
There are some questions you have to answer using the diagram. Those questions contain the following gems:
- How many cars were a snake?
- Were there more cars in country or more cars in yellow?
- How big is the difference between the number of cars in a fish and the number of cars in an interview?
- How many more cars are there in interview than in gerbil?
- Are there less cars in the 80s than in a gerbil?
I've always wondered. When you see something translated into another language, you think 'ok, these guys know what they're doing', but how often is the translation absolute shit? What about the instruction manual for my earbuds? Or the tag on my mattress?
-
@magnusmaster said in WTF Bites:
Sorry to ask but...
Not sure if you really want to know, because it's pretty horrifying. ;-)
What does evil.hpp do? It looks like a jump, but I don't do assembly
The assembly just calls
setjmp()
; I actually mostly copied the assembly from disassembling a call tosetjmp()
(Compiler Explorer FTW!).setjmp()
is a bit of a weird method -- it stores the current context (values in registers + location on stack), so you can return/jump back to it later, usinglongjmp()
. It's a non-localgoto
... The entry on Wikipedia will probably explain it better than I do.The problem with
setjmp()
is that it doesn't work if you call it from a function, return from that function and then do thelongjmp()
. Thelongjmp()
can only "return" to active function stack frames (i.e., it can only unwind the stack). This prevents writing a simple function-wrapper aroundsetjmp()
.To work around that, I want to force-inline (
__attribute__((always_inline))
) the function that wraps thesetjmp()
so that thesetjmp()
stores the frame of the function from which I "call" the wrapper. GCC very sensibly refuses to take any part in these shenanigans -- it sees thesetjmp()
and refuses to inline the function. So, I write out the call tosetjmp()
in assembly, and thereby sneak it past GCC.There's a loop around
setjmp()
-- I'm actually not 100% sure if that's required. Essentially,setjmp()
will return twice. First, when it's called initially to store the current context. It will return 0 at that point. Later, when the code returns to the stored context vialongjmp()
,setjmp()
will return again, this time with whatever non-zero value is passed tolongjmp()
. In that second case, the code will loop once and re-initialize thejmp_buf
(which again returns zero and aborts the loop). As mentioned, I'm not sure if this is required.How does that variadic template work? How does jmp_buf not do infinite recursion and how does it store each char on the struct?
The variadic template allows me to have multiple different "labels". So,
1_label
would instantiateEnv_<'1'>
, whereas137_label
would instantiateEnv_<'1','3','7'>
. EachEnv_<...>
has its own single static member (that isn't shared with otherEnv_<something else>
). This is thejmp_buf
wheresetjmp()
stores whatever state it needs to store.Essentially, I can refer to different
jmp_buf
instances thanks to this. So1_label
will have a separatejmp_buf
from5_label
. Thechar
s passed to theEnv_
template are not really stored anywhere, they are just used to create an unique type for each different "identifier" (=number that you use), which in turn creates a separatejmp_buf
.
-
-
@ben_lubar said in WTF Bites:
Env_
is this documented anywhere
What do you mean? It's defined there in the code, it's not some outside library/compiler feature.
-
@ben_lubar said in WTF Bites:
Env_
is this documented anywhere
What do you mean? It's defined there in the code, it's not some outside library/compiler feature.
How is it implementing new keywords like that, then?
-
@ben_lubar said in WTF Bites:
@ben_lubar said in WTF Bites:
Env_
is this documented anywhere
What do you mean? It's defined there in the code, it's not some outside library/compiler feature.
How is it implementing new keywords like that, then?
I don't understand what you mean.
Env_
is a template class with a static data member. Did you quote the wrong thing?
-
@lb_
500_label;
doesn't look like it's part of C++ syntax, is it?
-
@ben_lubar Those are the "user-defined literals" that @Zecc mentioned that started this whole subthread:
TIL about C++11 user-defined literals.
-
@hardwaregeek said in WTF Bites:
@ben_lubar Those are the "user-defined literals" that @Zecc mentioned that started this whole subthread:
TIL about C++11 user-defined literals.
whaaaaaaaaaaaaaaaaaaaa
-
@ben_lubar A common reaction to C++.
-
@hardwaregeek said in WTF Bites:
@ben_lubar A common reaction to C++.
Especially when you take the powerful bits of C++, combine it with the utterly strange bits, and build unholy shenanigans. :D
-
@carnage But when it comes down to it, really, how significant are those bits?
-
@hardwaregeek said in WTF Bites:
@carnage But when it comes down to it, really, how significant are those bits?
At least one, sometimes not.
-
Ah, good old YSIWYG post editors, leading users to generate HTML like this:
So much better than what we have in the modern age, huh?
-
@pie_flavor said in WTF Bites:
When you see something translated into another language
It is not translated. They have a link to other languages and the English version has the same layout and style and type of questions, but the actual questions are different and don't seem to be mixed up.
It looks like they have some framework for creating the sheets, which is probably a huge pile of and the people who did the German version hit some quirk in itâand failed to proof-read the result.
-
-
@ben_lubar said in WTF Bites:
whaaaaaaaaaaaaaaaaaaaa
Told you that the dark side was more fun. (Wait till you hear about the meta-classes proposal!)
-
@hardwaregeek said in WTF Bites:
@carnage But when it comes down to it, really, how significant are those bits?
Well, the utterly strange bits can be avoided, and powerful stuff will always come with the drawback that they can be abused. I do not quite see the reason to just throw the powerful stuff out altogether because they can be abused. Bad devs abuse everything anyway, so it wont help. :D
So, i'd say they aren't really significant enough to bother.
-
- How many cars were a snake?
- Were there more cars in country or more cars in yellow?
- How big is the difference between the number of cars in a fish and the number of cars in an interview?
- How many more cars are there in interview than in gerbil?
- Are there less cars in the 80s than in a gerbil?
- Does dog have buddha nature?
No quack.
-
Told you that the dark side was more fun. (Wait till you hear about the meta-classes proposal!)
Could be cool for stuff like Qt.
(if one felt like throwing a mature time-tested codebase out the window)
-
Told you that the dark side was more fun. (Wait till you hear about the meta-classes proposal!)
Could be cool for stuff like Qt.
(if one felt like throwing a mature time-tested codebase out the window)
Sutter explicitly mentioned the Qt moc as one example of things he'd rather have the compiler do than a meta-compiler, if I remember correctly. And if done right, only the behind-the-scenes implementation would change, everything else would work just as before.
Of course, it's a looong way for this to get standardized and even if it were already, Qt would have to wait until all supported platforms implement it. (Meaning, backwards compatibility support for old platforms gets dropped) Don't expect this to happen anytime soon.
-
Please make PR for the feature you're working on, I'd like to see the changes.
But I haven't finished it yet. It's not ready for merge.
Yes, but it's easier to browse changes that way. We don't have to merge it.
-
Please make PR for the feature you're working on, I'd like to see the changes.
But I haven't finished it yet. It's not ready for merge.
Yes, but it's easier to browse changes that way. We don't have to merge it.Next week:
: gasket, this change was not ready for merge and broke production. Why did you issue such an unfinished pr?
-
-
-
-
gasket
I thought the autocorrect was quite fitting
-
Please make PR for the feature you're working on, I'd like to see the changes.
But I haven't finished it yet. It's not ready for merge.
Yes, but it's easier to browse changes that way. We don't have to merge it.Next
weekday:
: gasket, this change was not ready for merge and broke production. Why did you issue such an unfinished pr?Fixed for reality.
Edit: Wait, I think I meant "Fixed for Agile"
-
From Wikipedia:
A gasket is a mechanical seal which fills the space between two or more mating surfaces, generally to prevent leakage from or into the joined objects while under compression.
A condom, basically.
-
The POSIX thread's
pthread_mutex_t
has had an error-checking mode since time immemorial. Yet when wrapping it in the newfangled C++ classstd::mutex
, neither GNU stdlibc++, nor LLVM libc++ cares to turn it on at least in debug. Fortunately they rely on the default initialisation, so callingpthread_mutex_init
with specific attributes on thenative_handle()
of a mutex you just created worksâbut is a butt ugly hack. Hell, the point of usingstd::mutex
was platform independence and this must be inserted per-platform and you have to wrap all the mutexes in your own wrappers to get it and⊠.
-
@bulb You can at least create your own mutex class that implements the mutex concept - that's at least less hacky than hijacking
std::mutex
. But I agree, perhaps there are even already some bug reports open for the variousstd::mutex
implementations.
-
@tsaukpaetra said in WTF Bites:
So much better than what we have in the modern age, huh?
Yes.
People look at the post, not the fucking markup.
-
Please make PR for the feature you're working on, I'd like to see the changes.
But I haven't finished it yet. It's not ready for merge.
Yes, but it's easier to browse changes that way. We don't have to merge it.Wait, what are you using where they can't do their own diff from your branch without a PR?
FWIW the Atlassian POS I used at a previous company to do PRs had a flag that was like "don't let anybody merge this PR until this flag is unchecked" but probably had a more pithy name.
-
@blakeyrat said in WTF Bites:
@tsaukpaetra said in WTF Bites:
So much better than what we have in the modern age, huh?
Yes.
People look at the post, not the fucking markup.
Except the post looks fucking terrible, on literally all devices. It also doesn't match what's displayed in the editor, natch.