Chris Pietschmann

husband, father, hacker, entrepreneur, futurist, innovator, autodidact


IronJSMVC: Script ASP.NET MVC in JavaScript using IronJS

Personally, I enjoy writing much of my applications using a statically typed language such as C#. However, I would really prefer to be able to write UI logic and script certain parts of my applications using a dynamic language if I could. I was thinking about this and the following question came to mind: What would it be like to write an ASP.NET MVC application entirely using JavaScript? So I thought I’d work up a prototype using IronJS (a javascript implementation for the .NET DLR.) Download... [More]

HTML5 IE9 Bug: SELECT box is Un-Selected using Mouse if CSS modifies position on hover

I recently encountered this rather strange bug that only shows up in Internet Explorer 9 (haven’t tried 10, but likely there too,) but works just fine in IE8, Firefox, Safari and Chrome. Generally the HTML/CSS markup for an individual page within a normal web application can get pretty complex, so this bug took me a while to figure out what it was. Apperently, if you have a <SELECT> box contianed within a <TABLE> (which is done fairly often with data entry interfaces,) and you have ... [More]

CanvasMap Prototype = HTML5 Canvas + Mapping

When Microsoft released the Windows 8 Developer Preview (Sept. 2011) I was a bit annoyed that they failed to include a “native” Bing Maps control for us to build with. Instead they require you embed the Bing Maps v7 Ajax map within an IFrame to use it. There are a few issues with this that I wont get into now. So, consequentially, I decided to prototype my own map control with the intended purpose to use it with JavaScript based WinRT apps if it turned out well. Disclaimer: The code for CanvasM... [More]

2012 Bing Maps Feature Wish List

The Bing Maps Silverlight control is really sweet (although it hasn’t been updated in forever) and the Ajax v7 control was a huge improvement performance wise over v6. However, the Bing Maps platform has a long way to go before I would consider it to be the mapping development platform I would hope it could someday become. Bing Maps Wish List Here’s a list of some features that I hope make their way into the Bing Maps platform for us developers to be able to utilize: 1) Bring 3D Mapping Back!... [More]

ASP.NET MVC Themes: 3 different theming methods

There really isn’t a single “one size fits all” solution to theming an ASP.NET MVC web application. From my experience working with the platform, there are really 3 different methods that can be used to theme your apps. Here they are in no particular order: 1. CSS Stylesheet This is the simplest and pretty much standard method that’s used to theme an ASP.NET MVC web application. Basically, you just create a different version of your sites CSS file for each “theme.” Then you include the approp... [More]

SQL Azure: REBUILD All Indexes in Database – Alternative to DBCC DBREINDEX

Unfortunately there are some differences between SQL Server and SQL Azure. One of these differences is that SQL Azure does not support the “DBCC DBREINDEX” command. Thankfully there is an alternative you can use to rebuild the indexes within your SQL Azure databases. The alternative is to use “ALTER INDEX” instead. ALTER INDEX ALL ON TableName REBUILD Here’s an example that loops through all the tables in a database and rebuilds all their indexes: DECLARE @TableName... [More]

JavaScript: window.onbeforeunload Event - Show “Are you sure you want to leave this page?” Message

All web developers have likely seen how inconvenient it can be for a user to edit some data in an application, then click a link/button to go on to the next task, but only to later realize that all changes made were never saved. This can pose a major problem for users, until they get it down that they need to click the “Save” button before leaving the page. Wouldn’t it be nice for the app to remind them to click the “Save” button? Everyone has seen the “Are you sure you want to leave this page?... [More]

Tag Editor Field using jQuery similar to StackOverflow

The tag editor featured on the StackOverflow website (and all the StackExchange websites) is a real slick tag editor that makes it much nicer to enter tags than just a plain textbox. I searched a little and couldn’t find anything that works just like theirs, so I decided to build one. Download Full Source Code: Here’s some example usage of the tag editor: <div id='SelectBox' style='width: 350px'></div> <input id='btnClear' type='button' valu... [More]

