This blog has moved!

Check out www.CodeBetter.com/blogs/grant.killian

<September 2008>
SuMoTuWeThFrSa
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011


Navigation

Professional Props...

Extracurricular Props...

Subscriptions

Article Categories



Leaving .Net Junkies . . .

DNJ broke new ground in the .Net community.  What a great forum for ideas and getting involved with .Net.  Donny Mack and Doug Seven pioneered a great .Net portal and I'd love to buy them a beer sometime!

That being said, I'm moving my blog to CodeBetter.com (specifically http://codebetter.com/blogs/grant.killian/ for a few reasons:

  • Brendan and Darrell, two good friends of mine, established CodeBetter.com to give us a bit more control over the signal-to-noise blog ratio, more creative license, and more power over the framework (a war on comment spam, anyone?)
  • DNJ perf and reliability has really suffered (victim of its own success!), making it tougher to post
  • It's going to save me 15% on my car insurance

One of those reasons isn't true, but the other two are true; I'll let you be the judge.

Thanks for everything DNJ!  See you at CodeBetter.com!

-Grant

 

posted Thursday, January 27, 2005 5:38 AM by grant.killian

Insecure Christmas Shopping: Am I Taking Crazy Pills?

I've done a lot of Christmas shopping online this year.  It's perfect for the gift giving I like to do: I prefer to give experiences instead of products because most of the people I shop for don't need more material possessions.  It's all samsara anyway, right?

