NetDevelopment

About .net development
More asp.net Viewstate filters ...

The background: I've seen a lot of articles lately about viewstate (well, in the last two weeks or so. I'm bad about keeping up with the rss) . Scott Mitchell recently published one article on MSDN all about the viewstate, and (among other things) showed how to send less viewstate. In it he also mentioned that Scott Galloway blogged on viewstate compression using bzip2. Also of note is the Flesk viewstate optimizer.  All of these allow you to send less viewstate to the client, which means that you're saving bandwidth twice -- since the browser sends the viewstate back with the next...

posted @ Friday, February 22, 2008 10:29 PM | Feedback (42)

Glass in Windows Forms

[Update - 9/13/06]  This seems to not work using RC1 - using DwmEnableBlurBehindWindow seems to work fine creating areas of glass, but DwmExtendFrameIntoClientArea does not - you get nothing but a black rectangle.   I'm trying to figure out why and I'll create another post if I do...  if you do, please feel free to comment here or point me to your posting!    I've seen a fair number of questions on using Glass in Vista forms, and I've seen a few answers as well.  However, the answers I've seen involve using Windows.Forms transparent forms support [1].  There's a big downside...

posted @ Wednesday, September 13, 2006 4:57 PM | Feedback (2)

Leaky abstractions can be great

  I’m sure you’ve heard the term “law of leaky abstraction”, apparently put forth by Joel Spolsky (if you’re unfamiliar, please go read it – it’s worth your time). Lots of people have blogged about what leaks, what doesn’t leak, why things leak and so on. To deal with this, people often are in search of creating a “cleaner” abstraction layer that doesn’t leak. And how many times have you seen an internal framework that took way too long to create – time spent refactoring to keep it “clean” by hiding the underlying system ? I think this is a big mistake… Let’s...

posted @ Saturday, July 15, 2006 3:47 AM | Feedback (0)

Heartland DC over

I'm not dead.  I just don't publish many of my posts, becase they seem.... pointless after I write them. Anyway, I just got back from the HDC, and it was lots of fun.   The pre-party the night before, the keynotes by Roky Lhotka and Andrew Troelsen, lots of great sessions, and other cool things.   I hope I can make it next year, surely, and for all you people who missed it - sign up next year as soon as it's announced.... this conference has sold out every year, and fast!  Joe Olsen told me there were over 100 on the waiting list for...

posted @ Friday, October 14, 2005 11:20 PM | Feedback (0)

VS.NET 2005 - Now supporting multiple languages... For the first time!

Back in February of '04, I posted “.Net says - multiple languages supported. VS.Net says - don't try it“.  A quick response by Paul Vick showed that it would probably never be fixed for Visual Studios 2002 and 2003 - but that they'd work on it for Whidbey.    Alas, the beta 1 and multiple CTPs came and went, and the bug continued.  However, I am happy to report that in VS.NET 2005 Beta 2, the problem seems to have been resolved.  My test case now works, and I'm a happy camper. Thanks to the background compilation teams for c# and vb.net!  While...

posted @ Tuesday, April 19, 2005 4:49 PM | Feedback (0)

C# 2.0's Generics - Are we missing some constraints?

I really do like the “Whidbey” generics for both C# and VB.net.  In my opinion, they bring a good solution to some problems with gaps in strong typing to the .net family.  Great stuff, really. However, I'm not happy with one of the constraints on constraints.  I'll endevor to explain.  Hopefully this is either addressed or (at the least) acknowledged by those in the know.  (Or, if I'm an idiot, feel free to let me know in comments) For a good background on C# generics, see this article on MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/csharp_generics.asp Okay, so let's say I have a generic collection that sorts items:1public class SortEx<T>2{3   ...4    public void...

posted @ Thursday, February 17, 2005 4:19 PM | Feedback (1)

MSDN Universal (-ish)

Rob Caron and Buck Hodges discuss a newsgroup post by Ajay Sudan discussing how Microsoft subscribes to one of the multiple-universe theories...  That is, MSDN Universal subscriptions will become “most” of the software a developer needs, and then you can buy additions to make it complete. Huh?  Let me look up the term “Universal”.  Now, I'm not whining about the cost (well, maybe I am) - I pay for a universal subscription out of my own pocket because it's worth it to me - I know that with that yearly fee, I can go into any client site and have the software...

posted @ Wednesday, January 26, 2005 3:31 AM | Feedback (2)

Smart tags are really, really obnoxious to actually use.

I am sure that VS2005 will improve before release, but I'm fearful that smart tags are the way its going to be..  I've been trying to say it in comments, newsgroups and Ladybug, and I'll say it again here: SmartTags are not productive in the code window.  Bold ( and italic) statment?  Perhaps, but true as well. The Smart Tag has one great feature - it's a visual cue that some action is available on a piece of text.  However, actually using that action takes way too many steps.   1) click the text.  2) Hover over the tiny sliver of an icon under...

