Geeks With Blogs

News profile for Aligned at Stack Overflow, Q&A for professional and enthusiast programmers
"free in Christ Jesus from the law of sin and death." Romans 8:2 (ESV) Check out the Falling Plates video on YouTube.
more about the Gospel
And then listen to Francis Chan speaking at LifeLight in SD.

Donate Bitcoins

My Gooroo profile

Programming and Learning from SD JavaScript
Teaching JavaScript
I had the privilege of spending time with four interns at Omnitech this summer. See our @Omnitech Twitter feed to learn a little more about them. Sometimes it's difficult to know how to have interns at a company, but we see it as an investment in them, the community and ourselves. We've had several interns in the past become valuable employees. It's fun to see how much they grow personally and technically in just a few months or years. I didn't have the opportunity to work with them directly, but ......

Posted On Wednesday, August 24, 2016 2:35 PM

$.ajax and WebApi example
I showed $.ajax at lunch yesterday and I've put up my code on github. There’s a simple javaScript class example and a Knockout example for comparison. I also avoided using jQuery (except for the $.ajax). I also added a knockout example to you can compare a simple example. Getting WebApi setup threw me for a loop. Use GlobalConfiguration.Configu... Also I needed some help to post a primitive value to a WebApi method. EDIT: August 25, 2015: I updated my AjaxExample using a data ......

Posted On Wednesday, August 19, 2015 6:12 PM

When does $.when.apply resolve the promises?
I learned some new things about $.when.apply that were worth sharing. · the first reject will fire the .always, but not the .then · .then won’t fire until all promises are resolved (or one is rejected) Maybe not new to you, but I had to try it out after seeing the last answer at I was playing with this again and made a different, simplified playground on codepen. 11/13/15EDIT 2: ......

Posted On Friday, January 30, 2015 7:53 PM

MutationObserver in HTML5
We were just in a code review and one of the guys showed how he was using the MutationObserverer with our search control to get tiles to resize after the list (Knockout observable). I hadn’t heard of this before and it looks very useful. Read the linked page (from 2012) to learn more about it. It’s supported on all but Opera mini and started in IE 11 and is a more performant than the old Mutation Events that have been deprecated. You point the MutationObserver to the DOM node and it ......

Posted On Thursday, January 29, 2015 7:55 PM

ctrl+p in Chrome Developer Tools to find and open a file
I was watching part of Using TypeScript for Large Angular JS Applications on TypeScript. In the SourceMaps and TypeScript section, Justin Schwarty mentions that ctrl+p in the Chrome Dev Tools will pull up a list of files (css, js) that you can debug against. This is similar to the ctrl + comma in Visual Studio (or ctrl + t with Resharper). Hopefully, you’re already aware of this, but for me it will be a huge time server. I’ve searched through the tree of files far too often. The official shortcuts ......

Posted On Tuesday, January 13, 2015 4:03 PM

Not using JavaScript Promises? It is time to make the change.
If you ignore the Angular part of this article, it applies to JavaScript in general. If you're still using callbacks with $.ajax(, please look into Promises. jQuery has an implementation (though I've heard it doesn't exactly follow the standard. It will be native in ES6 (the next version of JavaScript) – this is an in-depth on ES6 promises. - even the next IE will have it. Wrangle Async Tasks With JQuery ......

Posted On Tuesday, December 16, 2014 1:30 PM

Ajax promises without jQuery
I’m trying to move away from jQuery, since I’m using Knockout and AngularJS more all the time. I’ve always done my AJAX calls with the useful jQuery $.ajax( method. Searching for “ajax without jquery” brings up a lot of results, but they all include how to do it with jQuery. First a friend found a tutorial on ES6 promises on HTML5 rocks that included an example of “Promisifying XMLHttpRequest”. Since promises aren’t in all browsers yet (IE and Android Browser) you can polyfill with es6-promise. Or ......

Posted On Tuesday, October 7, 2014 4:20 PM

Include your JavaScript references in the correct order
I was stuck for 2 hours on this. I was using Wijmo library and was including the complete library before the open js file. I kept getting’Uncaught TypeError: Cannot call method 'formatString' of undefined’. Finally, I switched the order and put the open js file before the complete js file and the error went away. The lesson is that undefined means you haven’t defined it yet . Make sure it isn’t defined below it and that you didn’t forget to include it ......

Posted On Monday, January 7, 2013 3:51 PM

Find an element in a JavaScript array
I needed a C# Dictionary like data structure in JavaScript and then a way to find that object by a key. I had forgotten how to do this, so did some searching and talked to a colleague and came up with this JsFiddle. See the code in my jsFiddle or below: var processingProgressTimeoutIds = []; var file = { name: 'test', timeId: 1 }; var file2 = { name: 'test2', timeId: 2 }; var file3 = { name: 'test3', timeId: 3 }; processingProgressTimeoutId... name:, timerId: }); processingProgressTimeoutId... ......

Posted On Friday, August 22, 2014 6:27 PM

Mock the window.setTimeout in a Jasmine test to avoid waiting
Jasmine has a clock mocking feature, but I was unable to make it work in a function that I’m calling and want to test. The example only shows using clock for a setTimeout in the spec tests and I couldn’t find a good example. Here is my current and slightly limited approach. If we have a method we want to test: var test = function(){ var self = this; self.timeoutWasCalled = false; self.testWithTimeout = function(){ window.setTimeout(function(){ self.timeoutWasCalled = true; }, 6000); }; }; Here’s ......

Posted On Thursday, August 21, 2014 4:42 PM

Copyright © Aligned | Powered by: | Join free