/// Frank Hagen: Professional Web Developer, C# User, Reformed Über-geek RSS 2.0
# Friday, March 09, 2007

Some background:  A few months ago, I decided to put a little AJAX in an app I inherited.  The problem was a huge form that used post-back to fill some dropdown boxes based on values in other elements.  I coded the AJAX all from scratch, or near scratch anyway, mainly because ATLAS was still in early beta and this is a 1.1 app.  Anyway, everything worked well enough, or so I thought. 

This is where good end-user testing is so important.  You see, since I inherited this beast, I don't know how everything is supposed to work.  Some of the nuances are not always apparent to me and I might miss them.  For example, when creating a new form, a set a parameters will autofill the main form.  When I inserted my AJAX streamlining and tested, everything worked great from my perspective, a new form was created with some of the values prepopulated.   What I didn't realize was that the dropdown list was not being read correctly by the codebehind, because from it's perspective, it was empty the last time it saw it and was not reading the form post value.  I don't know yet whether this is my fault or the friendly designer who wrote this screaming... thing, but the end result is that not all of the values were filled that were supposed to.

So here's where my post title comes in:  When I put the AJAX calls in, I did not change the code-behind.  I simply added my JavaScript and disabled the elements' autopostback attributes.  When developing systems I don't understand, I make as little impact as possible and comment like hell, so someone can come in behind me and fix what I broke.  I also CYA in comments for who requested what changes and why.  Fixing broken code reminds me constantly about the importance of good commenting, despite that I don't do very good job of that in my original code.  Anyway, the implementation of some business logic features and these got rolled up, tested of course, and deployed late yesterday.

Well, this morning I get a frantic call and a HD Ticket:  Yep, the form is not populating all of the values.  It needs to be fixed immediately!  And behold!  It only took 15 minutes to find the cause and simply turn on the autopostback and disable the JavaScript.  All in the aspx file!  If I had removed or commented the methods in the code-behind, I would have had to recompile everything and risk version conflict; I had started on the next set of changes, of course.

So there's a lesson here, I think.  Although it is not the most efficient coding technique in the world, there is ample reason to not remove a method that you think is unused, especially if you do not understand the total impact of a change.  Let it sit there, all it is hurting is a tiny amount of overhead and some compile time.  This time it really saved my bacon!  Next time it will probably bite me.

Disagree?  Send me your exeriences in comments!

Friday, March 09, 2007 1:50:44 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
.NET | AJAX | Programming | Work

Once again it is time for me to rail against the ignorance that is Daylight Saving Time.  But I will spare the vehement accusations of stupidity of the whole system and concentrate on our state of resolution.

I have always advocated removing DST entirely and possible all American timezones as well.  Why not simply use GMT?  It's all just arbitrary numbering anyway; after all, I use 24-hour time myself.  Anyway, the U.S. Congress, whose record of learning valuable lessons from the past include issuing yet another dollar coin the size of a quarter after the last two incarnations failed, decided to change DST this year.  But instead of a move toward elimination, they decided that it should come 3 weeks earlier and last longer.  I think it is now the norm, not the exception!

"Who cares?", you say?  How about every IT shop that does any business on this continent!  I will be working on Sunday to ensure all of my systems don't mysterious choke because of syncing issues, as will every other responsible admin and/or developer that has servers in this country.  Hopefully, it will only be the 30 minutes it takes to validate functionality, but who knows.

Sometimes I am SO proud to be American.  Yeah, whatever...

Friday, March 09, 2007 10:51:43 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Politics | Rant
# Thursday, March 08, 2007

Came across this freaky site today.  http://imminst.org/  I wonder if TC is a member?

Thursday, March 08, 2007 1:58:36 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Life
# Wednesday, March 07, 2007

Here's a fun thing to do at work, but only if you sit close enough to the microwave with the numbers that don't work so good:

When you finish zapping your stuff.  Discreetly hit the '1' button as you close the door.  The next person to use it may not clear the keypad before entering their time and be surprised when their lunch goes for 12 minutes instead of 2.

Ha!

Wednesday, March 07, 2007 11:58:56 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Life

