Thursday, January 20, 2005

Drag & Drop To Windows Forms Control Hosted In Internet Explorer

We have a windows forms control that we host in a browser that we needed to make a drop target. This control is granted fulltrust already based on our strong name.

Based on this we thought this setup would be trivial.  Well we ran into two issues I want to get in the google index for others that hit them.

1. In our _DragDrop handler we only received the name of the first file that was dropped even with a multi selected drop.  Come to find out this is because the framework after grabbing the first file name does a FileIOPermission Demand assuming we are going to eventually do something with the file.  In our case however we just need the filename.  The Demand fails and the framework silently catches it returning only a single filename.  This has been reported as a bug.  The fix?  Make sure that you assert FileIOPermission on your _DragDrop handler like this:

[System.Security.Permissions.FileIOPermission(System.Security.Permissions.SecurityAction.Assert, Unrestricted=true)]
private void UserControl1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)

2. When setting .AllowDragDrop=true in the InitializeComponents section of the control an exception was raised during initialization of the control.  When I looked at the call stack I realized it was a message that was being received by the controls WndProc during initialization of Drag & Drop that was missing UIPermission.  To fix this I added:

[UIPermission(SecurityAction.Assert, Unrestricted=true)]
protected override void WndProc(ref Message m)
{
    base.WndProc (ref m);
}

Voila!  A working drop target in Internet Explorer. Thursday, January 20, 2005 4:26:56 PM (Pacific Standard Time, UTC-08:00)   #      Comments [0]  
 

  Friday, January 14, 2005

.NET Framework Penetration

I have been chatting with friends as of late about the penetration of the Flash runtime vs. the .NET runtime.  I had recently seen Flash stats but hadn't seen any .NET stats.  Brad Abrams drops some of them on his blog:

1.      More than 120M copies of the .NET Framework were downloaded and installed (using either Microsoft downloads or Windows Update)

2.      More than 85% of new consumer PCs sold in 2004 had the framework installed. More than 58% of business PC had the .NET Framework preinstalled or preloaded

Those were his top two and can only bode well for those of us shipping .NET applications out in the real world...

Friday, January 14, 2005 8:58:09 AM (Pacific Standard Time, UTC-08:00)   #      Comments [0]  
 

  Thursday, January 13, 2005

General Thoughts on Thinkpad Demise

PC Magazine finally published an article that I pretty much agree with based on thoughts I have been seeing on other blogs about the demise of the venerable thinkpad.  Check it out.

Thursday, January 13, 2005 11:45:28 AM (Pacific Standard Time, UTC-08:00)   #      Comments [1]  
 

  Wednesday, January 12, 2005

SourceGear Allerton

Like many other folks out there I am anxiously waiting for Visual Studio Team Foundation to make it out the door.

Just heard some incredibly good news on this front.  SourceGear is doing a Team Foundation client for VSTS that will run on Linux, Macintosh, and Solaris!  So now Team Foundation isn't just for windows developers. This can only be a good thing.

Head to the founder of SourceGears blog for the full scoop.

Wednesday, January 12, 2005 2:59:50 PM (Pacific Standard Time, UTC-08:00)   #      Comments [0]  
 

  Friday, January 07, 2005

VSLive Vegas Baby!

For the first time ever VSLive is coming to Las Vegas!  The show will be May 8-11 at the Rio.

I have been asked to head up the content selection for this show.  The current plan is to split into two tracks: a Smart Client track and an ASP.NET track.  To tell you the truth I think this makes a ton of sense compared to the old partitioning and this will be the second show to use this scheme.

Please send all proposals to me and include VSLive Vegas in the title so that i spot them.  This show will not be us just picking up all the content from the previous San Francisco and Toronto shows.  My plan is to look at the scores for those shows and pull forward only the top scorers.  Surprised that we actually look at the ratings?  Good reason to actually fill them out.  They do affect the future directions of the shows.  To those "legacy" sessions I will be looking to add new sessions.  If all goes well the plan is to have 50% of the show comprised of the best content from previous shows and 50% of the content all new content.  Hopefully this strategy will help make an already great show even better.

So treat this as the first call for proposals.  I need all proposals sent to me by February 4th so I can get a preliminary matrix setup. I need proposals for both 60 minutes sessions and all day workshops. 

Let's see what you have and hopefully I will see you in Vegas Baby...

Friday, January 07, 2005 1:26:39 PM (Pacific Standard Time, UTC-08:00)   #      Comments [0]  
 

  Thursday, December 30, 2004

VSTF December CTP

I just got the VSTF December CTP up and running.  I had one little issue I figured I would post. 

