Skip to content
Archive of posts filed under the C# category.

A Keyword I’d Like To See in C#

Although I use C# more and more these days, I still consider myself primarily a C++ developer. C# has a few really neat language features that are just now being added to C++ (like lambdas), but I still find C++ to be more expressive, with terser syntax, than C#.

One example of this is deterministic disposal in C#. For classes that implement IDispose this is accomplished with the using statement. One example from MSDN follows:

using (Font font1 = new Font("Arial", 10.0f))
{
    byte charset = font1.GdiCharSet;
}

Seems simple enough, right? What could I possibly have to complain about in that code?

Continue reading ‘A Keyword I’d Like To See in C#’ »

Share

Update on Ripsaw

A while back I started an article series on a utility named Ripsaw. I have since gotten pretty busy with other projects, and the only extracurricular thing I’ve worked on in the meantime is the lesson series on how to play “Spanish Fly”. I was also waiting for Visual Studio 2010 to hit release, but I haven’t moved up to Professional yet, so I may actually drop the whole project back down to VS 2008 when I start it up again.

On top of all that, Blogger is yanking the rug out from under me with some changes to how it updates certain sites, and I want to get that resolved before I add any significant new content. I just wanted to let everyone know that the project isn’t dead; in fact, there have been several times over the last few weeks when I’ve needed a utility like Ripsaw, so this is definitely going to get done eventually.

Share

Ripsaw Library Implementation

In this installment of the Ripsaw article series we’ll start putting some actual code into an implementation of the COM interfaces that we specified in the last article. For those of you who just joined the series, Ripsaw is a log viewer for Windows, similar to the Unix tail utility. This series of articles details my rewrite of the application from the ground up.
Continue reading ‘Ripsaw Library Implementation’ »

Share

Ripsaw COM Interface, First Pass

In this installment of the Ripsaw article series we’ll finally get to write some code. We’ve already gotten a pretty good idea about how we want to implement the core Ripsaw library, so now we’re going to define enough of the COM interface that we can create a simple test script that will eventually be used to exercise the library.

Continue reading ‘Ripsaw COM Interface, First Pass’ »

Share

Refining Ripsaw’s Design

In my last entry in the Ripsaw article series, I discussed some of the design goals for Ripsaw. In this article I’ll flesh out the design a little more and discuss specific implementation possibilities.

To bring you up to speed, Ripsaw is a log-viewing utility for Windows that I initially wrote about six years ago, but never released widely. I’ve decided to rewrite it and discuss each step of the rewrite here.
Continue reading ‘Refining Ripsaw’s Design’ »

Share

Design Goals for Ripsaw

In this installment of the Ripsaw project series I’ll sketch out some of my design goals for the new version of Ripsaw, and the rationale for those goals.
Continue reading ‘Design Goals for Ripsaw’ »

Share

A New Article Series: Ripsaw

Several years ago I wrote a Windows application called “Ripsaw” that implemented the basic functionality of the Unix tail utility in a graphical application, with a few twists of my own. I had intended to release the application as an open-source project, and although I still use the tool quite a bit I never got around to giving it the necessary polish for a public release. I’ve only shared it with a few friends and co-workers.

I’ve just downloaded Beta 2 of Microsoft Visual Studio 2010, and I’ve decided to create a new version of Ripsaw from the ground up so that I can become familiar with the new IDE and compiler. Besides being a chance to finally get Ripsaw right, this will also be an opportunity to create a series of articles on how I develop a complete application, from the first ideas through design, implementation, testing, and release. I’ll walk you through all of the design decisions and trade-offs, the problems I run into along the way, and the development methodologies I use.

I would really appreciate your feedback, ideas, suggestions, and criticisms. This is going to be fun!

Share

An API is Forever

An API is an interface. Those of you that have worked with COM already know that once an interface is published, it can never, ever change. Ever. Not until the end of time. The reason is that some bit of code somewhere is going to be using that interface, and if you change it you’ve just broken that code. Of course, not changing an interface also means not deleting a portion of it.

Continue reading ‘An API is Forever’ »

Share

Pre-emptive Snarkiness

It’s all about the sense of humor, people. First of all, read the “pre-emptive snarky comment” that I wrote in the earlier entry about the dragsens utility. It’s pretty clear that, first of all, I’m tipping my hat to Raymond Chen by even adding a pre-emptive snarky comment. Second, it should also be clear that I’m mentioning the size only because I’m trying to head off any snarky comments about it. Alas, that just doesn’t stop some people.

In my first comment to Raymond’s article I mentioned that it took me only eleven minutes to write the utility. That was the entire point of the exercise, really. If the utility happens to be useful as well, that’s fantastic. In fact, the reason that I bothered to take an extra 30 seconds and link in the C runtime was to make it easier to use. Just copy it to your favorite USB drive, and off you go. If you don’t have 84KB free on your drive for the ZIP file, then that’s still okay. You can download the source and VS project and build it any way you like. Not a problem.

So, despite the fact that I clearly stated that I was aware that I could make the utility very tiny if I wanted to take the time to do so (when I said, “Of course you could. So could I.”), someone still didn’t get it. I guess quoting me out of context, or perhaps even putting words in my mouth, is more fun.

If I wanted to make it smaller, perhaps I could dispense with the CRT altogether. Perhaps I could write it in assembly language. Who knows. It doesn’t matter. I just wasn’t inclined to take any more time gold-plating what I regarded as a very simple exercise. The utility does what it is supposed to do, with a very tiny investment in programming time. That’s all I was out to prove. I made the source freely available, with no strings, in case anyone wanted to tweak it to handle some situation that I didn’t think about, or perhaps wanted a different implementation (like setting the width and height separately).

As Raymond might say, I can’t believe I had to write that.

Share

Windows Drag Sensitivity Utility

Inspired by an article by Raymond Chen about how to correctly change the Windows mouse drag sensitivity, I wrote a quick utility called dragsens. It’s a small command-line utility that will allow you to change the number of pixels the mouse has to travel before a drag operation is initiated. Just download and unzip the utility, then run it at the command line, supplying a single parameter that is the number of pixels for the mouse to travel.

If you’d like modify the utility, or examine its source, you may download the Visual Studio 2008 project. If you just want the utility itself, you may download a ZIP of the executable.
Continue reading ‘Windows Drag Sensitivity Utility’ »

Share