Programming
Thoughts on how a hobbyist programmer approaches the .NET framework.
After my previous post on truncating a .NET String at the end of a word, I thought that the simpler problem of just truncating a string to a specific length, while retaining all the rest of the code’s features, would have been obvious, but I got a couple of email requests. So here it is. /// <summary> /// Truncate a string to the specified length. /// </summary> /// <param name="value">The input string.</param> /// <param name="length">The maximum length of the returned...
I recently worked with a friend on a small C# teaching project. We started with the premise of writing a String Truncate function for .NET 3.5 SP 1. At its simplest, this is trivial to create. public String Truncate(String input, int length) { return input.Substring(0, length); } After a review of the weaknesses of this implementation, we went in search of a more meaningful challenge. We expanded on this first effort with a few additional requirements: Input validation Do not truncate in the middle...
I am working on my first significant WPF application and found myself in need of a simple visual color picker. I quick trip to Bing linked me to a Sacha Barber CodeProject project that met most of my requirements. His associated blog post is here. My biggest unfilled need was the ability to set the initial color, so I set about adding that to the original code. I made a few changes along the way. The revised code can be downloaded here. I made the following changes to the ColorPicker control: Set...
Wow. Five years of posts. Of course, the last eight months have been pretty empty, but I am starting a new WPF project at work that looks to be very interesting. I hope to get back into the posting routine as the work evolves. We are working on the design right now. More to follow on that. I may also be posting on management of a distributed software development team
Reminder: All posts in this series can be found here. The Toolbox and the DesignSurface work together to allow a developer to add new components and controls to the design surface. There are two interfaces that implement this functionality: IToolboxService and IToolboxUser. IToolboxService defines an interface that provides methods and properties to manage and query the Toolbox capabilities in a development environment. All forms designer systems must implement the IToolboxService in their Toolbox...
Reminder: All posts in this series can be found here. Simply, it is a container for services. Services are classes that have a well-known interface, that have instantiations which be stored in service containers, can be obtained from a service provider, and are addressable by type. The ServiceContainer class is a service provider and implements IServiceProvider. You obtain a service by supplying the Type of the service you want to the service provider's GetService method. The ServiceContainer.GetService...
Reminder: All posts in this series can be found here. The first code I will look at is from one of the simplest services supporting the Windows Forms designer. The Name Creation Service is called each time you drop a control/component onto the visual design surface. Your job is to return a unique name for the new control that also means something. The standard process, per convention, is to take the control/component Type name, camel case it (lower case the first letter) since it will be a member...
Reminder: All posts in this series can be found here. Some time ago, I started work on hosting the Windows Forms design surface in a project. Since that was nearly three years ago, I believe it was in the early .NET 2.0 days. My priorities got redirected and the project languished. A new project is clearly targeted at achieving the same goal, so I am back to building a solid implementation to get a beta front end out the door. Those old posts are still of good use to remind me of everything I have...
Microsoft announced the availability of a new Tafiti experimental search front-end based on Silverlight. I tried out the Halo 3 branded system, and it is visually very nice and functionally very smooth. However, as a search engine front-end, it is currently a failure. I sent the team the following feedback: Sorry guys, but I have to grade it as a complete failure. 1) You completely fail to operate under a common setting (popup blocker set at medium) in your own browser (IE7) 2) You cannot bypass...
Technorati Tags: generic range class, C# First there was Jay Bazuzi and his article and follow-up with a simple Range class. I referred to those postings when I did a generic range class for a project I had. Now Sean Hederman has posted a CodeProject article with his generic range class. Very nice...
Almost five months ago, I wrote that "Microsoft screwed up big for customer confusion" with the whole .NET 3.0 naming thing. I got a few defensive comments about how the whole effort was great. Well, let's see. Today I read a post from a member of the Microsoft Architecture Editorial Board (whatever that exactly is). You know it is not going well when the post starts out with, "There has been considerable confusion about the differences between various versions of the .NET framework." My point exactly....
There are several friendly pages to help you get going. Assuming you are starting with VBScript, Microsoft has a Converting VBScript Commands to Windows PowerShell Commands page which will be your friend as you explore. Learn from their Task-Based Guide to Windows PowerShell Cmdlets. Get working examples from the Script Center Script Repository, and do not forget the Tools and Utilities. Download the latest version here...
It is sometimes amazing what those crazy programmers put in their comments! Bad programmers! Bad! I personally try to not use “Hard K” words. Again /. is on it...
I have been playing around with this new (test) feature and have a few more comments. First, it is irritating that it does not yet respect your search customizations. I like 100 results per page, but Code Search puts up 10 whether you want it or not. Second, it is evident that quite a bit more of the published source code from books is now easily findable. The publishers switched from floppies to CD-ROM and later removed CD-ROMs from books to cut costs. They probably did not think their book code...
Google Labs has come out with a new means to find source code online. Google Code Search is a feature that returns hits from within posted source code. It did not take long for me to ignore the main page and set the advanced search page as my shortcut. So far, it seems heavily weighted towards Java (not surprising), with less available from C-based sites. The results layout also needs more differentiation between each separate result -- things blend together too much. More to follow as I use the...
I have been posting infrequently, but it seems that a new pronouncement by Somasegar always stirs me up. The last time, it was about the .NET 3.0 Framework naming debacle. This time, it is about how the new Microsoft flagship operating system breaks with .NET 1.0/1.1 production support. Specifically, Microsoft will not support Visual Studio 2002 and 2003 on Vista. This is another ludicrous slap in the face. It is impossible to spin this in a good manner. Buzzwords like “compatibility“,...
Microsoft screwed up big for customer confusion on this one. First it was the attempt to explain the "red and green" model for compatibility in .NET 3.0. Now, it is announcing that .NET 3.0 will not include C# or VB 3.0, but will be an "additive release". Do you understand that? Even with pictures, you have to wonder what they were thinking. Everyone Microsoft is just bubbling over with support and entheusiasm. Customers are much less so. The general belief is that .NET is now heading down the evil...
I have been moving projects around, so most of my recent projects list pointed to locations which were wrong. I wanted to clean things up, but I should of thought of this. Start RegEdit. Go to HKEY_CURRENT_USER\Software\... Delete what you do not want. Disturb nothing else. Leave no tracks. (I also renumbered the entries.)...
Some neat stuff coming. From the summary of the C# 3.0 Overview. Most of these revolve around lambda and query expressions. Update: What to read a really bizarre explanation of the "red and green model" for compatibility in .NET 3.0? Check out Somasegar's strange backflips about promising binary compatibility without really promising it. I agree with the first two commenters to that post: do not try for compatibility, but rather work towards building the very best framework possible. Perhaps Hejlsberg...
After a few more minor tweaks, I have completed work on the generic range class and moved on to the other support classes required for my project. Of course, not wanting to keep thinks simple, I restructured my source tree and broke all my references such that the unit tests no longer work. Now I have to fix those as well...
My previous post talked about the layout for a generic range class I was working on. I have now settled on the nomenclature and have filled out the properties and methods. I think I'll post this to CodeProject some day. [Serializable()]public class Range<T> : IRange<T> where T : IComparable<T>{ [Flags] [Serializable] public enum RangeCompareResult { ... } // Constructors public Range() public Range(Range<T> range) public Range(T Start, T End) // Properties public T Start public...
It has taken awhile, but I have finally started on a C# project using VS2005. For the moment, VB6 has been retired. My initial actions have been porting some utility classes forward to a new library. One of the first ones I tackled is a generic range class to support the many ranges the project will be tracking. Things went well until I got to the part about defining the interaction while comparing two generic ranges. My current (partial) definition is: public class Range : IRange where T : IComparable...
I love free stuff. I especially love free stuff that has been tested and debugged. I hope to be starting a new app using VS2005 (if I can sell it) instead of VB6. As part of some quick research, I came up with this quick list of program parts that are already done. There are likely more. I would not use them all, but this can lead to a significant reduction in time and effort. They come with lots of adaptable samples. Enterprise Library for .NET Framework 2.0 Caching Application Block Configuration...
Now this is neat -- it is only 22MB download and 154MB uncompressed! The ultimate .NET Framework programming toy. New features in the SSCLI/Rotor 2.0 release include: Generics Lightweight Code Generation (LCG) Open static and closed instance Delegates Relaxed Delegates Loader and System.Reflection re-writes [\sscli20\clr\src\bcl\syste... Metadata format updates New C# features like Anonymous Methods, Anonymous Delegates and Generics support [\sscli20\clr\src\bcl\syste...
This is a great post on Ordering Code Construction Tasks by Jeremy Miller. In it he answers the question of what order do you build an application? It shows good reasons to implement agile development. (Hat Tip: Roy Osherove)
Full Programming Archive