Pix Fix

      41 Comments on Pix Fix

A couple of readers let me know lots and lots of links to pictures in my old posts are broken. I checked with my IP provider, and it turns out the links went bad when they moved the site from a Windows server to a Linux server last month.

Windows isn’t case-sensitive when it comes to file names and links. Linux is. A whole bunch of pictures in the images folder have an extension of .JPG but are linked as .jpg in my posts. Windows interpreted, Linux doesn’t. The only way to track down and fix the links is to go through every post from the last five years, look for broken links, and update the file name. So that’s what I’ve started doing, occasionally mumbling “Why the @#$% did I write so many posts?!”

2009 is done. Moving on.

Geek Rant — you may want to skip this

As a programmer, I don’t like the case-sensitive feature one bit. For software I develop on my own to sell to customers, I prefer VB.NET for lots of reasons, one of which is that it’s NOT case-sensitive.  When naming my variables and classes, I use what’s called CamelCase, capitalizing what would be the first letter of each word if they were separated …. e.g., TotalTrademarks, DateOfRenewal, BoundRecordset, etc.  When I use those variables later, I can type in lower case and VB will auto-correct.  So if I type dateofrenewal, it’s immediately converted to DateOfRenewal, which I use as sort of a spell-check.  If my lowercase is auto-corrected to CamelCase, I know I typed the variable correctly.

In most of my contractor gigs, the companies have used C# for development — largely because old-time programmers who are now in management believe VB is a toy while C# is for serious programming.  And that was true maybe 15 years ago.  Now both languages are built on the same platform, call the same code libraries and compile into exactly the same machine code, so pretty much anything you can do with one, you can do with the other.  You could even code part of your software in VB and another part in C#, and the compiler wouldn’t care.  The difference is in the coding language itself, not the result.

Like Linux, C# is case-sensitive.  So if I have a variable named DateOfRenewal and type dateofrenewal in my code, C# doesn’t auto-correct; it flags my variable as undeclared and then I have to go back and type it slowly, using the SHIFT key.  And yes, I’ve seen code where a programmer intentionally created one variable with a name like TrademarkDate and another with a name like trademarkDate, which I think is both stupid and confusing.

Anyway, that’s my rant on the subject.  I don’t like case-sensitive languages, and I don’t think sane people would want to have file names that are identical other than the capitalization.

Back to fixing all those @#$%ing links now …