posted @ Wednesday, December 15, 2004 1:30 AM | Feedback (0)

CAS's Full Trust - How I hate that name...

[Update 12/14/04] - Because I get a lot of Google referals where I'm a #1 or #2 result looking for how to give a network share full trust with CAS, I'm adding how to actually do it, rather than just complain about the name. So, to give a network share or mapped drive full trust, execute the following at a .net command prompt: caspol -q -machine -addgroup 1 -url file://z:/* FullTrust -name "Z Drive" This will give anything on the “Z“ drive full trust, make the name of the rule “Z Drive“, and put this at the machine level (applies to all users).  You must...

posted @ Tuesday, December 14, 2004 1:55 PM | Feedback (0)

Intellisense Woes. Please Help

I have a problem with Intellisense (no, I love intellisense, I just want it to quit making me type more at times) Create a new windows project.  Add a textbox to the default form.  In the code for that form, create a method.  In that method, do the following: Type  “TextBox1.TopLevelControl“. Press Enter Delete the line that we just typed in. Type “TextBox1.Top=“. There's the problem.  Note that when you hit “=” (or space, or whatever), your line was changed to “TextBox1.TopLevelControl” Ack!  Top is short.  I can type it in.  But now I must hit “.Top<escape>“ or “.Top<up arrow>“ instead.  Makes it really annoying when you're...

posted @ Tuesday, November 30, 2004 1:26 PM | Feedback (2)

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

posted @ Sunday, October 17, 2004 4:15 PM | Feedback (24)

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

[Updated again 8/12/04 (yes a bit late)] - added beta 1.[Update 5/30/04] Versions affected by this bug: VS2002 (all betas and RTM) VS2003 (all betas and RTM) Whidbey PDC bits, VS2005 CTP1, VS2005 CTP2 and also VS2005 Beta 1 Here's to hoping they can fix it.  I know it's not easy (kudos to Paul Vick for admitting that it was a mistake, and thanks for the extensive explanation) - so I'm not sure if they'll have the time. But I still hope. 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...

posted @ Thursday, August 12, 2004 6:17 PM | Feedback (18)

Exceptions are not exceptional

Okay, this is all about exceptions... as in try/catch. This is not a technical post, but a subject that I have pretty strong feelings on. Please let me know if you disagree -- It may be hard to change my mind, but I'm glad that people still try. Here's the meat: I'm really sick of seeing and hearing people claim that exceptions are for exceptional cases. I'm equally sick of people claiming that exceptions are for errors. I believe strongly that neither is the case. What an exception means is that something happened inside a section of code that was...

posted @ Wednesday, July 21, 2004 5:58 PM | Feedback (5)

Unit testing in VS2005 - But Why?

So there's that petition going around, and lots of people have “agreed” (see the trackbacks section on that comment for lots of people who agree)  Now, don't get me wrong, I want it there for all versions too.  But saying “Microsoft should put this feature in all versions” is like saying “Macromedia should include flash mx with dreamweaver”.   Sure, it'd be nice.  But it's not like this is some taxpayer-funded initiative. VS2005 is a product put out by a business.  Having different versions with different featuresets at different prices are one way that they try to make sure to maximize thier sales...

posted @ Monday, June 14, 2004 2:13 AM | Feedback (5)

It's a great day to create services...

Why is it such a great day to create interoperable services, you ask?  Well, (thanks to Dave Bettin for the heads up!) because WSE 2.0 has been released. Let's just say that I'm extremely excited. Take-a-day-off-and-play-with-this excited.  I'm a bit bummed that there's no WS-RM, but at this point, you won't hear me complain.  I will say this -- I really  hope that the next release cycle is a wee bit shorter.  WSE is the “speedboat” for WS-I early adopters -- here's to hoping it stays off the reef.

posted @ Monday, May 24, 2004 3:00 PM | Feedback (0)

Create context menu items in IE (a wish from cerkit.com)

I was reading Michael Earl's blog (aka The Cerebal Kitchen) this morning and came across his “Idea brain dump”.  One of the items caught my eye, and so I decided to make it happen...  That is, the “mark a url for followup” idea. The basic idea is to make a right-click (context) menu item appear when you right click on a hyper link. This menu item would then add a task to your task list to follow up on the link you clicked.  The scary thing is, I don't think people realize just how easy it is to add context menu items...

posted @ Thursday, May 13, 2004 1:04 PM | Feedback (16)

Trying for a 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...

posted @ Tuesday, March 30, 2004 12:48 PM | Feedback (8)

