Philip Rieck

Phil in .net

  • Create context menu items in IE (a wish from

    ...The scary thing is, I don't think people realize just how easy it is to add context menu items to IE.  It involves just two things:

    1. A html file containing a script (or a script file)
    2. A single entry in the registry

    ...But where's the fun? (more specifically, where's the user-friendly .net?) I went ahead and implemented it again as a .net application, just so you could use it (if you wanted to) as an example of how to make a .net-written IE menu extension application. Here's how it works...

    Go to the full entry for the source code and a screen shot...

    [Posted from Philip Rieck's full blog.. subscribe now, posts to are dwindling fast!]


  • Announcing the Visual Studio 2005 CTP "community change log"

    So, as I suggested in a previous post, I'd like to use the VS2005 CTPs.  All of 'em.  However, I don't want to tear my hair out trying to figure out what version we should use because the stuff I'm working with is broken in the latest version.  I also don't want to have to try working with someting for a day only to figure out that it is newly broken, especially if someone else has already suffered through it.

    So, Without further ado, I give you the
    Visual Studio 2005 Community Tech Preview community running change log (VS2K5CTPCRCL).

    What Dave Bettin and I (and hopefully more of you) wanted to accomplish with this is simple - make up for the lack of a change log with the CTPs.  This way, we can all know what's new, what's newly broken, and what is really, really cool.  Not much info is up there yet... but it's coming, and quickly.  If you help, it will be that much more useful to the entire community.   Otherwise, it may just be helpful to Dave and I.


    [cross-posted from Philip Rieck's full blog]


  • Our communtiy adds the C to the VS 2005 CTP

    I think the community can make the CTP drops much more useful to all of us.

    MS said it: VS 2005 CTP is not a beta. VS 2005 CTP is not a beta. VS 2005 CTP is not a beta. VS 2005 CTP is not a beta. Developers.

    The Problem:

    The expansions in C# - one of my new favorite features of visual studio - no longer work well.  That is, they still produce an "expansion" when you type the shortcut, but....

    • You have to hit tab twice now, and Ctrl-Alt-M, X is gone (sort of replaced by [Ctrl-R, X], but entirely different behavior).  It took me a few tries to get 'em going, because they show up in the intellisense menu (now), so you'd assume that just one tab would work (or selecting with mouse, or hitting ).  Nope.
    • The cursor position is all screwed up.  For example, with "prop", the cursor goes to the beginning of the file.  Oops. 
    • The expansion vars (places where you type in items that get replaced) are no longer navigable with "tab".. Well, they do get selection rectangles around them when you hit tab, but the cursor isn't moved around.
    • When you enter a expansion replacement area, all the text in that area isn't highlighted.  You have to delete what's there, then type new content.

    It's much, much, much less useful and useable than the PDC bits.  If I wanted to play with expansions, I may be better off using the PDC drop. I didn't know that until digging in a bit.  However, I may be wrong - perhaps there's something else different (and better) that I missed...

    So anyway - The Solution.  You.

    Dave Bettin and I are setting up a Wiki where the community can post and track these changes, figure out CTP breaks what feature, what CTP adds what feature, etc.   -- A community-built running change log that will allow for interaction as well.

    Why? If I'm reading correctly, these CTP drops will be somewhat frequent.  I'd love to have this "running change log" so that someone using CTP7 knows that if they want to play with some specific new feature (say, the Data Container in windows forms) they should use CTP5 instead because it's broken in CTP7.  Or a person looking for the refactorings knows that moving to CTP2 is worth the headache because it adds twelve new ones.

    Is this a dumb idea?  Would it provide any benefit to anyone?  Comment here and let me know.   We should have something up quite soon, but if no-one wants it, we won't sink the effort in. 

    Is this a good idea but needs more oomph? Is there something that must be included?  Comment here and let me know.   

    [This entry was cross-posted from Philip Rieck's full blog.]



  • .Net says - multiple languages supported. VS.Net says - don't try it.

    It's beta 2 of the new visual studio, soon to be VS.Net 2002.  It's awesome, and I'm blown away.  In all ways, I love .net development, and Visual Studio gets better and better.   However, one bug will plague me through my career.


    Warning -- it's extremely simple.  You will probably become very aggravated (as I did) when you realize that it's a bug that impacts anyone trying to take advantage of .net's language-agnosticism that hasn't been fixed for two and a half versions.  Is there anything I can do to help?

    Full Post here

    Cross Posted from Philip Rieck's full blog..


  • HttpModule to keep post-back scroll position

    One of the things I hate about the joy of postbacks is losing my scroll position.  On a page that's a bit longer than the window, if I have an auto-postback combobox (for example), the user selects an item, the page posts back, and poof! they're back at the top of the page.

    On a corporate intranet the post back is nice and fast, and many times the user has no clue that it happened....  Except for the fact that the page just "jumped" back to the top.

    Because of this I (as many people) write my controls to re-position, or I have page logic to re-position after a postback. There are articles on CodeProject with controls for keeping the scroll position,   one on DotNetJunkies that isn't quite so pre-packaged, but still good, and several tutorials.  The problem then is that the behavior is coded in everywhere, or the control must be included on each page, or the page must be derived from something other than the Page class, or something else..  I wanted a fire and forget solution.

    So here's what I created late last night to un-vex myself -- an HTTPModule that adds scroll position retention across postbacks to all pages.  It's implemented as a filter that adds javascript to the pages after they are output.  I've tested it only on IE 6, as that's the browser my client site's intranet uses.  

    The nice thing about this (to me) is that three lines in your web.config instantly gives you scroll position retention across postbacks on every page in your application.  No muss, and not a whole lot of fuss.

    To use it, add the module in to your web.config (see the readme.txt included for instructions on doing this), and then configure it to either add the behavior to all pages, or be selective (again, see the readme.txt).  The zip includes the source, and a pre-build binary that's strongly named in case you want to just drop it in.

    If you find any bugs or problems with it, fix 'em yourself!  No, really you can just leave me a comment here and I may look at it.  The module works great for me (the infamous "it works on my machine!" that translates to "it only works on my machine!"), and hopefully will for you too.   If you like the code, I wrote it.   If you don't like the code, then some other idiot wrote it. 

    Download it here (13K zip)

    Cross-posted from Philip Rieck's full blog. Full of neat stuff, don't miss it!


  • WaitHandles for the confused

    I put up a somewhat old writeup on the ManualResetEvent and AutoResetEvent on my full blog, thought since it was .net, I'd post here as well.  Here's an excerpt:

    Confused about WaitHandles? Sure you are. For one, they have the word "Event" on them.. Are they events? Do they call delegates?. For another, what's this "Reset" action, and why would I want to do it manually? And lastly, what does the documentation mean when it says "Signaled" and "Nonsignaled"? In project [codename] you see a good number of calls to WaitHandle-derived objects , both AutoReset and ManualReset. As the interaction can be somewhat complex, it can be difficult to decipher what is going on. Hopefully this simplified example will help clear things up.

    You can find it here if you're interested.  It really was written for interns, but if you've never used them, you might find it useful.


  • Sharing my oft-used Ink controls, part 1.

    I do a good amount of TabletPC development, pretty much mostly for myself.  I have lots of fun and useful apps that do things I need, and some apps I use to demo the Tablet to others..

    And, like any developer, I hate to redo work.  So I created a library of controls that I use that I can drop-in.  I showed these to a friend today and she said “Share with the world!”.  So here you are.  This is the first one that I would even consider letting anyone else look at, and it's not a control I'd consider anywhere near polished.  But perhaps you other TabletPC developers out there can use and adapt this to reduce some of the “gruntwork”.

    So, here's the TabletTextbox - it's an Ink input control that I use on a lot of forms to quickly input text / numbers whatever.  It allows quick retrieval of the recognized text with the .Text property, and can optionally show a field label and / or the recognized text inside the control (each can be put in one of the four corners, or omitted).

    Here's a runtime screenshot of four instances of it with different properties:

    And here's where to get the source for the TabletTextBox

    Feel free to do what you want with it. If you find nasty bugs, comment here and I may fix them. Even better, if you fix the nasty bugs or add features, comment here if you like so that I can use those fixes myself!

    [cross-posted from Philip Rocks, Philip Rieck's new-ish real blog - here.]


  • Strongly typed dataset tip

    While doing code reviews (for .net code, of course!),  I see one minor annoyance with strongly typed datasets again and again - not using the TableName property.  I don't know why this comes up so often, so I thought I'd add a quick tip about it.

    If you have a strongly typed dataset (some call them XSD datasets), great. You don't need to remember column names or worry about casting values.  So why do I see things like this:

    dAdapter.TableMappings.Add("Table1", "MyTable");

    Instead of using the table's name as a string, use the .TableName property as such:

    dAdapter.TableMappings.Add("Table1", typedSet.MyTable.TableName);


    Now you can rename your table and let the compiler find all of the code you need to change, instead of trying to do a “Find” and hoping you didn't miss any.  I'm all about making the compiler find as many problems as I can.

    [cross-posted from Philip Rocks, Philip Rieck's new-ish real blog -]