Public musings, often on software development RSS 2.0
# Wednesday, October 15, 2008

I ran into some code today which caught me off guard.  In the event handler for the Exit menu item was the command:

Application.Current.Shutdown()

(Note I've omitted the ; for C# syntax vs VB)

Now traditionally I've always used:

Close()

(I've omitted the 'this' or 'me' as well as the ; for those looking for language specifics...)

So is there a difference and is one better?  Well there is definitely a difference and in my opinion each is definitely better in a certain scenario.

The core similarlity is that both need to be called from your main application window thread in order to shut the application.  Thus calling close on a dialog doesn't shutdown your application, although calling shutdown from your main thread even in a dialog will...  each will also call all the appropriate events for closeing windows and disposing of objects.

The core difference comes down to how your main application thread responds to the events which are fired as it prepares to close.  The Shutdown command is unstoppable the app will close regardless of what one of the event handlers attempts.  However, the Window_Closing (in WPF) event allows you to update the status of the CancelEventArgs (e) to indicate that the shutdown should be prevented.  Thus if for example the user asked to exit and then the app said "but you have unsaved changes Save, Continue, Cancel?" which is something typically caught in the Window Closing event (since it's triggered when you click that cute little X in the upper right corner to close your window). 

The problem - if you've called Shutdown, it doesn't matter if the user says - "Cancel" your app is slamming down. 

Thus unless you are attempting to handle a sudden error condition ("Must stop now to avoid corrupting data.") you probably want to rely on the Window.Close() method instead of the Application.Shutdown method.

Wednesday, October 15, 2008 4:05:55 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] -
.NET | Technology | Visual Basic
# Tuesday, October 14, 2008

Well in theory the correct title for the group is the ASP.NET Special Interest Group of the San Diego .NET Users Group, but that didn't flow in the post title.  I'm speaking at their meeting on the 21st in relation ot SharePoint and ASP.NET.  Here's the description of the session I'll be doing:

SharePoint and its feature enriched cousin Microsoft Office SharePoint Server (MOSS) are becoming a standard part of company web properties.  As such ASP.NET developers need to understand how to create custom applications which can leverage this Microsoft product.  This presentation is going to look at setting up a shared SharePoint and ASP.NET development environment.  It will then look at debugging for custom workflow applications and examine a custom ASP.NET Web Service which leverages the OpenXML office document format to generate a Word document on the server and add that document into a SharePoint document library.  The presentation will leverage the Sales Forecast OBA code base which is publicly available on CodePlex with a focus on the ASP.NET , Visual Studio 2008 and SharePoint integration.  

 

The meetings are held at the Microsoft San Diego offices in La Jolla.  For more information go to their website at:

http://www.sandiegodotnet.com/Meetings/ASPNETSIG/tabid/59/ctl/Details/Mid/387/ItemID/113/Default.aspx?selecteddate=10/21/2008

Tuesday, October 14, 2008 4:38:38 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] -
.NET | Technology
# Friday, October 10, 2008

One of those things that just make me shake my head...

I have a computer I keep in the company domain.  Someone or something (I don't know who or what and to be honest don't care enough to find out, just enough to document the insanity) appears to have created a policy either at the domain or on my machine that automatically resets the default printer to OneNote.

For starters this is bad because it means that even though I go to the effort to make Printer 'x' my default because it's close to my office, the next time I restart, I instead have my default printer reset to OneNote... which is pretty annoying.

But a better question is why given that I already have an electronic copy of whatever it is I want to print I would want to print it to One Note.... so I could have an electronic copy... 

More importantly it pretty much kills all those nice print short cuts MS put on everything where I can with a single click print whatever I want to my default printer... but, nope doing that just causes my system to pause while OneNote starts - wasting my time - so I can shut OneNote - wasting my time - and go through the full multi-step process of selecting a printer - wasting, well you get the point.

I hate to think that it's just the act of installing OneNote that does this...

http://connect.microsoft.com/onenote/feedback/ViewFeedback.aspx?FeedbackID=363469

Friday, October 10, 2008 3:02:16 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] -
Musings
# Monday, October 06, 2008

Monday, October 06, 2008 11:43:28 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] -

So after quite the busy Spring I needed some downtime so I haven't posted in a while.  I was all set to restrart posting back in September with a post that will be coming online here shortly but although I had done the work, things got hectic and so posting was postponed. 

Well it's time to get rolling again.  I have the book I finished at the start of Summer coming out in the next couple weeks, I've got the cover article for this months SQL Server magazine, I'm speaking at the ASP.NET User group here in San Diego on the 21st, and then again at Code Camp in LA prior to PDC.  I don't have a ticket to PDC, but if you want to offer me one I'd be happy to take be there.

