Images in old articles?



  • Hi All,

    Seems that since the server move and the addition of HTTPS, some of the older articles (e.g. https://thedailywtf.com/articles/The-Zero-Dollar-Bill) have broken images due to the certificate being invalid for the domain img.thedailywtf.com (should have got a wildcard or a UCC Alex).

    Entering the following into the debug console (F12) works in the meantime for Firefox at least.

    $("img[src*='//img']").each( (ix, e) => $(e).attr("src", $(e).attr("src").replace("//img.", "//")))
    

    Note: I'm not a front-end dev, so if my JS sucks, please be gentle (but still tell me where I can improve).

    I'm aware that removing the https:// from the start of the URL also works, but I don't want to encourage regression.

    @whoever_runs_this_site may be worth adding something similar globally until the certificate issue is worked out.


  • Notification Spam Recipient

    @idzy said in Images in old articles?:

    @whoever_runs_this_site

    Well @ben-lubar maintains things. Kinda.

    Welcome to the forums!



  • @Tsaukpaetra Cheers for that. I'm a long-time reader but have finally reached a mental block that has lasted long enough for me to participate.

    Anyone with Computer Vision experience willing to offer advice on which library to uses at the core of a massive (>$2M) greenfields project, feel free to offer suggestions. We're going to be prototyping with OpenCV, Tensorflow, and some proprietary ones. Also trying to pick a future winner out of CUDA, OpenCL, Movidius and probably more I'm yet to learn about is killing me.

    Though it's fun to work on the very cutting edge of this tech, it's a nightmare when you're the one who's gotta take responsibility for predicting its future and committing to a path.



  • @Tsaukpaetra I think you mean @ben_lubar.


  • 🚽 Regular

    @idzy said in Images in old articles?:

    @Tsaukpaetra Cheers for that. I'm a long-time reader but have finally reached a mental block that has lasted long enough for me to participate.

    Anyone with Computer Vision experience willing to offer advice on which library to uses at the core of a massive (>$2M) greenfields project, feel free to offer suggestions. We're going to be prototyping with OpenCV, Tensorflow, and some proprietary ones. Also trying to pick a future winner out of CUDA, OpenCL, Movidius and probably more I'm yet to learn about is killing me.

    Though it's fun to work on the very cutting edge of this tech, it's a nightmare when you're the one who's gotta take responsibility for predicting its future and committing to a path.

    Only one of those I've used is OpenCV. It's fine, reasonably sane, and seems to work. I was trying to detect my cat with a Kinect though, not a >2MM project.


  • area_pol

    @idzy said in Images in old articles?:

    OpenCV, Tensorflow

    These are for slightly different purposes: OpenCV does image processing and lots of traditional vision algorithms, Tensorflow does neural networks.

    So for example I use both in one system: OpenCV for image handling and PyTorch for the neural nets.

    CUDA, OpenCL

    Tensorflow should work on both CUDA and ROCm (AMD's alternative), so theoretically you could use either Nvidia or AMD gpus with it.


  • ♿ (Parody)

    @idzy said in Images in old articles?:

    willing to offer advice

    You'll get better exposure if you go to the General or Coding Help category and post this question there. I have no experience in the field but I have a lot of experience with free threads.


  • BINNED

    @boomzilla said in Images in old articles?:

    I have no experience in the field but I have a lot of experience with free threads.

    And snark. Don't forget lots of experience with snark.

    I second it, though. A new thread about it might make for an interesting discussion.



  • @apapadimoulis what happened to the certbot I had set up on the front page?



  • I have a userscript that (among many other things) already checks for broken images... every so often, somebody messes up the filenames, and they'll be image.jpg when they should be image.png or vice versa. The code I wrote detects the broken images, and it tries changing the file extension to each of the other formats (JPEG, GIF, and PNG). If any of those alternate filenames load successfully, its load event updates the original image's source.

    I tweaked it so that if the image's host is img.thedailywtf.com (and the scheme is HTTPS), it also tries changing it to thedailywtf.com. Note that images that do load successfully are skipped, so if the HTTPS certificate gets updated and the images load properly, it won't unnecessarily try to fix them anyway.

    // detect whether images have loaded correctly and if any are broken try changing the file type
    function checkImgs(e) {
      function fixImg(img) {
        var ext = img.src.split(".").pop().toLowerCase();
        var extensions = ["jpg", "gif", "png"].filter(e => e != ext);
    
        var filenames = [];
        if (/^https:\/+img\./.test(img.src)) filenames.push(img.src.replace(/^([^\/]+\/+)img\./, '$1'));
        filenames = filenames.concat(extensions.map(e => img.src.replace(/[^\.]*$/, e)));
    
        filenames.forEach(file => {
          var i = document.createElement("img");
          i.onload = e => i.complete && i.naturalWidth && (img.src = i.src);
          i.src = file;
        });
      }
    
      if (e) {
        [...e.querySelectorAll("img")].forEach(img => {
          if (/^https?:\/+([^\.]+\.)*thedailywtf\.com\//.test(img.src)) {
            if (img.complete) {
              if (!img.naturalWidth) fixImg(img);
            } else {
              img.onerror = fixImg.bind(this, img);
            }
          }
        });
      }
    }
    checkImgs(document.querySelector(".article-body"));
    

    You're welcome to copy and use this for personal use. I say personal use because I doubt that Ben would want to include it in the site; it's basically monkey-patching stuff that should really be fixed in the articles themselves and/or by updating the HTTPS certificate.



  • @boomzilla Thanks for the suggestion.
    As it happens, my statement was more rhetorical than an actual cry for help. Unfortunately, the application is subject to many levels of occult ritual oaths of secrecy, so I couldn't explain the problem domain or scope anyway.

    While on first inspection, the requirements document seems like a bit of a moon-shot, upon further reflection I really believe that a successful and robust solution in this space would be a huge commercial success (trust me, everyone would want one).

    I've only recently been promoted to my current position (and am fairly young for such a senior post), and I really don't want to screw this up, so probably am obsessing more than I need to over this.

    I've got a great team, and fortunately enough aren't solely reliant on my own competence. But with this many resources to account for, I'm just trying to do a good job. Our company, whilst being owned by a US fortune 500, is an oasis of flagrant disregard for big corporate culture, by virtue of our high profitability as an independent division, and roughly 10,353 miles between us and our corporate overlords. But our local management structure is the opposite of a WTF, best company I've ever worked for in terms of salary, incentives, flexibility and a pure meritocracy, so I just don't want to be the WTF myself.


  • Notification Spam Recipient

    @Choonster said in Images in old articles?:

    @Tsaukpaetra I think you mean @ben_lubar.

    Yes, for some reason the dropdown thing stops suggesting so I had to guess.


  • Notification Spam Recipient

    @idzy said in Images in old articles?:

    trust me, everyone would want one

    It's a seeing-eye dog robot, isn't it?



  • It's a seeing-eye dog robot, isn't it?

    Sadly not... If that were the case, I couldn't resist incubating a Japanese start-up to make it freakishly cuddly and cute, with gigantic eyes.

    But the day I'm asked to build a sincerity simulator for a steel bending robot who's core logic is written in 6502 assembly, I'll know it's time for retirement.



  • @Adynathos

    You are absolutely correct. Without revealing too much about the project, there are elements of both computer vision and machine learning involved. The CV component is to identify the region of interest, which is fed into the neural net to improve the model. This is what makes it so difficult. Given that it is going to be deployed as an embedded device, the hardware choice is important, and OpenCV + Tensorflow was my instinctive choice, but I really don't trust the likes of Google and Facebook who open-source their previous generation tech to keep potential competitors on a level playing field. Obviously if they have moved on to a new generation, the previous tech was a dead-end design, so is fundamentally flawed in some way. But everyone comes to the same conclusion "We have no chance of building something better than what Google used yesterday, so lets start with that"

    Have never heard of PyTorch, but will look into it.

    In any case, it's a long weekend here in Aus, I should be upstairs in bed with my wife, not down here researching software libraries.


  • Considered Harmful

    @idzy CUDA and Tensorflow


  • area_pol

    @idzy said in Images in old articles?:

    embedded device

    So you probably don't want to run python?

    @idzy said in Images in old articles?:

    OpenCV + Tensorflow was my instinctive choice, but I really don't trust the likes of Google and Facebook who open-source their previous generation tech to keep potential competitors on a level playing field

    OpenCV is not controlled by a large corporation.
    Tensorflow and PyTorch are, but they are also what the majority of the research community is using - so you can use the code published by researchers (if you get it to run that is).


  • 🚽 Regular

    @idzy You have made this thread go off-topic.

    Welcome to the forum!



  • @Zecc said in Images in old articles?:

    @idzy You have made this thread go off-topic.

    Welcome to the forum!

    @idzy Don't interpret this as a complaint; it's standard operating procedure here. Almost all forums experience some topic drift. Not so TDWTF! We don't drift. We actively steam toward the maelstrom at full throttle while the people in charge party with the kracken, guzzling cheap whiskey and playing spin the bottle with the helm.


  • Discourse touched me in a no-no place

    @HardwareGeek said in Images in old articles?:

    @idzy Don't interpret this as a complaint; it's standard operating procedure here. Almost all forums experience some topic drift. Not so TDWTF! We don't drift. We actively steam toward the maelstrom at full throttle while the people in charge party with the kracken, guzzling cheap whiskey and playing spin the bottle with the helm.

    9719f93c-1f53-481f-9544-de057bc75cff-image.png

    4d4eeafd-5d13-4f42-b342-4ef16a38ce25-image.png

    c1a4428a-a1c4-4ab0-8516-65827a3a9c56-image.png

    Or one closer to home for me, that should probably be in The Lounge:

    791c5020-3269-414f-94f8-3e8e309cb2a2-image.png



  • @PJH said in Images in old articles?:

    one closer to home for me, that should probably be in The Lounge:

    ❓ You're in the UK, aren't you? The picture is from Norway. I don't see a reason for it to be Lounge material. Were you and ⛽ 🔥
    @Polygeekery vacationing together in Norway at the time?


  • Discourse touched me in a no-no place

    @HardwareGeek said in Images in old articles?:

    @PJH said in Images in old articles?:

    one closer to home for me, that should probably be in The Lounge:

    ❓ You're in the UK, aren't you? The picture is from Norway. I don't see a reason for it to be Lounge material.

    It is, indeed, Norway.



  • @PJH No denial of vacationing with our favorite arsonist? I'll take that as a confirmation, then. :trollface:


  • Discourse touched me in a no-no place

    @HardwareGeek, I was in the UK at the time that photo was taken...



  • @PJH How long after the fire started was the picture taken? How long does it take to get from there to the UK? Hmm...


  • Discourse touched me in a no-no place

    @HardwareGeek said in Images in old articles?:

    How long does it take to get from there to the UK?

    The flight's about 90 minutes in the air. By sea, it's overnight (and good luck finding a ferry that does the route). Driving… maybe 2½ days, border to border? (It's a long way through a lot of heavy traffic.)

    By train… I don't know. Route would probably be London → Brussels → Hamburg → Copenhagen → Oslo. Don't know how many intermediate changes would be required. It'd be unlikely to be much quicker than driving overall.

    Let's see what the internet thinks!

    London → Oslo:
    Driving: a bit over 19 hours still including quite a long ferry crossing.
    Flying: Direct flight, 1h55 but that'll include the taxiing time too.
    Rail: 32 hours. Quick as far as Düsseldorf, then slow and with some long changes… and a few others that are crazy short. Bleah.
    Ferry: No meaningful route.

    Newcastle → Bergen:
    Road: 29 hours, minimum.
    Flight: No direct route right now, but would be about the 90 minute mark.
    Train: Google fails to calculate this. Which is idiotic; it's one train to go to London, take the route above to Oslo, then a single train from Oslo to Bergen.
    Ferry: Used to be a direct route, but not these days (for passengers)… It's a shame; that was a good route for holidaying.


Log in to reply