Archives / 2007
  • I Love the File/Directory Classes in .NET!

    I just had a situation where a potential client gave me a zip file of about 200 files. They wanted us to give them an estimate on how long it would take us to recreate each screen in ASP.NET 2.0. I did not relish the thought of typing in all those file names into an Excel spreadsheet so I could assign hours to each one. So I wrote a simple little utility to grab each file in the folder, and add that file name to a StringBuilder object. I separated each file name with a CRLF. Once I had all of the files in the StringBuilder object, I simply copied the text to the Clipboard. Then I opened up Excel and pasted the contents of the Clipboard into an Excel column. Bingo! I now had all those file names into Excel, ready for me to assign hours to!

  • Code Audits: Not just for beginners!

    When is the last time you had one of your peers or an external consultant evaluate your coding? If you have not done this in awhile, you should seriously consider it. While I am sure you are a great programmer, different people have other ideas as well. In the IT business, it is all about learning. If you are not sharing ideas, or talking with others about your coding, then you are probably not learning as much as you could.

  • Finding Machine.Config

    OK, this is just a quick little tip. I need to be able to programmatically locate the Machine.Config file. Instead of hard-coding the path where I know it is, I used the new ConfigurationManager class in .NET 2.0 to perform this. Here is the code.

  • Are you still writing Add/Edit/Delete code?

    Recently one of my programmers came to me after having visited with a PDSA client. He told me one of the programmers at this client was creating a new .NET application and had about 5 add, edit, delete screens created. He had spent, on average, about 7 hours creating, testing, debugging and tweaking the code on each screen. He wrote a little over 200 lines of code for each screen and at least 5 stored procedures for each screen as well. Even though he was able to copy and paste a lot of the code from one screen to another, he still had to fully debug and regression test all the add, edit and delete routines on each screen. This was in addition to the business rule logic that he had to test.

  • Check out DNR TV!

    Last month I recorded an episode of DNR TV on creating custom providers. Carl and I go through a lot of code showing how to create your own custom providers. Enjoy!

  • Not Estimating and Tracking your Projects? Expect Failure

    Estimating software development projects is one of the hardest things to do. First, programmers just don’t like doing it. And why should they? They are usually incorrect and may feel the heat when their estimates slip. Secondly, most programmers just don’t have a method or process by which to develop an estimate. I will lay out some simple steps to follow to help you on your way to actually “loving” to provide estimates. Yes, loving it. Because if you can be right most of the time, wouldn’t you love it too? If you come up with a process for estimating, you will be on your way to being right a large percentage of the time!

  • Use Close and Finally

    In the last 2 weeks I have had two different clients complain that there are "memory leaks" in .NET. I tell them very politely, that most likely it is their code!<g> In both cases it was their code. The first case had to do with the programmers using a DataReader and not closing them when they were done with them, or they put the Close() method call within their Try block and not in a Finally. The second case involved the StreamWriter in the File.IO namespace where once again the file was not always being closed correctly due to the programmer not putting the close in the Finally block. Below is what the original code looked like: 

  • Beware of Encoding Types when saving to a File

    I learned something today... I was doing some Encryption of strings using DPAPI and converting them to a Base64 string and everything worked fine when I was encrypting and decrypting. However, when I saved the Base64 string to a file, then re-read the data and tried to decrypt the data, it would not work. It took me quite awhile to figure out what was going on.

  • Wrap it up!

    In our daily programming with .NET, we often find new things to use. In some cases Microsoft tells us there is something new to use. Take the case of moving from .NET 1.1 to .NET 2.0. Remember in .NET 1.1 how you used the ConfigurationSettings.AppSettings("MyValue")  to retrieve values from your .Config files? Then when .NET 2.0 came out and you attempted to upgrade your project, now all those lines of code were marked as Obsolete and a bunch of warnings were generated in your project.

  • dnrTV

    On Wednesday, January 3rd, I got together with Carl Franklin and filmed an episode for his Dot Net Rocks TV ( This episode is on, what else, creating your own custom providers. In this show I walk you through creating providers from the ground up. Carl informs me that this episode should air around the first week of February.

  • The Provider Model Rocks!

    In the last few weeks I have started on a new endeavor. I am rewriting my PDSA Framework from the ground up. I figured that it is time to once again take everything I have learned over the last few years of working with .NET and re-architect things a little better.

Past Blog Content

Blog Archive