Bugfree.dk – Ronnie Holm's blog

Not anti-anything, just pro-quality

Archive for September, 2006

CVS merge bit me

Posted by Ronnie Holm on 24th September 2006

I’m currently managing the merge operations for a CVS repository with a branch layout looking partly as follows:

cvs_merge.GIF

At some point in the past HEAD branched into B1, which subsequently branched into B1.1. Then development on B1 completed and it was merged back into HEAD so a release branch B2 could be created. B1.1, however, kept living its separate life for a while, because the features added aren’t to be released until with release branch B5. This also goes for the changes made to B3, so it makes sense for B1.1 to be merged into B3.

As a result, I just spend a few hours on tracking down a merge issue resulting from this merge, because a change made in B1 wasn’t present in B3 after B1.1 was merged into this branch. I finally figured out why: suppose a line is removed in B1 before the spin-off of B1.1. After that the very same line is added back in. Now when B1.1 is merged into B3, the line is removed again. There is no merge conflict at this point, because from CVS’ point of view it’s a clean merge.

It seems obvious what happened when looking at the diagram, but when you’re working with a large repository with lots of modified files and you’re merging code not written by yourself, this sort of indirect change propagation may inevitably bite you as well.

  • Share/Bookmark

Tags: ,
Posted in Uncategorized | No Comments »

Powertools from SysInternals

Posted by Ronnie Holm on 17th September 2006

I use the SysInternals tools (now acquired by the Empire). The ones I use most often are:

  • PageDefrag

    PageDefrag uses advanced techniques to provide you what commercial defragmenters cannot: the ability for you to see how fragmented your page file and Registry hives are, and to defragment them. In addition, it defragments event log files and Windows 2000/XP hibernation files [...].

    Has the ability to run at the next or every boot (that’s how it gets exclusive access to the system files). Running it every time I boot typically adds 10-20 seconds to my boot time, but I guess it depends on how often you boot, the amount of physical memory, and what kind of applications you run.

  • Contig

    Contig is a single-file defragmenter that attempts to make files contiguous on disk. It’s perfect for quickly optimizing files that are continuously becoming fragmented, or that you want to ensure are in as few fragments as possible.

    Also has a recursive switch, so you can specify C:\ as the starting point and it’ll defragment its way through your entire drive.

  • ShareEnum

    When you run ShareEnum it uses NetBIOS enumeration to scan all the computers within the domains accessible to it, showing file and print shares and their security settings.

    A worthy replacement for Network Neighborhood, although it sometimes is not able to find any shares, although I know there’s quite a few out there.

  • Autoruns

    This utility, which has the most comprehensive knowledge of auto-starting locations of any startup monitor, shows you what programs are configured to run during system boot or login, and shows you the entries in the order Windows processes them. These programs include ones in your startup folder, Run, RunOnce, and other Registry keys.

    On my computer, it takes longer for Windows to become responsive after log on than it takes Windows to boot and display the log on screen, because Windows loads a ton of software, fills up the systray, and starts various services I really don’t need.

    Services such as Remote Registry for accessing the registry across the network, Windows Image Acquisition for popping up a dialog box when I scan an image on the scanner I don’t have, or Windows Zero Configuration for managing the WLAN access I never use.

    Those services are all on by default and can be disabled using AutoRuns (or using Control panel => Administrative tools => Services).

  • Process Explorer

    The Process Explorer display consists of two sub-windows. The top window always shows a list of the currently active processes, including the names of their owning accounts, whereas the information displayed in the bottom window depends on the mode that Process Explorer is in: if it is in handle mode you’ll see the handles that the process selected in the top window has opened; if Process Explorer is in DLL mode you’ll see the DLLs and memory-mapped files that the process has loaded. Process Explorer also has a powerful search capability that will quickly show you which processes have particular handles opened or DLLs loaded.

    The quote speaks for itself.

There’s a lot more tools where these came from. Among the ones I use less frequently are FileMon and Regmon for real-time monitoring of file system and registry access, respectively. Also, I use TCPView as a more user friendly replacement for the netstat command.

Finally, take a look at dnrTV, where Scott Hanselman recently showed off some of these tools.

  • Share/Bookmark

Tags: ,
Posted in Windows | No Comments »

Query transform with MSSQL server

Posted by Ronnie Holm on 15th September 2006

