WTF Bites


  • Discourse touched me in a no-no place

    @bb36e “Thread injection rights into Explorer”? That seems a weird thing to have, especially if Explorer has comparatively-elevated privileges (as that page indicates must be so). It seems to me that, whatever good security properties are present at the kernel level, they are compromised by the user-level policies that are actually enforced. :(

    Security only really works when you don't fuck up anything at all.



  • @cvi said in WTF Bites:

    problem is, 15+ coffees per day is a bit unhealthy.

    That's why I have a huge mug :p



  • So basically in .NET, to cancel an asynchronous task, you have to pass a CancellationToken, which is essentially a glorified boolean, and the task has to check it regularly. Except you also have to create a CancellationTokenSource because reasons.

    So now for (what should be) the incredibly simple task of running a single function in the background, you have to keep three object references. Maybe I'll just wrap them in a single struct. I could name it Task.

    Addendum (2016-08-17T10:40:03Z): Also, notice how the documentation says:

    The new cancellation model makes it easier to create cancellation-aware applications and libraries, and it supports the following features:

    • Requesting is distinct from listening. An object that invokes a cancelable operation can control when (if ever) cancellation is requested.

    Which doesn't seem to make sense, because requesting and listening are opposite actions, so of course they're separate. It's like a car advert saying "accelerating and braking are separate actions, and you can control when each one happens". But what they really mean is:

    :
    They provide this separation of functionality to make things more predictable: when you pass a method a CancellationToken, you know you're still the only one that can cancel it.

    It's a classic case of the designer using his own mental model to explain things, without realising that the user has a completely different one.



  • @TimeBandit said in WTF Bites:

    @cvi said in WTF Bites:

    problem is, 15+ coffees per day is a bit unhealthy.

    That's why I have a huge mug :p

    In fact, smaller cup would be better in his case.


  • kills Dumbledore

    @cheong said in WTF Bites:

    smaller cup would be better

    IBTC


  • Notification Spam Recipient

    @Jaloopa said in WTF Bites:

    IBTC

    Gagh, I hate how Google tends to cut off the definition at exactly the point where it actually starts...

    0_1471458894396_upload-3876d2c1-3e9a-466e-ae33-399a029dbb3b

    Wait a minute, that's not even part of the first part of the site anyways!

    0_1471458951053_upload-7493f6b6-8bc2-45d6-892b-c8f8914df99e

    Unbar dictionary, you're :doing_it_wrong:


  • area_can

    Unhallowed:

    I have a Seagate Freeagent Desktop 750GB External HDD connected via USB port. When i connect the device to Windows, it is immediately locked by a system process that i cannot shutdown. I ran some sysinternals tools and found the culprit...
    <some Windows process info>

    Gokul T - Microsoft Support:

    Step 1:
    Firstly, let’s boot into safe mode and verify if the issue recurs in safe mode...

    I hate these guys.



  • @Maciejasjmj that's why I disapprove when coworkers want to name things and comment things in english. It always ends with ugly errors.



  • @FrostCat said in WTF Bites:

    @mott555 said in WTF Bites:

    Suddenly, a wild "This site uses cookies!" popup appears. Click OK to dismiss.

    Fuck them and their assumed consent. I use F12 dev tools to delete the offensive elements!

    0_1471482697743_unnamed.png



  • @groo said in WTF Bites:

    @Maciejasjmj that's why I disapprove when coworkers want to name things and comment things in english. It always ends with ugly errors.

    Reminds me how in the previous project we had many functions named ActualizeSomething and variables actualSomething, meaning update and current, due to the shift in meaning in corresponding local words.

    I still prefer using English in code, because using different native language leads to unsightly mixture. For example in the same project we had function GetDelka returning content of variable length ("délka" means length). It also leads to encoding issues as while most of the world has switched to UTF-8, Windows only work with legacy codepages or UTF-16 and don't support UTF-8 in some places or you have to configure it all over the place.



  • @Bulb naming things is hard, I hate naming things. makes me want to use int i,j,k and button1 as names


  • kills Dumbledore

    @groo You need Hungarian. btnButton1



  • @groo Button button = Button()


  • Discourse touched me in a no-no place

    @anonymous234 Double the fun:

    Button Button = Button();
    

    Can you confuse people enough like that? If not, we can make it worse! 🍹



  • @dkf

    IAbstractButtonFactory buttonFactory = new SillyButtonFactory(null, null, null);
    IButton button = (IButton) buttonFactory.createYellowButton(Type.GetType("IButton"));


  • @groo said in WTF Bites:

    Type.GetType(IButton)

    📎 Did you mean "typeof(IButton)"?



  • @Maciejasjmj No, I wanted to use a string to maximize the synergies and convergence of that function, but forgot the quotes


  • Discourse touched me in a no-no place

    @groo

    @Inject
    ButtonFactoryBuilder buttonFactoryBuilder;
    @Inject
    ButtonPolicyBuilder buttonPolicyBuilder;
    
    ButtonFactory buttonFactory = buttonFactoryBuilder.buildButtonFactory();
    ButtonPolicy buttonPolicy = buttonPolicyBuilder.getPolicyInstance(
            ButtonPolicy.STANDARD_BUTTON_POLICY, 
            ButtonPolicy.USE_SYSTEM_LOCALE,
            ButtonPolicy.SHARED_INSTANCE /* WARNING: Do not change! */);
    Button button = buttonFactory.makeInstantiatableButton(buttonPolicy).instantiate(container);
    

  • ♿ (Parody)

    My customer had some auditing done for various systems. So we've been pestered a bunch for screen shots of various things for them to verify something in our system. Found out today that another contractor (CSC), which has been raping my customer in many other ways (no one here can believe that they put up with it) has been charging $1000 per screen shot.



  • @boomzilla I can buy a brand new wooden table for the price of those screenshots



  • @boomzilla said in WTF Bites:

    has been charging $1000 per screen shot.

    At that price, they better be in 4k resolution.


  • Considered Harmful

    I'm finding lots of :wtf: in WebGL. This one is irritating, though.

    0_1471536790822_upload-871d119f-4ab6-48fd-8f61-2affb58f9b6c

    0_1471536752337_upload-5afd467d-d092-45aa-8976-218a49fc7aee

    See the problem?

    You set parameters by calling gl.pixelStorei with a GLenum of what to set, and a GLint value. The UNPACK_FLIP_Y_WEBGL and UNPACK_PREMULTIPLY_ALPHA_WEBGL enum values don't accept GLint values, they accept GLboolean values. The gl.pixelStorei method doesn't accept GLboolean values, it accepts GLint values.

    GLint is the number JavaScript type, and GLboolean is the boolean JavaScript type. Different animals.

    There's a Catch-22 here, where the spec simultaneously requires and forbids a GLboolean value.

    In practice, browsers accept the required GLboolean value and it works anyway. However, I'm using TypeScript, and the type definition file won't let me pass a boolean there, because the parameter is defined as a number, per the spec.


  • area_can

    Is this a lisp thing, or a GIMP thing?

    You should also notice that we took the head of the result of the function call. This may seem strange, because the database explicitly tells us that it returns only one value — the ID of the newly created image. However, all GIMP functions return a list, even if there is only one element in the list, so we need to get the head of the list.



  • @error said in WTF Bites:

    JavaScript type

    That's an oxymoron.


  • area_can

    0_1471538211419_Capture.PNG


  • Considered Harmful

    @NedFodder said in WTF Bites:

    @error said in WTF Bites:

    JavaScript type

    That's an oxymoron.

    :not_sure_if_serious:

    > const foo = 5;
    > typeof foo;
    "number"
    > const bar = true;
    > typeof bar;
    "boolean"
    

    Variables don't have types - rather, they're dynamically typed, so they're immutable like a hurricane (i.e., they can change type). Values definitely do have types. I'm using TypeScript, which enforces a loose type system while still allowing some fairly dynamic flexibility. Which is where I'm running into trouble, because TypeScript's type system doesn't want me to violate the contract which says this API takes a number and I'm giving it a boolean.


    Filed under: Possible :whoosh: from me.



  • @error said in WTF Bites:

    Filed under: Possible :whoosh: from me.

    Yeah, I wasn't as funny as I thought. But seriously, JavaScript types are a joke. Does TypeScript stop you from adding 2.4 to "f"?


  • Considered Harmful

    @NedFodder said in WTF Bites:

    Does TypeScript stop you from adding 2.4 to "f"?

    It doesn't stop me from adding it, but it stops me from assigning the result to a variable of the wrong type. So if I try to treat the result like a number, that's an error.



  • @groo

    ButtonSource button1Source = new ButtonSource();
    var button1 = button1Source.Button;
    

    Separation of concerns!


  • :belt_onion:

    @dkf:

    @Inject
    ButtonFactoryBuilder buttonFactoryBuilder;
    @Inject
    ButtonPolicyBuilder buttonPolicyBuilder;
    
    Button select;
     
    ButtonFactory buttonFactory = buttonFactoryBuilder.buildButtonFactory();
    ButtonPolicy buttonPolicy = buttonPolicyBuilder.getPolicyInstance(
            ButtonPolicy.STANDARD_BUTTON_POLICY, 
            ButtonPolicy.USE_SYSTEM_LOCALE,
            ButtonPolicy.SHARED_INSTANCE /* WARNING: Do not change! */);
    select = buttonFactory.makeInstantiatableButton(buttonPolicy).instantiate(container);
    

    :wtf:TFY



  • I recently had to explain to a coworker within the span of about a week why 1. a base class should not know or care about classes that inherit from it and 2. why it's important to escape strings before sticking them into a sql query. He generally does good work and he was very receptive to my explanations so I can't even put him up as the real wtf here.

    The class thing I can see because we generally don't have to deal with inheritance in our system, and definitely not on any kind of complex level, and there are a bunch of spots in our codebase where we're checking types manually.

    The sql thing I can almost give him a pass on because most of our sql is written right into the .cs files (yuck) and there was very little thought put into dealing with user values previously. But I can't believe I still have to explain sql injection concerns in 2016, even if this is a totally internal site and the worst case is somebody accidentally dropping a single quote in a name somewhere.

    Plus he's been nitpicking my work in peer reviews and I can't believe I'm having to point out such obvious issues in his.



  • In other news, previous developers (and some current) here seems to have an allergy to whitespace. Out of curiosity I did a scan of all the .cs files in our project and the longest run I could find was 394 lines without a empty line. Second place is 234, which might be worse because it's all if-else conditions down to the 10th level indented.



  • @fwd said in WTF Bites:

    394 lines without a empty line.

    Clearly, you're not being paid by the line.


  • Discourse touched me in a no-no place

    @boomzilla said in WTF Bites:

    $1000 per screen shot

    :wtf:

    @boomzilla said in WTF Bites:

    CSC

    Oh, them. All is explained.



  • @bb36e said in WTF Bites:

    0_1471538211419_Capture.PNG

    What's so surprising there? Everybody and their dog uses funny names for their concepts and everybody and their dog has plenty of documentation that just rephrases the function name. Why should this dog (Wilber) be any different?



  • @boomzilla said in WTF Bites:

    has been charging $1000 per screen shot.

    I just had a great new idea for my next Oracle SR....



  • @anonymous234 said in WTF Bites:

    Here's a much better way to do it:

    Because sometimes you want to have both a timeout and a way of manually cancelling tasks and also a way of sending session-scoped information without using thread-local variables which break pretty badly once you try to have multiple threads per session.



  • We have a project, that is composed from a handful of libraries. For $raisins, each component only has its own Visual Studio solution and there is a separate MSBuild project to build all of them. Ok, most of the time you only need to build the one you are editing, so it shouldn't be a problem. Except:

    • unit tests, even in the same solution, need something, that is only done by the external build script, so I have to run it before testing and
    • whenever (or at least most of the times) I run the MSBuild script, Visual Studio starts complaining about invalid CL.exe parameter and some duplicate item that makes no effing sense and I have to close it and open it again.


  • @error did you create a function out of your typescript thing for doing this stuff? how did you solve this?



  • @error There's no new pixelStore. in WebGL that explicitly accepts a GLboolean? Vanilla GL has glPixelStoref for when you need to pass a float, glPixelStorei for integers. No boolean version there, though. (I've seen a lot of people pass integer arguments through the ...f() methods on desktop, and it seems to work on occasion.)


  • Considered Harmful

    @groo said in WTF Bites:

    @error did you create a function out of your typescript thing for doing this stuff? how did you solve this?

    I can extend the built-in interface definition, or cast as any, so not a total blocker. Both of those are gross though. I opted to just not set those options.

    @cvi said in WTF Bites:

    @error There's no new pixelStore. in WebGL that explicitly accepts a GLboolean? Vanilla GL has glPixelStoref for when you need to pass a float, glPixelStorei for integers. No boolean version there, though. (I've seen a lot of people pass integer arguments through the ...f() methods on desktop, and it seems to work on occasion.)

    Correct, there is no glPixelStoreb. I would guess that the underlying C API is using BOOL, which is actually #defined as an int. That's not true in JavaScript though, so we have this odd contradiction in the spec. No one else seems to really care (the spec says it doesn't accept a bool, but in reality it does), and I wouldn't have noticed if the compiler hadn't bitched at me about it. I started to open a bug on the TypeScript repo about it, but then noticed it was correct per spec.

    I still might open a bug for it though.



  • @error said in WTF Bites:

    Correct, there is no glPixelStoreb. I would guess that the underlying C API is using BOOL, which is actually #defined as an int.

    I would have guessed that too, but quickly checked, and turns out it's a typedef unsigned char GLboolean, at least in the Linux-version of gl.h. Either way, in C I would have gone for the ...i() version as well.

    I still might open a bug for it though.

    Might even be worthwhile trying to report it the WebGL-org. Despite it working, they should care about contradictions in the spec. Then again, the latest WebGL release is from 2013, so I wouldn't exactly hold my breath waiting for a fix.


  • 🚽 Regular

    @ben_lubar said in WTF Bites:

    Here's a much better way to do it:

    Because sometimes you want to have both a timeout and a way of manually cancelling tasks and also a way of sending session-scoped information without using thread-local variables which break pretty badly once you try to have multiple threads per session.

    I like how you can nest tasks derive contexts so that when you cancel a parent task context that's been derived it also cancels its children deriving contexts.



  • @Bulb

    gimp-item-attach-parasite

    Did gimp just get pregnant?



  • How embarrassing.

    Filed Under: I did my "Spanish phrase meaning 'please beat me to death'" joke here already


  • Trolleybus Mechanic

    @cheong said in WTF Bites:

    @TimeBandit said in WTF Bites:

    @cvi said in WTF Bites:

    problem is, 15+ coffees per day is a bit unhealthy.

    That's why I have a huge mug :p

    In fact, smaller cup would be better in his case.

    http://i.imgur.com/hEwpLJB.png


  • Trolleybus Mechanic

    @dkf said in WTF Bites:

    @anonymous234 Double the fun:

    Button Button = Button();
    

    Can you confuse people enough like that? If not, we can make it worse! 🍹

    Namespace Thing
    
    Public Class Thing
    
       Public Function Thing as Thing.Thing
          Return new Thing()
       End Function
    
    End Class
    
    
    End Namespace
    
    Sub Main()
    
       Dim Thing as Thing.Thing = New Thing.Thing().Thing()
    
    End Main
    
    
    
    

  • Notification Spam Recipient

    @Lorne-Kates said in WTF Bites:

    @dkf said in WTF Bites:

    @anonymous234 Double the fun:

    Button Button = Button();
    

    Can you confuse people enough like that? If not, we can make it worse! 🍹

    Namespace Thing
    
    Public Class Thing
    
       Public Function Thing as Thing.Thing
          Return new Thing()
       End Function
    
    End Class
    
    
    End Namespace
    
    Sub Main()
    
       Dim Thing as Thing.Thing = New Thing.Thing().Thing()
    
    End Main
    
    
    
    

    Someone has an interesting complex....


  • Trolleybus Mechanic

    @Tsaukpaetra said in WTF Bites:

    Someone has an interesting complex....

    It's a thing.


  • Notification Spam Recipient

    @Lorne-Kates said in WTF Bites:

    @Tsaukpaetra said in WTF Bites:

    Someone has an interesting complex....

    It's a thing.

    Well, be careful not to introduce it to the Internet!


Log in to reply