Monday 30 March 2015

Visual Studio - Add JQuery Intellisense to ASP.NET Pages

There are multiple ways to enable intellisense for JQuery in Visual Studio.
I will lay down the steps for one of the methods.
  1. Add reference to the JQuery file.
    • <script src=""></script>
  2. Install the nuget package:
    • This will add reference to the required js files to enable intellisense along with documentation for the intellisense.
    • By default, the nuget package manager will add the files to /Scripts/......
  3. Add reference to the above js files on your web page. There are multiple files in the Scripts folder, But only the one below is necessary. 
    • <% if (false){ %>
      <script src="Scripts/jquery-2.1.0-vsdoc.js"></script>
      <% } %>
    • As you see the script is added within server side code, with an if condition set to false.
    • This makes sure the vsdoc file (that enables intellisense) is not rendered to the client.
Following the above steps have enabled JQuery Intellisense on your webpage.

Happy Coding.

Wednesday 18 March 2015

TOAD for SQL Server - Auto Complete / Auto Replace new entry not working fix

Toad for SQL server is an alternative to SQL Server management Studio (SSMS). Its a free tool from Quest Software which is now part of DELL. Its still a debate among developers over which is the best SQL Management tool for SQL Server. We will not get into it today. Instead, for those of you who are using Toad for SQL Server we will check how to make most out of the tool.
Today we will look into AUTO REPLACE option in Toad, which can also be made use of as a work around for AUTO COMPLETE of custom code snippets.

For example, typing
"SSF" automatically expands to "SELECT TOP 100 * " and
It would greatly increase your productivity. To achieve this we will make use of the AUTO REPLACE option in TOAD. But the problem is that in TOAD free version, you cannot make new AUTO REPLACE entries. A work around is to manually edit the template file for AUTO REPLACE.

Follow the below steps:

1) Get to the Options window from menu - Tools > Options.
Tools > Options

2) In the Options Window, go to Editor > Auto-Replace.
You can see the Auto Replace options available.
But if you try to add new it wouldn't get saved.
Auto Replace Editor Window
3) Browse to the folder: "C:\Program Files (x86)\Quest Software\Toad for SQL Server Freeware 6.5\Templates\CodeTemplates".
Toad Auto-Replace template folder

4) Open the SQL template file: CodeTemplate.SQL.SqlServer.xml.
You can add your auto complete snippets here.
Ex. Line 8 and 9:
<Template Title="st100">SELECT TOP 100 * </Template>
<Template Title="nl">WITH(NOLOCK) </Template>
From the above example typing NL will get replaced automatically by WITH(NOLOCK).
CodeTemplate.SQL.SqlServer.xml file
5) Restart Toad Editor and the new changes must start to work for you.

Happy Coding.....

Thursday 12 March 2015

Visual Studio 2013 - Missing Design View - Fixed

It was surprising for me not to find the Design | Split | Source options when I was editing HTML file in my Visual Studio 2013 editor.
Design | Split | Source Pane
This is because the HTML Editor in Visual Studio doesn't support this feature. Only Web Forms Editor supports the Design View.

Now the solution to our concern is to use Web Forms Editor to edit HTML files.

How to do this?

Follow the below steps:

  1. In Solution Explorer window, Right Click the HTML file -> Select Open With...
    Select Open With... for the HTML file from Solution Explorer
  2. In the Open With window, select HTML (Web Forms) Editor, click Set as Default and click OK.
From now all your HTML files will open by default with Web Forms Editor and it will have the Design View option

Happy coding

Tuesday 3 March 2015

Text Select in Adobe Acrobat Reader XI

Just now I was trying to copy some text from a PDF file which I was viewing using Adobe Acrobat Reader XI.

It was weird that I couldn't switch from the hand tool mode to the text selection mode. I checked all the menu options and it wouldn't let me do that.
Finally I got the "hidden" option. :)

Right Click on the text and the context menu gives you option to switch between Text "Select Tool" and "Hand Tool". It was that simple and I had to look around.