I've found that many of these experiential type places are small and don't pay attention to online security.  They're asking for credit cards etc without SSL certificates.  That's credit card info in plain text, everyone!  I recall two sites in particular because I called them on the -gasp- telephone to buy gift certificates “securely” instead of over the internet:

  1. Gold Lake Spa (http://goldlake.secure-shops10.com/view_category.asp?cat=32)
    • Great place to relax and visit, terrible place to shop “securely“ despite the word “secure“ in the URL.  It doesn't work with https, either, so this is clearly a case of somebody not spending a few hundred bucks to secure their shoppers' experience. 
  2. St Elmo Hotel (http://www.stelmohotel.com/gift-certificates.html)
    • Another fine Colorado mountain escape, but no SSL on that form action.  Submit at your peril!

When I spoke to these places, they were all very concerned that I didn't want to enter my payment information through their website -- they both explained that they never had anyone comment about SSL and that they figured their sites were as secure as amazon.com.  In the words of the great movie Zoolander: Am I Taking CRAZY Pills? 

I guess I can't really fault the hotel owners, it's whoever set the sites up and gives them technology advice that are really at fault.  As a public service, I'm linking to a good summary of how you can tell if you're in a secure online shopping situation.  Most shared hosting solutions have very reasonable SSL shopping plans, so just because you're a small business doesn't mean you can't be secure.

I suppose I need all the SSL caveats here, to head some of you commenters off at-the-pass:

  • SSL does not guarantee 100% privacy, but it is the standard for secure online communications and relied on by the majority of online businesses.  I read a Dan Brown book about web security to the contrary, but he's a fiction writer after all . . .
  • Yes, I realize my telephone calls could have been intruded upon and somebody could have stolen my credit card info that way. 
  • Yes, I realize my credit card info could be abused by whoever takes my phone call on the other end of the line.

While I realize the odds of somebody intercepting HTTP packets to grab credit card information is slim, it's all in plain text for anybody to see if you aren't in an SSL session.  This is 2004 and the internet and internet consumers should be mature enough to know secure from insecure.  Maybe I'm still up in my ivory tower and expecting too much from the public. 

posted Wednesday, December 22, 2004 6:31 PM by grant.killian

My 2 Cents on MapPoint

Brendan Tompkins praises MapPoint Web Services; I like the product too, but I'm not sure about the price point (our usage is small enough right now that our MSFT partner status lets us use it for free).  We'll have to see how that shakes out.  The functionality is outstanding.

There's a MapPoint blog available, too.  It's got lots of tips for MapPointers out there.

 

posted Friday, December 17, 2004 9:29 AM by grant.killian

Javascript Nostalgia

I have a real soft spot for doing things other people think are hard (or better yet, impossible!); this doesn't mean I always succeed, but it does mean I usually want to accomplish what others think “cannot be done.”  While sometimes that means challenges like this goal for 2006, this tendency of mine really plays well in the software development field.  For example, I cooked up some web drag-and-drop cross-browser javascript code a few years ago and probably more importantly used it as a relevant and intuitive situation in an application (for selecting and sorting from many different types of options).  It involved a lot of conditional logic based on browser testing and so on; I really got my DIV tag on back then.

I came across this cross-browser javascript code for drag and drop from etLux that had me waxing nostalgic over those good old days of javascript mayhem.  etLux's effort is solid and, based on my testing, runs great on Windows OS with Netscape 4 (yes, I still have that!), Mozilla, and Internet Explorer.

I can't find my javascript library for this, but now I don't have to thanks to etLux's contribution. 

posted Friday, December 10, 2004 9:33 AM by grant.killian

Local Alphabet Soup Social Courtesy of Microsoft

Microsoft had a nice end-of-year social for area user group organizers tonight; not just developer focused user groups, but a wide spectrum of technology related groups.  I had a chance to talk a bit with some folks from AITP and ITPA -- a bit of alphabet soup, right?  It gets better, though, as some folks from PMI were there too.  I'm not sure, but I might be leaving out a few acronyms.

I didn't realize the subtle difference in subject matter for the groups before tonight; in my mind, there was “developer focused” groups like WeProgram.Net and HRSSUG and “all the other ITPro sort of stuff.”  It was good for me to begin to see the different facets of each group and know that there's more technology organizations in the Hampton Roads area.

We may pursue some multi-group efforts in 2005, even it's just social stuff.  It was great for Kelly from Microsoft to bring us all together for a few hours -- and for her sister to answer the last minute catering call!

I also had a good chat with a WeProgram.Net regular (and user group connoiseur), Greg P.  On the West Coast, Greg ran a Delphi user group and he has a lot of experience with community building.  We discussed the challenges and rewards of being active in a local programming community -- and how such a small percentage of developers seem to invest time in the user group space.  It's a shame as it's a really underutilized resource in Hampton Roads.  I guess that's a call to action for us user group organizers, right?  We need to find better ways to reach out and get people involved.  Microsoft and INETA have built a good framework for our efforts, and Microsoft is more active in our area (with presentations etc) than ever before. 

posted Wednesday, December 08, 2004 7:34 PM by grant.killian

Post MSDN Event "Pub Club" Tuesday, Dec 14th in Newport News VA

The story for next Tuesday keeps getting better.  We've already got the MSDN event starting at 1 PM at the Regal Cinemas in Newport News (near Kiln Creek), and now I learn that Geoff Snowman and Microsoft will be hosting a casual “pub club” after the formal presentations at 2nd Street Restaurant -- probably starting shortly after 5 PM.  Sounds like a great chance to get to know your fellow .Netters a little better (and since it is a social event, I'm thinking Brendan Tompkins might make an appearance).

Here are directions to 2nd St in Newport News; I understand Microsoft will be ordering some snacks but not providing the beer -- you're responsible for that end of the bargain.  If I only would've saved my MSDN and INETA tequila from TechEd, this could've been the perfect chance to break it out!  Oh well, there's always next year . . .

I'm looking forward to meeting up with some of you next week!

posted Tuesday, December 07, 2004 12:49 PM by grant.killian

One step in the pursuit of fast executing .Net code

We observed sluggish performance in some “proof of concept“ code yesterday; I pealed back the layers of the onion to find what optimizations I could make.  Of course, measurement is a key to doing code optimization; it's how you quantify any progress you're making!  I've had success with the Win32 API for QueryPerformanceCounter (this Microsoft KB article breaks basic usage of QueryPerformanceCounter down succinctly); you could try something with System.DateTime, but the resolution isn't really there for accurate measurement unless you're working with really slow code.  If you're serious about analyzing the duration code takes to execute, I'd get comfortable with QueryPerformanceCounter and consider wrapping it into a quick CodeTimer class for ease of reuse.  Besides, you get to add those slick DllImports and Kernel32 calls to your code!

This particular sluggish code was easy to tune: I replaced inline SQL with parameterized stored procs and, where appropriate, combined SQL statements together to minimize the calls to the database.  The result was much quicker and, incidentally, more secure and maintainable (stored procs are superior to inline sql in nearly every way!) -- the standard sort of thing you do when turning proof-of-concept code into something more production-ready.

I should note that an optimization that didn't improve the performance was switching foreach(x in y) blocks with standard for(i=0;i<n;i++) syntax; many sources will include this optimization as a slightly quicker way to iterate over your collections.  In this case, the loop wasn't executed enough times to factor into the bigger picture.  Again, the only way I know this is because I had a quantifiable way to measure the duration of the executing code -- just eye-balling it or casually observing my human perception of code performance is completely inadequate for the task.

This is just one tactic in the pursuit of fast executing .Net code.  There are numerous other (and often more significant!) steps to take, including hardware monitoring, network traffic analysis, garbage collection inspection (John Robbins from Wintellect first turned me on to this -- check out the Wintellect group blog for their latest insights), and many many more.  There are whole books on the subject, in fact.

So, get comfortable with QueryPerformanceCounter to time your code, but don't rely on it exclusively for optimizing your applications.  Think of QueryPerformanceCounter as a screwdriver in the much bigger toolbox of improving .Net code perf -- it's a very useful tool but not the end-all-be-all of tools.

posted Friday, December 03, 2004 5:44 AM by grant.killian

VA MSDN Events for December

Microsoft's DCC Geoff Snowman just shared two free upcoming MSDN events for .Net developers:

Newport News: http://msevents.microsoft.com/cui/EventDetail.aspx?culture=en-US&EventID=1032258622

 Chester: http://msevents.microsoft.com/cui/EventDetail.aspx?culture=en-US&EventID=1032258636

There both in mid December, so check them out if you can break free of your end-of-year work committments and come out to learn about OO in .Net, MapPoint, and ASP.Net 1.1 and the upcoming 2.0 release.  I know Microsoft pays attention to turnout at these “secondary locations“ -- we're hardly a Washington DC or New York City -- so if a good number of developers come out we'll likely see more events around here. 

I'll be staffing a WeProgram.Net user group table at the Newport News event; Susan or another representative from the Hampton Roads SQL Server User Group may be joining me.  Chester is closer to Richmond so I'm not sure what community involvement you'll see up there.

<guilt target=“Brendan Tompkins“>I'm taking bets whether Brendan Tompkins will show at this event.  He's participated in all the WeProgram.Net fun events, like the cricket match and the bloggers dinner, but he hasn't attended any actual WeProgram.Net meetings.  This MSDN event could be a breakthrough for BT!</guilt>

Hope to see you there!

posted Thursday, December 02, 2004 6:23 AM by grant.killian

A Proud Hungarian [Notation] Heretic

If I still use Hungarian Notation, am I a programming pariah?  A Hungarian heretic?  Part of the Axis of Programming Evil?

Here is why I use Hungarian Notation (HN):

  1. I can quickly determine the type of a variable by glancing at it (I don't have to hover over the variable with the mouse or anything)
  2. I can quickly determine the scope of a variable by glancing at it (the _ for class level, etc).
  3. Our existing code base uses it, and I'm anal about consistency and code uniformity
  4. I've been doing it for so long I seem to “think“ in HN; it comes naturally to me

I know HN is out of fashion and critics say it obscures the meaning of the code.  I've always been a contrarian so I don't care if “all the other cool programmers“ use a style that I don't; and I don't feel it obscures my code.  Given the following code that doesn't use HN:

DataObject.Save( name, birthday ) ;

It may be close to real English, but my analytical side wants more structure.  I wonder: is “name“ a string?  a structure encapsulating both first and last names as strings? a more complex object with first, middle, and last name strings . . . along with culture info etc?  As for “birthday” the possibilities are more numerous: a DateTime?  a simple Date?  a verbose string for a date (like Tuesday, November 30th 2004); it could even be a boolean indicating if the birthday is today or not.  You get the idea.

So, revisiting this with Hungarian Notation we could have:

DataObject.Save( strName, dtmBirthday ) ;  //string and datetime

or

DataObject.Save( strName, dteBirthday ) ;  //string and date (not using time component)

or

DataObject.Save( strName, blnBirthday ) ; //string and boolean

And so on . . .

Now, I don't discredit other coding methods -- I'm just explaining my position on Hungarian Notation.  Use what you're most productive in (even Klingon Notation if you want -- which reminds me of this great Klingon post from a while back).  I think the key element to a coding style is consistency.  When maintaining code written by others, I can get up to speed quickly when there was some standard employed.  If you don't do it for yourself, then think of the children.  Those who come after you will thank you for it. 

I just finished some enhancements to an application written by another company; the app was well designed.  Yes, I avoid jumping on “the previous people who worked on this sucked!“ bandwagon . . . unless they really sucked, that is.  It was smooth sailing except for their failure to name user interface controls in any style -- they just left the designer defaults so we had a huge array of Textboxes named TextBox1(n) or TextBox1, TextBox2 and so on for 30 or more controls (it was a good old tabbed user interface, so lots of room for controls).  This was pervasive throughout the whole 25+ form application.  And no, I don't think leaving controls named to their defaults to be a “style.“  That's just lazy.  Give me a “txtTitle“ and “txtSSN“ any day!

posted Tuesday, November 30, 2004 10:38 AM by grant.killian

Cheap MSFT Exam Vouchers
Amazon is selling Microsoft exam vouchers for the lowest price I've seen -- unless you get them through your company connections etc.

posted Wednesday, November 24, 2004 7:49 AM by grant.killian

Bad Experience With Infragistics & Viral Marketing

Through WeProgram.Net and INETA, I get sent a lot of software to evaluate or experiment with; sometimes this includes a fully licensed version of the product.  Vendors hope I like the product and help to generate a positive buzz for their tool.

Through TechEd 2004, INETA, or some other completely legit source I got a fully licensed Infragistics user-interface suite.  I installed the product in June and explored the samples and thought “Hm, looks interesting.  Next time I'm not doing a plain vanilla user-interface, I should maybe check this out.”  Well, it's November and that time is now . . . I've got a need for a nice numeric up-down control and Infragistics should be the magic bullet . . . but I can't sort through the Infragistics run-time dependencies to make it work on anything besides the demo application installed many months ago.

So, instead of finding how easy and intuitive the Infragistics controls are to work with, I'm confronted with how brittle the Infragistics configuration and setup is to a new user.  I find out how tough it is to get support (unless you pay for support -- but since they gave this license to me free I don't have any payment record), particularly when you don't have the physical license key you installed the product with (remember, that was last June and the Infragistics box didn't live through our recent office move).  I find out how their Knowledge Base search doesn't contain anything for the “Can't Init Editor“ error message I get in the web status bar at runtime.  I find out things like their web Newsgroup area isn't FireFox compatible.  Finally, I glance at the clock and realize I've spent 120 minutes trying to get Infragistics to run outside of their demo application and I probably could've coded my own numeric up-down control in that time! 

