WTF Bites


  • area_can

    @maciejasjmj said in WTF Bites:

    Don't make me actually check out Gboard as a viable alternative, Swiftkey.

    Too late, gboard added it before them ;/


  • BINNED

    Our router/AP at home broke in an interesting way. It still routes and everything, but the Wi-Fi reset itself to the default SSID and no password, and the admin interface just doesn't work. I managed to log in once and very briefly, so I know I'm not an idiot trying the wrong address, but otherwise it just keeps telling me "site not found", and it's refusing ssh connections as well (which might just be the default setting, I haven't tried that when it worked normally).


  • Garbage Person

    @greybeard said in WTF Bites:

    Then don't use void pointers. Use pointers to structs of incomplete type.

    ...and I wish cURL would do this.


  • Notification Spam Recipient

    @blek said in WTF Bites:

    Our router/AP at home broke in an interesting way. It still routes and everything, but the Wi-Fi reset itself to the default SSID and no password, and the admin interface just doesn't work. I managed to log in once and very briefly, so I know I'm not an idiot trying the wrong address, but otherwise it just keeps telling me "site not found", and it's refusing ssh connections as well (which might just be the default setting, I haven't tried that when it worked normally).

    Our current router in the office does this, but it's running an ancient experimental build of DD-WRT so I can't really complain (well, except that attempting to flash newer versions doesn't boot the device...)


  • Trolleybus Mechanic

    Tech news is the worse.

    0_1504472241032_wtf-news.png





  • @coldandtired Without actually bothering to check, that could be timing (e.g. the girl was seriously injured and later died as a result).

    Or it could be typical British understatement. Hard to tell. It's certainly true that you can't get much more seriously injured than that...



  • @medinoc said in WTF Bites:

    which AFAIK, is Undefined Behavior because the C and C++ standards don't guarantee 2's complement

    No, it is so that expressions can be transformed utilizing identities valid for ℤ.

    C++ “almost” guarantees 2's complement: cast from signed to unsigned is guaranteed to be done modulo corresponding generator, which is exactly 2's complement, but the inverse cast is undefined if the result does not fit as is.

    @dkf said in WTF Bites:

    There are also other subtleties, such as the fact that a processor might have an overflow mode that saturates rather than wrapping.

    It may have it, but the modulo (2's complement) mode is usually still available. Unsigned operations need it.

    Anyway, the real reason is optimization.



  • @raceprouk said in WTF Bites:

    @greybeard said in WTF Bites:

    That would be the point where I pull out C++.

    Which doesn't have generics.

    Well, it does and it doesn't. It has templates, which are kinda like generics if you squint hard enough, but they aren't actually generics.

    Is there anything these generics (let's stick to C#) can do that C++ templates can't?

    @pie_flavor said in WTF Bites:

    Then you pull out Rust!

    Did the covariance-contravariance stuff get anywhere? I never tried to test that.


  • FoxDev

    @bulb said in WTF Bites:

    @raceprouk said in WTF Bites:

    @greybeard said in WTF Bites:

    That would be the point where I pull out C++.

    Which doesn't have generics.

    Well, it does and it doesn't. It has templates, which are kinda like generics if you squint hard enough, but they aren't actually generics.

    Is there anything these generics (let's stick to C#) can do that C++ templates can't?


  • Garbage Person

    @bulb said in WTF Bites:

    Is there anything these generics (let's stick to C#) can do that C++ templates can't?

    Have one instantiation of code for all* object types.

    * Except (at least for Java) primitive types



  • @raceprouk said in WTF Bites:

    @bulb said in WTF Bites:

    Is there anything these generics (let's stick to C#) can do that C++ templates can't?

    I don't see anything that generics could do and templates can't. Just something that generics can't do.


  • Considered Harmful

    @bulb said in WTF Bites:

    Did the covariance-contravariance stuff get anywhere? I never tried to test that.

    It has them and they work; I don't know anything beyond that.



  • @greybeard said in WTF Bites:

    @bulb said in WTF Bites:

    Is there anything these generics (let's stick to C#) can do that C++ templates can't?

    Have one instantiation of code for all* object types.

    * Except (at least for Java) primitive types

    This is rather obvious consequence of all types being value types in C++.

    Note that in Java, only primitive types are value and in C#, generics are reified for value (struct) types.

    It is, also, not really true. In C++ you can get essentially equivalent effect by writing a “thin template”, i.e. a template wrapper over a non-template implementation over type-erased reference. And it's not really a semantic difference.


  • 🚽 Regular

    @coldandtired said in WTF Bites:

    @lorne-kates

    0_1504485004919_dm.PNG

    That's a terrible stereogram.



  • @pie_flavor said in WTF Bites:

    @bulb said in WTF Bites:

    Did the covariance-contravariance stuff get anywhere? I never tried to test that.

    It has them and they work; I don't know anything beyond that.

    Now this is an actual advantage.

    @raceprouk, do you know whether C# has covariance and contravariance? It would be rather hard, because only immutable references are covariant and C# can only express that in some places but not others.


  • FoxDev

    @bulb said in WTF Bites:

    @raceprouk, do you know whether C# has covariance and contravariance?

    Since version 4



  • @raceprouk said in WTF Bites:

    TL;DR: C++ templates are a particular implementation of the idea of generic programming using a restricted form of macros, which unlike C-style macros play well with the rest of the language rather than being a separate language on top of it. C# implements generic programming as compile-time structures that the compiler has to decide how to dispatch on, instead, which in the demonstrated case means that if there's ambiguity in the type of a value being dispatched (i.e., because it is held in a variable whose class has subclasses that the generic might specialize) the compiler has to choose the most general form available. Or, in C#, you can declare the variable as dynamic and force it to dispatch at runtime, because they didn't think to make that the default in the first place for raisins.

    EDIT: Oops, I OOPSed wrong for a static language. I've corrected my mistake now, I think.

    Filed Under: Wait, that was the short version?


  • Discourse touched me in a no-no place

    @scholrlea said in WTF Bites:

    Generics in Java and C# are runtime structures that can do dispatch

    Generics are different in Java and C#. In Java, they're a type erasure system such that you don't have to write nearly so many casts, but the casts are still there in the underlying code on the caller side (unless you're subclassing a generic type). In C#, generic classes are reified into separate instances per actual parameter type used.

    However, a fundamental similarity is that both only allow generic type parameters, whereas C++ also allows non-type parameters (making it a lot easier to do awful/powerful things with templates). The other huge difference is that C# and Java use a single-rooted class hierarchy, whereas C++ uses a forest; it sounds trivial in relation to generic types, but it really isn't; in Java and C#, there's always a single most-generic type you could use for the type characteristics you wish to enforce for a particular parameter.


  • FoxDev

    @scholrlea said in WTF Bites:

    Or, in C#, you can declare the variable as dynamic and force it to dispatch at runtime, because they didn't think to make that the default in the first place for raisins.

    C# is a statically-typed language. Why would it default to dynamic dispatch?



  • @raceprouk Oh, it wouldn't I suppose. I'm just bitching about the contradiction I see in the whole idea of using static typing in OOP. I am weird that way.


  • Discourse touched me in a no-no place

    @blek said in WTF Bites:

    Our router/AP at home broke in an interesting way. It still routes and everything, but the Wi-Fi reset itself to the default SSID and no password, and the admin interface just doesn't work.

    Virgin Media did something like that to mine yesterday.

    ssh connections

    Ah. Different issue then.



  • @dkf said in WTF Bites:

    @scholrlea said in WTF Bites:

    Generics in Java and C# are runtime structures that can do dispatch

    Generics are different in Java and C#.

    I changed this part of my post when I edited it, I guess you caught it while I was editing, but it's a good point to address.

    In Java, they're a type erasure system such that you don't have to write nearly so many casts, but the casts are still there in the underlying code on the caller side (unless you're subclassing a generic type). In C#, generic classes are reified into separate instances per actual parameter type used.

    I guess the real take-away is that there are several different ways to implement generics - something that should be obvious but is easy to overlook - with different consequences for each way of doing them.

    The other huge difference is that C# and Java use a single-rooted class hierarchy, whereas C++ uses a forest; it sounds trivial in relation to generic types, but it really isn't; in Java and C#, there's always a single most-generic type you could use for the type characteristics you wish to enforce for a particular parameter.

    I recall that at least one textbook author (Bruce Eckel) claimed that the whole purpose of adding templates to C++ was to get around the problems caused by a multiply-rooted hierarchy with multiple inheritance. While generic programming overall goes back long before it was added to C++ (I don't know which language used them first, but it was originally meant to solve many of the problems in procedural languages which were later solved by bolting on OOP support instead, and it was one of the first things added to Ada when it was being designed in the late 1970s), in the case of C++, I can see that being a large part of the impetus to add it.



  • @scholrlea said in WTF Bites:

    @raceprouk Oh, it wouldn't I suppose. I'm just bitching about the contradiction I see in the whole idea of using static typing in OOP. I am weird that way.

    I've been thinking about it now, and the more I consider it, the more I think this is an important point, because this - even more than inheritance, polymorphism, etc. - is the real difference between a variable typed in and ADT, and an object. Why? Because the core metaphor of OOP is that the object is active, something that does things rather than having things done to it. The whole point of the term 'method' was to distinguish the act of the programmer sending a message to an object, and the object reacting to that message, from the act of passing a value to a procedure that would manipulate it.

    While you can implement this in a number of ways, the big factor here is that the object, not the variable, is what has to be dispatched upon. Otherwise, it's not an object, it's a value - regardless of what the type of that value might be, whether it is atomic or compound, and whether it is defined by an Abstract Data Type with encapsulation or not. 'Statically-typed OOP' is a contradiction in terms, or at least, that's what I am thinking right now.

    Is this too much of a purist position? Probably. But I do think it need to be discussed.


  • Garbage Person

    @bulb said in WTF Bites:

    It is, also, not really true. In C++ you can get essentially equivalent effect by writing a “thin template”, i.e. a template wrapper over a non-template implementation over type-erased reference.

    But then you're using additional techniques, which require additional work.


  • Discourse touched me in a no-no place

    @scholrlea said in WTF Bites:

    Is this too much of a purist position? Probably.

    A bit. The system runtime at least (and hence the compiler in strict ahead-of-time languages) should be able to see that there only ever happens to be a single concrete subclass of some abstract interface, and hence to be able to use fully static typing with that class. It might not always be worth the effort to do that determination (especially in more dynamic languages), but the option should be there. The static typing you're railing against is merely a stronger promise by the programmer on the typing than you're wishing to give (but which others are happy to make).

    But once you deal with Java or C#, you don't have static typing at the invocation point; when you invoke a method (e.g., thing.Frobnicate()) you don't really know exactly what class will implement that unless the classes concerned have constrained their subclasses to not participate in the method/protocol in question. (Admittedly, C# is a bit keener than Java on making that sort of guarantee; amusingly, aficionados of both languages use that as proof that their language is superior. ;)) There are some ways in which things are constrained — objects have fixed classes, classes have fixed ancestors — but they're not too large a constraint for most operations.

    I'd be careful with saying an object is active, FWIW, since to at least some of us (including me!) that says that it is capable of instigating activity of its own accord. Which requires some kind of internal thread of control. (Some objects definitely have such things inside themselves, or at least plug into some application level basic event loop with similar effects.) However, most objects tend to be more reactive; they do things, possibly complex things, but only in response to external stimuli via the passing in of messages (i.e., through method invocation). A complex application will have a relatively small number of active objects, and a much larger number of reactive objects clustered around them (or acting as passive go-betweens). The ADTs you were talking about are just massive simplifications of that; all they do is hold data, and have no wider behaviour than that. Pure value holders are really very boring indeed.


  • Discourse touched me in a no-no place

    @greybeard said in WTF Bites:

    But then you're using additional techniques, which require additional work.

    0_1504548543799_4270960f-c214-4c25-9b6a-a8ee7b184c3a-image.png


  • Garbage Person

    @dkf Nonetheless, templates do not provide that specific feature.


  • Winner of the 2016 Presidential Election

    @dkf said in WTF Bites:

    @greybeard said in WTF Bites:

    But then you're using additional techniques, which require additional work.

    0_1504548543799_4270960f-c214-4c25-9b6a-a8ee7b184c3a-image.png

    Why does he have condoms on his eyes?


  • Discourse touched me in a no-no place

    @dreikin said in WTF Bites:

    Why does he have condoms on his eyes?

    Because how else would you know that Mr. Krabs is sad? Duh!


  • Winner of the 2016 Presidential Election



  • @dreikin
    :wtf: MS?


  • FoxDev

    @dreikin said in WTF Bites:

    https://twitter.com/MSFTFamilyGeek/status/904784376965193729

    Why is there even a limit? Well, one that low, anyway. Make it 32 and be done with it.



  • @scarlet_manuka said in WTF Bites:

    It's certainly true that you can't get much more seriously injured than that...

    Well, arguably, there is "chunky salsa".


  • Notification Spam Recipient

    @dreikin said in WTF Bites:

    @dkf said in WTF Bites:

    @greybeard said in WTF Bites:

    But then you're using additional techniques, which require additional work.

    0_1504548543799_4270960f-c214-4c25-9b6a-a8ee7b184c3a-image.png

    Why does he have condoms on his eyes?

    Those aren't eyes...



  • @scholrlea said in WTF Bites:

    'Statically-typed OOP' is a contradiction in terms, or at least, that's what I am thinking right now.

    Somewhat unfortunately, “static” and “dynamic” means somewhat different thing in “static typing”/“dynamic typing” and “static dispatch”/“dynamic dispatch”.

    Static typing means that variables have declared static types and you can only call methods and access properties declared on that type through them. This does not exclude the possibility for the variable to actually store an object of a derived type, just the ability to call methods not declared on the declared type.

    But for dispatch, static means the method is resolved from the delcared type without regarding any actual subtyping. So virtual dispatch is already called dynamic.

    Java is statically typed—because you can only call methods declared on the declared type—but has dynamic dispatch—because the method is always resolved from the actual type. While C# is statically typed, but has optional dynamically typed variable, and defaults to static dispatch for classes with dynamic dispatch for interfaces and optionally for classes with virtual keyword.


  • Discourse touched me in a no-no place

    @raceprouk said in WTF Bites:

    Why is there even a limit?

    Presumably to preemptively stop the potential abuse for 'extending' your family by adding your friends onto it?


  • Considered Harmful

    @raceprouk said in WTF Bites:

    Why is there even a limit? Well, one that low, anyway. Make it 32 and be done with it.

    Just in case anyone thought that unixish 3-bit permission fields were typical 70s byte-haggling minimalism that would be done totally different today 🚎



  • My WTF of the day: So, yesterday I wanted to sync some of my movies to my iPad because of an upcoming school trip to Prague - an 8 hour trip by train can get long, after all.

    Being less than enamoured with iTunes I looked for an alternate solution and found one: VLC player has this nifty gadget where you connect to the same network your PC is on, then enable on simple switch in VLC, browse to the IP adress VLC tells you (because it just started a very simple web server) and simply upload the movies through a drag'n'drop interface in the browser.

    Expectations of this being dreadful nonwithstanding, this worked great - stable transfer rates of ~500 Mbit/s (not bad for a pure WLAN connection I think) and the capability of transferring multiple multi-GB files (for which I all own the BluRays, by the way). The whole transfer was done in about 30 minutes I think.

    This is not the WTF, it was yesterday after all. Just a display of what is possible.

    Today I bought a PS4 Pro. My original PS4 was getting a bit long in the tooth (I'll still gift that one to one of my brothers) and there was this nice deal including Destiny 2.

    Set the whole thing up, connected the LAN cable to my network (everything is Gigabit, mind!) and proceeded to do the setup routine. Wherein I was asked whether I wanted to sync my stuff from the old PS4 to the new PS4 Pro. Hmmh, yes, I remembered that downloading things from the PSNetwork can be quite slow, also my old savegames...

    So I said: Ok.

    And then I saw this:

    0_1504720074553_22873066-0723-4d10-a462-134e50aa87dd-image.png

    For those not quite able to make out the important part: The last bracket says:

    "8(eight!) hours remaining".

    That's 8 hours for 291 GB over a Gigabit network. Jesus Fucking Christ.



  • @rhywden said in WTF Bites:

    That's 8 hours for 291 GB over a Gigabit network. Jesus Fucking Christ.

    Odds that every packet is bouncing thru their servers...



  • @dcon said in WTF Bites:

    @rhywden said in WTF Bites:

    That's 8 hours for 291 GB over a Gigabit network. Jesus Fucking Christ.

    Odds that every packet is bouncing thru their servers...

    No, the traffic monitor on my router doesn't show anything on that level.

    If I do a rough back-of-the-napkin calculation 291 GB in 8 hours is roughly 10 Mbit/s.

    I think that number has some meaning for network cards, doesn't it?

    Maybe I should switch to the WLAN?



  • @rhywden Maybe there is some cryptostuff going on when it transfers between the two systems.



  • @rhywden Maybe they cheaped out and only put a 10Mbit network connection on box.



  • @dcon said in WTF Bites:

    @rhywden Maybe they cheaped out and only put a 10Mbit network connection on box.

    Yes, that was kind of what I implied ;)




  • FoxDev

    @timebandit said in WTF Bites:

    Looks like the speed is limited in software

    :mlp_facehoof:

    grabs a :piko: and books a plane to wherever Sony's HQ is



  • @timebandit @rhywden Even if it wasn't, the hard drive is hanging off the same USB 2.0 bus as the network card.


  • FoxDev

    @twelvebaud said in WTF Bites:

    @timebandit @rhywden Even if it wasn't, the hard drive is hanging off the same USB 2.0 bus as the network card.

    Seriously‽

    puts the :piko: away and gets the Long Hammer from Sonic Adventure



  • @raceprouk said in WTF Bites:

    Seriously‽
    puts the away and gets the Long Hammer from Sonic Adventure

    Wait for me, I need to punch them in the face, repeatedly



  • @RaceProUK @TimeBandit I apologize, I misspoke. Slightly. Thanks for calling me on it; I should have doublechecked first. Here's the slide from the 33C3 talk:


Log in to reply