in

ASP.NET Weblogs

MindFill - Brian Carroll's Blog

Do While (WhatYouKnow) < (WhatYouKnow + 1)
  • Reading poorly formatted .NET code - made easy!

    I downloaded a .NET app the other day and wondered how the author was accomplishing one piece of it.  He had made the source code available for download, so I downloaded it and started digging in.  But it didn't take me long to realize the the author had no style whatsoever - the code was a mess!

    While I was reformatting the code to make it readable, I had a thought - it might be faster to use Lutz Roeder's .NET Reflector to disassemble the exe and then read the generated code.  I tried it and within a few minutes I had found what I was looking for.

    What an awesome tool!

  • Coder To Developer - Rave or Rage?

    I picked up a copy of Mike Gunderloy's Coder To Developer book the other day and did something I rarely do with a technical book - I read it from cover to cover. 

     

    I've read several reviews of the book and find that they range from rave to rage.  The typical "rage" review argues that the book is .NET-centric and has a short shelf life.  Personally, I think both of these points are what make me "rave" about the book.  

     

    The book is definitely .NET-centric.  Since I'm also .NET-centric, this is exactly what I wanted - a book that covers what is relevant to my job.  A quick scan of the book makes this clear, so no one should be surprised.

     

    As many other reviewers keenly point out, the book discusses a lot of tools and trends that are current today that may not be relevant next year.  Well, guess what - I'm writing software today!  And the better I understand the tools at my disposal today, the better I'll be able to write software that will be used tomorrow.  Sure, when I pickup this book in a couple of years the discussion of FogBUGZ may be outdated, but the concept of tracking bugs will be the same. 

     

    Mike did an awesome job with this book.  He covered concepts that are not only relevant for today's .NET developers, but will be relevant for years to come.  He also introduced his readers to the tools available to us today that will help us develop better software for tomorrow.

  • How to determine when Windows started

    Note to self (and anyone else interested)...

    To determine when a Windows system was started, issue the following command from a command prompt:

    net statistics server

     

     

  • SR2Fav - Utility to add SharpReader locked items to your IE Favorites

    Although SharpReader doesn't have a lot of fancy bells and whistles, I keep coming back to it after trying the “latest and greatest“ aggregators.

    Like most people, I don't have time to read everything that I subscribe to, so I tend to read the headinlines and only drill into the entries that sound interesting.  I may want to refer back to some entries later, so I lock those and delete the rest.  Last night I was thinking it would be nice if I could add all of my locked items to my favorites list in IE.  Well, that sounded like fun, so I have put together this little utility that reads my SharpReader cache, creates a SharpReader folder in my IE favorites list, creates subfolders for each of my subscriptions, and then creates a favorite for each locked item. 

    I've provided a link to it here, so feel free to give it a test drive if you would like.

    If you have any questions I'll be glad to answer them if I can. 

    Again, I wrote this for myself, so the assumptions I was working under are:
    Windows XP w/IE 6
    SharpReader v0.9.4.1

    There are no guarantees that it will work with your configuration, but I'll be glad to work with you in an attempt to resolve any issues.

  • Deleting an NTFS Partition from DOS

    If you ever need to delete an NTFS partition from DOS, the Windows NT 3.1 Resource Kit has the solution.  Download the kit, extract the DELPART.EXE utility to a DOS boot disk, boot from the disk and then run the utility.  It's self-explanatory from there.

    I wonder why this utility is no longer in the Resource Kits?

    Note:  I kept getting a “Page Not Found” error while trying to download the resource kit, but it eventually worked.

    Posted Jun 25 2004, 03:53 PM by bkcarroll with 1 comment(s)
    Filed under:
  • Parentheses and Order of Operations

    It's a good idea to be explicit with parentheses when building arithmetic expressions.  For example, at first the following code doesn't look like it would cause a problem:

    Dim i As Integer = 1
    i = i + i - i
    Console.Writeline(i)

    Executing this code will return 1 as you should expect.  But consider what happens in this case:

    Dim i As Integer = i.MaxValue
    i = i + i - i
    Console.Writeline(i)

    This code ends with an overflow error which could have been prevented by simply using parentheses like this:

    i = i + (i - i)

  • Should programmers be able to convert from decimal to binary?

    When I'm interviewing candidates for a development position I typically write a number down and ask them to convert it from decimal to binary.  Of course this is a very minor factor in the interview, but I find it interesting to see their responses.  It amazes that onle one person out of the last twenty five or thirty candidates I've interviewed has been able to convert from decimal 45 to binary 00101101.  (He also proudly did the hex conversion to 2D without missing a beat.)  Most of these candidates have CS degrees and 5+ years of experience, but from the looks on their faces when asked this question, they either never learned or have forgotten one of the most fundamental concepts of computing. 

    Not only is it fundamental, it's also a simple concept.  My 9 and 10 year old sons can do these conversions.  They can do all combinations of decimal/binary/hex conversions.  They think the binary system is the coolest because they can count to 1024 on their fingers.  Thankfully I waited until after they were 4 to teach them.  I could see it now...“Hi Sweetie....how old are you?“ and them showing a binary 4 on their fingers!

    So, would the developers you work with be able to do these conversions (without a calculator) or would they go completely blank like my job candidates have been doing lately?

  • Virtual Desktop Manager

    I've been tinkering with Linux lately and one of my favorite KDE features is the desktop switcher.  Tonight I found Virtual Desktop Manager, a Microsoft PowerToy that does basically the same thing.  It looks promising so far.

    Update:  This thing was really flaky until I upgraded my RAM to 1GB.  As Girish pointed out, it would freeze under low memory conditions.  Also, one of my biggest gripes is that if I have VS.NET maximized on desktop #1, switch to a different desktop, and then come back to desktop #1, VS.NET will no longer be maximized.  Nothing major...just a pain in the butt.

  • Book Gripe

    While reading chapter 4 of the MSPress “Inside Microsoft Visual Studio.NET“ book, I ran across this paragraph:

    By right-clicking on a macro in Macro Explorer, you can bring up a shortcut menu that lets you work with the macro directly.  The Run command executes the Tools.Run command on the currently selected macro.  The Rename command allows you to edit the name of the macro in place.  The change you make to the name is reflected in the method name in the Macros IDE.  The Delete command deletes the currently selected macro.  And finally, the Edit command opens the current macro in the Macros IDE.”

    Now come on...who is the intended audience for this book?  I've never written a book, but I have taught several Microsoft developer classes and appreciate the difficulty of gearing content to a wide range of skill levels at one time.  But is it really necessary to go to such a low common denominator?  Surely anyone reading this book knows how to use a GUI and will understand that the delete command will delete the currently selected item. 

    Nevertheless, I've skipped all around this book getting the pieces I need and other than these types of annoyances, it's a very informative book.

  • Be careful using a datetime column as part of a primary key

    For no appartent reason an app that had worked fine for two years all of a sudden started failing with primary key violoations.  Of course I had “optimized“ it shortly before it started failing, but  I didn't see how my changes could have caused this problem.  I only removed a few lines of code and didn't change anything related to data access.  My change was intended to make the code run faster, but nothing else. 

    Well, my changes sped it up and that's exactly what was wrong.  Because it was running faster, data was being written to the database more often.  One of the fields being written was “LastUpdate“ which was defined as datetime data type and was part of the primary key. 

    The datetime data type in SQL Server is only accurate to one three-hundredth of a second, so although the app may have been passing two different values to SQL server for consecutive records, the values were being rounded which was causing the primary key violation. 

    For example, assume I pass these values to a stored procedure:
    2004-05-13 13:12:19.393
    2004-05-13 13:12:19.394
    2004-05-13 13:12:19.395
    2004-05-13 13:12:19.396
    2004-05-13 13:12:19.397

    SQL Server rounds them to this:
    2004-05-13 13:12:19.393
    2004-05-13 13:12:19.393
    2004-05-13 13:12:19.397
    2004-05-13 13:12:19.397
    2004-05-13 13:12:19.397

    It's easy to see how this was causing my problem.  SQL Server always rounds to .000, .003, or .007 milliseconds.

    I found no reason to have the LastUpdate field as part of the primary key, so I removed it and all worked well.  Another lesson learned!

More Posts Next page »