Tuesday, December 22, 2009

Tabs or Spaces

Some programmers have strong opinions about whether to use tabs or spaces to indent code.
This is what I use. In Visual Studio 2017 choose
Tools\Options\Text Editor\All Languages\Tabs
Select Smart Indenting
Tab size and Indent size = 4
Select "Insert spaces"

If you use Shift+Tab when in front of 4 spaces, it will delete the 4 spaces the same as if you press backspace in front of a tab character.
To convert a file one way or another there is "Tabify Selected Lines" and "Untabify Selected Lines" under the Edit\Advanced menu.

View White Space

Use the following Menu in Visual Studio to view the white space characters
Edit->Advanced->View White Space
This allows you to see whether the white space is tabs or spaces.

For me these characters are too prominent. So I dim them by choosing
Tools->Options->
Environment->Fonts and Colors
Select "Visible White Space" from the Display Items.
Select Silver. Then Click the Custom Button and use the darkness scale to choose the right amount of darkness.

In Beyond Compare you can select the following from the View menu:
Show White Space
Ignore Unimportant Differences

They are useful when dealing with differences in white space.

Wednesday, December 16, 2009

Tech Support Cheat Sheet

From xkcd, here is one great secret to computer tech support. Click on the picture to enlarge the flowchart.



I have written out some of the diagram so I can more easily find this post when I need it.
Google the name of the program plus a few words related to what you want to do. Follow any instructions.

Thursday, November 19, 2009

Covariance and Contravariance

My colleague directed me to some programming terms, covariance and contravariance.

Eric Lippert describes them quite well.

Wednesday, November 04, 2009

Reporting Services 2008 Custom Security

In MS SQL Server Reporting Services 2008 there is no longer an easy way to allow for anonymous access. I followed the steps here to get a custom security implemented. I modified it further to integrate with our existing security model.

You could also modify it to achieve anonymous access to your report server

Friday, October 23, 2009

Exception-Driven Development

One of the first things I like doing when coding is ensuring a stable error logging and notification system. I like to know about problems as soon as or sooner than my customers. And detailed logging really helps in reproducing and fixing the bug. Jeff Atwood calls this exception-driven development.

Today I found ELMAH. In a little more than an hour I implemented it in a ASP.NET app that did not have any exception handling implemented. It logs, emails and has a error log viewer. The screencast made this so easy.

Thursday, October 22, 2009

Keeping my Monster Mash

My wife used JibJab to create monster mashups of our family. I wanted to make sure we could keep the videos. I used CamStudio to capture the video and audio into avi files. I used MediaCoder to convert the avi to mp4 so I don't have to keep the very large avi files.