You might say that beggars can't be choosers, but if a company is after viral marketing by distributing free licenses of their tools . . . they need to make sure they have a plan for supporting those free licenses or the viral marketing could turn against them.  Infragistics supports the WeProgram.Net user group and that's great, but I've wasted enough energy on their complimentary copy.  I've gotta go roll my own up-down control . . .

posted Tuesday, November 23, 2004 11:51 AM by grant.killian

Canadian work STOPpage STARTS a lot of work for me

Too bad there isn't a Dependency Tool for non-programmatic dependencies!

The Work Stoppage for UPS Canada created a lot of high stress work today with our ecommerce customers and, specifically, the code that calculates shipping dynamically with UPS.  Whew.  We've got a few big customers who do a ton of online business around the holidays and this Canadian labour issue blind-sided us; I guess the lesson is to stay tuned in to all your application dependencies . . . code-based and otherwise.

I suppose this boosts the priority of the integrate with FedEx line item on the todo list.  It's not as cut-and-dried as it sounds because UPS has a nice package called WorldShip that automates package labeling and tracking numbers etc.  We've got a few nice integration points with UPS WorldShip and, frankly, we've not seen the necessity to pursue FedEx integration -- we'll see where things stand in a week or so but I may be exploring the FedEx integration options very soon.

posted Monday, November 22, 2004 8:03 PM by grant.killian

