Scott Hanselman

Ten Must-Have Tools Every Developer Should Download Now - Should be named: "...should know how to use"

June 17, '04 Comments [1] Posted in NUnit | Tools
Sponsored By

James Avery has a great article up in MSDN Mag called Ten Must-Have Tools Every Developer Should Download Now.  He's right.  Although, I'd have named it Ten Must-Have Tools Every Developer Should Know How To Use

It's a very good article that reminds us that world of Windows Programming has changed, and it's about more tools than just Visual Studio.NET.  I'm continually surprised at the number of folks that haven't even heard of NUnit.  I look forward to the tools to come!

I'll need to check my list of Ultimate Tools and make sure all these are on it!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

How do I automatically size (autosize) Columns in a WinForms DataGrid?

June 17, '04 Comments [19] Posted in Programming
Sponsored By

Apparently this is, like, the problem for the ages or something, but noone on this planet has come up with a way to automatically size the columns in a DataGrid.  Sure, there's all sorts of pyscho ways that involve measuring the length of strings in DataSets with the Graphics context, yada yada.  But, since I'm binding strongly-typed Object Collections to DataGrids in WinForm apps, that doesn't work for me (and it's a little over the top, IMHO).

So, I thought about it like this:

  • If you double click on the little splitter between columns they will autosize.
  • Therefore, the code to autosize has been written for me; no need to measure strings, etc.
  • How do I force a double click? No, wait, wrongheadedness, how do I call whatever THEY call when a double click happens?
  • So, I reflectored into DataGrid.OnMouseDown and saw their custom HitTest calls a private ColAutoResize.  Ah, bingo.

If you're going to 'sin' do it with style - do it with Reflection.

private void dgLogging_DataSourceChanged(object sender, System.EventArgs e)
        {
            try
            {
                Type t = dgLogging.GetType();
                MethodInfo m = t.GetMethod("ColAutoResize",BindingFlags.NonPublic);

                for (int i = dgLogging.FirstVisibleColumn; (i < dgLogging.VisibleColumnCount); i++)
                {
                    m.Invoke(dgLogging, new object[]{i});
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.Write("Failed Resizing Columns: " + ex.ToString());
            }
        }

(Thanks to Patrick Cauldwell for his help)

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

RSS Feed to dasBlog Content Converter

June 17, '04 Comments [2] Posted in ASP.NET | DasBlog | Nant | XML | Tools
Sponsored By

Greg Hughes once had a LiveJournal Blog and the only remnant of his blog was an RSS Feed/Archive.  Now that he runs dasBlog he wanted to move his old content foward into dasBlog.  So, we googled a bit and couldn't find a tool that would take an RSS (2.0) feed as input and put the entries into dasBlog.

So we made one over lunch, and here it is: RSStoDasBlog.zip (219.29 KB)

RSStoDasBlog.exe MyRssFile.xml "C:\documents and settings\whatever\dasblog\content"

Use it like this by pointing it to the RSS file and your (local) dasBlog content folder.  It will create all the needed dayentry.xml files for you to upload to your remote blog.  It will also (I think) take an http:// url to an RSS file and could be used to (possible as a service?) steal RSS and mirror them in dasBlog.  Thanks to Jerry (Chris) Maguire's RSS Framework that showed up first in Google and saved me the time of running XSD.exe on an RSS XML schema. Apparently he has even newer stuff on his site.  It's got a few more moving parts than I think it needs to, but it did the job with a few changes that I marked with my initials; SDH.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Windows XPSP2 RC2 on the TabletPC doesn't work in FireFox 0.9? *GASP*

June 17, '04 Comments [4] Posted in Musings
Sponsored By

Apparently the TIP (TabletPC Input Panel) in Windows XP SP2 RC2 doesn't detect the TextBoxes in FireFox 0.9?  Is anyone else seeing this egregious behavior?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

My upcoming speaking schedule

June 16, '04 Comments [1] Posted in ASP.NET | Web Services | Speaking
Sponsored By

Before I forget, here's my upcoming Speaking Schedule, which currently consists of Users Groups:

  • Bay.NET - chillin' in SFO with Web Services.  If you're in San Francisco or Oakland or Los Gatos or any points in between, come hang with us.  Spread the word and rush the stage. 
  • South Sound Users Group - TOPIC TBD, but it will undoubtably be fun, as I will drive up to Olympia to talk to my fellow Northwesterners.
  • South Colorado.NET Users Group - Probably a .NET Internals talk, where we'll start at LoadLibrary(), move past CoCreateInstance and end up at GetType() and Assembly.Load().  Very intense and upbeat talk that's mucho funno.
    • When: Tuesday, 10/5/2004 at 5:30 PM-ish
      Where: Probably at NxTrend in Colorado Springs, CO

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.