Blog

New Framework, New Sites

July 26, 2014 by Damien White

It’s been long overdue, but both the Visoft main site and our blog have moved off of WordPress. We are now using Jekyll to statically generate both sites. This allows us to host our sites just about anywhere as Jekyll spits out plain old HTML, JavaScript, and CSS. Aside from a static site, Jekyll allows us to cleanly use Markdown for our posts. We were using Markdown with WordPress and while it worked ok, it would occasionally mess up our content. No longer is this the case with Jekyll.

Read More »

Setting Up Ember CLI with Emblem and CoffeeScript

July 24, 2014 by Damien White

I’ve been using Ember CLI for various projects. Two things that I like to do right out of the gate is to enable CoffeeScript (instead of JavaScript) and Emblem JS (instead of Handlebars templates). Both of these tasks are pretty easy thanks to Broccoli.

Start by creating a new Ember CLI application:

ember new <my_app>

CoffeeScript

Now let’s get CoffeeScript working, it’s as easy as installing a Broccoli component

npm install --save-dev broccoli-coffee
Read More »

Logitech Ultrathin Keyboard Mini Review

June 26, 2014 by Damien White

I figured I haven’t done a product review in a long time, so here we go!

I’m lucky enough to own both an iPad and iPad Mini. At times the Mini is more convenient, and I like using a real keyboard, so I decided to try the Logitech Ultrathin Keyboard Mini (Figure 01). I ended up getting it for around $20 on Amazon, so I figured it was worth a gamble.

Figure 01: The Logitech Ultrathin Keyboard Mini
Figure 01: The Logitech Ultrathin Keyboard Mini

I’m writing this review using the keyboard on my lap, like a mini laptop. There is a magnetized slot that holds the iPad Mini at an angle. The magnet is pretty strong as I’m able to pick up the iPad and have the keyboard stay where it is (Figure 02).

Figure 02: Picking up the iPad with the Keyboard in the magnetic slot
Figure 02: Picking up the iPad with the Keyboard in the magnetic slot
Read More »

The “Ultra Intuitive” WCF Test Client

April 30, 2014 by Damien White

Did you know that Visual Studio includes a WCF Test Client? No? It’s very useful for testing out various services, especially SOAP ones. RESTful services are much easier to test as you just need a browser, but SOAP requires some sort of client.

Browse to the following path (note, this is Visual Studio 2013, adjust the 12.0 to whatever version you have):

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE

Once you’re there look for the icon shown in figure 1.

Figure 01: WCFTestClient.ext Icon
Figure 01: WCFTestClient.ext Icon

Now, while this is a useful tool, it’s so unintuitive, it’s not funny. One of the stumbling points has to do with Arrays so let’s look at this example.

Fun With Arrays

Connect to a service, and you’re given a tree-view of the methods that you can call on the service. So far, so good. If you click on a method, then you’re given the opportunity to add test values and then execute it to get the result. But wait, what do we have here? Our service takes an array of ints, what’s this weird length=0 stuff. Oh, of course we don’t have any items yet (Figure 02).

Figure 02: The Curious Length
Figure 02: The Curious Length
Read More »

My RubyGem Release Workflow

March 31, 2014 by Damien White

When going through and doing a release for ruby_odata, I had a workflow problem that resulted in extra, unneeded, work. I originally posed the question going on three years ago now (wow). You’d think I would remember the solution, but I find that I keep looking for my StackOverflow post where I answered my own question. I figured that was a sign that I should add to the Visoft blog. Before we get to the problem, here’s my basic release workflow for my RubyGems.

Git, Bundler, and RubyGems

I use git for source control whenever I can. The project that I was working on was ruby_odata, my Ruby “wrapper” to interface with Microsoft OData Services. I used to be a huge Microsoft “fanboy” as you know, and have turned very critical of them as of a few years ago. That said, OData Services is really a pretty cool thing. It was magical to be able to have an Entity Framework model, and easy expose it over the web by just adding one service file. Sorry, I digress.

Ok, where were we? Oh yes, git. In addition to git, I like using @nvie‘s gitflow. It makes branching fun. It’s a simple tool, that allows you to issue commands like git flow release start v0.1.6 and that will start a new git branch, and change you over to that release branch. You make all of your changes, checking them in as you go along, then you can run git flow release finish v0.1.6 and gitflow will add a tag of v0.1.6 and merge everything into your master and develop branches. Nothing you couldn’t do manually of course, but gitflow makes it a snap.

