Monday, May 26, 2014

Hostgator: How to clear the ASP.NET Application Pool from Parallels Panel

If you are using Hostgator Windows Hosting Plan for your ASP.Net websites, you probably have notice that is no easy magic button in the Parallels Panel to refresh the Application Pool from your website. 

Don't have a hostgator account? you can get one by using this coupon link to claim your hosting under $4.00.

I contact support asking to find a way to do this from Parallels and they told me there is no way to do that. They can reset it for me when I wish to. Well, that doesn't work for me. I am not going to sit and wait 13 min in the chat window to get an agent on the line and ask them to please reset the application pool for my website.

The Workaround:

If you are a developer you probably already know this work around. 
Edit the web.config via the web management panel in Parallels or FTP the updated web.config via the ftp and the application pool should reset automatically. But you don't have experience you can easily do these easy steps from the Hostgator Hosting Panel for Windows.

Follow these Steps:
1) Login to Hostgator Parallels Panel Web Interface
2) Under the Websites & Domains, location your website and find the ASP.NET Settings Link

3) Make a change here that would not harm your website. I usually just change the value of the session timeout (minutes).

4) Save the changes by clicking on the OK button. 

That's IIS will automatically reset the application pool for your website.

Friday, May 16, 2014

Visual Studio Deploying DatabaseProject Error Could not find DATABASE.SQLPERMISSIONS

I had this error today with my 2010 database project. I hope this simple fix helps you solve your issue.


The first thing I did was check the history of the database project and yet there was nothing unusual that had changed. Then I check to see if I actually had that file in the path that it was given and nope I did not had it. Obviously was looking at the wrong path. The file did existed within the database project path \properties\ folder.

 The answers on did not helped me at all.
 Then I remembered about the metadata files so I went into the location of the database project file and removed the *.dbmdl files and the .user files associated to my database project file.

In order to remove those files I had to first unload the db project from visual studio, otherwise you get an error.   That did the trick. Load the project again and I was able to successfully deploy the database project.

Wednesday, March 26, 2014

JSON Webservice Error There was an error processing the request

I was dealing with this error for a couple or more hours with a JSOn Webservice in when calling from JQuery and Backbone.js client side application. When I was returning a simple entity it was working just fine but when I wanted to return a complex object type it was failing.

Any ways after looking and trying different things I found that the issue was with the max response limit was exceeding. Of course it was hard because there was no detail error log information any where. The webservice class was not throwing any particular exception. IIS was just return the Error 500 with this message.

Message":"There was an error processing the request.","

The FIX:

Simply added this to the web.config where the .ASMX class lives and the problem was solved.

<jsonSerialization maxJsonLength="50000000" />

Tuesday, February 11, 2014

How to remove a TFS Workspace Mapping?

I just encountered this issue after changing the build servers domain names. Clearing the TFS mappings using TFS side kicks did not worked.


C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets (806): The path c:\builds\bizproj\QA\Sources\Configuration2.0 is already mapped in workspace LOCALBUILD02_72_2;\tfsuser.

Go to the build machines and delete the files under this folder.

C:\Users{UserName}\AppData\Local\Microsoft\Team Foundation\3.0\Cache

After you clear that trigger a new build and see the results.

Friday, January 24, 2014

Windows 7 Device and Printers not loading. Issues with Printer Spooler service.

I started this week experiencing issues with my computer. Some programs starts not working when doing an operating and click on it would read “Not Responding”.  It happened that I needed to print something and I when to Devices and Printers on the control panel and notice that it was not loading. I knew about the Printer Spooler service. So I went ahead and went into services.msc and look for Printer Spooler. It was running and set up as Automatic which is great that’s what we want. 
I right click and restart and immediately the Devices and Printers on the Control panel load up. However, I was not able to print. I tried to read the device and nothing would come up. 

