Net Neutrality 2017, an open letter


An open letter about Net Neutrality to my representatives and anyone interested in a sample letter for the FCC:

Image Source: http://act.watchdog.net/petitions/4565

Dear Representatives,

I am extremely dismayed that the FCC is ignoring hundreds of thousands of people in making their vote to remove Title II status from ISPs. By doing so, they are moving toward overturning the progress made of the last few years to maintain Net Neutrality.

There is hard empirical evidence that it has not hurt competition or investment as the FCC chairman has claimed. The CEO of Verizon has stated publicly that the status has not affected their investment in infrastructure at all since it was put into place. Competition has been widespread and profits increased since the regulations were put in place.

There is ample evidence that, if the consumer protections are removed from the FCC’s purview (by removing Title II regulations), the large ISPs will implement anti-competitive practices that will hurt competition by newer or smaller ISPs. This will hurt competition and progress us toward a pay-to-play internet. In that future, the massive ISPs that control access to the internet will be able to pick the winners and losers online, in industries far removed from the ISP market. Consumers have very little choice in their Internet Service Provider, in many cases only having 1 choice for broadband internet.

If there is concern about companies like Google or Facebook operating outside of these regulations, those concerns should be addressed separately, not by throwing the entire system out, but figuring out what should be done, if anything, to address concerns that those kinds of companies are taking advantage of the regulations placed on the larger ISPs.

Please consider these words carefully, I would really enjoy a personal note from each of my representatives stating their position on this issue. This is as close as I have to a make it or break it rule – I will not support, or vote for, representatives that do not value a free and open internet, and Net Neutrality along with classifying large ISPs under Title II regulations is currently the best way to ensure that it remains that way. I am more than willing to discuss this further with any of you if you are interesting in learning more from one of your constituents.

Thank you for your consideration,
Mike Behnke

—-

Here’s a video from John Oliver:

PS. For anyone reading this, feel free to use the above language or adjust it to suit your situation to send a message to the FCC and to your representatives.

PPS. Additional reading: https://www.battleforthenet.com/

 

Left Perficient/Enlighten, New Job at JOOL Health


I’m no longer working at Perficient, I’ve moved on from there to JOOL Health. JOOL Health is building an app that helps users to find their purpose and the allows them to track their alignment to that purpose, as well as a number of other factors such as energy and willpower that help predict whether the user is on track toward their purpose or not. It’s exciting to work on something new, and I’m doing a lot more development again. I hold no bad feelings for Perficient (or Enlighten, which was purchased by Perficient in Dec. 2015. Enlighten gave me my start (besides freelance work) in this industry and I’ll always have fond memories of my time there.

At Perficient, I was a front end team lead, and lead teams for up to 5 projects at a time. JOOL Health now allows me to focus on the application we are building. For the web version, we are using Ember and it’s interesting picking up a new JavaScript framework and trying to be productive in a very short period of time. I’m thinking of writing a separate blog post about that and my likes & dislikes about Ember.

Looking forward to new challenges as a new chapter in my life unfolds.

iOS UIView, WebApps and iFrames


One of our existing responsive websites (built using Angular) was being pulled in as part a Cordova project to make an iOS and Android app, and the developers had some weird issues on iOS. Inside the Cordova app, our app was loaded in an iframe. I wanted to write about a few of the issues that came up, particularly with the iOS UIView, and some of the hackery I resorted to in order to resolve the issues.

Issue 1: Fun with iOS Iframes

First issue we had was that the app kept bouncing between the small and xlarge media query. This turned out to be due to what I consider a bug in iOS, in that iframes size to their content, rather than sizing based on the attributes/styles on the iframe itself or parent constraints. We had logic that enabled some functionality on small, which in turned created a wide html element for a carousel and due to the iframe bug in iOS, would cause the width of the iframe to grow to the xlarge size again. The carousel functionality would be destroyed, as it was only for small, causing the element that was created to hold the slides to be destroyed, causing the iframe to shrink back down to the small size again. And then the cycle would repeat, infinitely.

I was able to fix this issue by immediately setting an explicit width on the body before any of the rest of the HTML was loaded/parsed. This worked in our case because the application will always be in portrait mode, we would need to also watch for resize events and things would get more complicated. Right at the top of the body, I added the following code:

<script>
  document.body.style.width = document.body.clientWidth + 'px';
</script>

Issue 2: iOS WebApp links open in Mobile Safari

The second issue we had was that any link clicked in the website being wrapped in this iframe would load in Safari. It didn’t matter if the link was relative or fully qualified, or what kind of target (or lack thereof) it had. Turns out that is normal behavior for web apps on iOS. I’m not proud of the solution, but the fix was to grab all links in the app, watch the click event, stop the default browser action, and load the new page with window.location. It looked something like this:

$('html').on('click', 'a', function (event) {
  var href = $(this).attr('href');
  if(href && href.indexOf('http') !== -1 && !event.defaultPrevented) {
    event.preventDefault();
    document.location.href = href;
  }
});

I had jQuery available, but for a non-jQuery version, check this out here: https://gist.github.com/kylebarrow/1042026

My initial solution broke links in the site that already had JavaScript functionality attached to them, so the click event was delayed briefly from being attached by wrapping it in a timeout. That way it should be the last event attached, and be skipped if the event had already had preventDefault called on it.

Overall, it’s two hacks that fixed the issues we were seeing. Mileage may definitely vary given, but hopefully this will prove useful to the reader (or more likely, a future me trying to figure this out again).

Vanilla JavaScript vs. Framework Functions


Had a quick conversation at work today about whether or not it was good to use built-in framework functions for tasks that are simple to write in vanilla JavaScript. For example:

angular.isFunction(fn) 

vs

typeof fn === 'function'

I’ve tended to do the vanilla JavaScript, but while checking if something is a function is almost identical in complexity/length, while others can be (slightly) more complex:

angular.isObject(yourVariable) 

vs. 

yourVariable !== null && typeof yourVariable === 'object'

Still, either way is pretty readable, and fairly clear what it is doing. I wonder if this is what leads to people bashing frameworks like Angular for teaching people the “framework” rather than vanilla JavaScript, as newer coders who may not have ever had to check variable types who are learning Angular may use the framework checks without knowing how to do a similar thing in vanilla JavaScript.

I like to collect snippets that will help me, and reuse them where appropriate. This probably tends to skew me towards vanilla JavaScript, because I want my snippets to work no matter what project I am working on. For example, the following snippet gets the class (or type) of a JavaScript variable.

/**
 * getClass - get real type of JavaScript object 
 * @param object
 * @returns {string}
 */
function getClass(object) {
    return Object.prototype.toString.call(object).slice(8, -1).toLowerCase();
}

/*
getClass({}) // "object"
getClass([]) // "array"
getClass(function(){}) // "function"
getClass('') // "string"
getClass(1) // "number"
*/

I came away from the conversation thinking there was not one right way. If you are writing an app with the help of of a framework, there is nothing wrong with using the tools the framework provides. At the same time, it shouldn’t become a crutch where a framework is needed because a developer isn’t comfortable doing the same thing in vanilla JavaScript.

Blog theme updated


Getting back to posting more often, and wanted a simple but clean theme. Found one that will do the job with minor customization. While I have the capacity to build my own theme from scratch, I’d agonize over the details, and this lets me focus on the content instead.