Read More »

Lights, Camera, ActionBlock!

February 28, 2014 by Dave Marini

The TPL Dataflow library available from the NuGet Package Manager is a great way to manage in memory asynchronous data processing. It’s especially useful in producer/consumer situations because it greatly simplifies the amount of ceremonious code required to manage and synchronize multiple asynchronous processes happening in parallel. Last but not least, the library is written on top of the Task Parallel Library introduced in .NET 4.0, so it makes judicious use of Task and Task<T>, which as of .NET 4.5 can be awaited using the new async/await keywords. You could just say that it’s awesome-sauce in a NuGet Package. While the library offers a number of classes that have different specialties, there is one class that I believe to be the rockstar of the group: ActionBlock<T>.

ActionBlock Jackson

Basically the ActionBlock class takes in an Action<T>, which will serve as the code that will be run for every item passed to the block. So if I wanted to email “Hello” to a number of email addresses, I can represent that like so:

var emailer = new ActionBlock<string>(email =>
{
    using (var smtpClient = new SmtpClient("myhostserver"))
    {
        var message = new MailMessage
        {
            From = new MailAddress("dave@somecompany.com"),
            Subject = "Hi",
            Body = String.Format("Hello {0}!", email)
        };
        message.To.Add(new MailAddress(email));
        smtpClient.Send(message);
    }
});
emailer.Post("person1@place.com");
emailer.Post("person2@place.com");
emailer.Complete();

Here I’m defining my ActionBlock and passing in an anonymous delegate that will send an email to the provided email address. After the block is initialized, I can call the Post method to send items into the block to be processed. The Post method is synchronous and returns a boolean that indicates whether the item was accepted by the block for processing. If you want to send data to the ActionBlock asynchronously you can call the SendAsync method, which returns a Task<bool>, and await it’s return. When we’re done posting data to the ActionBlock and we don’t expect to post any more, we call the Complete method on the ActionBlock. This method indicates that no more data will be posted and allows the ActionBlock to finish up any running threads and end itself gracefully.
Read More »

You Have Chosen Poorly – MaxLength vs StringLength

February 25, 2014 by Damien White

You Have Chosen Poorly

Are you using Entity Framework and ASP.NET MVC along with client side validations? Are you trying to restrict the length of a string only to find that you client side validation isn’t working? Me too, and there is a solution!

MaxLength Attribute

In a recent project, we are using ASP.NET MVC 5 and Entity Framework 6 (EF for short). We are using Code First along with EF Migrations to update our underlying SQL database. We use Data Annotations throughout the project. A reoccurring pattern for many of our properties looked like this:

[Required]
[MaxLength(30)]
public string Name { get; set; }

Our goal here is to obviously require a Name value and to limit the length to 30 characters. This results in an EF migration entry that looks like this:

CreateTable(
    "dbo.User",
    c => new
        {
            Name = c.String(nullable: false, maxLength: 30),
              ... Other Properties ...
        });

From an Entity Framework and EF Migration point of view this is exactly what we wanted. Now flip to our client experience with ASP.NET MVC. For our Views, we often use shared templates to generate our forms. This uses the ModelMetadata to build the form. For the Name property, we generate an input plus a span for our validation messages, using the Html.Editor and Html.ValidationMessage helpers. It yields your average label and input combo in the UI (Figure 01).

Figure 01: The Name input Field
Figure 01: The Generated Name input Field
Read More »

SSMS and the IntelliSense Red Squiggle Mess

February 21, 2014 by Mark Dickson

Have you ever been writing a bunch of SQL code in SQL Server Management Studio (SSMS), only to have the query editor put a red, squiggly line underneath a table, column, view, procedure or any other object that you know exists? Of course, that red, squiggly line means that IntelliSense is not recognizing that object, thus it will also not appear in your auto-complete pop-ups either. If you too have come across this, it is likely that the object has been newly created or modified since you last opened SSMS.

I have known about this issue for years, but have just ignored it up to now. Luckily for us, there is a simple solution. Though I try not to rely on IntelliSense anyways, I decided to take to Google and see if I could figure out how to fix this problem without restarting SSMS. The answer lies in the cache.

