A March of MOOCs; How to Find a (Good) Course; Working as a Team; Is Free Really "Free"?

I’m in the middle of a few courses on edX right now, and I felt like sharing my experiences so far, and other thoughts I was having on the uses and applications of MOOCs. What’s a MOOC? A MOOC, or massive online open course, is a general concept. It’s usually attributed to any course that’s available to a large audience via the Internet, with a very low barrier to entrance (i.e. free, and only requiring a simple user registration). Such courses have been around for a number of years, but the landscape is constantly changing, »

Having Fun with Snap Circuits Jr

I knew I was going to have the kids to myself this weekend, so it was the perfect time to be the hero and break out a cool new toy to play with! I wanted it to be something I could get into too (is that selfish?), so I purchased a set of Snap Circuits Jr, which I keep hearing good things about. For the review-conscious like me, ratings for these sets (there are different expansion sets too) are off the chart, and are reasonably priced (this one was only $25). What’s in the Kit? Here’s the kit »

An explanation of implicit and explicit conversion in C#

Given a method signature that expects two nullable DateTime parameters… protected int CalculateActualDuration(DateTime? startDate, DateTime? endDate) … SamIAm asked on Stack Overflow about how the compiler understands nullable types: I am able to call the method by passing in both a DateTime? and a DateTime. So how does the compiler understand the difference? My interpretation was that the OP was assuming some hidden logic, obfuscated by the compiler, was responsible for allowing both a type and a nullable type. While everything does eventually have to make its way down to the compiler (so yes, it is ultimately handling both types »

The effect of the Obsolete attribute on a class is ignored when there's an interface involved

While marking some code obsolete the other day, I noticed an unexpected behavior (at first glance). Say you have a class, and an interface it implements. The second argument (true) indicates whether or not you’re allowed to call the method, and it means the difference between a simple warning and an error preventing compilation. public interface ISampleClass { void SomeOldMethod(); } public class SampleClass : ISampleClass { [Obsolete("This is the old way. No one uses it anymore. Shame on you!!", true)] public void SomeOldMethod() { // This is old. I should probably remove and refactor, but I'm too scared. Console.WriteLine("Oooooooooooooollllllllllld stuff."); Console. »

An extension method for passing a column name to SqlDataReader.GetFieldValue in C#

I was reading some or another question on Stack Overflow today, and someone happened to reference the SqlDataReader.GetFieldValue method. It’s a generic method that returns the value of a column, given its 0-based ordinal value. using (var conn = new SqlConnection("yourConnectionString")) { using (var cmd = new SqlCommand("SELECT name, age FROM students", conn)) { conn.Open(); using (var dr = cmd.ExecuteReader()) { var name = dr.GetFieldValue<string>(0); var age = dr.GetFieldValue<int>(1); } } } This doesn’t seem very user-friendly to me. What happens if the query changes? If an additional column is added to the beginning, »

Using Annotations to Assist ReSharper in Analyzing Your Code

(The code - posted here as images to demonstrate ReSharper’s code analysis - is also available on Github.) Anyone who uses ReSharper is familiar with the little squiggly line indicating a “warning” of one kind or another. And anyone who develops with .NET is familiar with the ubiquitous NullReferenceException and ReSharper’s “possible ‘System.NullReferenceException'” warning. This post was inspired by a question on SO: ReSharper: Null check is always false warning ReSharper and optimistic analysis Here’s a really simple example (VS 2013 / R# 8.2) demonstrating the feature. In both cases, a string is initialized to null »

Passing data between two Forms in WinForms

Yes, WinForms is an older technology, and no, there’s nothing particularly sexy about it. But it works and it’s quick to spin up a new program. Many businesses still have legacy apps built with it, and its drag-and-drop interface makes it easy to use in a classroom setting too. True to its name, most things you do in WinForms revolve around Forms, and the creation of multiple Forms for performing different functions. Functions like collecting data from the user, or displaying a record from the database for the user to edit. After the user enters the requested data, »

Using a TextBox and CollectionViewSource to Filter a ListView in WPF

I was recently asked to provide our users with a field they could type in, in order to filter a ListView that could potentially hold a couple hundred names. Now, on the old WinForms platform, filtering used to be easier. A few settings on a ComboBox control, set the data source, and off you go. DropDownStyle = Simple AutoCompleteMode = SuggestAppend AutoCompleteSource = ListItems As with many things though, the slightly harder WPF way (not very hard, as you’ll see) provides for more flexibility (including grouping and sorting, but I’m only going to cover filtering). Just Teh Codez Here’s how »