Skip to main content

Posts

Showing posts from 2015

How We Teach

Teaching EDGE This is the second post in a 4-part series about how we learn. In the first post, I specifically discussed the four steps that everyone goes through when learning something new. To recap, they are:

Unconscious incompetence: You don't know what you don't knowConscious incompetence: You understand what you don't know and want to learnConscious competence: You start to understand, with effortUnconscious competence: You internalize your understanding and no longer have to thing about it. You just "get it."
In this post, I am going to discuss how to teach students at each step of the process. The techniques used will vary, depending on where a given student is. Please note, you don't have to be a professional teacher to understand and use these techniques. Whether you are a teacher, a parent, a manager, or even a student yourself, understanding these techniques can make you better at what you do.

The Boy Scouts of America are widely known as an organ…

Revert Your Mistaken Git Commits

Today one of my development teams had a merge problem. We use GitFlow, and it was time to merge from the develop branch to the release branch. If things are done correctly, this should always be a clean, simple merge. It is especially true in this case, because it was our first release for this project, so the release branch should be empty. Except that it wasn’t. Huh?
As it turned out, a well-meaning developer on the team knew we were pushing our code into release, so that’s what he did. The output of `git log --oneline` on the release branch showed something like this:
      1852291ablah blah blah       2f575c87blah blah       383d855dblah blah       49fa11dfblah blah blah blah       5111b003blah blah       62b3a530blah blah blah       7a4c5f54blah blah blah blah blah blah       8b2a62fablah blah blah blah blah blah blah blah blah       95fb67b9blah blah blah      104d1a5fcblah blah blah      11ed40aecInitial commit
No, we really don’t use “blah blah” as commit messages. The problem was tha…

How We Learn

Have you ever stopped to think about how we learn things?

My 15-year old is learning to drive, and I have the unenviable job of teaching him. While watching him tonight, I noticed that he has to think about every little detail of what he's doing. He needs to be reminded to check his mirrors, signal his lane changes, look behind him when backing up. Learning to drive requires his absolute and complete attention. He doesn't even have the spare mental capacity to listen to music.

Watching him struggle reminded me of something I learned many years ago about how we learn new things. Regardless of what we are learning -- whether it's driving, putting up drywall, or learning a new programming language -- we all go through four stages of learning. You could think of them as the four steps of mastery. They are:

Unconscious incompetence: You don't know what you don't knowConscious incompetence: You understand what you don't know and want to learnConscious competence: You …

Owin Startup Class

It seems that every time I start a new ASP.NET WebAPI project, I have to go out to the web to "remember" what I want in my OWIN Startup class. Not anymore. I added a GitHub Gist that I can copy (and add to) whenever I start a new project.

There should never be anything in that file that is proprietary, so I figured I'd open it up to the world, for comments, edits, etc.

What's in it so far:

Attribute RoutingError DetailsJSON as the default in the browserUsing camelCase with the default JSON serializer.Comments to remind me which NuGet packages to install to make it all work. Feel free to comment, fork, issue pull requests, etc. I'd like this to grow over time to become useful for anyone creating a new WebAPI application.

How I Finally Got AdMob and Ionic Framework to Play Nice Together

Note: Some of the plugins referenced in this article have had their names, and possibly their APIs, changed. The information contained herein may no longer work. Please don't rely on it until I have had a chance to review and update it. -Mike Callaghan
TLDRThis is a summary of how to display ads in my MDCL (1650) mobile application, which was written using the Ionic Framework. If you want to see the sample project that displays both banner and interstitial ads, you can look at my AdMob Demo app on GitHub.

AdMob
The first thing that's necessary is to get an AdMob account, which you can create at https://www.google.com/admob/ Ionic Starter App
If you don't already have an ionic app, you can create one with the following command, which will create a folder named myApp in your current folder, and initialize it with an empty application.
ionic start myApp blank



ngCordova
Next, you'll need to install the ngCordova bower package and include that in your project. This script does m…

Pixabay.com Review: Get Free Images for Your Web Site or Application

I have a new favorite site this week. The other day I was looking for a picture of a swimming pool for a mobile app I'm writing (more on that later). Much to my excitement, I stumbled upon an online image catalog called Pixabay. This site claims to have over 360,000 images that can be used free of charge. Their terms of service indicate that every image is bound to the CC0 Public Domain license, which puts them into the public domain, and thus can be used for any legal purpose.

The site is attractive and easy to use. I typed "swimming pool" into the search box and was quickly rewarded with more than 450 images to review.

Pixabay offers three different types of images: photos, vector graphics, and illustrations. You can choose a single image type or all. I changed my search to include only photos, which reduced my search results to 414. Obviously most of their images of swimming pools are photographs.

There are more search options available. You can search by portrait or…

WiX Installer Phantom Overwriting App Settings for New Users

Recently I received a bug report of some very odd behavior in a Windows application that my team and I had written. Sometimes the server URL, which was set during the application's installation, would be overwritten to the default value of http://localhost.

The application in question is a WPF application. I have kept up with the latest libraries and framework updates. It is installed with the WiX Toolkit 3.9, so even that is current.

When you have a problem that happens "sometimes," the first thing you need to do is figure out what "sometimes" means. My first thought was to check the value in the app.config file. It had indeed changed, which was odd, because the application cannot change values in that file using the Properties.Settings API. It would actually be a compiler error to try.

I checked the source code anyway, to see if someone had brute-forced their way around that limitation using the XML APIs. Nope. It wasn't that.

The next thing I checked was…

My New Years Resolution - Use more shims

When I need to unit test my code in isolation, I typically use Moq to mock the interfaces that aren't related to the methods I'm testing. Until today, that is. I wanted to test a little bit of functionality that depends on values coming back from the System.IO namespace in .NET 4.5. Specifically, if a file in a given folder was more than a certain number of days old, it would get deleted. How do you unit test that? Here is the code that needs to be tested.

publicvoid Rotate() {     var searchPattern = "*." + BaseName;     var files = Directory.GetFiles(Folder, searchPattern);     foreach (var file in files)     {         if (File.GetCreationTime(file) < DateTime.Now.Add(-MaxLogAge))         {             File.Delete(file);        }     } }
In the past, I probably wouldn't have bothered testing it. After all, it's pretty straightforward. Today I was feeling extra cautious.

The first problem with testing this is that Directory.GetFiles() is going to return m…