After first setting up the client I attempted to connect to TFS. I was logged in as the Administrator on the local box (yeah, yeah I know. I was just trying to test the setup and hadn't created users yet.).  I couldn't connect to TFS.  It was at this point that I realized that it was probably because the local administrator wasn't a member of the TFS Adminstrators group in ADAM.  So I logged in using the TFSSETUP domain account which the docs tell you is added to TFS Administrators and tried to connect.  Still couldn't connect.  At this point I was fairly sure everything else was correct.  I could browse to the bisservice/registration.asmx page, etc.  It finally dawned on me however that TFSSETUP had no privileges on the local box!  I added this domain account to the local administrators group and voila! everything worked.  Hopefully this saves someone else some grief.

Thursday, December 30, 2004 10:48:56 AM (Pacific Standard Time, UTC-08:00)   #      Comments [0]  
 

  Wednesday, December 29, 2004

A Commonly Seen Problem with Developers

Scott Hanselman turned me on to a hilarious essay on Spurious Pundit that talks about what happens when you give a junior programmer a task.  I think junior programmer isn't even stretching it.  I have worked with some "Architects" whose thought processes are scarily similar. Check it out and see if you don't see some similarities to folks you have worked with...

Wednesday, December 29, 2004 5:23:01 PM (Pacific Standard Time, UTC-08:00)   #      Comments [0]  
 

  Wednesday, December 08, 2004

Alas the Thinkpad is no more

I have been a loyal thinkpad user for around 7-8 years now.  I can't imagine going back to anything else at this point.  But with the announcement that IBM is selling their PC business to Lenovo out of China it looks like I am faced with that prospect.  Problem is I am just not overwhelmend by the reliability and/or form factor of a a lot of the machines out there.   I will certainly miss my Thinkpad when it is time to replace it later this year.  May have to move up the replacement schedule so I can get one of the last of the existing ones...

Wednesday, December 08, 2004 1:43:36 PM (Pacific Standard Time, UTC-08:00)   #      Comments [0]  
 

  Tuesday, November 30, 2004

I Am Writing Some Code That I Cross Compile Under Both The Full 11 Framework And The 11 Compact Framework It Drive

I am writing some code that I cross compile under both the full 1.1 Framework and the 1.1 Compact Framework.

It drives me nuts that objects that support IDisposable in the full framework don't always support IDisposable on the Compact Framework.  This means that if I have been a good kid and written code like this:

using(SolidBrush indicatorBrush = new SolidBrush(stationColor))
{
    using (Pen indicatorPen = new Pen(stationColor))
    {
        // Draw a path 
        g.FillPolygon(indicatorBrush, points);
        g.DrawPolygon(indicatorPen, points);
    }
}

Then my code won't compile on the compact framework because Using can't cast SolidBrush to IDisposable nor can it cast Pen! I know the compact framework is compact, etc. but come on guys this is an interface with one method, Dispose that for all I care could be a no op.  So I am left with two choices.  Wrap all the objects and add the dispose interface to my wrappers.  I must admit it doesn't sound like a lot of fun.  Or write the much uglier code that does the same thing:

// Declare the objects
SolidBrush indicatorBrush = null;
Pen indicatorPen = null;
// Wrap in a try/catch so we can dispose of them on the desktop
// This is because SolidBrush and Pen don't support IDisposable on 
// the compact framework
try
{
    indicatorBrush = new SolidBrush(stationColor));
    indicatorPen = new Pen(stationColor));
    // Draw a path 
    g.FillPolygon(indicatorBrush, points);
    g.DrawPolygon(indicatorPen, points);
}
finally
{
#if !CF
    indicatorPen.Dispose();
    indicatorBrush.Dispose();
#endif
}

Has anyone checked this out in Whidbey?  Has it changed?

Tuesday, November 30, 2004 4:13:48 PM (Pacific Standard Time, UTC-08:00)   #      Comments [0]  
 

  Monday, November 29, 2004

Seattle CoLocation Leads

I am currently renting space in downtown Seattle just to house a couple of servers and a DSL line. Since I spend almost no time in the office it suddenly dawned on me that I should check into CoLocation instead and get rid of the office.

I currently run a 1.1Mb/s DSL line into the office.  I probably have less than 21U of boxes.  I do tend to use quite a few IP addresses.  I currently have a /26 block.  Redmond area would be great but the only colocation I could find there was IsoMedia which offers anemic bandwidth options.  No 95th percentile billing and only 10GB of transfer a month included.

Love to find something in the Westin or Fisher plaza downtown but am open to other locations.  Just looking for space, power, good connectivity and a reasonable price.  Hopefully somewhere in the $400/mo range.

Any suggestions or am I crazy and should keep the existing office?

Thanks,

Chris

Monday, November 29, 2004 10:01:39 PM (Pacific Standard Time, UTC-08:00)   #      Comments [1]  
 


Administration
Sign In