Thursday, December 11, 2014

SQL Server Stuck in Restoring State

If you database ever gets stuck in restoring state run this script to get it usable again.




RESTORE DATABASE MyDatabaseName WITH RECOVERY

Tuesday, December 9, 2014

What is that website built with?

Wondering what a website is built with?  Is it ASP.Net, Java, PHP?

Built with will tell you

http://builtwith.com/


Tuesday, November 25, 2014

Run as Different User in Windows 8

In previous versions of windows I could do the key combination ctrl+shift+ right mouse click and run an application as a different user.

This can be useful for troubleshooting connectivity issues to servers and applications.

I could not find this in windows 8.

This feature is turned off by default on Windows 8.  Below are the instructions to turn this back on.


  1. Press Win+R, and type"gpedit.msc",then press Enter.
  2. In the left pane, click/tap on to expand User Configuration, Administrative Templates, and open Start Menu and Taskbar.
  3. In the right pane of Start Menu and Taskbar, double click/tap on Show "Run as different user" command on Start.
  4. Select Enabled, click/tap on OK.
  5. Reboot the computer.


The full post can be found here Reference

Monday, November 24, 2014

How to Turn Off "Enable Editing" in Office 2013

Recently I opened a word document and missed half of it because it opened with the "Enable Editing" warning.

Because of the warning I did not realized there was a second page on the document and missed some key information.

I figured there must be a way to turn this off, and googled it.  I found this really great post about how to do this.

http://www.thrivenetworks.com/blog/2011/05/25/turn-off-enable-editing-in-microsoft-office-2010/

This was for Office 2010, and I really need to do this for 2013.  Here is the updated screen shot.



You will need to do this for each office product (Excel, Word ...)

Doing this got rid of this warning.  You are opening yourself up to some possible security issues.  But for me the pain of dealing with the "Enable Editing" was worse than the possible security breach.


Thursday, November 20, 2014

Stop IE8 Form Submit on HTML Button on click using JQuery

Internet Explorer 8, and also in newer versions of IE that are running in compatibility mode, buttons in a form automatically do a form post.

If you are in Chrome, newer versions of Internet Explorer or really any other modern browser this will not be a problem.  But often I have clients that use old versions of browsers for various valid business needs.

To get around this problem I just capture the click event in jquery and return false. The HTML and JQuery example below shows a snippet on how to do this.


Thursday, November 6, 2014

I found this really good article.  I am so guilty of staying up late at night coding. This explains why this works so well for me


.http://swizec.com/blog/why-programmers-work-at-night/swizec/3198

Monday, September 8, 2014

Start Visual Studio Faster

I am always looks for ways to make my development machine and environment for efficient.  For me my laptop is never as fast as I want it to be.

I find that opening Visual Studio can be very slow.  I found a setting inside the setup that loads nothing at start up.  My Visual studio now loads much faster.

To Change this setting in Visual Studio
1. Open visual studio ( the slow way loading the start-up page)
2. Go to Tools -> Options on the menu.

3. Set the At Startup to Show Empty environment


Now Visual studio will open faster.

Happy Coding


Wednesday, August 27, 2014

Visual Studio Online Update - Stakeholder Account

Just got an email today for some new features in Visual Studio online.  My favorite is the new stakeholder user.

I have a small project that I am using the free Visual Studio online.  One of the limitations of this is you can only have 5 user accounts.  After that you have to start paying. Now the fee is only $10 per month, which is very fair. However I still will save $10 where I can.

Using this feature I am able to make the BA, PM and other project stakeholders have access to view and create tasks.  Freeing up my five free accounts to only developers who need access to builds and source control.

Thanks to the Visual Studio Online team for the nice new feature.

Stakeholder User


Monday, July 14, 2014

Self Hosted Web API application Domain Registration

I recently build a self hosted Web API windows service.  The goal of the application was to receive HTTP Posts from a Asp.Net website and process long running processes.

The self hosted Web API worked really well.  We were able to post the information from the website and process the request.  In just a few hours I had off loaded work from my website to my application server.

However, once I deployed the self hosted windows service to my app server it would not run.

I had the correct URL and port on both the website and the application.

