• Melnorme (unregistered)

    TRWTF is the messed up formatting in this post.

  • Heinebold (unregistered)

    The formatting is messed up

  • DQ (unregistered) in reply to Heinebold

    Are you sure?

  • (nodebb) in reply to DQ

    It was, fixed now though.

  • Programmer Bot 1-32612 (unregistered)

    Came here fully expecting to see a SQL query with a concatenated WHERE clause. Left disappointed.

  • Bart (unregistered)

    DateTime conversionroutines in what seems to be some Delphi variant are indeed localized. It is however possible that they fixed the separators for time and date to some fixed character somewhere else in the program (which, b.t.w. is not recommended, one should use an overloaded version that supplies locale info).

  • Scott Simmons (unregistered)

    In fairness, the Ctrl-C think is a WTF.

  • Shortcuts (unregistered)

    When closing terminals, my Ctrl+D's often spill over to bookmarking whatever page I'm on in Firefox.

    A sudden, brutal window closing when attempting to copy some text would be really embarrassing to support as a sales rep or help desk agent. And, let me guess, right-clicking in a text box deletes the database, sends an email telling off the CEO and then formats the hard drives of everyone in the office?

  • (nodebb)
    So, to close a dialog, you hit "CTRL+C", because who would ever use that keyboard shortcut for any other function at all? There's no reason a GUI would use "CTRL+C" for anything but closing windows.

    But that's not the WTF.

    Yes it is.

  • Hasseman (unregistered)

    We, old school, developers seriously talked about hiding the mouse for our main windows developer to convince him to create keyboard shortcuts for most functions.

    Good old Emacs!

  • Vilx- (unregistered)

    Well, obviously everyone uses

    Ctrl+Insert to copy Shift+Delete to cut Shift+Insert to paste

  • Officer Johnny Holzkopf (unregistered)

    Unlike the presented source code where, traditional Pascal uses { braces } for indicating comments instead of //. It's also often possible to use the older (* two character form ) if your management has banned the use of braces, or you get paid by the amount of characters entered. In addition to comments, compiler switches and settings are also written that way, like {$X+} or ( $M 64000,0,0 *), somehow like (older versions of) Internet Explorer processes "conditional comments" in HTML. But maybe it's a problem with the syntax highlighting mechanism used in the article: it can work with C# and PHP just fine, but doesn't fully support Pascal? Hmmm...

  • write click (unregistered) in reply to Shortcuts

    You wouldn't happen to have a BOFH on site, would you?

  • Ann Onymous (unregistered)

    Bonus points are awarded for starting a transaction which may not even be committed let alone rolled back should an exception occur.

  • Worf (unregistered)

    So what would Ctrl-W in the program do? Copy the text to the clipboard?

  • Chris (unregistered)

    A quick google search tells me that "German date format" simply means "YYYY-MM-DD", which is 10 characters long as required by the code. So it's assuming a fixed or default date format from that DateTimeToStr function. So this will probably work just fine, but will be flaky if the expected format can be changed for any reason. E.g. some C*O decrees that dates must now look like MM-DD-YY, in which case this code will break, since the 10-character substring will include one digit of the hour.

  • Gerry (unregistered)

    I first thought "at least they uses parameters for the DateTime", then I noticed they created it with string manipulation. What I usually see is all sorts of manipulation to craft a date as a string, hopefully as YYY-MM-DD, but not always.

    While Remy is correct in saying a single UPDATE .. WHERE would work, if more complex logic, the developer may have wished to display the information to the user, which would also explain why "NAME", STATUS etc are included in the query.

    In which case, all they would need to do is (assuming Delphi)

        qryUsersToDeactivate.ParamByName('EXPIRED').AsDateTime := Date(); 
    

    Note that in Pascal, the () after Date is optional - functions that have no parameters don't need to have brackets.

    Even if the datetime was passed in as a parameter, there is a DateOf() function that returns the date part in all but he oldest versions of Delphi. Even back then you could simply use Trunc(dt);, as Delphi's TDateTime is a double-in-disguise, with the non fractional part being the number of days since 30/12/1899. The odd cut off is because Lotus 123 used it, so Excel used it, so COM uses it.... Lotus had a bug with leap years, it thought 1900 was leap.

  • RLB (unregistered)

    And after all that, the one thing that truly offends me in this code is the inverted capitalisation of the SQL string. It's keywords in all-caps and identifiers in lower or camel case, dammit!

  • kaewberg (unregistered) in reply to Officer Johnny Holzkopf

    Well parenthesis-star comments are much better than programming like

    code code ä comment å

    ...or maybe in C

    if (condition1 öö condition2) ä consequence(); å

    The joy of ISO 646-SE2 terminals: https://www.aivosto.com/articles/charsets-7bit.html

  • kaewberg (unregistered) in reply to kaewberg

    (Explanation: on such a terminal, "}{@][|~" are replaced with national characters "åäöüÅÄÖÜ")

  • iqra (unregistered)
    Comment held for moderation.

Leave a comment on “Expiration Dates”

Log In or post as a guest

Replying to comment #533025:

« Return to Article