I was working on an old MVC4 project that was running on .NET 4. I couldn’t upgrade it to 4.5 because this app runs on a Windows 2003 server and .NET 4.5 doesn’t support Windows 2003. Thus, I was stuck targeting good old .net 4. Not the end of the world, or so I thought. I then went to upgrade Kendo UI for MVC by Telerik. I used the MVC 4 version of Kendo since I’m using MVC 4 and that’s just the logical thing to do. I built and got a warning that prevented me from using the Kendo.Mvc DLL.
The primary reference "Kendo.Mvc, Version=2014.2.716.440, Culture=neutral,
PublicKeyToken=121fae78165ba3d4, processorArchitecture=MSIL" could not be resolved
because it has an indirect dependency on the assembly "Newtonsoft.Json, Version=184.108.40.206,
Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" which was built against the
".NETFramework,Version=v4.5" framework. This is a higher version than the currently
targeted framework ".NETFramework,Version=v4.0"
Start by creating a new Ember CLI application:
ember new <my_app>
Now let’s get CoffeeScript working, it’s as easy as installing a Broccoli component
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.
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).
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.
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).
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.
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>.
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:
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 »
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!
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:
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).