Software Development

JQuery UI Autocomplete and MVC3 Remote Validation Conflict

On a recent project I had a great deal of trouble to get JQuery UI Autocomplete and ASP.Net MVC3 Remote Validation to play nicely with each other. The goal was to have a type-in for selecting a city for a search in which the pull-down would auto-complete based on the available cities in the database:

Autocomplete in action

Once a city is selected from the autocomplete it should do a validation as to whether the city is populated with actual data in the database (in case the user types in an invalid city:

Clipboard Printer App

Note: Installer and source code were updated on September 1, 2025 to support the latest versions of .Net

Sometimes you might want to print a small section from an email that has 30-embedded replies or just a snippet of code from that big class file. The Clipboard Printer Windows app makes it easy to do by copying what you want to print into the clipboard (CTL-C or right-mouse “Copy”) and then print it to your printer.

User Initialization in Code First/Altairis

In a previous post I showed how Entity Framework Code First ORM could be integrated with the Altairis Web Security simple membership provider to create a simple way to add a membership provider with an application using the EF 4.1 framework. One of the issues is that when the database is regenerated during development the users would have to be manually re-registered.  This is a hassle if you want to create an initial admin account or user account for testing.

Force Database Initialization in Code First EF

Continuing on the previous post about using the drop-in Altairis.Web.Security membership provider, I ran into an issue where the database may not be recreated in a timely fashion on a change to the model classes. For example if you add the following property to the User class:

public string FullName { get; set; }

And change the initializer in the ApplicationDB.cs class to drop and create the database on model change:

public class DBInitializer : DropCreateDatabaseIfModelChanges<ApplicationDB> 

The problem is if you then access the database by creating a new user in the “Account/Register” controller, the database will not drop and create because the Altairis membership provider uses non-EF (ADO.Net classic) methods of data access. Therefore, the Entity Framework access methods haven’t been touched yet and won’t drop/create the DB until that time.

Code First EF 4.1 with the Altairis Membership/Role Provider

Problem with Current Membership/Role Provider

I’ve always thought the default membership/role provider for ASP.Net is a bit heavy in that it is targeted by default to a different database than the main application database and takes several additional steps to set up and deploy. I found the Altairis Web Security Toolkit on CodePlex and it has a nice, simple schema that is easy to integrate that into your application database. It is also available from Nuget as Altairis.Web.Security.

Magic Pen and Paper

I bought a magic gadget from Best Buy called the LiveScribe smart pen and paper after watching a colleague using it for making notes during a meeting.

Magic Pen

Technology

The smart pen is really a small computer with an infrared camera analyzing a series of micro-dots in a matrix pattern on paper (originally invented by Anoto in Sweden). You write as with an ordinary pen on special notebook paper and the pen also optionally records audio. It can record everything you write and say and all of it is synched in time and saved to the pen.  Later you can play back the whole session or just click the pen on the a section of the paper and hear the audio that was being spoken when you wrote the particular entry. You can also synch it back to a computer to save as PDF or put on the Internet as an interactive Flash presentation.

Linode VPS Hosting

I decided to learn more about VPS (Virtual Private Server) hosting and set up an account with Linode, a leader in affordable Linux VPS hosting. Basically a VPS host gives you a “slice” of a computer to use for hosting where you’re guaranteed a certain amount of the computer’s resources.  Also the virtual operating system is isolated from other user’s systems so you won’t be affected if somebody else on the server fouls up and pulls too much resources as can happen with shared hosting.

Windows Live Writer

I just got Windows Live Writer set up and so far it seems to be a very nice way to edit a blog. It has a great preview function so you can see how the blog is going to look before you publish it, even before you save it as a draft locally to your computer, or publish it on the website.

You can download Windows Live Writer from this link: Download Windows Live Writer.

Better F1 Help for Visual Studio

The F1 Help key can be frustrating because it is very slow to invoke on Visual Studio. I figured out a way to make it faster by having it bring up a browser rather than the MS help. This technique will also work with the currently highlighted word.

Use the following steps to make this happen:

  1. Use the Tools > External Tools menu.
  2. Add a new tool as shown in the top image below.
  3. Use the following text for the Arguments: http://www.google.com/search?q=site:microsoft.com%20$(CurText)
  4. Use the Tools > Options menu for and select Environment > Keyboard.
  5. Type in “External” in “Show Commands Containing”
  6. Select “Tools.ExternalCommandN” (Where N is its order in the External Tools list).
  7. Fill out the rest of it as shown in the bottom image below. If the F1 command is already taken by the existing Help then disable it in the Help.F1Help command.

Now your help should come up very fast.