YES, IT DOES EXIST, YOU LITTLE…!

The other day I created a new table in my database. I ran the script, checked in the Object Explorer to make sure it was created properly, then started writing Stored Procedures against it. It became quickly apparent that IntelliSense was not recognizing my table, as illustrated below:

Figure 1: Bad Code Before Refresh Figure 1: Bad Code Before Refresh

My scripts would still run and execute fine, as the table did actually exist, but IntelliSense can make it easy to double-check yourself when writing code. Recognizing that it was an IntelliSense issue, I searched for solutions.

Read More »

Visual Studio Extensions Update Hell

January 31, 2014 by Damien White

This post is a rant about the Visual Studio Extension update process. It’s one of those things that I think we all get annoyed with, right? Well, maybe it’s just me. Anyway, let’s look at how the Extension update experience in Visual Studio can be fixed.

Let me start by apologizing to Microsoft and the Visual Studio team, I’ve gotten to the point of being fed up with the process so I found it therapeutic to rant about the experience. My goal here is to improve the software that I use day in and day out.

Begin Rant

First off, in a world of “Automatic Updates” and “Upgrade All” buttons, why aren’t there similar options when updating VS extensions? Having to click each item in the Upgrade list and go through two or three windows to have the update installed is annoying. One fix here would be a list where you could “check” the updates you wanted to install, and then click once to have them all installed.

As you’ll see in the next section that describes the current process, those annoying windows are modal, meaning you can’t do anything with Visual Studio until the extensions are installed, and you can’t even use the extensions until restarting Visual Studio. What a way to kill productivity. Grrrrr…</p>

Read More »

Windows Search Doesn’t Like Android File Import

January 24, 2014 by Mark Dickson

Have you ever remembered an important file on a mobile device, such as your smartphone, that you forgot to backup? Have you then gone looking for that file only to find that it doesn’t exist in the location you expected it to be? If so, I am guessing this realization is followed by a certain degree of heart-sinking, nauseating panic, which comes along with the immediate dropping of all other tasks around you to frantically look through the files. You start to wonder, “did I put it somewhere else,” “did I back it up already” or “I am going to write a scathing letter to the makers of my storage device for making a product that will just lose my data.”

If you have been here, I feel your pain. The other day I thought I had lost an important video on my phone. After frantically looking through the photo and video albums in my QuickPic app to no avail, I hooked my phone up to my PC with USB to search through the files directly. I could have done this with my Astro File Manager app but I figured this would be easier so I could copy it onto my computer when I found it.

The main problem I ran into was trying to copy the files from the Search Results View in Windows Explorer to my local hard drive. Rather than copying correctly, a cryptic error window popped up. I initially freaked out thinking that my files were corrupt, which might have caused them to be lost in the first place. After a quick Google search I found that this is apparently a known issue with this operation. I will share my story.

I should let you know that the phone I am working with is a Samsung Galaxy S3 using the stock Verizon Android OS (ver 4.1.2), connected to my machine running Windows 7 Professional SP1. iPhone users should stop reading here. I am not sure how iTunes handles files, searching and syncing for your iPhones and iPods, but I don’t get involved in that mess.

I was not too familiar with the new method of Windows file searching brought about in Vista. Microsoft has moved to injecting search options and “hints” into the search string directly, which is hidden as a small text box in the upper right of the explorer window. When in the explorer window, the search box will default search the current location and sub-folders. I won’t spend my time teaching about Windows Search, you can learn how to Find what you’re looking for, including How to Use Windows 7′s Advanced Search Operators and also check out some Advanced Tips for Windows Searching out there on the web.

Tweaking the Way Windows 7 Searches

Having figured out and tested some of the Windows 7 search options, I selected my connected phone and searched for some files that I knew existed. I was less than surprised to find that Windows searched for a few seconds and brought back a subset of the files that I knew should be returned from the search. Ah, Windows file indexing, thou art a pain in the butt. Back to my friend Mr. Google to figure out how to change this.

There are a few options I found in this article How to Make Windows 7 Search File Contents. It is possible to add certain folders and locations to the Windows Index, but since this device is not usually connected, I opted to change my search options using Method #1: Enable Widespread Content Searching. Granted this method does not technically address my problem as Windows should have still searched my non-indexed location by filename (by default settings), but I have often found Windows Search to be unreliable.

Read More »