After doing some research I found that you need to register you domain with windows, or your request will be blocked.

Below is the syntax to register you url from the command line in windows

netsh http add urlacl url=http://+:9000/ user="Users"

Make sure you specify the correct port and user

Friday, July 11, 2014

TFS Build - Deploying an MVC Web Site Project with mixed platforms x86 - x64

The Problem
Recently I was working on a project that had mixed platforms (x86 and x64) assemblies. The project would build locally in visual studio 2013, but not on the TFS build server
I was building the project as Any CPU in the project configuration.

The Fix
Set the MSBuild Platform settings to X86 from Auto.


The Configuration
Visual Studio 2013
MVC 5 Web Application
TFS 2010 / TFS Build Server
Windows 2008 / IIS 7 web deployment

I hope this helps someone else out in the future, it took be a good part of a morning to figure this one out.

Wednesday, July 2, 2014

Translation in visual studio

I was working on a recent project where the code was written in English, but the comments were in Chinese. I do not know the Chinese language, but wanted to see the comments.

Installing the translator http://visualstudiogallery.msdn.microsoft.com/f2321406-c5bb-42b7-9660-dfacd313eeed/view/Reviews extension to visual studio 2013 I was able to read the comments.

It worked great, translated flawlessly.


Monday, June 30, 2014

Friday, March 28, 2014

Friday, March 21, 2014

Google Glass

Got the opportunity to try out Google Glass yesterday.

The Good Stuff
1. It can translate for you.  Look at some Spanish text, and it will convert it to English.  It does other languages to.  I cannot understate how cool this was.

2. Google hangouts is pretty cool.  And unlike usual hangouts you the person you are hanging out with sees what you see not you.

3. Directions were pretty nice.  Driving in your car with the directions would be really handy.  No more glancing down at your phone to follow your route.

4. The basic content like CNN was nice.  You could watch new videos.  Everything was displayed as Google cards.


What Needs Work
 The Battery life was pretty bad. We used it for about 30 minutes, and it was already down to 40%.  It got hot, really hot.  In fact glass told me it had to cool down.

Only geeks would think glass is a fashion statement.  I felt a bit dorky wearing it.  I don't see a Kardashian wearing this thing around with a matching Gucci bag.  

The navigation was a bit challenging.  You scroll by a touch pad on the side of the glasses.  I took a picture and tried to send it but picked the wrong contact. I hope they enjoyed the photo.

Synopsis 
I am sure in a few years Google will perfect Glass. Google will get RayBan's or Oakley to create a stylish version. We will all remember life without Glass.



Wednesday, March 19, 2014

Machine Key when load balancing asp.net web applications

If you are load balancing ASP.net web applications you will need to generate a encryption key and add it to the web.config or machine.config on each machine in the load balanced server farm.

If you don't add this you will get the error


To do this
1. Go to this site and create a key.  It even created the whole tag for you so all you have to do is copy and paste it into your web.config or machine.config

http://aspnetresources.com/tools/machineKey

2. add the new key in your web.config or machine.config




Monday, March 3, 2014

Visual studio 2012 and 2013 Create Unit Test Context Menu

In visual studio there was a handy context menu to create unit tests for you without a bunch of boiler plate coding.

In visual studio 2012 and 2013 this is missing.

This visual studio plugin build by the ALM rangers works great.

http://visualstudiogallery.msdn.microsoft.com/45208924-e7b0-45df-8cff-165b505a38d7

To install this in visual studio go to the menu

1. Tools -> Extensions and updates
2. search for unit test
3. click on and install the unit test.  you will need to restart visual studio.


4. now you can right click on your method and create a shell of a unit test.

5. you will get a bunch of cool ways to customize and create your new unit test.



Thursday, February 27, 2014

Use Access Jet Engine to read excel files in C#

In a recent project I used the microsoft jet engine to parse out a Excel spreadsheet in code.  When trying to run this code I  got the error


In order to do this I had to install the 32 bit Access Connectivity Engine from Microsoft.  The key is that you will need the 2010 32 bit install.  The 64 bit will not work.

ACE (Access Connectivity Engine)

Jet Vs Ace