The Emperor's Lottery

by fwhagen Thu, 30 August 2007

When I am Emperor, I will have a quiet policy to fire any IT worker who starts an office lottery pool.  Not only are they wasting the time of people that are trying to get good work done, but they obviously do not have the mathematical and statistical skills to properly perform a programming or development task correctly.

What they do on their own time is, of course, their own business.  I love those who contribute to Ignorance Taxes.

Keywords:

Filed Under: Rant

Proper ASP.NET Database Calls

by fwhagen Mon, 20 August 2007

Last week, I posted an entry about a simple call to an MS-SQL database with a warning that it should only ever be used in a quick and dirty scenario.  By that I mean when it doesn't make sense to integrate or create a Data Access Layer or class to do the heavy lifting for you.

The advantages of creating classes to do the data calls behind the scenes are many, not the least of which is easier development in the long run.  Take a look at the following code:

    Query qEmplQuery = new Query(); 
    qEmplQuery.ConnectionSettings = ConfigurationManager.ConnectionStrings["EmployeeDB"]; 
    qEmplQuery.StoredProcedure = "DW.PKG_HRPORTAL.PRC_EmployeeInfo"; 
    qEmplQuery.AddParameter("P_EmployeeNumber", szEmplNum); 
    qEmplQuery.MinutesCached = 12 * 60; 
    DataSet dsEmplQuery = qEmplQuery.RetrieveDataSet("P_EmployeeInfo");

Much easier than even the "simple" call I posted earlier, isn't it.  The beauty of this is that it is also an Oracle call (database agnostic:  the same call for Oracle or MS-SQL makes for easier and standardized development) and is cached for 12 hours.  We also have a coding standard that only parameterized Stored Procedures are used for any kind of data access. 

But the most important advantage is that the Query class contains all of the complex coding needed to make this as efficient and "correct" as you know how and never have to think about it again.  This is basic abstraction and Object Oriented Programming fundamentals.  I have used Enterprise Library factories for my calls in Query because of the desire for its good caching and efficient data and network layer calls, but you can use whatever you want. 

In my next series of posts, I will present details of the Query class in order to help build your own.

Keywords: , ,

Filed Under: .NET | DataBase | Programming

My Focus Must Be Off

by fwhagen Tue, 14 August 2007

I was exploring the statistics on this site the other day and made an interesting discovery.  My rant on The Fall of the Soviet Union, which was done out of annoyance of modern softening of history, is by far the most popular article I have written.  It has received more traffic than all of my other articles.  Which makes me think:  maybe coding is not of interest, but history and military technology.

Then I remember, I post what I know and to help me remember it.  I am not a historian, nor do I play one on TV.

Keywords:

Filed Under: Blog

Book Review: Up Front - Bill Mauldin (1945)

by fwhagen Thu, 09 August 2007

Bill Mauldin is probably the most famous cartoonist from World War II.  He was an infantry soldier in the Italian campaign who also worked for Stars and Stripes, the soldier-run newspaper.  If you were to see one of his strips, you would instantly recognize his work.

Up Front is a collection of some of Bill Mauldin's panels from the war, starring Willie and Joe, along with his own commentary on the war, his work and his own experiences.  They range from very funny to moving.  The text is in no particular order, the panels are roughly arranged by topic, and the stories are fine, indeed.  He gives the reader a feel for what the infantryman, the most important element of any army, went through while at the same time conveying a feeling that it truly can not be comprehended by any outside of the brotherhood of men who were there.

Bill Mauldin has been called the best cartoonist covering the war years and the plight of the foot soldier of all time.  I would agree, though I certainly have not been exposed to the full range.  I liken it to the book Company Commander, written by an average Joe made Captain and given the command of two subsequent companies during the invasion of France.  I tremendously enjoyed Up Front and it will be added to my permanent collection.  I anticipate that I will be reading it again many times, or at least referring back to it on many occasions.

Ed:  Wow, this is my third review in as many weeks!  But that's not entirely fair.  I started this book while still reading Fatal Terrain, which I reviewed a couple weeks late.  I did blaze through The Last Colony very quickly, though.  That was an excellent book!  And Up Front was a very easy read with a lot of space used for panel comics.

Keywords:

Filed Under: Books

Simple ASP.NET Database Query

by fwhagen Wed, 08 August 2007

Below is the most simple database query for C# to populate a GridView object:

int nItemID = 1; try { using (SqlConnection oSQLConn =
new SqlConnection(ConfigurationManager.ConnectionStrings["UserInfo"].ConnectionString)) { oSQLConn.Open(); using (SqlCommand oSQLCmd = new SqlCommand()) { oSQLCmd.Connection = oSQLConn; oSQLCmd.CommandText = "SELECT DisplayName, EMail FROM Users WHERE UserID = @PARAM_ItemID"; oSQLCmd.Parameters.AddWithValue("@PARAM_ItemID", nItemID); SqlDataReader oSQLReader = oSQLCmd.ExecuteReader(); GridView1.DataSource = oSQLReader; GridView1.DataBind(); } } } catch (Exception ex) { Label_ErrorMsg.Text = ex.Message; }

There are actually many reasons to never use this, including performance, caching, safe SQL, code reuse, standards, proper exception handling, etc, etc.  But sometimes you need a quick and dirty, non-production, piece of code for testing and/or development.  This is it.

Keywords: , ,

Filed Under: .NET | Programming | SQL

WebComic RSS Feeds

