Friday, September 12, 2014

Making jQuery and Boostrap 3 and "hide" class work together

One of the problems with using jQuery's show and hide methods is that they are no compatible with the provided Bootstrap css classes "show" and "hide".

What is the problem? Bootstrap's css class looks like this:

.hide {
  displaynone !important;

Those important styles are necessary on some elements to make the behavior as expected. However, jQuery doesn't overwrite them when setting css attributes with the built-in show/hide methods. The recommended way that I found is to manually use .addClass("hide") and .removeClass("hide")...which is way too annoying.

Add the following JavaScript code after the initial jQuery .js file load and all is well.

var originaljQueryShow =;
var originaljQueryHide = jQuery.fn.hide;
    show: function () {
        var result = originaljQueryShow.apply(this, arguments);
        return result;
    hide: function () {
        var result = originaljQueryHide.apply(this, arguments);
        return result;

This lets the original functionality of the jQuery show() and hide() to be maintained, while adding transparent support for the Bootstrap css hide class.

Sunday, January 19, 2014

Entity Framework 6 + Stored Procedure = The type or namespace name 'Objects' does not exist in the namespace 'System.Data'

(this post is formatted poorly, it will be fixed later because I really need to post this one before I forget it)

On my latest project I upgraded to Entity Framework Version 6 and everything was fine until I tried to add a Stored Procedure function import.

After adding that I could no longer build the project and the error message of "The type or namespace name 'Objects' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)" started showing up.

I found the solution here and the fix is to download the Entity Framework 6 Tools for Visual Studio 2012/2013.

Note:  After you install the tools, your model will still not compile.  To fix it you must either:

  • Delete and re-add the Model.edmx to your project
  • Create another model and copy the file from it over your initial model.  After you copy the .tt, on Line 5 you'll need to set the name of your original Model.edmx
Line 5: const string inputFile = @"OriginalModel.edmx";
Now, after it compiled I ran into the fun error message "System.InvalidOperationException: The value of EntityCommand.CommandText is not valid for a StoredProcedure command. The EntityCommand.CommandText value must be of the form 'ContainerName.FunctionImportName'."  At this point I was almost ready to write EF6 off as unusable, but I found a page at that gave me the updates to that I needed.

Look for the method signature

public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)

Replace that method with

public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
var parameters = _typeMapper.GetParameters(edmFunction);
var returnType = _typeMapper.GetReturnType(edmFunction);
var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
if (includeMergeOption)
callParams = ", mergeOption" + callParams;
return string.Format(
"return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",

Monday, September 30, 2013

Create an ad-hoc network in Windows 8

My USB drive died and I needed a very quick way to get some larger files from my tablet to my laptop.  The largest problem was that I was connected over an open WiFi network in my hotel room and I needed it to be as secure as I could make it.

So, creating an ad-hoc network came to mind between my laptop and tablet to transfer the files.  I have never actually had a need to create one of these, but the steps are more manual than I remember them being in previous versions of Windows.

I found my answer at  The site has detailed steps and pictures if you need them, so I'll give a very quick run-down of what needs done.


  • Your NIC needs to support virtualization (see the website for more info).  Any modern NIC should support it, however.
  • Your ad-hoc network will broadcast a public SSID.
  • The encryption is WPA-2 Personal.
  • Copying between the tablet and the laptop is pretty slow, but it works over a network share that I made.
To enable it:
  1. From a command prompt run:
    1. netsh wlan set hostednetwork mode=allow ssid=NETWORK_SSID key=PASS_KEY
    2. netsh wlan start hostednetwork
  2. Open up the network adapter list, you can search for "View Network Connections" in the Windows 8 search.
  3. Enable Internet Connection Sharing (ICS) by going to the Network Adapter properties you want to share (the same place you'd assign an IPv4 static IP at) and choose the Sharing tab.  Then just enable it to be shared by others.
  4. Look for your SSID on your other device(s) and connect to it.

Friday, September 20, 2013

Xbox 360 Sign-in Error 80072EF3 and other ailments

I've had all kinds of problems with one of my Xbox 360s in particular, the 4GB with Kinect newer model , but not the latest version that looks like the Xbox One .  This thing had been through about every beta invite and set in my son's room for over a year doing who knows what.

Some of the things I was experiencing:

  • Random popups asking for me to enter my security information and password when a profile is signing in.
  • Random disconnects from Xbox Live
  • Constant freezing during game play and movie watching
    • Sometimes there would be no indication other than a frozen screen
    • Sometimes it would display vertical blue broken lines on the screen
    • Sometimes it would display vertical red broken lines on the screen
  • And finally the inability to connect completely with 2 of the 4 profiles on the Xbox with Error 80072EF3 required me to do some research 
I had honestly written off all the problems as the thing was dying.  I assumed my son had done something, like let it get too hot, causing the video card to just start the path to death.

I found a lot of suggestions ranging from delete the cache to delete the profiles and re-download them for the disconnects and the 80072EF3 error.  Something was corrupted and the most likely assumption was the profiles.  The only suggestions about the freezing with the vertical lines was to send my Xbox in for warranty because the video card is about to die.

In the end none of that worked. Finally I found a few places suggesting to just do a system software reset.  I'm sure some have never heard of this, but back in the day it was the only way to reset the cache as well. Microsoft likes to "give you a good user experience", forcibly usually.  Hey, just like the Windows 8 User Account Control being mandatory to use and create Metro (yeah I know it isn't called that anymore) applications causing me to never be able to double click files to open them in Visual Studio.  Ok, I'm done with that complaint and onto the rest of this post.

Now onto the Steps:

Go to Settings, Storage, and highlight any of your storage devices.  Then press the magic buttons.
  1. Left Bumper
  2. Right Bumper
  3. X Button
  4. Left Bumper
  5. Right Bumper
  6. X Button
Restart your console and it will download the latest software version again.

This sequence is available all over the internet, but I'll give credit to a user post on the Xbox forums as it last place I looked it up.

Create a bootable USB drive from a bootable ISO image

It seems I'm always wanting to make a bootable USB drive my an ISO I have, but I never remember where I found the tool.

Microsoft provides a free tool Windows 7 USB/DVD download tool that does the job.

Friday, September 6, 2013

Automatically add "maxlength" attribute to MVC validation textboxes

We needed the maxlength attribute added to all of our text boxes, but there was no obvious way to do it while using the built-in MVC validation.

I found this bit of JavaScript at that takes care of it automatically by adding the maxlength attribute to any input objects that contain the data-val-length-max attribute already.

<script type="text/javascript">
        function () {
                function (index) {
                    $(this).attr('maxlength', $(this).attr('data-val-length-max'));

Monday, August 19, 2013

Windows Phone 8 IE 10 Responsive Design Fix

It seems that WP8 with IE10 has a bug with responsive design viewports.  I found the widely used fix at

Add the following CSS:

Add the following JavaScript:
<script type="text/javascript">
    if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
        var msViewportStyle = document.createElement("style");