Thursday, October 25, 2007

Debug JavaScript

Most of the time developers uses alert('message'); to debug the JavaScript. But its not that much efficient because whenever you want to change the property of an object you have to change the code & re-run the application.

One keyword available in JavaScript which will enable us to debug the JavaScript as we do in our .Net (will have intellisense), by this we can see all the properties & function available in the object.

Steps to Debug JavaScript:

  1. Identify the debugging point & place 'debugger;' keyword in the JavaScript code.
  2. Open IE (Internet Explorer) - Go to Tools -->Internet Options -->Advanced Tab
  3. Deselect the below mentioned two check boxes.
    • Disable script debugging (Internet Explorer)
    • Disable script debugging (Other)Debug Javascript - IE Settings
  4. Run the application (for which you want to debug). If you are developing .Net application Visual Studio .Net IDE will automatically jumps to debugger position. Start using the intellisense & resolve you issues.Debug Javascript
  5. If you are not using Visual Studio IDE, one window will prompt to select debugger engine with all available JavaScript debugger engines in you system. Some times even Visual Studio IDE will also prompt for the debugger.Debug Javascript - Select Debug Engine
  6. Select any of the Debugger engine and start debugging the JavaScript.

Solution for Visual Studio .Net - Error file name & line numbers are not getting displayed.

I think most of the developers are came across this situation where they can see the file names & line numbers of the errors after building/compiling the code. This is very annoying thing in Visual Studio IDE. I don't know why the Microsoft guys unable to resolve this issue.

I too came across this issues & after googled I found this solution.

The issue is if you have the parenthesis ( '(' or ')' ) in the file path, it won't show you the file name & line number.

To solve this you have to rename that folder name.

Tuesday, October 9, 2007

Failed to access IIS metabase Error - Solution 2

This type of problem will occur if you have installed iis after installing framework.

Solution is uninstall & install the framework (2.0).

thanks,

vijju

Disable right click on web page

Hi Friends,

Here is the small JavaScript function to disable right click.

//register right click event (mouse click)

document.onmousedown = disableclick;
//function

function disableclick(e)
{

if(event.button==2)
{
alert("Right Click Disabled");
return false;
}
}

thanks,

vijju

Failed to access IIS metabase Error - Solution 1

This type of problem will occur only if you have both 1.1 & 2.0 Framework installed on your system. (along with the associated Visual Studio 2003 and 2005 products because you can't help but write software in both environments).

Upon running your website (via http://localhost/xxx or something like that), you may encounter the error page that reports:

Failed to access IIS metabase

If so, you may have installed IIS after installing the .NET framework.  If that's the case, try running to repair your ASP.NET installation and set up all of the appropriate ISAPI extension mappings.

aspnet_regiis -i

If, however, you're like me and had IIS already installed, and you installed VS 2003 and then VS 2005, and then set up a 1.1 virtual directory / website, simply check that the appropriate ASP.NET version is associated with it (Select VDIR --> Properties --> ASP.NET tab).

"aspnet_regiis -i"  - However, the directory it is located in was not included a system path previously, so just note that you may have to run this from the "WINDOWS\Microsoft.NET\Framework\vX.X.XXXXX" directory (with the X's being your version number) .

thanks,

vijju

Visual Studio Clipboad Ring - Tip

Unlike most other applications, VS.NET has something called a clipboard ring.
During development, the average developer finds it very annoying that you can only save 1 item into the clipboard (copy-and-pasting).
Well with VS.NET, the clipboard ring allows you to save up to 20 items into the clipboard. To reference this items, its important to know that they are saved in a LIFO method (Last-In First-Out if your not into stacks).
Usage:
1. Copy a selection using Ctrl-C (Copy). You can repeat this copying upto 19 more times.
2. Pressing Ctrl-V will paste the last item you copied. Nothing new yet right?
3. Pressing Ctrl-Shift-V will also paste the last item in the clipboard.
Now say you want to retrieve the 2nd, or 3rd last item you inserted into the clipboard, simply keep pressing Ctrl-Shift-V to cycle through the items in the clipboard.
So this saves you from running back and forth between documents to get the next selection of text you want to paste over to some other page of code.