Say goodbye to unsightly SourceSafe residue

Visual Source Safe.   I cringe whenever a client site is using it.  Let's face it, when VSS 6.0 came out it was an acceptable product for its time (what was that.. 6 years ago? 7?).  It was pretty good for VB6 developers working alone or in small teams.   But VS.NET isn't  VB6.  The methodologies of development are different... unfortunately VSS treats them as the same. One of the things I hate most about VSS is actually issues with VS.NET's SCC integration -- the crud that VS.NET puts inside project and solution files when using source control.  (Unfortunately, VSS's standalone client does the same thing for...

posted @ Saturday, March 27, 2004 3:38 PM | Feedback (0)

Go Get It.

You know you want it.  Go Get it. [Visual Studio 2005 CTP, that is]

posted @ Thursday, March 25, 2004 6:27 PM | Feedback (1)

.Net bugs - what do you do with 'em?

Okay, so I have found this bug (no, not this one) with ASP.NET 1.0 and 1.1.  What do I do with it?  It can be worked around, so there's no point in burning a call to PSS and looking for a hotfix... but then I don't see anything about it in the MS Knowledge Base.  I haven't seen anyone discussing it in the blogs, or on newsgroups -- even on the web.  So what do I do with it? It seems to be fixed in the PDC drop of Whidbey, but do they want to know about it? Do they already know about it? ...

posted @ Tuesday, March 23, 2004 1:42 AM | Feedback (0)

ASP.Net Bug: CheckChanged event firing incorrectly when checkbox held on a disabled datagrid row

Symptoms When a checkbox is housed in a datagrid's templatecolumn, that checkbox has the AutoPostBack property set to true, and the datagrid's row is disabled, the checkbox will fire its CheckChanged event on any subsequent postback even though the row's state did not change. More Information Steps to reproduce behavior Reproduction solution here.  Extract all files to a directory and set up that directory as a virtual directory in IIS named "DisableBugRepro". If you have a datagrid with the following column definition: <asp:TemplateColumn> <ItemTemplate> <asp:CheckBox AutoPostBack="True" OnCheckedChanged="CheckChanged" Runat="server" ID="chk" /> </ItemTemplate></asp:TemplateColumn> And you are: Setting the checkbox's checked propery in the DataGrid's ItemDataBound event Disabling a row Then on the next postback immediately...

posted @ Tuesday, March 23, 2004 1:41 AM | Feedback (1)

Solve the real problem, not the solution's problems (and a quick example with IMessageFilter)

There are many, many tools in the .net framework that are there to help solve specific problems that developers may need to overcome.  The big problem is knowing when they are there. For me, a great example of this is a problem that I used IMessageFilter on. I didn't realize how neat this feature in the Windows Forms framework is, until I had an "off the wall" request from a friend. They had this small application that they created, and they were doing frequent training on it. What they wanted to do was highlight each control (textbox, listbox, label, etc)...

posted @ Friday, March 05, 2004 10:05 PM | Feedback (3)

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

posted @ Wednesday, January 28, 2004 10:32 PM | Feedback (1)

WaitHandles for the confused.

AutoResetEvent and ManualResetEvent - using WaitHandles This comes from a quick writeup I did for a group of intern and entry-level developers on an internal project (project [codename] -- yes, that's the real name). This particular project had a number of threads working on some various tasks and used WaitHandles in one critical section. Although most of them didn't need to work with the threading stuff ever, I still got questions on it. I wanted to encourage them all to understand everything -- especially if they took their own time to look at it -- so I wrote this (quickly). It's...

posted @ Tuesday, January 27, 2004 7:16 PM | Feedback (5)

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");//orcntrl.DataMember("MyTable"); Instead of using the table's name as a string, use the .TableName property as such: dAdapter.TableMappings.Add("Table1", typedSet.MyTable.TableName);//orcntrl.DataMember(typedSet.MyTable.TableName);   Now you can rename your table and...

posted @ Wednesday, January 21, 2004 1:57 PM | Feedback (2)

Don't loose this regex

I really wish I knew where I found this... but after only an hour of digging in my old code, I found the regex to deal with CSV files (that is, handle both quoted and non-quoted values, commas in quoted values, etc). I know I didn't write the regex pattern. I also know I don't want to lose this and have to try. // ,(?=([^"]*"[^"]*")*(?![^"]*")) Regex rex = new Regex(",(?=([^\"]*\"[^\"]*\")*(?![^\"]*\"))");string[] values = rex.Split( csvLine );foreach( string v in values){   ...} If you have an attribution for me, please let me know. I'd like to give credit to the regex author. [update] - yes, it was...

posted @ Friday, January 16, 2004 11:05 PM | Feedback (1)