So over the next day or so I'll get a nice technical post on Silverlight 2 Beta 2 in place and a short post on how I'm losing weight (and you can too :- ) and generally start things going here on the blog again.

Monday, October 06, 2008 11:23:53 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] -
About the Nerd
# Wednesday, June 18, 2008

Another of those diseases which doesn't get nearly enough coverage given the number of people it effects each year is Melanoma.  This article talks about how by useing a patient's own blood cells and essentially cloning them and reinserting them they can attack an otherwise potentially fatal cancer.  http://www.breitbart.com/article.php?id=080618212711.38ht6zq0&show_article=1 Some of the stuff that is going on in medicine today is just amazing.

Wednesday, June 18, 2008 4:56:24 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] -
Musings
# Saturday, May 10, 2008

I wanted to make a quick shout out to my favorite 'new' kids television show.  As with every parent of a toddler you go through a phase where you get inundated with kids shows.  Some like Teletubbies or Barnery are pure torture (My son doesn't watch these shows).  Others like the new Mickey Mouse club are instantly appealing and for an adult at least watchable (the first 3 or 4 times for a given estimate, after that your brain still turns to mush).  Of course in posting this I'm admitting that my son (age 2) watches TV - which is of course the root of all evil according to some.

However, this post is focused on my favorite of today's current array of morning kids programming.  In the preceding paragraph I mentioned shows that are rather old, and I don't want compare say Barney to 1970's era Captain Kangaroo.  Different eras have different shows.  The first thing I learned about modern pre-school kids TV in the morning is that there are two definite leaders - Disney and PBS Kids.  I know several of you probably think I've missed both Cartoon Network and Nickelodeon.  I didn't you see Disney and PBS both follow a minimal advertising model for the morning stretch.  Admitedly PBS keeps that model 24hours a day but to me the fact that Disney has matched this model from 6AM through Noon is impressive.

In general Disney has a better set of shows when it comes to the combination of entertainment and education.  By this I mean that when I consider the shows my son pays reasonable amount of attention to the Disney shows keep his attention while several of the PBS shows while potentially more educational are met with 'no- no' meaning - take me back to Disney.  After all one of his favorite shows is the Mickey Mouse show and Mickey's appeal is great and the show includes things like counting, shapes and colors.

That's great however last fall Disney and PBS Kids each 'introduced' from my standpoint a new show.  On Disney the new show was Bunny Town.  It was preceded by weeks of over-promotion telling us how great it would be. As usual the overwhelming hype was indicative of just how weak the show was.  On the other side although to the best of my knowledge there wasn't overwhelming publicity, but PBS Kids introduced a show - the only show which we can switch to even against a showing of Mickey.

By now if you recognize the title of this post you know that show is Word World.  This is an awesome show, they introduce the idea of building words from letters.  The computer graphics not only create characters but literally use the letters to create the object they describe.  For example the Dog character is an adaptation of the letters Dog with legs, ears, tail etc. added.  The letters don't just disappear or appear they are used to create objects and the graphics are of the type you could only create in the past couple years. 

I have no doubt but that watching this show feeds into the fact that my son knows all of his captial letters (note reading books and playing with letters in the tub and talking about them elsewhere - including license plates - also plays a big role , not to mention that my son is surprisingly bright.) At any rate, the show is well produced and you can check out their site including a sample episode at: http://www.wordworld.com/

To view the show's opening scene head over to PBSKids.org (http://pbskids.org/wordworld/video/montage.html?load=montage1) or to get a feel for how the characters behave check out the embeded video below - although it omits the rich animated scenery and just focuses on the characters and building words.

Saturday, May 10, 2008 10:11:35 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] -
Musings
# Friday, May 02, 2008

This is one of those musing posts and comes from one of the challenges I have when teaching a feature that Microsoft chose to call 'Generics'.  I think this name was picked by someone, who while reasonably familiar with English wasn't a native speaker of the English language.  Thus they found a definition and thought it applied - allow me to elaborate.

What is a .NET Generic - well in short - under the original implementation of .NET collection classes contained a set of other objects.  However, these classes didn't know specifically what kind of object they contained.  Instead a given collection might contain more then one different type of object, for example numbers stored in a collection with strings and image objects.  It wasn't possible to say thata given collection would contain only a specific type of class. 

With the introduction of 'Generics' it was possible to indicate that a given collection would only contain a specific type of object.  That's right the feature Generics describes a set of rules and syntax for ensuring a collection is of a specific type.  Now the challenge comes from how the definition of generic is phrased in some dictionaries: "Relating to or descriptive of an entire group or class"

