8 Favorite Developer Tips & Tricks

by Kyle Ballard 11/9/2008 6:02:15 PM

I've been keeping a running collection of tips/tricks that I felt made my life easier as a developer.  I hope this collection has you feeling the same way.  Feel free to post a comment at the bottom if there are others you found useful as well.

 

1.  Visual Studio.  Conditional breakpoints.  Have you ever right clicked a breakpoint when developing in visual studio?  If you have then you would know there are a slew of break options.  You can break when a certain 'Condition' is met (i.e. x = 5), when a certain hit count is reached (i.e. after 5 hits).  This should speed up your debugging.

Breakpoint 

 

2.  Visual Studio.  If you want to comment or un-comment an entire block of code inside visual studio.  Highlight the block of code and select <Ctrl>+<K> and then <Ctrl>+<C> ... if you wish to un-comment a block, then use <Ctrl>+<K> and then <Ctrl>+U.  This works in both Visual Studio as well as SQL Management Studio.

 

3.  Visual Source Safe. When in Visual Source Safe you may use the keyboard shortcut <Ctrl>+<S> to see all files currently checked out, globally, or to a specific user.  Additionally you can search within only the current project, or the entire VSS database.

 

4.  Visual Studio. If you want to see a history of all edits to your file when you are in Visual Studio, you may right click the file in Solution Explorer and select "View History".

 

5.  Javascript.  When including a script file on a site with an SSL certificate, use the html markup <script src=”//www.company.com/scripts/file.js”> approach for preventing the security ('This page contains secure and non-secure items) dialog pop-up.  Notice that the http: portion is gone, but it will render properly regardless of the current protocol.

 

6.  Javascript.  In addition to #3, if you would like to obtain the current protocol which is in use in your Javascript, you may obtain that by issuing the following command:

var prefix = window.parent.document.location.protocol + '//';

 

7.  Javascript.  If you wish to get the object which caused the asynchronous postback on an asp.net ajax enabled page.  You may use the following code:

var ClientId; 
var prm = Sys.WebForms.PageRequestManager.getInstance(); 
prm.add_InitializeRequest(InitHandler); 

function InitHandler(sender, args) { 
  ClientId = args.get_postBackElement().id; 
  alert(ClientId); 
}

 

8.  SQL.  If you need to remove a set of duplicate records, try using the following statements.

SELECT MyDuplicateColumn, MyDuplicateColumn2, Count(*) - 1 As NumToDelete FROM MyTableWithDuplicates GROUP BY MyDuplicateColumn, MyDuplicateColumn2 HAVING COUNT(*) > 1 


Then while looping through the records in the above recordset, issue the following command:

DELETE TOP (NumToDelete) FROM MyTableWithDuplicates WHERE MyDuplicateColumn = 'MyDupeValueFromPreviousQuery' AND MyDuplicateColumn2 = 'MyDupeValueFromPrevousQuery2'
 

kick it on DotNetKicks.com

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Related posts

Comments

1/7/2009 7:06:52 PM

Good tips! Thanks.

Joe us

3/16/2009 5:49:08 AM

Great tips thanks for sharing..

Hectic Capiznon Bloggers 2009 us

Add comment


 

  Country flag





Live preview

7/4/2009 5:02:52 AM

Powered by BlogEngine.NET 1.2.0.0
Theme by Mads Kristensen

About the author

My lovely wife and I at a wedding I am a web developer living in the Chicagoland area. I mainly focus on developing e-commerce applications and work with asp.net on a regular basis.


Send mail Facebook Twitter LinkedIn

Calendar

<<  July 2009  >>
MoTuWeThFrSaSu
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

View posts in large calendar

Recent comments

Categories


    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2009

    Sign in