Archives

Archives / 2004
  • Generic version of string.Join

    Have you ever had a list of something other than strings and wanted to combine the list in someway to get a single string? You could use string.Join if you could get your list into a string[] but that is not always so easy. Usually I end up writing my own join method.

  • Code Htmler

    Code Htmler is a simple program that will translate plain text code into a colorized html version of the code. Currently there exist language definitions for C#, JScript, VB.Net and XML.

    It uses regular expressions to match language structures, such as keywords and literals (strings, integer, real, etc.). The language definitions are stored in xml files and so languages can be customized or new languages can be created rather easily.

  • Storing VS projects on a Network drive

    I have a centralized file server where I store pretty much all of my data. When I got my file server I moved all my data to it including my Visual Studio projects. This was about a year ago. 

  • Outlook macro to permanently delete items in junk email folder

    If you are anything like me you hate using the mouse to right click on your Outlook Junk E-mail Folder to select Empty "Junk E-mail" Folder and then on top of that you have to click Yes when it asks you "Are you sure you want to permanently delete all the items and subfolder in the "Junk E-mail" folder?". I hate doing that and I'm more of a hotkey kind of person so I wanted some way to do this with a hotkey.

  • C++ static variables

    I'm working on a project in C++ and I created a static member function and a static data member in one of my classes. When I tried to compile I kept getting an unresolved external error that was pointing to my static data member and I couldn't figure out what the problem was. Finally after some research (via Google, Msdn, and Stroustrup) I figured out that you have to define the static data member outside the class declaration.

  • Using LinearGradientBrush in C#

    Well during my CSS change over I needed some background images for my headers. I wanted some simple gradient looks, but I only have 2 picture programs installed mspaint and Paint.Net, neither one of those does gradients (at least that I could find). I could download and install some picture program that has gradients but that is too much work and not much fun :)

  • C# Tips and Tricks

    I have been starting to participate more in newsgroups, in particular microsoft.public.dotnet.languages.csharp. I figured I have learned a lot from the .Net community and I should share my knowledge. It truly is amazing how much better you understand things when you have to explain it to others.

  • Why can't you create a Generic Class that inherits from Attribute in C#?

    Today I was creating a set of attributes for a project I'm working on and I attempted to create a generic class that inherits from Attribute and I didn't think anything more about it until I compiled and got the error: "error CS0698: A generic type cannot derive from 'Attribute' because it is an attribute class".

  • echo %RANDOM% ... {0, 32767}

    I knew there are environment variables for SystemRoot, UserProfile, etc, but I didn't know about the %RANDOM% variable that when used will generate a random number between 0 and 32767.
     
    I remember a few years ago I needed to generate a unique name for something in a batch file and I had to use an external program to generate a random number. This can come in handy for generating temporary and/or unique file names.
     
    For a complete list of Windows XP Environment variables see Command shell overview.

  • Weblogs @ ASP.Net MainFeed...?

    I just now noticed that http://weblogs.asp.net/MainFeed.aspx == http://weblogs.asp.netMainFeed.aspx?GroupID=2, meaning that the MainFeed now only has Microsoft Bloggers. Did I miss an announcement about this or is this just a mistake? I was thinking that Weblogs @ ASP.NET has been a little light as of late. I only subscribe to the Main Feed so I have been missing some posts lately.
     
    I hope this is only a mistake and will be fixed soon because I get most of my traffic from the MainFeed or Google, I don't think anyone subscribes directly to my blog. Maybe I will need to start following Scoble's advice How your blog will get discovered.
     

  • Tooltip now has the ability to be displayed as a Balloon

    While adding tooltips to the application I'm working on in C# Express (more on that later)  I noticed the property IsBalloon and though hmmmm. So I set it true and now my tooltips display as balloons instead of the normal rectangular popups. There are a few more changes to the ToolTip Members. Two others properties I think are helpful are ToolTipTitle and ToolTipIcon (ie Info, Warning, Error).
     
    Also on a side note when getting the links from the MSDN beta documentation for .Net 2.0, I noticed that the site is different. Does anyone know what is with the change to the MSDN beta documentation?

  • Copernic Desktop Search

    Copernic Desktop Search - They claim to be "The Search Engine for your PC".
     
    I just installed it and it is indexing my files right now, we'll see if it is as good as they say. The first thing I see that I don't like about it is their Web Search, it uses http://www.alltheweb.com with no option to change it, that I can find, however I will over look this since that is not its main purpose.

  • Using C# Generics on Static Classes

    I was playing around with some C# generics today and I began thinking about different things I could do with them. Then I began to wonder what happens if you give a static class generic type parameters? I wasn't even sure it would compile but sure enough it did. Then I tried to come up with an example where this might come in handy. Here is a simple factory pattern example using a C# generics:

  • Standard Windows Password Character

    I was writing a login form for an application I'm working on and I decided I didn't want to use the standard '*' as my password character. I wanted to use the black circle (●), the same one that windows login uses. I figured out what the Unicode value for it was (0x25CF) and then I tried to set that as the password character for my textbox through the designer but no luck it would only take standard ASCII characters. So I decided to set in my form constructor, like:

  • Windows Run Command Wish List

    In order to get more familiar with the new features in version 2.0 of .NET and C# I have been working on a side project using C# Express Beta 1. The project that I have been working on is a replacement for the windows run command. I for one use the run command a lot and there has always been some features lacking. Currently the run command provides a drop down list of the last 26 typed commands and the auto complete functionality for the file system / browser history as described here. Some features that I have already implemented for my new run command are:
    • Auto complete commands - as you type you are given a suggestion list matching what you have typed and the command that matches the closest is filled in for you
    • Smart suggestion list - the commands you use the most often appear at the top of the suggestion list, and the commands are pre-populated with common commands that someone might run like:
      • Start Menu Shortcuts
      • Control Panel Applets
      • Favorites
      • Recently Opened Documents
      • Common Windows Commands - i.e. My Computer, My Pictures, Administrative Tools, etc.
      • All Executables in the Path
    • Easily create short commands - being able to define short strings to run the command of your choice, like defining "ie" to open up Internet Explorer.
    • Command hotkeys - being able to assign a hotkey for any of your custom commands.
    • List computer shares on network - when you type "\\" it provides a list of the computers on your LAN and then when you type "\" again it provides a list of the shares on that computer (including hidden shares)
    Also one other side feature not necessarily related to the run command that I'm including is the ability to assign a global hotkey that will minimize the foreground application to the system tray.
     
    What I would like to know is if there are other things people would like to see included in a replacement run command? Please leave your suggestions in the comments. Once I have a working version I will post it.
     
    Update: For anyone interested I have released see this post for information about the release of my program Run++.

  • Turn AutoCompletion on for Run Command

    Have you ever been typing a file path in the run command and had to hit the down arrow to select the file you want from the drop down list? Wouldn't it be better if as you typed it automatically filled in the text for you?
     
    The run command uses the SHAutoComplete interface which is also how IE and most other auto completing text/combo boxes in windows do auto complete. By default the auto complete mode is set to suggest only, meaning just give a drop down of items that match what I have typed. There is also an auto complete mode to append, which automatically fills in the text with the closest match from the suggest list. The append mode is turned off by default but you can enable it by going to Internet Options > Advanced, and checking the box next to Use inline AutoComplete, or if you like you can change it in the registry Change the Auto Complete Mode [1]. Now when you type paths in the run command, open/save dialogs, IE address bar, and others that use the default auto complete registry settings you will have both the suggest and append mode.
     
    On a side note the textbox and combobox in .Net 2.0 also have auto complete functionality using the same SHAutoComplete underneath. The one thing I don't like about the new auto complete functionality in .Net 2.0 is that the dropdown width is set to the width of the textbox and you can't change it in code, at least I couldn't figure out how, this forced me to implement my own auto complete functionality.
     
    [1] http://www.regedit.com, if you are interested in the registry I highly recommend this site, it is one of my favorites.

  • My blogging philosophy and my need to analyse my referral log

    One of the primary reasons that I blog is to help the community, I don't really expect anyone to directly subscribe to by blog (just out of curiosity does anyone?). I depend on people finding my information through search engines. Most of my posts are technical things that for what ever reason I spent some time figuring out how to accomplish.

  • Recusive GetFiles for DirectoryInfo via a C# Iterator

    I have been working on a project using C# Express and so I have been playing around with some of the new C# 2.0 features. In my project I had a need to get all the files of a particular type in a given directory including all sub-directories. The DirectoryInfo class has a method GetFiles that takes a search pattern (ie "*.exe") but it only searches that directory it doesn't search sub-directories. So I figured this would be a good chance for me to play with these new things called iterators. At any rate I wrote a recursive version of GetFiles using an iterator so that I could do a simple foreach loop to get all the files recursively.

  • RoboForm - Bookmark/Password manager

    Well I started using RoboForm a couple of days ago after reading the comments on Dan's post. So far I have to say I really like it. It fills in form data. It acts as a bookmark manager and if that bookmark needs login information then it will fill in that information and login so you don't have to login every time you visit that page. Another feature I like is that all the bookmarks (passcards as they call them) show up in both Firefox and IE. I'm almost thinking of using this as my standard bookmark manager as well as my password database. For security it has a master password so I only need to remember that one password. Also if I want more security I could store my data on a USB key drive.

  • Finished my internship

    I have not been blogging much over the summer because I was busy with my internship but I'm back now so you will see a few more blog posts from me.

  • Variable number of parameters... C/C++ vs C#

    A friend and I were talking about variable length parameter lists in C/C++ the other day and neither of us knew how to do it. We knew there must be some way because of the printf function. Just out of curiosity I did some googling and figured out how to do it.

  • Notepad2, Disable Reusing the same window

    After reading about notepad2 from some other bloggers in the community (Omar), I downloaded it and have been using it for a couple weeks. If you desire more from notepad I would highly suggest you take a look at it. I took Omar's advise and just replaced the existing notepad with it and I haven't had any problems. The only thing that bothers me is that it resuses the window by default. So you can't open more than one file by clicking on the files themselves you would have to do it through notepad2, by the open new window option.

  • Ditigal Camera Reviews

    This semester I'm taking a digital picture processing class at Virginia Tech and my professor pointed me to http://www.dpreview.com.  If you are in the market for a new digital camera I highly recommend checking out this site for very detailed reviews of a ton of digital cameras.  About a month ago I bought a new digital camera, a Cannon Powershot S50, but of course I didn't know about this site at that time luckily after checking its review at dpreview it seems to rate pretty good so I'm happy. 

  • Photo Gallery

    I have create a photo gallery using nGallery, its an open source ASP.NET web application.  If you haven't looked at it yet please do it is a very nice application.  There are still some things that need to be improved but all in all it serves my needs. 

  • Customizing Windows Run Command...

    If you are like me you use windows run command all the time.  I hate using the mouse to point and click a shortcut on the start menu.  WIN-R are probably the two most over used keys on my keyboard.  After thinking about if awhile I hunted down how the run command works.  It turns out that it makes a call to ShellExecute, which I guess is not too surprising.  The next thing I wanted to find out was exactly how the commands are resolved. The following is an ordered list of how they are resolved ([1]):

  • Javascript UP Bookmarklet

    Sometime last June I posted about a Javascript Bookmarklet that lets you move up one directory level.  I had a comment from a user about allowing it to dig into sub-domains when it was at the root.  So I have revised it to allow for this as well as fixed some other bugs that were in it. 

  • FireFox Tweaks

     Thanks for the Tips, I have been wanting the ability to rearrange my Tabs for a while.

  • Firefox.... Firebird Renamed

    Well they just released Firebird v0.8, well not exactly it is now been renamed to Firefox 0.8. But anyways if you aren't using it as your primary browser then I suggest that you check it out. I have been using it for a while now and I love it, I can't get enough of the tabbed-browsing and its clean feel.

  • ClickOnce

    I finally got a chance to look at Click Once: MSDN TV Wow, am I impressed. We have written a lot of NTD code to do what this is going to do for us. I look forward to working with this. Via [Greg Robinson's Blog]

  • Update on Internship Offers

    Well just for those of you that don't know, I was given an official offer from Microsoft and IBM's Extreme Blue Program for summer internships. It was a very tough decision to make. After many hours of thinking and discussing with my wife, I have come to the decision to accept Microsoft's Software Design Engineer Internship Offer.

  • Online Bookmark Manager

    Well thanks to a comment on an old post. I'm now using Crutons as my bookmark manager. So far I like what I see. I have tried a lot of them and this one meets my needs the best out of all of them (If you look at the comments of the old post there were a lot of recommendations and I looked at everyone). It doesn't have very much documentation but it is pretty simple to use but I would still like a to see a little more documentation. As for features it has most of the features that I was looking for, including rearranging nodes via drag and drop, support for Firebird and IE sidebars, and a search feature.

  • Microsoft Internship Interview

    Well I have my plane, hotel, and car reservations for my internship interview with Microsoft on Jan 30. I'm going to be interviewing for a software design engineer position. Besides for Chris Sell's Microsoft Interview Tips, does anyone have any tips or pointers for me?

  • Trip to India

    Well it has been a while since I last blogged its also been a while since I’ve been on my computer (luckily I some how survived without my computer for 3 weeks). I just got back Sunday from a 3 week trip to India. I meet my wife's family members for the first time, I have no idea how many people I met but it was a whole lot. I was in Mumbai with her parents most of the time but I did get to visit New Deli, Agra (Taj Mahal), Jodhpur, and the deserts of Jaisalmer.