Ever found yourself struggling with a big chuck of embedded SQL failing on you? Oftentimes because of a trivial, but hard to spot, syntax (or semantic) error introduced as part of your dynamic query composition process.

Typically, you’d target your frustration at the debugger and insert a breakpoint around the problematic part of your code to extract the SQL and copy it into the Query Analyzer for investigation.

Unfortunately, pasting the SQL into Query Analyzer causes the statement to appear on one line entirely. You then find yourself inserting new line characters for readability and for making the error message more precise.

Transforming SQL this way is tedious, boring, and crying for automation. Fortunately, Enterprise Manager responds well to these cries. Just drill down to a table view of your database, right click on a table, and select “Open table” followed by “Query”.

Now paste your extracted SQL into the text portion of the Query by Example window and hit “Run”. Although the query might not actually execute, it’s transformed into a more readable one.

Obviously, you could start and stay in the QBE window. Personally, though, I dislike QBE as a working environtment beyond for layout beautification, so I usually copy the transformed query into Query Analyzer.

By the way, the transform also comes in handy if you want to make sure your query doesn’t contain any camouflaged expensive joins, e.g., for a query with inner joins done using where clauses, QBE transforms it into explicit inner joins.

  • Share/Bookmark

Tags: ,
Posted in Windows | No Comments »

Windows Vista RC1 rocks

Posted by Ronnie Holm on 12th September 2006

I’ve been playing around with different setups of Windows Vista RC1 the last couple of days. Just getting Vista to install was an challenge in itself as RC1 refuses to install on VMWare Workstation.

It stalls at “Windows is loading files …”. Apparently the subsequent switch into graphics mode causes Vista to hang, because Vista all the sudden doesn’t properly support the emulated video hardware of VMWare.

That’s odd, because I previously installed Beta 2 on VMWare without any sign of trouble (could it be that MS wants people to try out RC1 on their free Virtual PC? By the way, VMWare Server is free too).

Luckily, Joel on Software provides a solution to the VMWare issue, by adding

    svga.maxWidth = "640"
    svga.maxHeight = "480"

to the configuration file for your virtual machine prior to booting the Vista DVD. It’ll force the installer to run in SVGA mode. Then when the installation is complete and you’ve installed the VMWare tools, remove the above lines and Vista shines.

My intention was to run Vista in VMWare on a secondary computer and connect to it via Remote Desktop. For some yet to be uncovered reason, however, I wasn’t able to connect from my WinXP machine. Perhaps the host OS blocked the incoming request or perhaps Vista just wasn’t properly configured.

Anyway, I decided to run Vista on the bare hardware instead, so I fired up PartitionMagic. Unfortunately some guy accidentally cut power while PartitionMagic was doing its shrink-existing-partition-to-create-space-for-an-additional-one magic. After that the existing OS chickened out and bluescreened on me, so out everything went and in Vista came.

Thus, now I utilize a two-monitor setup, running Vista on a native 2.6GHz processor with 2GB of memory on one monitor and WinXP on the other. Unfortunately, the Vista machine has a crappy video card, so no fancy, transparent UI for me (unless I find a workaround).

As a final note, I’m using Synergy to seamlessly share one mouse and keyboard between the physical machines as if it was one machine with dual head video output.

Way cool!

  • Share/Bookmark

Tags: ,
Posted in Windows | No Comments »

70-536: MCTS, part 1 of 2

Posted by Ronnie Holm on 9th September 2006

Just received my copy of the Microsoft .Net Framework 2.0, Application Development Foundation book.

This book is essential in preparing for the 70-536 certification exam. It’s the first of two exams one has to pass to become a MCTS (Microsoft Certified Technology Specialist), specializing in either web or Windows application development.

I’d rather have used Amit Kalanis book, but its shipping date just continues to get pushed.

  • Share/Bookmark

Tags:
Posted in .Net | No Comments »

How to break Notepad

Posted by Ronnie Holm on 2nd September 2006

Do the following:

  • Open Notepad
  • Type in “this app can break” (without the quotes)
  • Save file
  • Close Notepad
  • Re-open saved file in Notepad

Now Notepad displays funny looking foreign characters.

This is caused by a “bug” in the Win32 function IsTextUnicode, which Notepad calls to heuristically determine if a file is Unicode encoded.

For more in-depth info click here.

  • Share/Bookmark

Tags:
Posted in Windows | No Comments »