41 thoughts on “Pix Fix

  1. Carlos

    Of course you prefer what you’re used to, but really it should be your editor (VS I presume) doing the auto-correcting when you type something its seen before and fix the PascalCase (as opposed to camelCase) you’re using. Another sorry practice IMO in the MS-world is to use Hungarian notation, but I digress. I actually like this sort of problem, it’s a chance to write a quickie script, scan (grep) your existing files for any instance of /jpg/i (ignore case) and just lowercase every one of them, then do the same for all files within your directory tree. Should be quick. Or, if you’re using Apache, you could write some rules in your .htaccess file http://answers.oreilly.com/topic/108-how-to-permit-case-insensitive-urls-with-apache/

    1. Tom Naughton Post author

      I’m not sure if I can get my IP to install and enable that, but thanks, I’ll look into it.

  2. Jay

    The good news about Linux is that solving the problem may be easier. If you have access to the directory, then rename all image extensions to lower case “rename JPG jpg *.JPG”. Unless of course your links are mixed upper and lower.

      1. Jay

        You could try running a command to make a copy of each image, so that there are two versions of each old image; one with an upper case extension and one with a lower.

        Or update the link references to all be upper or lower.

  3. Ariella

    I had to fix something like this years ago. It’s one command if you have database access to your CMS (this example is in MySQL):

    UPDATE posts SET posts.body = REPLACE(posts.body, “.jpg”, “.JPG”)

    Or something very similar. It’s been a while. What sucks is that you’re stuck always naming image files with capitals in the extension if you fix the db data and not the filenames. It’s probably a better idea to rename file extensions to lowercase in bulk. I’ve done that using a third party app on a local copy of a site, and then FTP synced the différences (when I was on a Mac, I used Transmit as the sync tool).

    1. Tom Naughton Post author

      I found a WordPress plugin that at least found them for me. Turns out there were other case-sensitive issues besides JPG and jpg.

  4. Ariella

    Oh I like Jay’s idea!

    1-Duplicate all images with .JPG so that they end in “.jpg”

    2-Delete all those that are left with .JPG at the end.

    3-Run a comparable UPDATE query like I mentioned before replacing .JPG with .jpg


  5. Bill Murrin


    You could rename them all as suggested by Jay and then setup an .htaccess rule to make it so all files ending in (JPG|jpg) get rewritten to .jpg. Mod-Rewrite sample rule:
    RewriteRule ^(.+)\.JPG$ $1.jpg

    Additionally, see if you ISP supports mod_spelling and not have to worry about it at all! 🙂

    As far as the case-sensitive goes, you must come from a windows background! 🙂 I used to find the same thing with VBA and VBSCript, however, once I started using more Linux in my work I realized I had formed bad “habits”. I standardized the way I coded to ensure I always use case sensitivity. That helps me use any language and platform.

  6. vlc eater

    Huh? its quite common to have a class Foo and an instance named foo or aFoo. I know you dont like it but that’s the way code is written in many places.

    Ultimately everything gets compile to machine code. That’s not a good argument to say that all languages are the same. Try programming in python,ruby,groovy,Haskell,Erlang,clojure and see how each feels so different.

    VB is a language burdened with its legacy roots. Your file names and references were sloppy and didn’t matter on windows. Linux is different. Why don’t you stay on windows if this is so hard to fix? Can’t you write a script to find filenames and fix using sed or awk?

    1. Tom Naughton Post author

      VB.Net and C# are essentially the same now. Same code libraries, etc. Everything is compiled to machine code, yes, but the point is that if I wrote code in C# and write the same commands, classes, etc., in VB, they’ll end up as the same machine code. That’s why you can mix them and the compiler doesn’t care. It’s also why software can convert a C# project to VB and vice versa.

      I didn’t notice how many files were uploaded with a .JPG extension or a capital letter that was lower case in the filename. The Windows server never complained. I wasn’t able to write a script (and I doubt our IP would let me run on their server) but I did find a WordPress plugin that found all the broken links for me.

  7. Elenor

    Hey Tom,
    Can I raise a didactic hand and ask for a wee change in how you code your blog posts? (I’m amazed and delighted that you posted an entry about programming, just as I’m trying to stop myself from writing this request in a ‘normal’ entry comment.) You’ve switched to using a dotted underline for your hyperlinks. That’s very frustrating, because the ‘web convention’ is that a dotted underline is the default appearance for an acronym (initialism, actually) — one hovers the mouse over a dotted-underlined item and a pop-up provides the spelled-out version, or an additional comment that wouldn’t fit in the text.

    For instance, many of my web client’s readers are overseas; when he uses American slang, we signal the reader that there is a explanation (or some ancillary info) by a dotted underline. In his essay “Overstated Attack Hiding Behind Scientific Assessment: An April 2014 Cochrane Review Trashes the Usefulness of Influenza Antiviral Drugs” (http://www.psandman.com/articles/Cochrane.htm), there is this sentence:

    “In contrast, the World Health Organization’s rationale for stockpiling antivirals in advance of a flu pandemic rests only to a small degree on a possible Hail Mary campaign to stop a pandemic.”

    The phrase ‘Hail Mary’ has a dotted underline, with the pop-up: “U.S. slang for a last-ditch effort unlikely to succeed.” (We assume many folks in, say, Indonesia, don’t know that phrase.)

    My guess is you chose the dotted underline to minimize the ‘eye-grabbing’ of the ‘normal’ underlining for links. However, a solid underline in a lighter color would also minimize the ‘grab’ while not conflicting with the convention for acronyms. And yes, I suggest web conventions are actually important: do you not automatically assume that clicking on the logo in the top left will always take you to the site’s home page? Do you not always look in the top right corner for the search bar? (Slight poke there too, sorry…) Web conventions allow us-all to ‘operate’ websites without having to figure out how-in-the-hell to operate this non-“conventional” layout…

    (/annoyingly didactic)

    1. Tom Naughton Post author

      Actually, I didn’t do anything to make that dotted line appear. It’s either WordPress or the theme I’m using.

  8. Sam

    For me Visual Studio autocomplete will fix the case of names in c#, just like you described in your post above for VB.
    Maybe your knowledge about c# is 15 years old (like most others people knowledge about VB?) 🙂 🙂

    1. Tom Naughton Post author

      Since I code in C# for roughly 40 hours per week, I don’t think my knowledge of it is dated. The intellisense popup will autocomplete, but often fails to find a match if my variable is capitalized and I type in lower case.

      1. Jason

        One good thing about Visual Studio is its extensibility. It’s not free, but Resharper (http://www.jetbrains.com/resharper/) makes the autocomplete much better. It will show you declared variables after only typing a few characters, even if they aren’t next to each in the variable name (i.e. td would show you TrademarkDate).

  9. Boundless

    This is all Baudot’s fault. His 5-bit code had room for a full roman alphabet that was upper case only. This evolved into the ITA2 code generated and rendered by the teletype equipment that became the early computer peripherals.

    When I was coding for a living in the 1970s, many operating systems, terminals and printers were still upper case only, due principally to the expense of ROM space for encoding the lowers, or the lack of impactor positions, or the expense of mechanical shifts. These systems generally had to be case-agnostic, or you might type or encode a lower case letter and not even be able to discover the problem. Lower case was an option ROM on the terminals and printers we were using, and we were dead in the water one day when we discovered that when the tech swapped a board in the printer the day before, he’d walked off with our LC ROM.

    As lower case became standard, existing and emerging systems had to decide whether to be strict. Unix went strict. DOS did not. Dawn of a schism. And it leads to more problems than JPEGs not found. A *nix directory can have multiple distinct files with the “same” name, differentiated only by case. Serve them with Samba to a Windows machine, and stand back.

    As we enter the Unicode era, strings that appear identical are nothing of the sort. Some code sets may have no case at all. Some may have multiple. My personal opinion on this is that operating systems should treat strings with different collections of code points as different. Not gonna happen.

    It’s always been my impression that Mr.Bill was content with this MS.vs.Unix incompatibility, and allowed the opportune moment for harmonization to pass. It is now too late, because too much would break if MS switched to strict case.

    This leaves coders in an awkward position, given that apps are becoming increasingly web-enabled and platform-agnostic. We have to pick a posture, and then be rigorously consistent about it. Thanks a bunch, Émile.

      1. Boundless

        > Never heard of the guy, but I’ll happily blame him.

        Émile Baudot, for whom “baud rate” is named. His code is at:
        Note that this encoding can’t even be used to spell his own name.

        At the teletype to computer transition, the entity that had the best chance of fixing the character encoding mess was IBM. Instead they did EBCDIC. Computer humorists have described this encoding as an only partially successful attempt at document encryption.

  10. Ulfric Douglas

    Surely case-sensitive filenames are correct (allowing god-knows-why flexibility especially for very short filename junkies) , but case-sensitive extensions are just plain silly : of course a JPG is a jpg! (but so is a Jpeg, and there’s another case of worms)
    Solution : stop being a LAZY programmer. Do it right, all the time : this includes cases.

    1. Tom Naughton Post author

      I wasn’t programming. I was typing the name of a photo in a WordPress dialog box. Get a green arrow, it means the photo was found where you specified and it appears in the preview of the post. So all looked well, and was well … until the site was moved to Linux.

  11. Daci

    I’ve been a Linux user for ten years when I installed a distro over XP. Once I had it,I never looked back…I’m typing this with Ubuntu as my os. For me, what you hate is the norm. I’ve used Linux for so long,It’s the only thing I know now.
    Good on you switching to Linux.

    1. Tom Naughton Post author

      I’ve never seen it. My IP said the site would be faster if we moved it to Linux, so I said sure, go ahead.

  12. Bryan Harris

    I like case-sensitive because I’ve “grown up” using Linux & UNIX. Now that I’ve been using a Mac for a while I’ve had to get used to their weird nonsensical way of dealing with case on their filesystem. I guess it’s basically the same as what Windows does, giving me the illusion of case when really in the background something else is going on. I really really don’t like it…but at least it behaves better than Windows and doesn’t rearrange my desktop icons everytime I sneeze.

    Oh well, glad you got it working. Happy blogging. 🙂

    1. Tom Naughton Post author

      I didn’t notice all those .JPG (capped) files before and didn’t name them that way, so maybe my Mac had something to do with it.

  13. Mike

    Tom, someone already commented on terms of camelCase and PascalCase, so I won’t rehash here. It’s great that you have so many software developers reading your blog. For awhile I thought I was the only one. 🙂 Please keep posting relevant techie articles.

    On an unrelated note… A few years ago I emailed you for your advice on breaking through the wall that is Disney, as you’d mentioned you occasionally do contract work for them. I’m happy to report that I just celebrated my third year anniversary as a full-time Cast Member at Walt Disney Parks and Resorts Technology in Florida. We’re doing a lot with .NET, as well as HTML5/JavaScript, creating new experiences in and out of the parks.

    If you ever in the Orlando area, please let me know. I’d love to show a fellow .NET developer some of the things we are doing here.


  14. Gerard


    I believe this is hang over from c (not C#) – as in C the low level language Dennis Ritchie made to make Unix. Seriously what a smart guy to come up with an OS concept and reverse engineer a language (C) to make it! C was completely case insensitive and Unix was an embodiment of that language.

    But I see no use case for having multi cased file names.

    When Novell went Linux it was even worse. A rename wouldn’t even work on the Novell file system which isn’t a Linux standard.

    rename A -> a would not work
    rename A -> B -> a would work.

    I had to write a script that recursively went through and append a 1 to every file. Then remove the 1 and put it in correct case.

    They fixed the file system by the way. It now is like Windows (or Novell Netware) – presents in double case but you can’t duplicate files. But before applying that patch you could loose files with duplicate names on the your netware linux mounts. 🙂

    Mac is also Unix based (BSD) and I think their file systems prevents double casing files. If your on a Mac try –

    touch B
    touch b

    At the end it all boils down to OS standards I guess. When I emulate windows shares on Linux (samba/cifs) I can never get the permission system perfect. Same with NFS (Linux shares) on Windows.

    God you have alot of geek friends! Good to see Unix catching on. I could never go back to windows for server side stuff but in this specific case it could be argued that apache’s default behavior should be to do it windows like.

  15. Tim Moore

    Hi Tom, just discovered your website (from talking w/ our friend Mark Green). Yeah I’m a bit slow in getting up to speed. 🙂

    Anyway, I liked this post and agree with it 100%. I was a VB.NET developer up until about 2 years ago, when our IT director switched us all to C# (for no good reason). Now, I quickly caught on to C#, because it’s so close to VB.NET now it’s almost a joke, and I like C#. But the case-sensitivity burned me at first and it still does. WHY WHY WHY have case-sensitivity in a coding language? I use camel-case like you do and most professional programmers, but, I don’t want to be forced into it. It’s ant-democratic, it is. 🙂

    1. Tom Naughton Post author

      Geez, Tim, it only took you five years to find the blog?

      Yeah, C# and VB are so close now, it’s like picking between Spanish or Italian. Case-sensitive issue aside, I prefer VB partly because my code looks cleaner without all those friggin’ brackets and semicolons.

      1. Tim Moore

        I know, I know… actually it only took a second to find your blog.. it took 5 years to remember to do it… my memory sucks.

        I hear you on the semicolons and various other useless and incidental garbage that C# seems to require. But some of the add-ons thru NuGet make it easier.

        BTW, I watched FatHead and started a high-protein, low-carbohydrate diet about 3 weeks ago. I’ve lost about 15 pounds and feel much better. This sh*t works.

          1. Tim Moore

            So glad I checked it out .. yeah it takes Tim a while to get motivated.. Lost 20 pounds in the last 6 weeks.


Leave a Reply to Bryan Harris Cancel reply

Your email address will not be published.