Where there's a Wills, there's a way!

Mike Wills

I have been a long-time geek playing with many things throughout the years. Thus stuff like my website is constantly changing so I can learn more.

This website was restarted recently from the ground up so many of my blog posts throughout the years haven't been migrated back to the site. I will (someday) get many of the good posts back on the site.

Forcing SSL in IIS without being annoying

When we recently launched our site, and with everything going to HTTPS only, I wanted to force as much to HTTPS only as possible. There are many, many links on how to force HTTPS on an IIS server. The issue is that when you debug your application locally, you have to comment out that section of code, do your debugging and changes, then hope you don't forget to uncomment out that section of code. I have finally found out to the force HTTPS and allow you to debug on localhost. Here is the code that you need in your web.config:

      <rule name="HTTP to HTTPS redirect" stopProcessing="true">
        <match url="(.*)" />
          <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          <add input="{HTTP_HOST}" matchType="Pattern" pattern="^localhost(:\d+)?$" negate="true" />
          <add input="{HTTP_HOST}" matchType="Pattern" pattern="^127\.0\.0\.1(:\d+)?$" negate="true" />
        <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}{REQUEST_URI}" />

The HTTP_HOST lines are what need to be added then it will work! Reference

After the release of the new Visual Studio Code, I took a look at it and figured out that the target market is those that are currently using Sublime Text. I want to give it the ol' college try, but the one big thing that was missing for me is the ability to right-click on any file and open it in Visual Studio Code, like I can with Sublime Text.

Here is how to add this functionality. In the registry add the key HKEY_CLASSES_ROOT\*\shell\Open with Visual Studio Code\command with the value of @="C:\\Users\\USERNAME\\AppData\\Local\\Code\\app-0.1.0\\Code.exe \"%1\"" replacing USERNAME with your username. That is it!

We came across an interesting bug in Chrome two days in a row, a PDF wouldn't display correctly. It would be missing either an entire page or just some of the information on the page. There are published work-arounds to disable the built-in Chrome PDF viewer and instead utilize Adobe Acrobat Reader instead and also notices to maybe use a different browser. Let's be honest here, the fault is the person/company that creates the PDF to make sure to optimze the PDF for the best viewing experience on the web.

Here is the problem, the Chrome PDF viewer cannot work with layered PDF files. I didn't know layers was possible until just yesterday. Apparently, though I don't yet know how, you can turn on and off layers (think of Google Maps with turning on and off features on the map). So how do you fix it? In both our our instances, we needed to flatten the PDF. Once we flattened the PDF and optimized it for the web, it showed up correctly in Chrome.

Don't get me wrong, sometimes you will want those features and then you will need to provide a disclaimer stating that some PDFs may not render correctly in the Chrome browser. At least until Chrome adds support for layers.

At work I am working on rewritting a bunch of maps so that they are consistant and mobile-friendly (a.k.a. responsive). When I starting searching for some basic how-tos I turned up nothing. I did find how to make Google Maps itself responsive. My issue was how do I add a legend and form that will filter or add content to the map and keep it mobile-friendly. Since I couldn't find anything, I set forth to make something myself. In one weekend, I created a basic framework utilizing Bootstrap, then following week I refined and finalized the application and I think it turned out well.

I made the template open-source so that others can benefit from what I learned and help make this a better template in the future. I hope others can help me make this even more accessible and improve the template further.

I used Bootstrap because that is what I am most familiar with. In the future, if I have time, I wamt to try eliminate Bootstrap to reduce the overhead. Once our new website launches, I'll add some examples of what I created with the template so you can see why I felt this was important.

Here is my first installment of the Dog Days of Podcasting podcast (a little early). I am using Auphonic on my Android phone to record and upload. There is a bug right now on the Android that forces me to go to their website to apply the tags, but I hope that gets fixed soon. They have a cool interface that automatically tags your MP3 for you and uploads to your final hosting spot. I am using Amazon S3.

You have just received the Reneck Virus. Because we don't use electricity, we don't have any computers or programming experience, so this virus works on the honor system.

Please delete all the files from your hard drive and then manually forward this virus to everyone on your mailing list. Thank you for your cooperation and..... God bless you.

The Computer Engineering Department.

Do Not Use Comments

This came across my Hacker News feed the other day, "I've never seen a language's style guide recommend avoiding comments before." After reading the link it became clear that the HN title was link bait. What the Haskel documentation was stating is something any good programmer already knows. Don't document every line of code.

x = x + 1; // Increment x by 1

This comment is not required as it is obvious what it is doing. My rule of thumb for commenting is; if it's complicated or was problematic, it requires a comment explaining the why or why not. A good programmer should be able to read through the simple code and know what is going on. However, commenting on why you wrote something the way you did would help yourself or the next guy to know what you were thinking.

This comes to light not only when I am looking at code I wrote 5 years ago, but recently I had a co-worker leave. He didn't write many (read any) comments in his code. Now in some cases I am running debug just to see what the application is doing before I can think of fixing that bug or making that change.

So do your future self or co-worker a favor and comment... but not too much.

I used a previous version of this free monitoring tool, but I recently setup their new version. It is quite neat. Basically it uses Google's infrastructure to constantly hit your website and if it doesn't get a 200 status back, it will contact you via email or SMS saying your site is down. While this was nice, I really wanted to use Pushover more. So I looked through their API and discovered it is very easy to send messages. So I modified their script and now I get notifications via Pushover. Here are the changes that you need to perform.

© 2005, Mike Wills.

Scroll to Top