by fwhagen Wed, 08 August 2007

Almost everything I read regularly online now is through an RSS feed.  The few things I don't get through RSS are either not suited to RSS or don't come in a feed, but are too important to me to skip.  I use SharpReader to collect and browse all of these feeds.  It is not a perfect reader but does what I want it to do better than anything else I can find (for free).

I have always enjoyed comic strips and much prefer them on the web than any other format.  I have been reading Dilbert online since the old days when Scott Adams posted them himself on Usenet.  But not all comics online are available in an RSS feed.  And none of them were a few years ago (before RSS, of course).  I have tried over the years to script or code different ways of collecting strips with some success, into webpages or browsable collections, but something was always lacking.

Today I use a app I created to collect the img tags from the hosted sites and put them into RSS feeds for each strip.  It works for me.  The only problem is the RSS library for .NET that I used doesn't clear the old entries correctly, so the XML file get big over time.  Not huge, just big.  Now I can load my feed into SharpReader and have all of the feed-y goodness such as tracking which entries I've read, notification of new ones, and locking or saving the ones I want to save.  I have about a dozen strips now, including the fabulous XKCD all RSSed up.  If you'd like to use some, let me know and I will email you the link.  I will not post it here as I don't want them abused. 

Oh, the other problem:  I'm always looking for more webcomics.  Most that I like I just stumbled on, so I always take recommendations.  And yes, I will feed up a strip, even if I don't like it, for someone else.  Just the way I am, service-oriented.

Update [10 Aug 2007]:  Ha ha!  When I went to XKCD.com today, I noticed that he's put up an ATOM feed himself.  So I can remove that one from my collection list. 

Keywords:

Filed Under: Programming

Book Review: The Last Colony - John Scalzi (2007)

by fwhagen Sun, 05 August 2007

Scalzi's latest book is The Last Colony, which also marks the end of the OMW trilogy.  The first two books were very enjoyable, so obviously, I had to pick this one up too.  I think I should also note, that this is the only trilogy that I have bought the first run of entirely in hardcover.  They are that good.

This is the last book in the John Perry storyline, at least for now.  Perry and his ex-SpecialOps wife Jane Sagan are asked to be the administrators of a new colony against the demands of the Conclave of Worlds, which Humans are not part of.  Fittingly, the colony is named Roanoke as it will be hidden, or lost, from everyone.  Of course, it is not hidden forever, nor is the premise as simple as it appears.

An excellent, and quick read.  I have read every novel that Scalzi has written to date.  This is the best of them all.  You can tell that his style is maturing nicely in this novel, which was written as well as many of the giants of SciFi.  A more complex story than Old Man's War, more compelling than The Android's Dream, and packed with more intrigue than The Ghost Brigades.  I still think I liked OMW best, but that is because it was much more military than this one.  Can't recommend Scalzi enough for the true SciFi aficionado.

Keywords:

Filed Under: Books

Lack of Programming Posts

by fwhagen Sat, 04 August 2007
I really haven't posted many code-related posts lately.  There are a few reasons for that:  Primarily, I have been working on SharePoint 2007 branding.  Sheesh!  Once I figure out the guts of that, I will post what I learned.  I have also been maintaining VB.NET code, which I am not at all interested in posting about.  The goal here is to post useful or interesting information for myself and others.  What I have been doing in VB.NET 1.1 is neither.  And I have been taking a business C++ class for my major, and boy it's close to worthless.  So a bit of a code break.

Keywords: ,

Filed Under: Blog | Programming

Book Review: Fatal Terrain - Dale Brown (1997)

by fwhagen Mon, 30 July 2007

Amazon.com: Fatal Terrain: Books: Dale BrownFollowing Shadows of Steel is Fatal Terrain, a continuation of the Patrick McLanahan / Brad Elliot storyline.   The next in my quest to read all of the Old Dog series from Dale Brown.

This time, the conflict is in China.  Specifically centered on the "rogue province" of Taiwan.  The Taiwanese leadership declares independence from China, which is not received well.  Gen. Elliot (ret) is recruited by Sky Masters, Inc. to fly one of the EB-52 Megafortresses with McLananahan and crew on contracted Sig-Int recon missions in the Formosa Strait.  When a Taiwanese frigate is attacked by Chinese navy ships, Elliot launches against them, exposing the stealth missions and heating things up.  Major conflict ensues.  Nukes are used.  Fun by all.

I found it very helpful, and quite enlightening , to read up on Taiwan's real status in today's world.  Wikipedia's article on the Republic of China (Taiwan) is concise enough to get a feeling of the complexity of the situation over there.  While not one of Brown's best works, it was very entertaining, if a bit disturbing.  The portrayal of Elliot was a bit over the top, but worked for the story, and the reasoning why was evident in the end.

Keywords:

Filed Under: Books

ICQ: Ancient Internet History

by fwhagen Thu, 26 July 2007

I had to hunt down my ICQ number the other day, which I seem to do occasionally over the years.  I use it for a few weeks, then delete it as useless.  I used to use it a lot, but email is much more useful, generally.  I even have an early number:  529564.  It is becoming more difficult to find it, so here it is.  Preserved until this fad wears thin too.  Of course, the client really stinks, since AOL bought them out, but the new Trillian client is pretty nice.  And it integrates Yahoo and MSN IMs too, which I have by default of possessing accounts there.   Let's see how long I use it this time...

Keywords:

Filed Under: Life

TextBox

RecentPosts