Software (RSS)

Thoughts on Software and development

Single Source Logging In Multiple Assemblies

I have what I believe to be a fairly simple problem in theory, yet in reality it proves to be a bit more hairy.  Below I present the problem and the requirements as I see them as well as a few possible solutions.  The solution I've settled on may or may not be correct, so I'm tossing out here to see what you guys think.  By all means please post some feedback.

Problem

To have a common, consistent logging...

Read the rest at: http://www.timbarcz.com/blog/SingleSourceLoggingInMultipleAssemblies.aspx

(Update your feed readers to point to new address http://feeds.feedburner.com/TimBarcz)

Rated Excellent [5 out of 5]. with 1 Comments

My Issues With Var

I posted earlier this year with the basic question, Is Var Better?  I'm not the only one to question the reintroduction of var.  Rhys Campbell went as far as to say some abuse the new keyword. I will say that my initial aversion to using var has softened a bit.  However there are at least two issues I have with them.

  1. Implicit conversions
  2. Intellisense

Read the rest at: http://www.timbarcz.com/blog/MyIssuesWithVar.aspx

(Update your feed readers to point to new address http://feeds.feedburner.com/TimBarcz)


with 0 Comments

MVC Framework - A Needle In a Haystack

This is the third in an ongoing series of articles about my team's transition to the Asp.NET MVC Framework.  In my last post I blogged a bit about how I haven't quite got comfortable enough with the new MVC framework to feel über productive.  What augments the feeling is the difficulty of finding quality information.  The data is few and far between and only sometimes relevant.

I was struggling yesterday to find information on the ComponentController class.  Things I was finding were from the Preview 2 release but finding something on the Preview 3 release was a bit more challenging.  Things are rapidly changing...

Read the rest at: http://www.timbarcz.com/blog/MVCFrameworkANeedleInAHaystack.aspx

(Update your feed readers to point to new address http://feeds.feedburner.com/TimBarcz)

with 0 Comments

Formatting Output with String.Format() Part 2 - Left and Right Alignment

I recently posted some code that could have taken advantage of format strings available when using the ToString() for integer output.  The other day I was building a report for a moonlighting gig where some of the text had to be right aligned and left aligned.  String.Format() does that as well.  I've seen some goofy attempts at formatting text, presumably not realizing...

Read the rest at: http://www.timbarcz.com/blog/FormattingOutputWithStringFormatPart2LeftAndRightAlignment.aspx

(Update your feed readers to point to new address http://feeds.feedburner.com/TimBarcz)

with 0 Comments

Making Good On a Promise

Last week I blogged a about Unappreciated Open Source projects.  In the post I made a commitment:

From here on I've resolved to donate a dollar any time I download a free library or webcast where a donate link is presented.  Why $1?  In all honesty it is something I can commit to.

I'm thoroughly looking forward to watching the...

Read the rest at:  http://www.timbarcz.com/blog/MakingGoodOnAPromise.aspx

(Update your feed readers to point to new address http://feeds.feedburner.com/TimBarcz)

with 0 Comments

Using MVC Framework In the Wild, Our Transition to the ASP.NET MVC Framework

We recently decided that with the effort we're putting into our website and some changes that we're making that now would be as good of time as ever to make the switch to the new Asp.net MVC Framework.  We're no Google, but we're currently receiving around 18,000 unique visitors a day and 300,000 page views and hope to grow that number as we make our site easier to use for our customers.  I hope to rely heavily...

Read the rest at:  http://www.timbarcz.com/blog/UsingMVCFrameworkInTheWildOurTransitionToTheASPNETMVCFramework.aspx

(Update your feed readers to point to new address http://feeds.feedburner.com/TimBarcz)

with 0 Comments

Formatting Output with ToString()

A coworker ran across the following and shared with me.

   1: Dim strpage
   2: strpage = pageNumber.ToString()
   3: If Len(strpage) = 1 Then
   4:     strpage = "000" & strpage
   5: ElseIf Len(strpage) = 2 Then
   6:     strpage = "00" & strpage
   7: ElseIf Len(strpage) = 3 Then
   8:     strpage = "0" & strpage
   9: End If 

The programmer is trying to ensure that the page number, when printed out, is always four characters long.  This is not the best way to write this code.  I thought I'd keep this post to myself but unfortunately this isn't the first time I've seen code like this, it is quite common.

The better way to write the above is:

   1: Dim strpage
   2: strpage = pagenumber.ToString("0000")

It's shorter, more concise, and easier to read.  Further the second example is more extensible.  If the requirements change to say the page number should be five characters, the first example must recompile.  The second example must be recompiled as well in it's current state, however the string "0000" could be moved to a configuration file somewhere and then wouldn't need to be.

Originally Posted At:  http://www.timbarcz.com/blog/FormattingOutputWithToString.aspx

(Update your feed readers to point to new address http://www.timbarcz.com/blog/)

with 0 Comments

My "Building A Solid Core" Contest Entry

About a month ago Jean-Paul Boodhoo announced a contest that he was sponsoring.  The contest idea centered around the idea of developing passion in others around you.  I have an immense amount of respect for JP having met him at ALT.NET Seattle.  When the contest was announced I thought I'd put in an entry as I enjoy the journey passion for my craft has taken me on with others.  Here is my entry in its entirety:

Read the rest at:  http://www.timbarcz.com/blog/2008/07/08/MyQuotBuildingASolidCorequotContestEntry.aspx

(Update your feed readers to point to new address http://www.timbarcz.com/blog/)

with 0 Comments

Open Source - You Have The Source

"But you have the source!"

I heard that statement a little over a month ago at the Alt.Net Open Spaces event in Seattle.  It's no secret to those who know the community, that open source technologies are at the very least promoted and in many cases you'll find many open source project committers within the Alt.Net community.  Heck, David Laribee, a founding member if there is such a thing, in a post defined Alt.Net as...

Read the rest at:  http://www.timbarcz.com/blog/2008/06/10/OpenSourceYouHaveTheSource.aspx

(Update your feed readers to point to new address http://www.timbarcz.com/blog/)

with 0 Comments

Regular Expressions, Your Job Requires Them

I've thought about writing this post several times over the past two years.  Having had regular expressions come up three times last week, I thought it time to address the lack of programmers out there who understand regular expressions.  The sheer amount of fear surrounding regular expressions and the work that goes into avoiding them is astonishing...

Read the rest at:  http://www.timbarcz.com/blog/2008/02/25/RegularExpressionsYourJobRequiresThem.aspx

(Update your feed readers to point to new address http://www.timbarcz.com/blog/)

with 0 Comments

LINQ To SQL Fails To Impress As An ORM

Over the past year or two I've really tried to improve coding abilities by thinking on objects.  By talking about, and programming, real-world objects you can reduce the impedance with clients when discussing

Read the rest at: http://www.timbarcz.com/blog/2008/01/09/LINQToSQLFailsToImpressAsAnORM.aspx

(Update your feed readers to point to new address http://www.timbarcz.com/blog/)


with 0 Comments

There's No Such Thing As A Prototype

Has this ever happened to you?  You been asked to put together something quickly to demonstrate some functionality and it somehow has ended up in production?  I have, and for that reason, I believe there is no such thing as a prototype.

When I'm asked to see if something is possible, I, being a good pragmatic programmer, run off to implement a quick prototype...

Read the rest at: http://www.timbarcz.com/blog/2007/12/14/TheresNoSuchThingAsAPrototype.aspx

(Update your feed readers to point to new address http://www.timbarcz.com/blog/)

with 0 Comments

Debugging .Net Applications with WinDBG

Programming languages these days do their best from keeping you from doing something stupid.  We have compile time checking, "managed" code, and garbage collection.  We've been led to believe that if you just write the code, in any fashion that meets the requirements of the project, that any missteps you may take in code will be corrected....

Read the rest at: http://www.timbarcz.com/blog/2007/12/12/DebuggingNetApplicationsWithWinDBG.aspx

(Update your feed readers to point to new address http://www.timbarcz.com/blog/)

with 0 Comments

Nant Setup for Visual Studio 2008 and .net 3.5

Yesterday I posted about an issue I was having with Nant and Visual Studio 2008.  The solution I found from Jeffrey Palermo ultimately only got me so far.  First, let me say that ....

Read the rest at: http://www.timbarcz.com/blog/2007/12/05/NantSetupForVisualStudio2008AndNet35.aspx

(Update your feed readers to point to new address http://www.timbarcz.com/blog/)

with 0 Comments

Visual Studio 2008 with Nant/MSBuild Issue

I'm having a problem with my nant script which uses the Nant.Contrib library in order to build using a solution file.  The error currently reads, "MSBuild can only read solution files between versions 7.0 and 9.0 inclusive."

Read the rest at: http://www.timbarcz.com/blog/2007/12/04/VisualStudio2008WithNantMSBuildIssue.aspx

(Update your feed readers to point to new address http://www.timbarcz.com/blog/)

with 0 Comments

How to Print XPS Documents, easy as 1...1a...1aI..2...3...3a....4....5

office_space_baseball.jpgI'm exploring the new HealthVault beta from Microsoft.  Every document on the MSDN site regarding HealthVault is downloadable as an .xps file.  In my attempt to print a document, I've read numerous blogs posts this morning about how XPS (Xml Paper Specification) is supposed to be superior to PDF but I would strongly disagree.  Here's my experience trying to simply print a .xps document (which hopefully you won't experience):

  • Click on download link (using Firefox), I'm then asked if I'd like to open the .xps document with "XPS Viewer" to which I say yes, only to find that another tab is opened in FireFox asking me the question again.  Another affirmative answer opens another blank tab asking the question again, you can see where this is going.
  • I'm smart, so I'll save the .xps document to my desktop and open in IE.  Sure enough, the file opens and I can read it fine.  I go to print however and I only have 3 printers to choose from, none of which are my actual printers (you know the things that spit out paper and have cryptic messages like "PC Load Letter" .  Normally I have nine printers, but now I have three, so I start seeing what I can do with these:
    • Microsoft Office Document Image Writer - This "printer" is there but selecting it disables the print button.
    • Microsoft XPS Document Writer - This "printer" asks me where I want to save my file...as another .xps document.
    • PrimoPDF - When choosing to "print" to a pdf file I encounter an error.
  • Now I'm at the point where I'm googling for a solution.  I can't find squat, maybe this problem is limited to me.  I do find a pack to download the viewer on Microsoft's site, so I try to download a viewer, hoping that the problems I have may be fixed in a new version.  The installation comes in the .NET 3.0 redistributable, and low and behold it fails to install, saying I already have the .NET 3.0 redist.
  • So I find another option on the Microsoft XPS page for the "Microsoft XPS Essentials Pack".  Mind you there's a nice note telling me the option explored in the previous step is "recommended for your system configuration."  I download and install the "Essentials" pack with no problems.
  • Now I open the .xps file in the standalone xps viewer and am please to see that when I go to print that all of my printers are there.  So I attempt to print to the default printer and everything seemingly works...until I see that only 11 pages print of the 58 pages.  I print to a different printer, this time 19 pages.  Better...but still wildly deficient.  Next I try printing to pdf, I open the PDF and all 58 pages are there.  I print from my PDF reader and all 58 pages come out of the printer.

That's it...simple.  What I don't get is why people are so afraid to embrace new technology?

So to summarize, here is how to print a .xps file:

  1. Download the "Microsoft XPS Essentials Pack".
    1. Make sure you have the .net 3.0 redistributable.
      1. You first need the .net 2.0 and .net 1.1 before you can install the 3.0
  2. Change the default program to handle .xps documents.
  3. Print your file, selecting the "PrimoPDF" printer.
    1. Install PrimoPDF if not installed.
  4. Now open the result PDF in your reader of choice.
  5. Print your file, selecting the hardware printer of your chioce.

There it is, easy as 1...1a...1aI..2...3...3a....4....5

with 0 Comments

When It Comes to Search You (Don't) Have Options

I've recently finished reading Steve Krug's Don't Make Me Think which was highly recommended by both Jeff Atwood and David Sturtz, Geonetric's information architect.  One of the points the book makes is that the users of your website nowadays have been so conditioned by Google that they expect to see a search box. My contention is that adding "search" to your website is no trivial matter.

There seem to be few categories your site can fall into, here are three that I'm familiar with:

Scenario 1:

My father has a website, with a number of pages of static content.  The pages are .aspx pages only to utilize features of .NET like MasterPages and/or themes.  The content is static.  To implement a search I need to somehow index the content, which should be easy, in theory since the content is static.

Scenario 2:

I've built a small CMS system for myself, to manage pages and content.  The pages are dynamic in that when you request a page, no page exists on disk and is loaded from a database.

Scenario 3:

A large CMS with multiple different "objects".  You may at various points want to search for specific "objects" or search across all "objects".  I'm thinking back to my last job where we had a large site to manage baseball tournaments.  There were three primary "objects", players, teams, tournaments.  There was a general search that had to search everything and individual searches for each object that would only return those objects.  In other words the site wide search for "Blue Devils" would return both the "Cleveland Blue Devils" team as well as the "Duke Blue Devils Classic" tournament.  The same search in the team and tournament section would only return the team and the tournament, respectively.

Options:

  • I could use Google to search my site.  You've seen the "search this site" boxes on websites.
    • Pros
      • Google indexes well
      • Easy?
    • Cons
      • lose the "look" of your site since you're using google for the search results page.
      • Can't index "objects".  Google can index only public facing web pages/documents.  Therefore (using Scenario 3) a tournament could only be found if the name appear prominently somewhere where Google will find it.  In other words you're relying on Google, a lot.
      • Cannot limit Google to certain "objects".  I can't say, "search only pages that are about Teams", where I could do that quite easily implementing my own search
  • Implement my own search
    • Pro
      • The algorithm is my own and I can change it if I'd like.
      • Keep "look" of site by never leaving site.
    • Cons
      • Much more work.  Writing my own SQL to search and aggregate the results.  Do I full-text index on tables?  Do I use a third party solution?

It's a very tricky proposition.  Krug says that users will look for a search box, so that means you should put one there right?  If you put a search box on your site that doesn't produce reasonably good results then the user will lose faith in your website and may leave.  If you don't provide a way to search your pages/data, of which there may be quite a bit, then the user may struggle to find what they're looking for and leave.  The only option you seemingly have is too implement search and implement it well.

with 4 Comments

A Bear, a Helicopter, and an Overarchitected App

As a developer I want to build something neat, that impresses others and makes someone's life a bit easier.  This most commonly manifests itself in a problem that could be easily solved but I've added various extensibility points that were neither required nor will probably ever used.  In times where I find myself slipping into one of those modes, where I'm just adding functionality for the sake of functionality, I remind myself of YAGNI ("You aren't going to need it") who's main tenet is:

Programmers should not add functionality until it is necessary

I was reminded of this twice recently, the first last Saturday, the latest being tonight. 

Last Saturday I was talking with family while at a parade.  The discussion of brainstorming came up.  The somewhat well-known story, or so I'm told, was reiterated to me on Saturday.  It has to do with a power company trying to figure out how to remove ice from electical lines.  When the ice would build up the lines were in danger of breaking under the weight of the ice.  Here's what they came up with during a brainstorming session on how to fix it:

"during one of the breaks, one of the linesmen shared with some of the participants about how came face to face with a big, brown bear when he was servicing the power lines, and how he narrowly escaped being mawed by it.

when they returned for the meeting, someone suggested training the brown bears to climb the poles to shake off the ice from the wires. brown bears were very common in the areas that they were looking at and they are strong enough to cause the poles to shake when they climb the poles.

someone else then suggested putting honey pots at the top of the poles to entice the bears to climb the poles.

they then started to discuss about how to put the pots of honey at the top of the poles and someone threw out the idea of using helicopters to do the job."

The idea however was quickly abandoned for a more simpler solution when a secretary pointed out the following:

"a secretary in the meeting pointed out that the down wash from the helicopters could possibly break the ice and blow it off the wires."

The helicopter idea works, and is still in use to this day (read the whole story), but how cool would it be to sit back and say, "I trained some bears to climb a tree in search of honey to solve our problem."  The story is typically used to illustrate how even crazy ideas in brainstorming sometimes aid in finding a simple solution.  As a programmer however, I learn from the story the fact that they implemented the helicopter solution because it was easy, safe, cost-effective, and quick to implement.

The second, and latest, reminder occurred tonight when talking to a co-worker at a client cocktail party. The co-worker was talking to me about a conversation with a client who's main complaint is that we have to provide everything "whiz bang".  Typically "whiz bang" denotes something cool or neat, however, the gripe was not that what we delivered was bad or wrong, but that in our pursuit to "wow", we didn't "wow" the client because it took a long time to implement.

Over-architecting.  This is a seemingly common trait in developers.  If you work on a team it's likely that you're constantly having to fight this from somewhere within the team.  On days where I'm dutifully adhering to the YAGNI principle and building shippable software, someone else on my team may be in the throes of a battle of over architecting.  Likewise while everyone is adding real features, I may be dreaming and scheming of ways to make a program über-great.

I have to keep reminding myself that shipping software is the most important aspect of a software company.  It seems too simple to carry any real weight; like something as simple as a shippable product is enough.  It's really a novel idea considering how much software I've shipped recently.

with 0 Comments

Passed my MCTS test, but is it relevant?

Today I passed my first Microsoft Certification test in about seven years.  I passed the first of two tests, 70-528 (Microsoft .NET Framework 2.0 - Web-Based Client Development) on my way to MCTS.  I've had mixed feelings on certifications and still do to this day.  I know some very talented certified developers who add to the MC* reputation.  Likewise I know several developers who despite being certified, can't program, and weaken/cheapen the MC* title.

My reaction to the test is that it is heavily weighted in places that seemingly don't matter "in the real world".  I'm keenly aware I could be way off base here, however I've been working with .NET now since 2003 and asp before that.  The two areas that were heavily stressed in my test were deployment ("Copy Website", Publishing, aspnet_compiler) and Mobile Controls.  In my nearly 5 years with .NET I have never written an application that uses mobile web controls.  Should I have? Am I strange?  Regarding "deployment", at Geonetric, we have a build server which uses Cruise Control and NANT, and therefore I rarely (read:never) have used the "Copy Website" function from within Visual Studio to get a site to a staging server, nor used the "ASP.NET Configuration" application to change web.config settings in my production machine.

While the debate can rage on about the relevancy of tests, I'm softening my position on them and do see them as beneficial (maybe for another post) when taken as part of a whole.  In some chats with Scott Hanselman about the subject recently, he took the stance that certifications are just a good resume line item but the most important thing was to ship software, not what collection of consonants you can string together behind your name.


with 1 Comments

Optimizing the Web Stack

We recently hired a DBA here at Geonetric to fill a much needed niche.  While we have several better than average developers in terms of SQL, I'm excited to see what very SQL specific optimizations (ie indexes, normalization, filegroups) that Jason (DBA) can bring to the table.  Thinking about the optimizations that will be handled at the database level, I stopped to think of the "stack" to deliver a web application.  Here's my first-pass list:
  • HTML
  • Javascript
  • CSS
  • Presentational Logic
  • Business Logic
  • Data Acess Logic
  • Data Access
Looking at the list above.  Optimizing a single layer in no way gets you great performance across the entire application, however a poorly built/optimized layer can ruin the entire application.  What's the saying?  A bad apple spoils the bunch?

We can