Notice that the preceding definition basically associates the definition of a generic with a class.  Thus if you were searching the dictionary for a word that described a class - well there you have it.  Unfortunately this use of the word "class" doesn't relate to the use of the word "class" in object oriented programming.  In this use a class is more of a category of like items - not the definition of a single item. 

Webster's Revised Unabridged Dictionary - Cite This Source - Share This

(http://dictionary.reference.com/help/web1913.html)

Generic

Ge*ner"ic\, Generical \Ge*ner"ic*al\, a. [L. genus, generis, race, kind: cf. F. g['e]n['e]rique. See Gender.]

1. (Biol.) Pertaining to a genus or kind; relating to a genus, as distinct from a species, or from another genus; as, a generic description; a generic difference; a generic name.

2. Very comprehensive; pertaining or appropriate to large classes or their characteristics; -- opposed to specific.

Webster's Revised Unabridged Dictionary, © 1996, 1998 MICRA, Inc.

 

That's right the word I most frequently use to describe the feature Generic is the one which defines the opposite of the definition of the word generic....

I don't think Microsoft can really do much about this, it's just one of those things that make you wonder...

Friday, May 02, 2008 11:46:25 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] -
.NET | Musings
# Monday, April 21, 2008

So officially it's not yet an option, after all the San Diego Chargers are still working with the city (suburb) of Chula Vista to keep the Chargers football team in San Diego County.  And of course the Chargers spokesman has officially denied it... http://www.sportsbusinessdaily.com/index.cfm?fuseaction=sbd.preview&articleID=120164 (account needed for full article - but the headline says it all)

However, if Chula Vista 'stumbles', one environmental suit or negative ruling in the next two years, and lets face it the Chargers are moving to Los Angeles and this brand new, very fancy stadium.  Construction should be ready to begin in 4Q of this year and my guess is if it does and if the inevitable challenges to the Chula Vista site arise - "Los Angeles 'super' Chargers" will be the new theme song...

http://www.losangelesfootballstadium.com/

I easily could be wrong but let's face it if there wasn't already a sequence of events (or perhaps more than one) that would result in a team moving here, this idea would be crazy.  Fact is, IMHO that's what you would have to be to think that this isn't the future home of the Chargers.  BTW, check out the background color scheme - which NFL team has uniforms in Baby Blue?  Heck another story even has Roski on the record as stating that the team moving could play in other LA venues for 2009, 2010 till this place opens in 2011.

Monday, April 21, 2008 2:05:07 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] -
Musings
# Thursday, April 17, 2008

This is one of those 'hey look at me' posts that always make me feel like... well if you recognize the title of the movie that the quote which is the title of this movie comes from - that pretty much sums it up.

Anyway a few 'ads'. 

First off, I have a new article available over at SQL Magazine.  It's a very introductory article to LINQ for SQL so if you are looking for a good starting point for just getting started with LINQ, here's a short article that might be of assistance: http://www.sqlmag.com/Article/ArticleID/98205/sql_server_98205.html

The second item fits the post a bit better.  Back in the first Quarter I signed on to do another book - yes my wife is ready to kill me - which since she is pregnant get's the pregnancy multiplier (we're currently around 7 or 8 so the danger level is getting pretty high).  At any rate if you are interested it's still way out in the future - like October 2008 - if "we" (me) make "our" (my) final due date - here is the page: http://www.amazon.com/o/ASIN/0470377313/105-1544171-6096430

As you can note on that page this next book is an Office Business Applications book.  Of note, it will have both C# and VB samples (ok VB sample - but more on that later) and covers using WPF with Outlook Form Regions and Excel not to mention server side document generation.  That's the good news - the bad news - well I'm late on my chapters - of course that's pretty typical for me - the question is can I catch up in the next few weeks - especially given the increasing pregnancy multiplier...

Finally, I thought I should mention that my last book is finally getting read to be available.  At 1600 pages it pretty much is a phone book, and it should ship for the first week of May which apparently is fast approaching: http://www.amazon.com/Professional-Visual-Basic-2008-Evjen/dp/0470191368/ref=sr_1_1

 

Thursday, April 17, 2008 5:27:25 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0] -
.NET | LINQ | SQL Server | Technology | Visual Basic | VSTO
Archive
<October 2008>
SunMonTueWedThuFriSat
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678
About the author/Disclaimer

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

© Copyright 2012
Bill Sheldon
Sign In
All Content © 2012, Bill Sheldon