I continue to had this issue for several days. When an application like snag-it or Word or Excel would hang up, I restarted the Printer Spooler and it worked right away. So I thought this freaking Printer Spooler is corrupt. I tried finding help online but no help at all. I end up finding about Restarted the Bluetooth Service. This was not helpful for me at. However, it looks like for several users it did helped. So give that a shot first if your Devices and Printers is now loading in Windows 7 or possible in Windows 8. 
What you want to do is make sure you start up the services:

 1) Bluetooth Service 
 2) Bluetooth Support Service. 

If after your start or restart this services you still have the issue like me, try the following: 

 1. Go to the Start menu and type REGEDIT. Then right-click on REGEDIT and select 'Run as Administrator'. 

 2. Go down to the following key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environment\Windows NT x86\Print Processors Under Print Processors there should be a folder called 'winprint'. If it's there delete and recreate it. if it's not there create it. 

 3. To create the 'winprint' folder and key, right-click on 'Print Processors' and select 'New' - 'Key'. Type in winprint Now, select the new winprint folder and right-click in the black white space to the right where the sub keys should be and select 'New' - 'String Value'. 
Type in Driver for the name. Double click driver and enter in winprint for the value. 

 4. Now try installing the printer. 

I found this from the Microsoft website

After doing this I was able to add a new printer and all my printer spooler issuer where gone.

Wednesday, December 15, 2010

jQuery hasClassName prototypejs function: How to check if element has class with JQuery

To determine if an element has a class register with jQuery you can use the function .hasClass() which is shorter for .hasClassName() in prototypejs

// Do something

// With Prototype js you would use...

// Do something

jQuery check element is visible : How to check if div is visible with jQuery

Unlike Prototypejs where there is a dedicate function .visible() that return true/false when element style is 'none', jQuery has this function .is() to check the value of given properties.

This is how you can determine if an element is visible.

<div id="target" style="display:none"></div>

