Posts

Showing posts from 2014

Popular Visual studio add-ons/plugins

SQL Prompt   for Database Projects (works inside your SQL Management Studio as well) SmartPaster   - (FREE) Copy/Paste code generator for strings   AnkhSvn  - (FREE) SVN Source Control Integration for VS.NET VisualSVN Server   - (FREE) Source Control ReSharper  - IDE enhancement that helps with refactoring and productivity CodeRush  - Code gen macros on steroids Refactor  - Code refactoring aid CodeSmith  - Code Generator PowerCommands  is a Microsoft-created plugin that offers a variety of new features that one would think probably should have been in Visual Studio in the first place. GhostDoc  - (FREE) Simple code commenting tool DXCore  (FREE) and its many awesome plugins:  DxCore Community Plugins ,  CR_Documentor , CodeStyleEnforcer ,  RedGreen TestDriven.Net  - (FREE/PAY) Unit Testing Aid Reflector  - (PAY) Feature rich .Net Disassembler  Reflector AddIn's Web...

SQL Server 2008 MERGE statement

One Statement for INSERT, UPDATE, DELETE In earlier versions of SQL Server we had to write separate statements for Insert,update and Delete based on certain conditions but now, using MERGE statement we can include the logic of such data modifications in one statement that even checks when the data is matched then just update it and when unmatched then insert it. One of the most important advantage of MERGE statement is all the data is read and processed only once. In previous versions three different statement has to be written to process three different activity (INSERT, UPDATE or DELETE), however using MERGE statement all update activity can be done in one pass of database table. This is quite an improvement in performance of database query. Syntax of MERGE statement is as following: MERGE [ TOP ( expression ) [ PERCENT ] ] [ INTO ] target_table [ WITH ( ) ] [ [ AS ] table_alias] USING ON [ WHEN MATCHED [ AND ] THEN ] [ WHEN NOT MATCHED [ BY TARGET...

Facebook, Twitter and Google Plus shortcuts keys

Facebook Facebook shortcut keys are based on browser. Shortcuts for Facebook will vary from browser to browser. In Firefox, you will need to add a Shift key before the key combinations given below, whereas in Internet Explorer, you need to hit Enter after the combination. Same goes for a Mac, except that for Firefox, you need to press Ctrl instead of Shift. Rest of the keys should be same. Facebook key combinations Key     Function Alt + M Compose new message Alt + /    Main site search Alt + 1   Go to home page Alt + 2   Go to Timeline Alt + 3   See friends requests Alt + 4   Go to message inbox Alt + 5   See all notifications Alt + 6   Go to Account Settings Alt + 7   Go to Privacy Settings Alt + 8   Go to Facebook's Profile Page Alt + 9   Go to Facebook's Terms of Service Alt + 0   Go to Facebook Help Center Twitte...

IPL 2014 live streaming

Watch your favorite teams playing.... Just put the below code in your blog or website   

App_Offline.htm feature in ASP.NET 2.0

Image
"App_Offline.htm" feature in ASP.NET 2.0 provides a super convenient way to bring down an ASP.NET application while you make changes to it (for example: updating a lot of content or making big changes to the site where you want to ensure that no users are accessing the application until all changes are done). This is very handy when we do deployments manually. This allows you to remove the locks from those files and replace them, without the need to do a full IISRESET, taking down other sites on the server How this is implemented? We just need to put App_Offline.htmfile in root directory of web application and the ASP.NET runtime will detect the existence of  App_Offline.htm, if it exists, then the ASP.NET runtime will shut-down the application, unload the application domain from the server, and stop processing any new incoming requests for that application. When all Web site files have been copied, you can delete the App_offline.htm. Once remo...

Parallel programming in c# 4.0

In our daily programming routine we use thread mechanism to parallelize your code to distribute work across multiple processors .  To take advantage of the hardware of today and tomorrow Visual Studio 2010 and the .NET Framework 4 enhance support for parallel programming by providing a new runtime, new class library types, and new diagnostic tools. Let’s start with a simple concept in parallel programming. Data Parallelism (Task Parallel Library) Data Parallelism describes how to create parallel for and foreach loops. In this article we will look into simple for loop in parallel programming world. In this application I wrote a simple method to calculate the Root of a given number. Let’s look into the executing time of for and Parallel.For loop methods. The below code took me 16 seconds to execute. I am using 2.8-Ghz dual core 64 bit processor with 4 GB of RAM. for (int i = 2; i < 20; i++) { var result = SumRootN(i); ...

Decorating code snippets in blogger

Follow the below steps to highlight you content (code) in blogger posts. Step 1: Go to Blogger Dashboard -> Template ->Edit Html Paste the below code into your Blogger Template inside the <head>   </head> tag Step2: Use the <pre> tag to highlight your code snippet Example: <pre  class = "brush: csharp" > RequestToken GetRequesttoken()         {             var requestToken = (RequestToken)Session["RequestToken"];             Session.Remove("RequestToken");             return requestToken;         } </pre>  output looks like: RequestToken GetRequesttoken() { var requestToken = (RequestToken)Session["RequestToken"]; Session.Remove("RequestToken"); return requestToken; }

Google Authentication with ASP.Net

Image
Code download available at the bottom of the post In this post i would like to share my experience with  Google Authentication with Asp.net membership (Forms Authentication) High level google authentication work flow with ASP.NET membership 1.              Your application requests access and gets an unauthorized request token from Google's authorization server. 2.              Google asks the user to grant you access to the required data. 3.              Your application gets an authorized request token from the authorization server. 4.              You exchange the authorized request token for an access token. 5.              You use the access token to requ...

HTML5 Geolocation

Image
Code download available at the bottom of the post In this tutorial we will use Jquery,Goople Api and HTML5 to capture geolocation Browser used:Google Chrome Step 1: Include the Jquery and Goople maps API as shown below     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" type="text/javascript"></script>     <script src="http://maps.google.com/maps/api/js?sensor=true"></script> Step 2: Add a place holder for the Map <div id="map"> </div> Using HTML5 feature we will display the latitude and longitude, so add placeholders for latitude and longitude.  <div id="lat"></div> <div id="long"></div> Step 3:   Start writing code to capture the Geolocation <script> //using navigator (Html 5 feature) to get the Geolocation x = navigator.geolocation; x.getCurrentPosition(sucess,failure); 'getCurrentPosition' m...

How to find a column reference in a given database schema

Image
Run the below query SELECT T.NAME AS TABLE_NAME,SCHEMA_NAME(SCHEMA_ID) AS SCHEMA_NAME,C.NAME AS COLUMN_NAME FROM SYS.TABLES AS T INNER JOIN SYS.COLUMNS C ON T.OBJECT_ID = C.OBJECT_ID WHERE C.NAME LIKE '%User%' ORDER BY SCHEMA_NAME, TABLE_NAME; Output:

Change default browser in visual studio

Image
Step 1: R ight-click on an ASPX page within a Web Project and click "Browse With..." Step 2:  From this dialog you can click Set Default Step 3: You  can add other browsers, like Google Chrome to this dialog via Add

Jquery not working

Image
6 steps to take if your jQuery is not working 1. The file is not there or does not exist People tend to become upset and/or frustrated (Including me) when something simple doesn’t work, such as  jQuery not working . Before you do anything, navigate to your jQuery file and check that it is exactly where it should be. Also make sure that you have the correct html file open – I have actually tried to load files using the incorrect html, so the path would have been correct if I had the correct html file open. Don’t ever be too proud to check the absolute basics. 2. Incorrect File Path This is a common problem and it is the first thing I check when I’m having a javascript problem (I actually do step 1 and 2 with my style.css as well). After checking that the file path is correct, I double check by viewing the page source using Firefox, I then click on the .js link. If it opens up the jQuery file (Double check it is opening the correct file) then the destination is correct. I...

Difference between HTTP Post and HTTP Get

In an HTTP GET request, key/value pairs are specified in the URL:   http://Aditya/PageName? value1=foo&value2=bar   In an HTTP POST request, key/value pairs are sent as part of the HTTP request after the headers. For example:    POST /something HTTP/1.1    Host: server    Content-Length: 21    Content-Type: application/x-www-form- urlencoded   It's hard to really describe one as being more or less secure than the other, but HTTP POST data is not visible in the URL, and when submitting data to a website, an HTTP POST can usually only be performed as a result of user interaction (for example clicking on a "Submit" button).   This means a user can't be tricked into visiting a URL like  http://Aditya/update_profile? name=I_ Test  and sensitive data is not exposed in the URL.   You can also use nonces and other anti-forgery tokens with html forms (which use POST) to prevent other forms of cross-sit...

Break points in SQL Server

Image
TOGGLE A  BREAK  POINT ◦ Press F9 . To   open  the breakpoints window ◦ Press CTRL + ALT_B To RUN the query/execute the store procedure ◦ Press ALT + F5 Sample break point example below: Move from one break point to another: Right click on the query window and select ‘Run To Cursor’