Developer Office Decor Help

We're in the process of moving our offices and my new workspace has two features I'm really psyched about: a set of windows (yes, multiple windows) and a door I can close to be free of distractions.  I haven't had a door on my office for years (since I moved from DC) and I already feel more secluded and, in my opinion, productive.  I may stop working from home so much now that I can concentrate better at the office.

My new office is, however, bereft of any decorations or furnishings besides a desk, computer, chair, and a big whiteboard.  I'm looking for suggestions for ways to turn my space into something fun but still productive.  I have 100% artistic license, meaning I can paint, drill, weld, or whatever it takes (we own the building so there's no landlord and we'll likely be here for ever).  I've only got about 200 sq feet, so space is a big issue. 

I have a blue training board for climbing which I'll likely put above the door, but I'm seriously considering putting a full bouldering wall in.  The ceiling is sloped at a 45 degree angle; 10 feet high at the shortest point, 20 feet high at the tallest point.  It would be cool and a great way to take a break from thinking too much about code.  The downside to the bouldering wall is “how much use will you really get out of that?” and “what if I fall and break lots of stuff?” I don't know the answer, but I'm tempted to try it and see . . .

Other things I've thought of include plants, a water fountain, fish tank, comfy furniture, some lamps (right now it's overhead fluorescent lighting), etc. 