if( $('#target').is(':visible') ) {
// this element is visible
// Check if its hidden
if( $('#target').is(':hidden') ) {
// this element is hidden

Tuesday, December 14, 2010

jQuery add class to element: How to add a class to a div

Adding class or removing a css class from an element with jQuery or Prototypejs is very simple.

// With JQuery


// With Prototypejs...


// Removing a class with Jquery


// With Prototypejs...

Once again, jQuery has shorter function names which is awesome!

Wednesday, October 13, 2010

Linq Lamba Expressions Performance Problems SingleOrDefault Super Slow

A few months ago a release my website for real estate properties in Puerto Vallarta, Jalisco Mexico. In the last few nights I decided to start optimizing the site and noticed huge performance problems when using SubSonic 3 with Linq. I used to use SubSonic 2 on a high traffic site without any problems. However, with Linq I have been having High CPU Peaks and Memory consumption. I throw some webtests/Load tests with Visual Studio 2010 and started noticed the performance issues especially with Linq. No problems with Subsonic since its just a layer to Linq to Sql.

In particular I was surprise with the function .SingleOrDefault() on a single call for a Property it was taking 0.2 seconds on a database with ~4,000 records. The database has already been optimized.


I did some reading and found an article from JD in regards to this issue
I decided to implement on the Property class the static for delegates:

public static Func> _propertyGetQuery =
SubSonic.Linq.Structure.QueryCompiler.Compile((PropertyRentalDB db, int id) =>
from p in db.Properties
where p.PropertyId == id
select p);

public static Property GetById(int propertyId)
var db = new PropertyRentalDB();
Property p = _propertyGetQuery(db, propertyId).SingleOrDefault();
return p;

Compile and run Ants performance profiler and the load tests and the performance results here HUGE!


Total hits 71. Average from 0.20 to 0.011.

Now I can go and optimized more of the code where I use similar instances.
However, I think on my next project I will just go back and use SubSonic 2 and forget about Linq.

Wednesday, August 25, 2010

SDC Tasks Failed to Update IIS website on Windows Server 2008 R2 IIS7

I just moved a website to IIS 7 on Windows Server 2008 R2 and the automate deployment builds failed to update IIS to set the website in maintenance mode (app offline) by simply changing the website path using the SDCTasks.


A task error has occured. Message = Unknown error (0x80005000) MachineName = \\LOCALQA01 HostName = Description = Path = D:\websites\app_offline\acme Identifier = AuthFlags = AppPoolId = AnonymousUsername = AnonymousPassword = HttpExpires = DirBrowseFlags = DefaultDocs = at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_IsContainer() at System.DirectoryServices.DirectoryEntries.ChildEnumerator..ctor(DirectoryEntry container) at Microsoft.Sdc.Tasks.Configuration.Web.WebSite.GetIdentifierFromDescription(String machineName, String description) in c:\projects\codeplex\sdctasks\Solutions\Main\Tasks\Configuration\Web\WebSite.cs:line 264 at Microsoft.Sdc.Tasks.Configuration.Web.WebSite.Exists(String machineName, String description) in c:\projects\codeplex\sdctasks\Solutions\Main\Tasks\Configuration\Web\WebSite.cs:line 241 at Microsoft.Sdc.Tasks.Web.WebSite.Modify.InternalExecute() in c:\projects\codeplex\sdctasks\Solutions\Main\Tasks\Web\WebSite\Modify.cs:line 225 at Microsoft.Sdc.Tasks.TaskBase.Execute() in c:\projects\codeplex\sdctasks\Solutions\Main\Tasks\TaskBase.cs:line 67

I did just digging around and finally go to the real issue. Looks like DirectoryServices which is what SDC tasks uses to update the IIS was the caused of this problem.
I created a simple consolde app to try updating the website with DirectoryServices:

static void Main(string[] args)


string MachineName = "LOCALQA01";
var Identifier = GetIdentifierFromDescription("LOCALQA01", "").ToString();
string path = @"D:\websites\app_offline\Acme";

// load the site
DirectoryEntry site = new DirectoryEntry("IIS://" + MachineName + "/w3svc/" + Identifier + "/ROOT");

// make the changes we need to make
if (!string.IsNullOrEmpty(System.IO.Path.GetFullPath(path)))
// Log.LogMessage(string.Format("Setting Path: {0}", path));
site.Properties["Path"][0] = path;


catch(Exception ex){



public static int GetIdentifierFromDescription(string machineName, string description)
// load the W3SVC and check all the children for a property that matches

DirectoryEntry de = new DirectoryEntry("IIS://" + machineName + "/W3SVC");

foreach (DirectoryEntry o in de.Children)
if (o.SchemaClassName == "IIsWebServer")
if ((string)o.Properties["ServerComment"][0] == description)
return Convert.ToInt32(o.Name);
return 0;

Bu when I run this from the build machine I was then getting this error:

[System.Runtime.InteropServices.COMException] {"Unknown error (0x80005000)"}

Unknown error (0x80005000)
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_IsContainer()
at System.DirectoryServices.DirectoryEntries.CheckIsContainer()
at System.DirectoryServices.DirectoryEntries.Find(String name, String schemaC

Without going to further details the caused of this error was because I did not had IIS 6 Metabase Compability role service installed for IIS7 on the build machine where I was running the scripts from. You can installed this by going to :

Server Manager > Roles> Web Server (IIS) > Add Role Services

After you fix this and still have issues probably the next error will be "Access Denied".
This is because of the UAC in Windows Server 2008 R2 which is annoying if you ask me. You can then make the account service that runs your builds local admin on the server your trying to update. This will take care of the issue. Or you can just disable the UAC and be done with it.

Hope this helps.

Thursday, August 19, 2010

How to disable flash debugger Error Messages in FireFox

If you have the flash debugger installed or have Flash or Flex builder you will get annoying error messages from many of the websites that you visit today where developers have errors in their flash applications.

You can disable this by creating a file mm.cfg under your users settings folder

Windows Vista / Windows 7:

Windows XP:
c:\Documents and Settings\

/Library/Application Support/Macromedia

Enter this in this file and save it.


Restart Firefox and the errors will no longer show.
If you need to display the debugger error messages set the value to: