ReportWire

Category: Humor

Humor | ReportWire publishes the latest breaking U.S. and world news, trending topics and developing stories from around globe.

  • omg

    [ad_1]

    submitted by /u/Fair-Entrepreneur-47
    [comments]

    [ad_2]

    /u/Fair-Entrepreneur-47

    Source link

  • These two are the real MVPs

    [ad_1]

    Tags: john wick, funny, movie memes, humor

    4217 points, 209 comments.

    [ad_2]

    Source link

  • NUrll

    [ad_1]

    Grace was tarcking down some production failures, which put her on the path to inspecting a lot of URLs in requests. And that put her onto this blob of code:

    app.get(
        (
          [
            "/api/ddm/getProjectList",
            ":dueDate",
            ":status",
            ":userAssignedId",
            ":managerID",
            ":clientID",
            ":projectHeaderID",
            ":tagId",
            ":companyId",
            ":clientGroup",
            ":isDefault",
            ":dateRange",
            ":dateToFilter",
            ":tagIds",
            ":statusIds",
            ":repeatValues",
            ":engagementID?",
            ":completionDate?"
          ]
          .join( "/" )
        ),
        ddmDboardCtrl.getProjectList
    );
    

    This defines a route in ExpressJS for handling GET requests. And it defines the route such that every single parameter on the request is contained in the path portion of the URL. That raises questions about why you need seventeen parameters to fulfill your request and what that means for our API design, but it's even worse than it looks: most of those parameters are allowed to be null.

    That means the request looks like this:

    GET /api/ddm/getProjectList/null/null/null/null/878778/null/null/2049/null/null/null/null/null/null/null/3532061?
    

    For bonus point, the developer responsible for that awful API also has a "special" way for dealing with possibly empty returns:

    (
          fs.readdirSync( `${ GLOBAL_DIRECTORY_PATH }` )
      ||
          (
            [ ]
          )
    )
    .map(
      (
        function( moduleName ){
          return  (
                    path.resolve( 
                      ( `${ GLOBAL_DIRECTORY_PATH }/${ moduleName }` )
                    )
                  );
        }
      )
    )
    

    This code calls reddirSync and in case that returns null, ||s the result with an empty array. Only one problem: readdirSync never returns null. It returns an empty array when there are no results.

    Also, this indenting is as submitted, which… what is even happening?

    This developer has a strange relationship with nulls- defending against them when they're not a risk, spamming them into URLs. They have gazed too long into the null, and the null gazes back into them.

    [Advertisement]
    Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.

    [ad_2]

    Remy Porter

    Source link

  • Happy pickle!

    [ad_1]

    Eating dinner and pulled out this little guy from the jar. Named him Hank.

    submitted by /u/StantzDarkKnight
    [comments]

    [ad_2]

    /u/StantzDarkKnight

    Source link

  • Well Timed Double Checking

    [ad_1]

    Last week’s out of order logging reminded Adam R of a similar bug he encountered once.

    The log files looked like this:

    [2026-01-14 16:40:12.999802][process_name][42][DEBUG][somefilename:01234] A thing happened
    [2026-01-14 16:40:12.999997][process_name][42][DEBUG][somefilename:01235] Another thing happened
    [2026-01-14 16:40:12.000031][process_name][42][DEBUG][somefilename:01236] A third thing happened
    [2026-01-14 16:40:13.000385][process_name][42][DEBUG][somefilename:01237] A fourth thing happened
    

    Note the timestamp on the third log line: it’s out of order. But as you can get from Adam’s highly anonymized messages, it’s actually in the correct order- it’s the third thing that happened, and it’s the third log line. So clearly, something has gone off with calculating the timestamp.

    Now, if you want to ask your OS for time with microsecond precision, you can call gettimeofday, which will populate a timeval struct. That gives you seconds/microseconds since the epoch. gmtime can then be used to convert the seconds portion into something more readable. This is pretty standard stuff- how could someone screw it up?

    void Logger::log(const char* message, int level, const char* filename, int line)
    {
        time_t now = time();
        struct tm* now_tm = gmtime(&now);
    
        struct timeval now_tv;
        gettimeofday(&now_tv, NULL);
    
        char buffer[1024];  
        snprintf(buffer, sizeof(buffer), "[%04d-%02d-%02d %02d:%02d:%02d.%06d][%s][%s][%s][%32s:%05d] %sn",
            now_tm->tm_year + 1900,
            now_tm->tm_mon + 1,
            now_tm->tm_mday,
            now_tm->tm_hour,
            now_tm->tm_min,
            now_tm->tm_sec,
            now_tv->tv_usec,
            get_process_name(),
            get_thread_id(),
            log_level_string(level),
            filename,
            line,
            message);
    
        write_to_log_file(buffer);
    }
    

    This C++ function is reconstructed as Adam remembers it. The first four lines highlight the problem: they check the time twice. The call to time() returns the number of seconds since the epoch, which they then convert into a readable time using gmtime. Then they use gettimeofday to get the seconds/microseconds since the epoch. When they print, they use the values from time for every field but microseconds, and then use the microseconds from gettimeofday.

    They check the clock twice, and shockingly, get different values each time. And when the clock ticks are near a second boundary, the microseconds can roll back over to zero, creating a situation where log entries appear to go backwards in time.

    The fix was simple: just check the time once.

    Adam writes:

    My suspicion is that this logging function started out printing only seconds, and then someone realized “Hey, wouldn’t it be useful to add microseconds to here as well?” and threw in the extra call to gettimeofday() without thinking about it hard enough.

    That’s a pretty solid suspicion. Adam can’t confirm it, because he doesn’t work there anymore, and has no access to their source control, and even if he did, the project has been through multiple source control migrations which destroyed or otherwise mangled the history, leaving the root cause as always and forever a mystery.

    [Advertisement]
    Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.

    [ad_2]

    Remy Porter

    Source link

  • No title

    [ad_1]

    18151 points, 100 comments.

    [ad_2]

    Source link

  • Marking Territory

    [ad_1]

    There's something about hierarchical arrangements that makes top-down interference utterly irresistible to many managers and executives. Writers may also experience similar strife with their editors, a phenomenon Robert Heinlein described with the perfect metaphor: "After he pees in it himself, he likes the flavor much better."

    Sometimes, a leader leverages their hard-won wisdom and experience to steer a project onto a better path. But, all too often, someone's imagined wisdom and starving ego force a perfectly good train off the rails.

    Today, our friend and long-time submitter Argle shares an example of the latter:

    Between 2017 and the end of 2023, I worked with a contracting firm. The work was quite varied, and I generally liked all the clients I had to deal with. One of those was Regional Western Electric. RWE was a good company, and the engineers I worked most closely with were guys I'd happily drink beer with. The project itself was a bit of a WTF: it was a transformer design program written in BASIC running on DOS (from circa 1988) that they wished to modernize.

    While it's possible to write good BASIC code, that generally doesn't happen, and this project was typical. Aside from having a horrendous user interface, their 10 base transformer designs started as a single program and bloated to 10 programs, all sharing variables g1 through g99 and g1$ through g99$. At some point, they got a language update, so full-length names dotted the program, and a few line numbers went away.

    Thankfully, they didn't want us to fix the program: they wanted it replaced as web application for their intranet. This proved that there ARE smart engineers and management.

    My job was to convert all the math from BASIC to C#. I was more the math guy than the other senior programmer who wanted this to be our second big project in Angular. (The first was an internal project.) This worked well, though I did ask at the start if it wasn't wiser just to have me get together with their engineers at a marker board and just figure out everything directly. There was some discussion about this, and one engineer remarked that we'll probably look back and regret not following my suggestion, but at least going the "conversion" route let us compare old output to new.

    Since this was a fact, we forged ahead. The catch with this was that I had to replicate all the content errors, and there were many. A sorted table of wires had one sorted out of place. A lengthy magnetic field calculation was negated by multiplying by a global variable that was always 0. The code was littered with *1.1 or *1.05 to add 10% or 5% fudge factors to one specific design, then left in the code. As this progressed, the project went from unmanageable code to which nothing new could be added (they had newer equipment which couldn't be figured into designs) [into something manageable].

    This is the happy part of the story.

    The unhappy part is what happened to my co-worker. While I had a lovely base class for the transformers and happy virtual functions making the designs slick, he had something similar working in Angular. The CSS was great and designed by our house designer (who was good at his job), the components were perfect … the whole thing was a showcase project.

    Then came the meeting to discuss the aforementioned additions that everyone was looking forward to. For the first time, their IT director joined one of the meetings. He looked over everything, then declared that he didn't want to learn Typescript and Angular, and then insisted that the whole front-end be rewritten in MVC.

    The company was paid by the hour, so the owner didn't mind this, but you could almost see the smoke rising from my co-worker's head as he spent weeks on the rewrite.

    As for the IT director, he never stuck his nose in the project again. Never maintained it, and retired around the time I added some of the new features.

    Sadly, the period of inflation ate into any budget they might have had to move on to the next big phase of the project, and I've moved on to another company.

    It's just a shame what one person throwing his weight around can do to a project.

    [Advertisement]
    Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!

    [ad_2]

    Ellis Morning

    Source link

  • The ultimate disrespect.

    [ad_1]

    I think they’ve actually adopted him as their leader.

    submitted by /u/Central_desert
    [comments]

    [ad_2]

    /u/Central_desert

    Source link

  • Honesty

    [ad_1]

    Tags: fat

    2722 points, 500 comments.

    [ad_2]

    Source link