Please send me any thoughts you have on personalizing this 200 sq feet of developer space!

posted Friday, November 19, 2004 1:21 PM by grant.killian

Stop baking strings for UI display into your code

I like resource files.  I can put all the strings that are displayed to the user in my application into one easily modified resource file.  How many times do you demo an application and the customer says: "can you change this message to say X instead"; or worse: "There's a typo in this text."  Customers often have long lists of these sorts of minor changes to the text of an application.  Instead of using search and replace, which can involve touching many different pieces of the application (and trigger a new round of unit and/or acceptance testing) if you've used a resource file to store these strings you can make all the modifications in one place without impacting any source code -- sort of like a configuration file for application constants.  The kicker is you can compile alternate versions of the "constant files" and substitute them into your application without having to recompile the whole thing.  MSDN has the steps on how to create a "resource assembly" as this compiled external resource file is known.

If you're just getting started with resource files, it's easy.  Add a file of type "resx" to your VS.Net project (in the New File dialog box for VS.Net it's under Add->New Item->Resources->Assembly Resource file.  VS.Net presents the resx file in Data or XML view, the Data view is easiest for entering simple strings of text.  The "Name" column is the "Key" with which you'll lookup your strings; the "Value" column is the string associated with the key.  This tabular view in VS.Net makes working with these strings a breeze.

Once you've got a test string in there, your code can access the strings by creating an instance of the ResourceManager type (add a reference to System.Resources):
    static ResourceManager resMgr =
        new ResourceManager( typeof( myClass ).Namespace + ".ResourceFileName",
        Assembly.GetAssembly( typeof( myClass ) ) ) ;

Note that this constructor takes two arguments: the name of the resource file (like Namespace.Class) and the assembly containing the resource file.  I'm using a little Reflection to dynamically determine the assembly name, but you could hardcode it, just be sure to reference the System.Reflection namespace to access the Assembly object from your code.

In your code, to access a specific value from the resource file use:
    resMgr.GetString( "MyKey" )

You'll want to replace "MyKey" with the key in your resource file.  Now you can have your validation messages, exception handling text, etc all originate from a single resource file for ease of maintenance and sanity when it comes time to update or modify the text.  No more "magic strings" baked into the fabric of your code -- and for real decoupling of these resource files from your code, check out the Resource Assembly approach I referenced earlier.  Critics may point out that the “Key“ of the Resource item is a form of baked-in string for your application -- but it's one that you will never have to change and never is displayed to a customer, so in my opinion, that sort of baking is acceptable.

This should be enough to get you started with Resources.  I will often create the ResourceManager in a base class so that I only have the ResourceManager declaration code etc in one spot in the project.  For example, I will derive every page in an ASPX applications from a custom page object (which inherits from the System.Web.UI.Page class), and this ResourceManager approach fits in well in that base class scenario.

posted Friday, November 19, 2004 12:47 PM by