Let's make a filename



  • string filename = DateTime.Now.TimeOfDay.ToString().Substring(0, 11);
    filename = filename.Replace(":", "");
    filename = filename.Replace(".", "");
    filename = "chart" + filename + ".xls";



  • This might well be Java's influence: it makes formatting date time strings hell.



  • Luckily, this is only slated to run during a specific 24-hour period, so there's no risk of duplicates, right?



  • @TGV said:

    This might well be Java's influence: it makes formatting date time strings hell.

    The capitalized method names suggest C#. But perhaps the author of the code was thinking in Java.



  • @TGV said:

    This might well be Java's influence: it makes formatting date time strings hell.

     

    Because this is SO hard:


    String filename = new SimpleDateFormat("YYYYmmddHHMM").format(new Date()) + ".xls";



  • @TGV said:

    This might well be Java's influence: it makes formatting date time strings hell.

    There are only two kinds of languages: the ones people complain about and the ones nobody uses. Bjarne Stroustrup



  • @ubersoldat said:

    @TGV said:

    This might well be Java's influence: it makes formatting date time strings hell.

     

    Because this is SO hard:


    String filename = new SimpleDateFormat("YYYYmmddHHMM").format(new Date()) + ".xls";

    Y10K bug again!



  • @Speakerphone Dude said:

    @ubersoldat said:

    @TGV said:

    This might well be Java's influence: it makes formatting date time strings hell.

     

    Because this is SO hard:


    String filename = new SimpleDateFormat("YYYYmmddHHMM").format(new Date()) + ".xls";

    Y10K bug again!

    IIRC, YYYY just means "use the long form", which in theory should work fine past year 9999--it's not saying "use exactly 4 digits to represent the year".

    Hilariously, I think this is still a bug because Y is a week year whereas y is a calendar year, so this will probably give unexpected results. "SO hard" indeed..



  • @Rick said:

    @TGV said:
    This might well be Java's influence: it makes formatting date time strings hell.

    There are only two kinds of languages: the ones people complain about and the ones nobody uses. Bjarne Stroustrup
     

    Gotta love it when the maker of a defective product tosses off glib little one-liners whose only purpose is to abruptly put an end to the discussion at hand in order to avoid a frank and honest discussion of the flaws in his work.



  • @Rick said:

    @TGV said:
    This might well be Java's influence: it makes formatting date time strings hell.

    There are only two kinds of languages: the ones people complain about and the ones nobody uses. Bjarne Stroustrup

    And at the intersection: C++.



  • @Mason Wheeler said:

    @Rick said:

    @TGV said:
    This might well be Java's influence: it makes formatting date time strings hell.

    There are only two kinds of languages: the ones people complain about and the ones nobody uses. Bjarne Stroustrup
     

    Gotta love it when the maker of a defective product tosses off glib little one-liners whose only purpose is to abruptly put an end to the discussion at hand in order to avoid a frank and honest discussion of the flaws in his work.

    An oldie but a goodie: "I don't see what C++ has to do with keeping people from shooting themselves in the foot. C++ will happily load the gun, offer you a drink to steady your nerves, and help you aim." -- Peter da Silva



  • Here's another one:

    string strFileName = "chart" + DateTime.Now.Hour.ToString("00")
          + DateTime.Now.Minute.ToString("00")
          + DateTime.Now.Second.ToString("00");
    
    string strSecure = strFileName.getSha512(iInformation.MyIProfile.idNO);
    strFileName += strSecure.Left(12).Replace(@"\", "_").Replace("/", "_");
    strFileName += ".xls";
    


  • Elegant.

    I prefer this:

    [code]
    mov eax, 0

    cpuid

    // getting information from EBX

    mov pszCPUType[0], bl

    mov pszCPUType[1], bh

    ror ebx, 16

    mov pszCPUType[2], bl

    mov pszCPUType[3], bh

    // getting information from EDX

    mov pszCPUType[4], dl

    mov pszCPUType[5], dh

    ror edx, 16

    mov pszCPUType[6], dl

    mov pszCPUType[7], dh

    // getting information from ECX

    mov pszCPUType[8], cl

    mov pszCPUType[9], ch

    ror ecx, 16

    mov pszCPUType[10], cl

    mov pszCPUType[11], ch

    [/code]


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.