# Wednesday, October 29, 2014

I’ve created a github project showing various examples of how to use/interact with Bootstrap 3 modal dialogues in ASP.NET MVC 5. 

I did this project many months ago when I was starting out with Bootstrap.  I was trying out various techniques and figured someone else might benefit from the samples.  I imagine this is not exhaustive nor do I purport the examples are "best practice".  Feel free to add pull requests to improve it.  I would love learning a thing or two from others.

Check out the project at https://github.com/klabranche/ASPNETMVC5Bootstrap3ModalExamples

Happy Coding! Smile

Posted 10.29.2014  #    Comments [0]  | 
# Tuesday, July 02, 2013

I create a virtual machine every now and then and even less have to resize the hard drive.  Below is my mental notes jotted down so I can easily remember how to do what I normally do with virtual machines using Oracle VirtualBox 4.2.14 for windows host.

The notes are raw and by no means a complete list and/or an exact step by step tutorial.  I figured, if I find it helpful so will someone else. Enjoy!

First, the manual.

Creating a virtual machine

The below sample creates a new W2008R2 Server and is assumed to be on a Windows host machine.

  • Select New button in VirtualBox Manager, give it a name, type is MS Windows & Version is Windows 2008 (64bit).
  • Give it the amount of RAM you want.
  • For Hard drive there are three options, do not add, create, use an existing.
    • Create a new HD is likely what you will want unless you downloaded an existing virtual hard drive file. If the latter is true select use an existing.
  • For creating a hard drive, select VHD (Microsoft's version) OR VDI (VirtualBoxes version) or VMDK (VMWare version).
    • There are tools to convert each to the other. Choose what you believe is the best for your situation.
  • Select Dynamically allocated for hard drive type.
  • Choose the size you feel you need to be able to adequately run the box on. Be sure to consider the OS size, updates and all of the extras you need on the machine. The default is 25GB which mean the hard drive can grow to 25GB at most. For a windows OS this is a little on the small size.
    • The default location for the virtual machine file is under your user profile (c:\users\<profile>\) VirtualBox VMs\<virtual machine name>.
    • You can change this on the size wizard page by selecting the folder icon and specifying where you want it.
      • This does not effect snapshot location. See snapshots below for more.

The Windows 2008R2 OS before updates is around 7GB but after all the updates through 7/1/2013 puts it at 24GB. A hard drive around 40-50GB may be more appropriate.

Network Configuration

There are several ways to setup the network for the virtual machine. The choice effects how the machine is or is not seen on a network.

The most common for a developer station is either host-only or bridged.

  • Host-only means the VM is only visible to the host machine. This is a great option if you don't need any external resources for the VM.
  • Bridged - The VM will use the NIC card on the host to connect with network resources. The bridge creates it's own MAC serving as a virtual NIC card.

For more in depth review see the manual.

General settings

Under the advanced tab you can enable sharing of the clipboard between host and guest as well as drag and drop.

You can only make changes to settings for the VM when it is shutdown. If it isn't, you can view the settings but everything will be greyed out.

For more on settings see the manual.

Installing OS

After the image is created, you'll need to install the OS. You can do this with an ISO and/or an actual install disk.

To select this, select your VM in the Virtual Manager, select settings, select the storage item & in the controller IDE select either the CD/DVD drive on your host machine or choose the ISO to run against.

Now start the virtual machine and follow your normal procedures for install/post install configuration needs/instructions to get your VM ready to go.

Install Guest Additions

After the OS is installed and you are in the VM, from the Devices menu select Install Guest Additions and follow the wizard to install.

Basic commands

"Host Key" - default is the right ctrl key.

Sending ctrl+alt+del - host key + del

You can cycle through screen sizes:

host key + f - full screen

host key + c - scale

host key + a - allow you to resize...

More on special characters.


VirtualBox can save the VM at it’s current state with snapshots. This is a great way to save off the VM at points in time that you may want to go back to. One great example would be to snapshot the VM before you do a major update on it. If something goes wrong you can go back to a snapshot.

Snapshots are created by right clicking on the VM and selecting snapshot.

Snapshots are stored separately from the main virtual hard drive. The default is under your user profile in VirtualBox VMs\<VMName>\snapshots. <VMName> is the name you gave the VM.

You can change where snapshots are stored under the General settings, advanced tab.


Cloning copies a VM. You can also clone from a snapshot. Right click on the VM and/or in the snapshot view and select clone.

Resizing the virtual machine hard drive

Assumed using Oracle VirtualBox 4.2.14.

You can resize a virtual hard drive if it is dynamically allocated. Fixed drives can not be resized*.

If you used snapshots you also need to clone your drive and merge all of the snapshots thus loosing the snapshots first. :-(

From the command line run VBoxmanage

vboxmanage modifyhd "path\virtualharddrivename" --resize <megabytes>

<megabytes> is the size you want to resize to, say 40GB would be 40000.

Assuming windows server OS, fire up the VM, go into disk management, right click on the partitioned space (likely your C drive) and select Extend Volume. The newly created unpartitioned space (the difference between your original hard drive size and the newly created size) will be added to your disk.

* You could convert the fixed to dynamic and then resize by cloning the drive to a dynamic first.

By no means am I an expert on VirtualBox.  There may be slicker ways to resize or use VirtualBox. 

Happy Coding! Smile

Posted 07.02.2013  #    Comments [0]  | 
# Friday, May 03, 2013

Today I wasted an hour or two chasing my tail around trying to figure out why a change to one of my ASP.NET MVC Views was not at all showing any changes in my jQuery Mobile version.  I cleared my cache, hit ctrl+F5 a billion times, redeployed to our test server and then again.  I double checked my code, then again.  I would view source and on my mobile version it hadn’t changed.  What is going on?

I noticed another oddity through all this. My page was loading up two versions of jQuery.  One being an older version I know I updated. 

<script src="/Scripts/jquery-1.8.2.js"></script>
<script src="/Scripts/jquery-1.8.3.js"></script>

Yet, it was loading. Huh? I’m confused.

What’s Happening

Then it hit me. Bundling in ASP.NET MVC looks for whatever version I have in the scripts folder to generate the tag since my syntax is:

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
    Does this mean I have the older version along with the newer version on my test server. 


Inspecting the test server revealed this to be the case.  I then went to my view folder for the mysterious view that wasn’t changing and found a very old .mobile.cshtml file that we ditched a while back once we were able to consolidate our normal and mobile view on one page.

So how did this happen.  We’re a small shop and use Web Publish built into Visual Studio to deploy to our servers.  I looked at the file publish options and the "Remove additional files at destination" was unchecked.


Leaving this unchecked means that any file you removed from your project if on the destination machine will not be removed. 

Delete some views, update your jQuery nuget packages and publish without this checked and the old items will remain on your deployed environment.

A simple check of the box and all is well again.

Luckily, our production server deploy settings were correct so we didn’t have to worry about some nasty little bug in production due to this. Smile

Happy Coding!

Posted 05.03.2013  #    Comments [0]  |