Or just (Democrat) politics, as usual.  Only days after Gore conspicuously accepted the Oscar for An Inconvenient Truth, a propaganda piece on energy depletion, ABC News exposes Gore as a incredible hypocrite.  It seems that Mr Environment uses 20 times the amount of energy as the national average.  While I don't condemn him for that practice, despite a personal feeling that it is a ridiculous inefficiency, I do find him in contempt of humanity and desire his public exposure as a fraud.  This is the politico that is constantly harping that I, and you, are destroying the planet through frivolous activities as driving to work and heating our homes.

Shenanigans!!  I am calling Shenanigans on Al Gore.

The man is a dratkcuf.  If I find out that he was behind the DST embarrasment, I just may have to start a crusade against the corrupt bastard.

Wednesday, March 07, 2007 8:59:58 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Politics | Rant
# Monday, March 05, 2007

Yep, John Scalzi's latest is ticked off the list.  I have literally read all of his fiction to date.  (Well, I only listened to The Sagan Diaries, though I am glad I didn't waste my limited reading time on it.  I didn't even listen to all of it, it was a bit too much fanboi for me.)  Don't let the goofy cover art or the odd name dissuade you, The Android's Dream is right up there with the rest of Scalzi's titles in quality and enjoyment.

The story of Harry Creek, UNE Diplomat and retired Combat Veteran, follows the mystery of the Evolved Lamb, the hostile alien nation of Nidu, and a chase through the galaxy.  Creek is the only one with enough answers to unravell the tangle, at least with the help of his rather unique AI.  As the opposing factions start closing in, it looks like there is no way out, but for an interesting twist hinted at by the Churches secret AI that brings the whole mess swirling into a very interesting climax.

Scalzi's 3rd major novel has absolutely nothing to do with the previous two books.  TAD stands alone, so far.  It is the story of inter-system intrique in the style of Robert Ludlum, with the humor of Christopher Moore, and the sci-fi flavor of Robert Heinlein.  Good, not great, plot twists mixed with just the right amount of believable future tech make a balanced story that I really enjoyed.  I was very impressed by the InfoSys tech that Scalzi invented for this book, seeing as I am in the industry and he is not.  Some cute holes, but nothing to gripe about.  Well, done, John.  I am still a fan!

Did I do a review of Agent to the Stars?  I can't remember.  It was not actually published, but was released as a CC LIT copy on scalzi.com.  It was much later published by Subterranean Press, a niche publishing house, for a limited collectors run.  I did not purchase it, but did read the LIT version soon after getting my IPaq 2 or 3 years ago.

And sorry for the bad review.  Just not on top of my game tonight...

Monday, March 05, 2007 7:38:52 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Books
# Friday, March 02, 2007

I heard from a reputable program this morning that up to 83% of Americans believe that Christianity, including Creationism and the Resurrection, is true.

Yet, strangely, as many as 40% believe that astrology is also true, despite the fact that it is entirely contrary to Christianity.

I know what I believe:  Sometimes it is embarrassing to be an American.

Friday, March 02, 2007 9:02:43 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Life | Rant
# Thursday, March 01, 2007
I Believe...  that all database connections should be opened immediately before using them and closed immediately afterwards.
 
I Believe...  that if you are going to create a data layer, and you should, and you also create a data access layer, and you should, that the connection.open method be put in the lowest level and handled as abstractly as possible.  Yes the connection.close should be called before returning results.
 
I Believe...  that if you open the connection to the database in a method and pass that connection as a variable to another object, you should be shot.
 
I Believe...  that if you open the connection to the database in a method and pass it as a variable to another object, and forget to close said connection, you should be stabbed.
 
I Believe...  that if you open the connection to the database in a method and pass it as a variable to another object, and store the open connection in an ASP.NET session variable, you should be stabbed in the eye.  Twice.  With a spoon.
 
I Believe...  that if you store the results of a large query in ASP.NET session so you can page it back to the user, they haven't devised a painful enough punishment for you yet.
 
 
With special thanks to Blue Collar TV for the "I Believe..." concept.
Thursday, March 01, 2007 6:27:35 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
.NET | Programming | Rant
<%--
--%>
Statistics
Total Posts: 186
This Year: 0
This Month: 0
This Week: 0
Comments: 72
Locations of visitors to this page
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 2010
Frank W Hagen
Sign In
All Content © 2010, Frank W Hagen
Custom DasBlog theme based on 'Business' by Christoph De Baene