|
Cuntpunch posted:It's been a little bit since I've touched WPF. For most things you can use a trick in XAML where you refer to the datacontext of an ancestor element in the visual tree. For context menus this doesn't work, because they "are not part of the visual tree" and so don't fit into the hierarchy (even if the XAML that defines the context menu appears in a definite position in the hierarchy so that it could in principle be figured out) I just made the child control have a reference to an object that can communicate with the parent, because that's simpler than figuring out how to do it in XAML. Of course, then the parent has to be able to inform its children when the relevant property changes, otherwise it's not updated in the UI, so that means putting a load of obnoxious extra method calls in the parent viewmodel... It would help if the code that creates the child object hadn't been written by a lunatic. Say, if you have two classes A and B, what is a good name for an instance of class A? Well it's "b", of course. Rant over, apologies
|
# ? Mar 12, 2019 14:03 |
|
|
# ? May 17, 2024 01:17 |
|
This probably belongs here: https://www.zdnet.com/article/yelp-for-conservatives-maga-app-leaks-users-data/quote:But according to Robert Baptise, a French security researcher who goes online under the pseudonym of Elliot Anderson (the name of the main character from the Mr. Robot TV show about hackers), the 63Red Safe app is leaking almost all of its data. https://twitter.com/fs0c131y/status/1105259901205516288
|
# ? Mar 12, 2019 14:06 |
|
moostaffa posted:This probably belongs here: https://www.zdnet.com/article/yelp-for-conservatives-maga-app-leaks-users-data/ It’s React Native, and the dev put the auth keys in the JavaScript side, so it got bundled in the APK as a string. So the steps the security researcher took was: Downloaded APK from Mirror site Unzip Open app bundle Ctrl-F “password” And they knew how to POST requests It’s a known thing with React Native that it does this, but I can totally see people being bit by it if they don’t understand what it’s doing, and how they should better protect their keys. Hopefully now more people can get articles in ZDNet with the advance hacking techniques I’ve provided.
|
# ? Mar 12, 2019 14:19 |
|
ultrafilter posted:Trying to understand the inner workings of anything Microsoft made in the 90s is a bad idea. some microsoft apis are some obtuse that i seriously believe that the company was partially staffed by extra-terrestrials or schizophrenics, especially once you start getting into the finer details of COM or the ATL.
|
# ? Mar 12, 2019 14:26 |
|
Bruegels Fuckbooks posted:Just do windows key + R, calc, and watch how long it takes the window to show onscreen. Compare it with say, windows + R, notepad. Notepad shows up nearly instantly imperceptibly fast, I'd estimate calc shows up in about 400 ms on my windows 10 laptop with an SSD just eyeballing it. And on mine it's up before the run window is done fading out
|
# ? Mar 12, 2019 16:10 |
|
Bruegels Fuckbooks posted:some microsoft apis are some obtuse that i seriously believe that the company was partially staffed by extra-terrestrials or schizophrenics, especially once you start getting into the finer details of COM or the ATL. hackbunny's deep dives into Windows internals in YOSPOS have been described as "like reading an alien autopsy."
|
# ? Mar 12, 2019 16:42 |
|
raminasi posted:hackbunny's deep dives into Windows internals in YOSPOS have been described as "like reading an alien autopsy." Seriously I can't understand 10% of what they post in there.
|
# ? Mar 12, 2019 17:01 |
|
But they should never stop, because it rules
|
# ? Mar 12, 2019 17:24 |
|
Where can I find these?
|
# ? Mar 12, 2019 18:14 |
|
Jewel posted:Where can I find these? I think mostly in the programming languages thread.
|
# ? Mar 12, 2019 18:44 |
|
moostaffa posted:This probably belongs here: https://www.zdnet.com/article/yelp-for-conservatives-maga-app-leaks-users-data/ Thank goodness that I can find safe spaces where I can go and complain about liberals and their safe spaces oh gently caress there go the common credentials that I use for everything, username CoolDude69 password TrumpR0x!
|
# ? Mar 13, 2019 07:34 |
|
TIL: in C/C++, the braces in the switch statement are optional if you have a single caseC++ code:
Thermopyle posted:I think mostly in the programming languages thread. I once made a dedicated thread too hackbunny fucked around with this message at 09:20 on Mar 13, 2019 |
# ? Mar 13, 2019 09:16 |
|
hackbunny posted:TIL: in C/C++, the braces in the switch statement are optional if you have a single case https://en.cppreference.com/w/cpp/language/switch The grammar that makes this possible is also what makes else-ifs possible btw. Most people probably think there are special syntax rules for that, but the grammar is actually code:
|
# ? Mar 13, 2019 11:31 |
|
Mooey Cow posted:You can in fact have any number of cases, as long as there is only one statement. Does that mean this is legal code:
|
# ? Mar 13, 2019 12:17 |
|
The way variables in switches shadow is the worst.
|
# ? Mar 13, 2019 12:24 |
|
Hammerite posted:Does that mean this is legal That is legal; a label actually labels the statement following it, rather than being a statement in itself, so it's equivalent to code:
|
# ? Mar 13, 2019 12:46 |
|
Mooey Cow posted:You can in fact have any number of cases, as long as there is only one statement. Wait, what kind of grammar does C++ use? I remember when I took compilers we used an LR parser (flex/bison) and this definition of if/else if created a parsing ambiguity.
|
# ? Mar 13, 2019 20:25 |
|
IIRC C++ has so many syntax ambiguities that in mathematical terms the language is "undecidable". One simple example: code:
Or am I instantiating a foo object named bar, passing a variable named baz to the constructor? The only possible way to know is to look at the context around the statement.
|
# ? Mar 13, 2019 20:46 |
|
The first, because the language spec says so
|
# ? Mar 13, 2019 21:13 |
|
Linear Zoetrope posted:Wait, what kind of grammar does C++ use? I remember when I took compilers we used an LR parser (flex/bison) and this definition of if/else if created a parsing ambiguity. The C language spec says that "an else is associated with the lexically nearest preceding if that is allowed by the syntax", i.e. prefer shift for the dangling else conflict. The C11 standard's final draft includes a grammar in Annex A and that grammar is indeed ambiguous when it comes to dangling else: code:
quote:Note: There are two shift/reduce conflicts, correctly resolved by default: Xerophyte fucked around with this message at 21:17 on Mar 13, 2019 |
# ? Mar 13, 2019 21:14 |
|
RPATDO_LAMD posted:IIRC C++ has so many syntax ambiguities that in mathematical terms the language is "undecidable". Another fun one: https://yosefk.com/c++fqa/web-vs-c++.html#misfeature-3
|
# ? Mar 13, 2019 23:15 |
|
Linear Zoetrope posted:Wait, what kind of grammar does C++ use? I remember when I took compilers we used an LR parser (flex/bison) and this definition of if/else if created a parsing ambiguity. There are indeed many ambiguities in the language, as it doesn't define any particular grammar, just a lot of syntax rules the compiler must follow. You may be able to use a GLR parser more easily though. GCC however switched from Yacc to a handwritten recursive descent parser many years ago. Clang has always used recursive descent I believe. edit: There is however a grammar summary in appendix A: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3092.pdf#appendix.A Mooey Cow fucked around with this message at 23:36 on Mar 13, 2019 |
# ? Mar 13, 2019 23:29 |
|
RPATDO_LAMD posted:IIRC C++ has so many syntax ambiguities that in mathematical terms the language is "undecidable". I think C++ is decidable but hard to parse if you disallow templates. The problem is that templates are Turing complete, and that means that determining whether a given program is valid can require you to solve the halting problem.
|
# ? Mar 14, 2019 00:23 |
|
Isn’t that the definition of undecideable? I think strictly speaking the syntax is not undecideable but the semantics are, I guess it depends on which side of that you consider “parsing” to fall.
|
# ? Mar 16, 2019 05:36 |
|
I don't think templates being turing complete affects the parsing. Many turing complete languages are parseable after all. The issue (I believe) is there are ambiguities that can only be resolved if you know what kinds of things the tokens involved are (such as types or variables), eg:code:
code:
|
# ? Mar 16, 2019 16:58 |
|
HappyHippo posted:I don't think templates being turing complete affects the parsing. Many turing complete languages are parseable after all. I think you're confusing a programming language being Turing complete (any Turing machine can be simulated by running a program written in the language) and the parsing of the language being Turing complete (you can take any Turing machine and any input to that machine, encode it in that language's source code, and the result of parsing said source code will be the output of the Turing machine on the specified input). The former is consistent with the language being parseable, the second means it is impossible to write a parser that will always successfully parse the language on all inputs, even if you have infinite space and time. Jeb Bush 2012 fucked around with this message at 17:15 on Mar 16, 2019 |
# ? Mar 16, 2019 17:11 |
|
Jeb Bush 2012 posted:You're confusing a programming language being Turing complete (any Turing machine can be simulated by running a program written in the language) and the parsing of the language being Turing complete (you can take any Turing machine and any input to that machine, encode it in that language's source code, and the result of parsing said source code will be the output of the Turing machine on the specified input). The former is consistent with the language being parseable, the second means it is impossible to write a parser that will always successfully parse the language on all inputs, even if you have infinite space and time. But does the "turing complete" nature of templates come in during the parsing step of compilation, or later? (I'm genuinely curious)
|
# ? Mar 16, 2019 17:31 |
|
It's not that templates allow you to perform arbitrary computations; it's that they allow you to perform arbitrary computations *at compile time*. At some point someone implemented a piece of code that took an int n and produced error messages listing out all of the primes less than n, but I'm having trouble tracking that down.
ultrafilter fucked around with this message at 17:35 on Mar 16, 2019 |
# ? Mar 16, 2019 17:31 |
|
The only way the parsing could be Turing complete is if you could arbitrarily extend the syntax or modify the source code at parse-time. Otherwise as long as you are consuming a static finite-length string, it's either going to terminate or enter an infinite loop with no progress being made.
|
# ? Mar 16, 2019 17:32 |
|
Anyone who is confused at how c++ templates can be Turing-complete and are thus subject to the halting problem, should look up std::conditional. Essentially the compilation of templates can be considered executing (ie evaluating) a functional program.
|
# ? Mar 16, 2019 17:33 |
|
ultrafilter posted:It's not that templates allow you to perform arbitrary computations; it's that they allow you to perform arbitrary computations *at compile time*. At some point someone implemented a piece of code that took an int n and produced error messages listing out all of the primes less than n, but I'm having trouble tracking that down. Yes but there are multiple steps involved in compilation. Parsing is just one step. The question is, is the parsing undecidable due to the turing complete nature of templates, or some other reason?
|
# ? Mar 16, 2019 17:55 |
|
HappyHippo posted:But does the "turing complete" nature of templates come in during the parsing step of compilation, or later? (I'm genuinely curious) Volte posted:The only way the parsing could be Turing complete is if you could arbitrarily extend the syntax or modify the source code at parse-time. Otherwise as long as you are consuming a static finite-length string, it's either going to terminate or enter an infinite loop with no progress being made. This is wrong because the parser is allowed to (and must!) maintain its own state to help in parsing. One thing you're allowed to do at parse time is check whether you've got a valid program, for instance, which means deciding any set, including undecidable ones, can be cast as a parsing problem. I think you're maybe getting hung up on the fact that the output is not arbitrarily large, but, for one thing, it is (because, as ultrafilter pointed out, parsers can output error messages) (e: and, as pointed out below, even your non-erroneous output can be arbitrarily large), and even if it wasn't that wouldn't really matter (if you have a machine that can simulate any function with a 1-bit output, you can simulate any function with an arbitrarily long output by running it multiple times on a modified 1-bit output function). Jeb Bush 2012 fucked around with this message at 18:02 on Mar 16, 2019 |
# ? Mar 16, 2019 17:57 |
|
Volte posted:The only way the parsing could be Turing complete is if you could arbitrarily extend the syntax or modify the source code at parse-time. Otherwise as long as you are consuming a static finite-length string, it's either going to terminate or enter an infinite loop with no progress being made. Parsing C++ may require arbitrary template instantiation, and is not simply consuming a static finite-length string. Since template instantiation is undecidable, so is parsing. Instigating example. This has little practical impact: people don't write undecidable template instantiations and C++ compilers do not in fact allow arbitrary template instantiation no matter what the language spec says.
|
# ? Mar 16, 2019 17:58 |
|
Jesus, I didn't know that template instantiation happens during parsing. That is absolutely bizarre behaviour.
|
# ? Mar 16, 2019 18:14 |
|
Volte posted:Jesus, I didn't know that template instantiation happens during parsing. That is absolutely bizarre behaviour. That's why the body of a template function has to be visible everywhere that it's called, and why templates are a very bad idea if you care about binary size.
|
# ? Mar 16, 2019 18:16 |
|
ultrafilter posted:That's why the body of a template function has to be visible everywhere that it's called, and why templates are a very bad idea if you care about binary size. I guess it basically comes down to the fact that parsing isn't really its own phase when it comes to C++. Volte fucked around with this message at 18:31 on Mar 16, 2019 |
# ? Mar 16, 2019 18:23 |
|
I am just gonna leave this type-level TM implementation here http://coliru.stacked-crooked.com/a/de06f2f63f905b7e
|
# ? Mar 16, 2019 19:15 |
|
Xerophyte posted:This has little practical impact: people don't write undecidable template instantiations and C++ compilers do not in fact allow arbitrary template instantiation no matter what the language spec says. Even the spec says that there's a limit on the number of recursively nested template instantiations (the exact limit is implementation-defined, but recommended to be at least 1024). Bonfire Lit fucked around with this message at 19:50 on Mar 16, 2019 |
# ? Mar 16, 2019 19:44 |
|
ultrafilter posted:templates are a very bad idea if you care about binary size. Not really. Maybe 20 years ago, but if you need code to work over multiple types, they generally result in identical code to handwritten specializations. Sometimes smaller, since unused template functions and methods are not even emitted (although unused handwritten code could also be removed at linktime). It's also usually possible to separate out code that doesn't depend on the type to avoid unnecessary code duplication within functions, but you would also have to do that if you wrote your functions by hand and wanted to minimize size.
|
# ? Mar 16, 2019 20:29 |
|
|
# ? May 17, 2024 01:17 |
|
They still suck for compile time though.
|
# ? Mar 16, 2019 22:33 |