• SomeDBEngineer (unregistered) in reply to huppenzuppen

    I had the same problem until I Adblock-ed the gif.

  • WTF (unregistered) in reply to File Not Found
    File Not Found:
    'Y' = True 'N' = False 'F' = File Not Found
    'W' = Wrong 'T' = True 'F' = File Not Found
  • (cs) in reply to Tongle
    Tongle:
    I have seen something similar but instead of nvarchar(1) it was about nvarchar(100). Lots of boolean configuration fields stored in one string that looked like: NNNNNNNNNNYNYNYNNYNYNNNNYYYYNNNNNNYYYYYYYYYYYYYYNNNNNNY

    Oooh, fun :D I once worked on a database pulled from scanned paper survey forms. Most questions were multiple selection boxes, and (being paper) had no limit on how many boxes you could check. So more than half the fields in the DB were long varchars which could have any combination of letters, each letter indicating a different box was ticked. It kind of made sense, but was the mother of all dbs to write efficient queries on.

    Amusingly, when I interviewed for that job part of the test was to construct a query to count survey responses with a particular combination of answers, and my reply involved a lot of LIKE comparisons and complex character sets. So you can imagine my delight when I started the job 5 weeks later, to find an exact copy of my interview test answer in the live database ;)

    And I'm afraid no-one quite wins the cookie, as the correct answer was 'Y' for true, 'N' for false, and there are no nulls, blank strings, or any other value, in the entire dataset. And that's what you get when you boneheadedly shift data around several different storage formats without thinking about what you're doing...

  • Captain Oblivious (unregistered)

    What's wrong with functions that return functions that return functions?

    Wah it makes my head hurt!

    Let me tell you: I think the same dang thing when I see the "standard" object oriented patterns. Why would somebody use 4 complex "language interfaces" (classes, objects, and their respective methods) instead of the single unifying interface that are functions? Oh, because some people in the 90s were limited by their tools. And because functions are hard! :(

    Of course, this complex interfacing is the cause of a whole lot of language complexity, too. Code is not "conceptually portable", because one language's class semantics are different from anothers'. One language's method calling semantics are different from anothers'. So we end up writing adapters and such to interface between the languages. Interfaces for interfaces, so you can interface while you interface.

  • (cs) in reply to Kasper
    Kasper:
    MiniMax:
    Like nominally numeric primary keys stored as Strings in the database and passed around as both String and int in code, casted/converted on the spot as needed, boolean flags as ints, etc.
    I am developing for a system, which works just like that. Except in my case it is even worse, as the system is not the least bit consistent about it.

    In some tables they are strings in others they are ints. Additionally in each table, there are different limits on the highest allowed value for this number. The error message you get, by attempting to exceed the maximum varies. One error message if you exceed a 32 bit signed integer, another error message if you stay within that limit, but exceed the other arbitrary limit imposed on this particular table. Of course those two error messages are different depending on whether this particular table uses ints or strings to represent the primary key.

    You think that sounds like a WTF? Well, I haven't really gotten started yet.

    There are two different ways to access the data in these tables. The two different ways do not enforce the same limits. Some of the arbitrary limits are only enforced for data entered through one of these methods, while the other method can exceed the limits. Some of the limits are however enforced through both access methods.

    The limits are also enforced when you edit data. Which means if you create an entry through one interface, then editing it through the other interface has to respect the limit applicable to that second interface. That is a bit tricky, if the primary key used through the first interface was too large for the second interface.

    Luckily there is a way around that problem. There is a per user configuration page, that will give access to change the primary key on existing rows. So each user can choose on which tables, she wants to be able to change primary keys. Though, not all tables are selectable on that configuration page.

    The interesting part about strings whose values are nominally numeric, is that you can be quite inconsistent about it. Thus one table actually allow non-numeric values in the primary key.

    That table allow any character in the windows-1252 character set to be used in the value. Comparison of values is done case-insensitive for characters, which exist in iso-8859-1 and case-sensitive for characters which exist in windows-1252 but not in iso-8859-1.

    I always wonder why developers who know better either 1) don't fix those systems immediately, or 2) find a job at a company that produces better code. I couldn't work in an environment where I was forced to maintain a system like that.

    But that makes me think of another point: if good developers won't work at companies that produce bad code, does that mean that only bad developers will work there, thus ensuring that the bad code lives on?

  • anonymous (unregistered)

    This seems to work:

    // ==UserScript==
    // @name        AniStop
    // @namespace   custom
    // @description Stops animated GIF or PNG images from playing when the Esc key is pressed by replacing them with static PNG images.
    // @include     *
    // @grant       GM_xmlhttpRequest
    // run-at       document-start
    // ==/UserScript==
    
    try {
    window.addEventListener("keypress", function (e) {
    try {
    if (e.keyCode == 27) {
    console.log("The Esc key was trapped by the AniStop user script");

                <span style="color:#000080;"><b><i>var</i></b></span> d <b>=</b> <b>[];</b>
                <span style="color:#000080;"><b><i>for</i></b></span> <b>(</b><span style="color:#000080;"><b><i>var</i></b></span> i <b>=</b> <span style="color:red;">0</span><b>;</b> i <b><</b> document<b>.</b>images<b>.</b>length<b>;</b> <b>++</b> i<b>)</b> <b>{</b>
                    d<b>.</b>push<b>(</b>document<b>.</b>images<b>[</b>i<b>]);</b>
                <b>}</b>
                <span style="color:#000080;"><b><i>for</i></b></span> <b>(</b><span style="color:#000080;"><b><i>var</i></b></span> i <b>=</b> <span style="color:red;">0</span><b>;</b> i <b><</b> window<b>.</b>frames<b>.</b>length<b>;</b> <b>++</b> i<b>)</b> <b>{</b>
                    <span style="color:#000080;"><b><i>if</i></b></span> <b>(</b>window<b>.</b>frames<b>[</b>i<b>].</b>document<b>)</b> <b>{</b>
                        <span style="color:#000080;"><b><i>for</i></b></span> <b>(</b><span style="color:#000080;"><b><i>var</i></b></span> j <b>=</b> <span style="color:red;">0</span><b>,</b> d2 <b>=</b> window<b>.</b>frames<b>[</b>i<b>].</b>document<b>.</b>images<b>;</b> j <b><</b> d2<b>.</b>length<b>;</b> <b>++</b> j<b>)</b> <b>{</b>
                            d<b>.</b>push<b>(</b>d2<b>[</b>j<b>]);</b>
                        <b>}</b>
                    <b>}</b>
                <b>}</b>
                
                <span style="color:#000080;"><b><i>for</i></b></span> <b>(</b><span style="color:#000080;"><b><i>var</i></b></span> i <b>=</b> <span style="color:red;">0</span><b>;</b> i <b><</b> d<b>.</b>length<b>;</b> <b>++</b> i<b>)</b> <b>{</b>
                    <span style="color:#000080;"><b><i>with</i></b></span> <b>(</b>document<b>.</b>createElement<b>(</b><span style="color:#808080;">"canvas"</span><b>))</b> <b>{</b>
                        width <b>=</b> d<b>[</b>i<b>].</b>naturalWidth<b>;</b>
                        height <b>=</b> d<b>[</b>i<b>].</b>naturalHeight<b>;</b>
                        <span style="color:#000080;"><b><i>try</i></b></span> <b>{</b>
                            <span style="color:#008000;">// draw a static version of the image on a canvas, and copy that back to the original image
    

    getContext("2d").drawImage(d[i], 0, 0); d[i].src = toDataURL("image/png"); } catch (e) { // security error occurs when copying images cross-domain. stupid security error. GM_xmlhttpRequest({ // use GM_xmlhttpRequest to load cross-domain image method: "GET", binary: true, context: d[i], url: d[i].src, overrideMimeType: "text/plain; charset=x-user-defined", onload: function (r) { try { if (r.status != 200) r.context.src = ""; else { var contentType = r.responseHeaders.substr(r.responseHeaders.indexOf("Content-Type: ") + 14); contentType = contentType.substr(0, (contentType + "\r").indexOf("\r")); if (contentType.indexOf("gif") >= 0 || contentType.indexOf("png") >= 0) { // wouldn't it be nice if btoa() just worked? var d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; for (var i = 0, c, o = ""; i < r.responseText.length; ) { c = ((r.responseText.charCodeAt(i ++) & 255) << 16) | ((r.responseText.charCodeAt(i ++) & 255) << 8) | (r.responseText.charCodeAt(i ++) & 255); o += d.charAt(c >> 18) + d.charAt((c >> 12) & 63) + (i - r.responseText.length > 1 ? "=" : d.charAt((c >> 6) & 63)) + (i > r.responseText.length ? "=" : d.charAt(c & 63)); }

                                                <span style="color:#000080;"><b><i>var</i></b></span> img <b>=</b> document<b>.</b>createElement<b>(</b><span style="color:#808080;">"img"</span><b>);</b>
                                                img<b>.</b>addEventListener<b>(</b><span style="color:#808080;">"load"</span><b>,</b> <span style="color:#000080;"><b><i>function</i></b></span> <b>()</b> <b>{</b>
                                                    <span style="color:#000080;"><b><i>try</i></b></span> <b>{</b>
                                                        <span style="color:#000080;"><b><i>with</i></b></span> <b>(</b>document<b>.</b>createElement<b>(</b><span style="color:#808080;">"canvas"</span><b>))</b> <b>{</b>
                                                            width <b>=</b> img<b>.</b>naturalWidth<b>;</b>
                                                            height <b>=</b> img<b>.</b>naturalHeight<b>;</b>
                                                            getContext<b>(</b><span style="color:#808080;">"2d"</span><b>).</b>drawImage<b>(</b>img<b>,</b> <span style="color:red;">0</span><b>,</b> <span style="color:red;">0</span><b>);</b>
                                                            r<b>.</b>context<b>.</b>src <b>=</b> toDataURL<b>(</b><span style="color:#808080;">"image/png"</span><b>);</b>
                                                        <b>}</b>
                                                    <b>}</b> <span style="color:#000080;"><b><i>catch</i></b></span> <b>(</b>e<b>)</b> <b>{</b>
                                                        <span style="color:#008000;">// if this still fails, it's most likely a broken image
    

    console.error(e.name + ": " + e.message); } }); img.src = "data:" + contentType + ";base64," + o; } } } catch (e) { console.error(e.name + ": " + e.message); } } }); } } } } } catch (e) { console.error(e.name + ": " + e.message); } }); } catch (e) { console.error(e.name + ": " + e.message); }

  • (cs) in reply to Flash
    Flash:
    minim:
    huppenzuppen:
    Am I the only one who finds it difficult to read the article when a Jenga tower is constantly collapsing on the right?
    Right click, Inspect element. Right click, Delete node.

    Chrome is a nice browser.

    Same steps work in Safari. Thanks!

    Also works in FireFox with NoScript.

  • Meep (unregistered) in reply to Nick
    Nick:
    MiniMax:
    I will be happy to refer you to my esteemed ex-colleagues whose code I am trying to keep alive. Like nominally numeric primary keys stored as Strings in the database and passed around as both String and int in code, casted/converted on the spot as needed, boolean flags as ints, etc.

    You have individual variables for your fields? Luxury! Ours are passed around all thrown together in pipe separated character arrays and knowing whether a method adds to the buffer or clears it usually requires careful examination of that method.

    Yes, I am fixing this monstrosity, slowly.

    So, my old company had a total hard-on for AWK.

    But some of the younger coders thought that was nonsense. Just to prove the awk guys sane by comparison, one wrote a loader that parsed JSON. I take that back, each line in the file was a separate JSON object.

    Of course, some fields in the object were "complex" and those were loaded from a pipe-delimited array, or sometimes a caret and pipe delimited array of arrays.

    In short, I want to fucking kill whoever invented String.split.

  • Sebastian Ramadan (unregistered)

    TRWTF is the animation to the right of the article. The readers eyes are drawn straight to the thing that moves, where they remain as it remains on loop. If you consider that your site serves two purposes (to promote products, and to provide stories), this makes no sense. Draw attention towards your ads or your articles, rather than away from them.

  • Sebastian Ramadan (unregistered) in reply to Sebastian Ramadan
  • (cs) in reply to Sebastian Ramadan
    Sebastian Ramadan:
    TRWTF is the animation to the right of the article. The readers eyes are drawn straight to the thing that moves, where they remain as it remains on loop.
    I didn't notice it. In fact, I still haven't seen it; the only reason I have some idea of what it is is because of all the comments complaining about it. After I post this I guess I'll go back to the article and look at it; it sounds interesting.
  • Shinobu (unregistered) in reply to JimM
    JimM:
    MiniMax:
    ... boolean flags as ints ...
    Could be worse, I recently discovered an entirely new way to store boolean values in SQL server: nvarchar(1). An internet cookie to the first person who can guess how the value is encoded in this field ;)
    Our CMS does that. True = "1" and False = "".
  • anonymous (unregistered)
  • Sebastian Ramadan (unregistered) in reply to anonymous
    anonymous:

    This anonymous has reinvented the way all articles should be presented!

  • Neil (unregistered) in reply to anonymous
    anonymous:
    } catch (e) {     console.error(e.name + ": " + e.message); }
    Because of course if you didn't catch that exception there would be no way to log it to the console!
  • anonymous (unregistered) in reply to Neil
    Neil:
    anonymous:
    } catch (e) {     console.error(e.name + ": " + e.message); }
    Because of course if you didn't catch that exception there would be no way to log it to the console!
    Errors in GreaseMonkey user scripts aren't automatically logged to the console. At least, they're not in Firefox.
  • Javelin (unregistered) in reply to JimM
    JimM:
    MiniMax:
    ... boolean flags as ints ...

    Could be worse, I recently discovered an entirely new way to store boolean values in SQL server: nvarchar(1). An internet cookie to the first person who can guess how the value is encoded in this field ;)

    • Values interpreted as true: * '1' 'T' 'true' 'True' 'TRUE' 'y' 'Y' 'Yes' '0' 'SUCCESS'

    • Values interpreted as false: * '0' 'F' 'false' 'FALSE' 'n' 'N' 'no' 'No' 'NO' '-1' '' NULL ' ' :wq!

  • LOL (unregistered)
    Remy:
    Disassemble means dead? NO DISASSEMBLE. NO DISASSEMBLE.

    Well, that takes me back! :)

    Link: http://www.youtube.com/watch?v=WjeptaI2T8E

    Captcha: secundum

Leave a comment on “Managed Order Management”

Log In or post as a guest

Replying to comment #:

« Return to Article