Entity Framework Tips and Tricks: Use GetObjectByKey When Querying a Single Entity

I’ve been using Entity Framework a lot lately and it makes data access really nice. It’s fairly simple to use and maps all your tables to a .NET object model. However, just like any other library, it can be misused and have it’s own issues. I’ve been figuring some things out as I’ve been using it, so I thought I’d share a few tip and tricks that I’ve learned. Here’s the first one: Use “GetObjectByKey” when Querying for a Single data entity Take the following query: var person = (from p in con... [More]

Mixing some Dynamic-ness with IronJS in .NET 4

I recently started messing around with IronJS again, and I must say that this project is pure awesomeness! One of the first things I noticed is that when you call the “Execute” methods to run some JavaScript code it returns an “object.” Now, while this works just fine, I would prefer if it returned a “dynamic” object while running against .NET 4.0. There may be some reason that Fredrik Holmstrom (the author) decided to return an ‘object’, so I don’t mean to sound negative, but you have to admit ... [More]

Bing Maps v7 Ajax Hacks: InfoBox Description containing Html tags

For some odd reason the Bing Maps team decided to not allow HTML tags within the Description property of the InfoBox class they baked into the Bing Maps v7 Ajax control. I don’t know why they would limit it in such a way, but thankfully I have figured out a hack to override it and allow HTML tags as desired. Here’s a full sample page that adds a map with pushpin and infobox, and sets up overriding support to allow HTML tags within the infobox’s description:   <!DOCTYPE html> ... [More]

Bing Maps v7 Ajax Hacks: Pushpin Tooltips via Html Title Attribute

The Bing Maps v7 Ajax control is still a bit lacking in functionality, and good for us it’s written in JavaScript so it’s easy to extent and hack. The following hack is an “unsupported” method of adding Tooltips to Pushpins by making use of the HTML Title attribute. The Google Maps API already has a “setTitle” method on Markers to add a Tooltip to the pins plotted. Now, thanks to this hack, the same can be done using the Bing Maps v7 Ajax control. Here’s a full sample page that adds a map wi... [More]

Awarded 2011 Microsoft MVP–Windows Live Platform

I really enjoy helping others. One of my main motivations for my continued efforts in helping others build great software and implement the latest technologies is the fact that I am trying to give back to the communities that I have learned so incredibly much from over the years and continue to learn from every day. I often feel that I have learned so much more from the community than I could ever repay, so my community contributions (blogging, forums, users groups, open source projects, etc.) a... [More]

Deeper in .NET 2011 in Review with Pictures

I had a great time at Deeper in .NET 2011 this past Saturday. It was a day full of geek speak about .NET, HTML5, MVVM, Silverlight, IOC, Windows Phone 7 and more! Not only were the sessions great, but it was also an awesome opportunity to network with other local developers and recruiters. A special thanks goes out to all those who helped organize and administer the event! (Too many to name and frankly I don’t want to leave any one out.) Also, thanks must be given to the sponsors and speakers. ... [More]

New “Earthquakes in Last 7 Days” Bing Map App

In recent light of the earthquakes, tsunami and huge disaster in Japan, I put together the new “Earthquakes in Last 7 Days” Bing Map App. You can try it here: “Earthquakes in Last 7 Days” Bing Map App This app pulls in the USGS feed of earthquakes of magnitude 2.5+ from the past 7 days. When ever you go to the app, it will show you the most recent earthquakes that have occurred. Here’s a screenshot showing all the earthquakes globally from the USGS feed at the time of writing this blog post: ... [More]

Step By Step: Bing Maps Silverlight and an Out Of Browser (OOB) Application

I’ve received a couple questions regarding the display of the Bing Maps Silverlight control within a Silverlight Out Of Browser (OOB) application, so I decided to write up a simple step by step example of creating a basic Silverlight OOB application that displays a map. Step By Step Example Follow the below steps to create a basic Silverlight OOB application that displays a map using the Bing Maps Silverlight control within Visual Studio 2010: Step 1: Create New Project In this case, I’m ... [More]

Geomap Project - HTML Extensions for Rendering Map Displays

One thing missing from HTML5 is the ability to render maps on a page. The Bing Maps and Google Maps JavaScript API’s are generally fairly simple to implement, but they could both be easier. I wrote up a small example API that allows you to add Maps, and plot data on those Maps, to an HTML page by using mostly HTML markup using a new <geomap/> tag. While this project uses JavaScript to perform the map rendering once the page loads, all you need to do to implement it is write some simple ma... [More]

MvcXaml - Images from XAML within ASP.NET MVC Application

It can be cumbersome using GDI+ to dynamically generate images based on data. I recently had to perform some dynamic image generation within an ASP.NET MVC application, and had the idea of using XAML to define what the image will look like. In a relatively short amount of time, including searching the web and looking at Anoop Madhusudanan’s example, I successfully put together a proper ASP.NET MVC ViewEngine to perform this task. Download MvcXaml with Samples! Basics of Usage After you regi... [More]

Technology to Watch in 2011 and Beyond

While we may not find evidence of extrasolar intelligence, there is plenty of terrestrial things to keep in eye on. But then again, you never know. The below items are not numbered, as I did not want to emphasize any single item more than the others. They are all important and their advancements WILL CHANGE EVERYTHING! “Any sufficiently advanced technology is indistinguishable from magic.” – Arthur C. Clarke Advancements in Technology Touch Screens Sure, we’ve seen single touch monito... [More]

Odd .NET Namespace Scoping Causes Compile-Time Exception

This isn’t really a bug in the .NET compilers, but it sure is an interesting namespace scoping issue that could easily be encountered. If this teaches you anything, be it that you should never name a nested namespace level the same name as one of its parents in the hierarchy. In C# First here’s the Compile Time Exception that I was getting: The type or namespace name ‘Data’ does not exist in namespace ‘MyApp.Data.MyApp’ (are you missing an assembly reference?) At first I was like “What do yo... [More]

4 Reasons Why Virtual Router is Superior to Connectify

Over a year ago I launch the Virtual Router project, and over that time it has become fairly popular! Virtual Router is downloaded nearly 7,000 time per week! Download Virtual Router Here! Virtual Router is a free, open source software based router for PCs running Windows 7 or Windows Server 2008 R2. Using Virtual Router, users can wirelessly share any internet connection (Wifi, LAN, Cable Modem, Dial-up, Cellular, etc.) with any Wifi device (Laptop, Smart Phone, iPod Touch, iPhone, Android Ph... [More]

Bing Maps Ajax 7: Add a Simple Mini Map

The Bing Maps Ajax v7 control doesn’t include support for adding a Mini Map. So, I decided to quickly work up a simple example of adding one. Below is the source code for it and a zip download of the code at the bottom of the post. Source Code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <html xmlns=""> <head> <meta http-equiv=&quo... [More]

Bing Maps Ajax 7: Add Custom Navigation Bar Buttons using jQuery

The Bing Maps Ajax v7 control does not include support for adding custom buttons to the navigation bar (where the zoom, pan and map style buttons are). There may be times when you will want to add a custom button or two, and this post contains some simple code that will help you do so. Here’s a screenshot of this in action. The ‘Click Me’ link in the navigation bar is a custom button that the below code adds. Code First, here’s the code that I came up with to add custom navigation bar butto... [More]

Bing Maps Ajax 7: Simple Pushpin Animation via Extension to Microsoft.Maps

When updating the location a pushpin using the Bing Maps Ajax Control, the pushpin instantly moves to its new location. Sometimes this may work, but other times it may be nice to animate the movement. Updating the location a vehicle in an asset tracking application is one example where it would be nice to animate the movement. I wrote a simple extension to the Bing Maps Ajax v7 control that adds the “Pushpin.moveLocation” method to perform such an animation. Usage Let’s start with some sample... [More]