Geeks With Blogs

Neat Stuff Read all my hurricane entries While you are here, visit the Geeks With Blogs main feed
Links Status of the Navy
Channel 9

.NET Hobbyist Programmer Staying Confused in a Busy World Programming Thoughts on how a hobbyist programmer approaches the .NET framework.
C# Value Type Table
One of the things I always seem to be checking are the various characteristics of the C# value types. You know, stupid questions like whether int is the same as System.Int32 or System.Int64. I know the answer, but when I need it, I just want a quick reference. I could not find one, so I made one. I think it is correct since I combined multiple tables from the MSDN documentation. Value Type Category .NET Framework Type Approximate Range Default Value Literal Size Precision Implicit Numeric Conversions ......

Posted On Sunday, March 25, 2012 8:34 PM

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 ......

Posted On Saturday, August 28, 2010 10:32 PM

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 ......

Posted On Monday, August 23, 2010 7:15 PM

WPF: A Simple Color Picker With Preview
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 ......

Posted On Sunday, January 3, 2010 6:35 AM


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.

Posted On Saturday, March 21, 2009 6:01 PM

Custom Forms Designer: A Restart
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 ......

Posted On Wednesday, October 17, 2007 9:02 PM

Tafiti Search
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 ......

Posted On Friday, September 21, 2007 11:02 AM

Custom Base Exception Class - V3 (C#)
A long time ago, I posted a VB version of this code and thought I would post the C# version since I have gotten several requests. I have not tested it too extensively yet, but it is working so far. I had to remove the XML documentation comments for posting here. I have made some improvements over the VB version, but not significantly. Eventually I will be posting the whole project structure to CodeProject. using System; using System.Text; using System.Runtime.Serialization; namespace Kobra.Error ......

Posted On Saturday, July 9, 2005 1:38 PM

Custom Forms Designer: Toolbox and ToolboxService - Part 1
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 ......

Posted On Thursday, October 25, 2007 11:41 PM

More About a Generic Range Class
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 ......

Posted On Saturday, June 2, 2007 2:41 PM

Custom Forms Designer: ServiceContainer
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 ......

Posted On Monday, October 22, 2007 10:15 PM

Custom Forms Designer: Name Creation Service
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 ......

Posted On Thursday, October 18, 2007 6:12 PM

.NET Naming Debacle - 2
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. ......

Posted On Sunday, December 3, 2006 7:23 PM

Windows PowerShell Jump Start
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 ......

Posted On Thursday, November 30, 2006 5:45 AM

Google Code Search - Finding Hidden Evils
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 ......

Posted On Wednesday, October 11, 2006 3:50 PM

Google Code Search - Use and Misuse
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 ......

Posted On Sunday, October 8, 2006 8:18 AM

Google Code Search - Finding Source 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 ......

Posted On Thursday, October 5, 2006 6:09 PM

Sony DRM Debacle: Now for the Lawyers
Brian Bergstein, AP Technology Writer, gives us a good summary of where things stand with Sony and their DRM problems. Suffice it to say that they relied on First 4 Internet for the expertise and F4I proved to be inept. I think Sony's suits have little concern about the “thieving users” who are trying to steal their content, but only get concerned about the lawsuits and lost profit. The music industry got too used to obscene profit margins and now cannot live without them. Sony seems ......

Posted On Sunday, November 20, 2005 5:37 AM

Vista Hates Developers
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“, ......

Posted On Wednesday, September 27, 2006 5:30 PM

.NET Naming Debacle
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 ......

Posted On Sunday, June 11, 2006 11:57 AM

VS05 Recent Projects List
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.) ......

Posted On Wednesday, May 31, 2006 3:42 PM

WinForms Z-Order
This is a reminder to myself in the future. When you need to adjust the z-order of controls on a WinForm, you can use the controls' SendToFront and SendToBack methods. A better solution is to go to the control's container. There in the container's Controls property is the SetChildIndex method that can then independently set the z-order of its contained controls ......

Posted On Saturday, March 5, 2005 11:50 PM

Mapping the Win32 API to the .NET Framework

This is a great resource to keep at hand: Microsoft Win32 to Microsoft .NET Framework API Map.  Of course, you need to keep PINVOKE.NET at hand as well.  Think of them as lifejackets in the .NET world.

A list of suggested NLS updates is here.

Posted On Wednesday, February 23, 2005 8:49 PM

Custom Forms Designer: Framework 2.0
In a comment to an earlier post, Tim Dawson pointed out that there are some significant improvements with respect to design surfaces in the upcoming .NET Framework 2.0. I was going to get to that after I covered what bits need to be assembled in order to get a design surface to work. Instead, I will modify my table now to indicate what the new Framework brings. Here is some info from MSDN2: ---------- The new DesignSurface class implements what the user perceives as a designer. DesignSurface is the ......

Posted On Tuesday, January 11, 2005 8:10 PM

Custom Forms Designer: Classes and Interfaces
An obvious first question when building a designer is: Where do you start? Unfortunately, the answer is that you need to start everywhere. A custom Windows Forms designer requires multiple interlocked services that all need to run correctly from the beginning. Getting this web of classes up an running is not trivial. Luckily, we have three operating samples at which to look. I will start this part of the discussion with a comparison of the classes and interfaces implemented in the three samples. ......

Posted On Thursday, January 6, 2005 10:12 PM

Copyright © Mark Treadwell | Powered by: | Join free