個人檔案Nates Stuff相片部落格清單更多 工具 說明

部落格


1月20日

Booing the Former President on Inauguration Day Shows Very Poor Taste!

There are things that people do that are in poor taste.  Some things that come to mind is scavenging at the dump (yeah, I saw this guy do that one time), yelling at the waitress for onions on your burger,  or leaving the lavatory without property sanitizing your hands.  If you do any of those things you are likely guilty of poor taste. 

Now, I don't really like Bush nor do I like Obama but I do show proper respect to both of these individuals.  Being a Republican without a party I tend to starkly disagree with much of President Obama's platform.  I understand that many people have a lot of pent up emotion and anger toward the decisions the previous administration has made.  Personally I have much of it toward both former President Bush and President Obama, but there is absolutely no way I would ever boo either of them at the inaugural ceremony!  Apparently many of those in attendance choose to boo anytime President Bush and Vice President Dick Cheney where shown on the screen.  Having recently undergone back surgery, Vice President Cheney was in a wheel chair for heavens sakes! 

I have personally never been to an inauguration, but I should think that the kind of patriotic atmosphere that exists would prohibit such disgustingly undignified acts.  To those who choose to boo, you have none of my respect!  I place you below the people who use profane language, below people who put gum under restaurant tables, below people who throw lit cigarettes out the window, and even below people spit on the ground while indoors.  You people have no sense of taste and could never earn respect from anyone who does.

8月21日

Product Reviews: Westinghouse 32H570D & Jensen HD5112

Thumbs Down!I don't normally do product reviews on my blog but recently I have come across some really poor electronics and have had such a bad experience I want to warn any potential buyer -- These products are beyond poor, they are unacceptable!  So I have decided that at least for the time being I would share my experiences online. 

There are all kinds of new electronics out there to buy.  Flat screen TV's, iPods, iPhones, HD Radio's, BluRay, etc.. However, I personally feel that there are some companies who's business model is to produce junk and sell it as these new style electronics.  In the case of both of these products it is obvious that they rushed to market in such a way that makes them completely worthless!  This is much reminiscent of the late 90's where computer manufacturers were pushing out components before they were ready resulting in very unstable PC's!

Another thing to note is that I am a little more savvy than the average consumer.  Not to tout too much my credentials as a "product test guy" but I did used to work for a service company called Service West and I would fix electronics.  When you see the guts of some electronics you really see the difference between brands!  You could (at least then) really tell the difference between a Sony and a JVC!  The Sony was eloquent and beautiful inside and I never saw many of them!  Some of the JVC's I worked on I had to de-solder wires just to get the unit open to perform a simple mechanical adjustment and they were always in there because the user tried to do two things at once (like change disks and press play in rapid succession).  In short, you get what you pay for.  Unlike computers where you buy a Dell for the name or cereal where you pay a lot more for the little improvement in quality; electronics are a little different.  If you can make a cheaper brand electronics component work for you then that's great but it is not going to be as good as quality as a better brand.

Westinghouse 32H570D Flat Panel TV

When we first purchased this TV we loved it!  The best feature was the DVD player, it is built in such a way that you can pop a DVD into the front of the TV (front loading) and it will turn the TV on and start playing the DVD.  How they were able to do a front-loading DVD slot and keep the TV so low profile I'll never know.  I bought this from Target back in April 2008 and returned it exactly 90 days later.  I was hoping to find something else to replace it with but we're going to be doing a lot more homework before trying that again. 

Westinghouse TV

The Pro's:

  • Front loading DVD slot!
  • The price
  • Very low profile
  • Great picture
  • Easy to play DVD's

 

The Con's:

  • The TV would hang every one in a while.  Not an innocent "the picture is frozen" but it completely FROZE!  You would have to get up, un plug it, and plug it back in!  You can't even power it off with the remote!  Yes, there was adequate ventilation and the TV did not appear to be hot.
  • The audio inputs did not work!  I spent literally DAYS trying to get audio from my computer (where we would watch online content) to the TV!  Getting the audio from the laptop speakers was not desirable! 
  • The HD tuner was clumsily laid out.  You could literally take a full 20 seconds just to flip past channel 7!
  • The remote was nothing special!  It had a poor layout as well and did not have buttons for things you would do often.
  • The menu did not have a lot in the way of customization & function.  This may be part of the "easy to use" but I was unable to select an audio source.

 

I would not recommend this unit to a friend!  It's possible they fix the "bugs" and will have a good product in the future, but from other reviews their technical support was very poor and sending the TV for repair is very expensive.  I can not recommend this brand to a friend either.

Jensen HD5112

This radio supposedly had it all!  Literally!  HD Radio, MP3/WMA playback on CD/CD-R/CD-RW, SD Memory, USB.  IPod link, Aux input, pre-outs, Satellite ready, EVERYTHING!  The problem? None of it worked! (more below)  I really wanted this product to work for me -- epically since these puppies aren't easy to install! Plus it was pretty inexpensive and I knew that anything else wouldn't have as many features.  I thought that if I can just find 1 brand of product compatible with the SD reader or USB, or CD ROM then I would be fine.  I couldn't find any combination that worked!  I purchased this from WalMart in August 2008 and returned it days later.

HD5112

The Pro's:

  • Very Featureful (on the surface)
  • Price is right!
  • I really liked the HD radio.  It seems like the Satellite radio companies are fighting very hard to limit the number of units with this feature so it was nice to find one.  HD Radio is pretty cool and one of the main reasons for buying this unit.
  • I didn't get to try the iPod link (as I do not yet have an iPod and would probably opt for a Zune)
  • Once I got the correct dash kit (don't say that you support *any* Pontiac when you don't stupid first dash kit!) installation was pretty easy.  The wires were ISO compliant so I just had to match colors with my GM/Pontiac pigtail.
  • The unit seemed to have pretty good power.  It went much louder than my stock radio.

The Con's:

  • I could not install it without removing the "warranty void if removed" sticker!  It was right over where the sleeve slid over.  You slide it over that spot more than twice (which is usually required) that sticker is gone man!
  • The installation instructions couldn't be accessed.  They are usually provided online through a 3rd party.  You enter your serial number and it will let you download installation instructions for your vehicle.  I suspect I was the N'th person to buy this particular unit and so it wouldn't let me download the instructions!
  • I tried 6 different SD cards in this unit and could not get any of them to read.  I tried formatting these every which way possible and even tried a number of different MP3 formats just in case it was not capable of playing VBR.  I tried renaming the files to have as few as possible chars. I never got this feature working!
  • I tried 15 different CD brands! Nothing would play.  Though in defense (if you can call it that) this unit must have been defective because the CD playback didn't work with a regular music CD (CDDA) that came straight from the store. That's right, I couldn't play my Blink 182 album!
  • I tried all 6 thumb drives I had and it wouldn't read any of them so I bought a new one, and it wouldn't read that either!  Reading other reviews these last three are common.  One guy could only get 1 thing to work and that was a SD card reader to work in the USB slot.  I believe he described it as "an abomination sticking out of my dash!" and that a sudden stop would snap his card reader & radio like a twig!
  • The clock looked weird and it would never display the information I wanted. 
  • The aux port worked but only if the faceplate was not open (expected but still annoying)
  • The faceplate didn't detach or attach without a fight! 
  • The snaps that hold the radio to the sleeve weren't great.  After I installed it I couldn't get the right side to snap into place.
  • The product manual was very poor!  The website had few answers.

I would not recommend this unit to a friend.  Based on the whole number of poorly implemented features I could not buy this brand of electronics again.

I have bought the XOVision DVD player for my car to replace this CD Player.  It should get here in the next week so look for a review on that.

6月16日

Nerd Quiz

For now on you may address me as my proper title:

NerdTests.com says I'm a Nerd God.  What are you?  Click here!

I wish the title was a little less blasphemous; therefore you may alternately call me 'King Nerd'.  That would also match with my wife who is a "Slightly Dorky Nerd Queen".

 

I also scored quite high on the version 1.0 test:

I am nerdier than 92% of all people. Are you a nerd? Click here to find out!

Remember, that is 92 percentile!

--Nathan Zaugg

6月12日

3D Modeling With Google

Those who know me will tell you that Microsoft might as well just put me on payroll because I talk about their new products all day long.  I have even characterized myself as an "Unofficial, Unpaid, Microsoft Solutions Evangelist".  Having said that, I know what's good and bad about the products I love so much.  I also know when someone else has something worth taking a look at. 

Google Defined

Google: very successful Internet advertising company seeking to find, buy, and evolve technology that has promise and then figure out a way to turn a profit on the new technology. 

And they are very good at what they do.  When Google purchased KeyHole (Google Earth) everyone started scratching their heads and wondered why!  I may not understand exactly how but I am almost positive that they have turned a profit on it. 

Well, here is another interesting gem.  Google SketchUp is a armature 3D modeling tool.  It's easy to pick up and has some pretty cool features.  I created the sketch below of my back yard (or at least how I want it to be).  There is tons of detail from the landscape brick in the back to the translucent windows.  I did the below model in less than an hour and when I started I couldn't figure out how to add dimension to my square shape or how to move it around. 

 

3D Sketch Yard-2

Cool Features

Some of the cool features are textures, and the 3D model community.  The textures makes these simple sketches look very life-like.  It has most of the common building materials and many basic outdoor shrubs & plant-life.  You can also capture an image from Google Earth and transpose it onto your work area.  You can even take a picture of something and mold it to your objects. 

 

Google 3D Model Search

I added my model to the Google search and now anyone can use my shop! 

The Not So Cool

It would be nice if there was more keyboard involvement.  I find my self switching between tools a lot and it's cumbersome.  While you can get results pretty quickly the interface is difficult to maneuver even after using it for a while.  Simple tasks like changing the size of a rectangle are complicated.  You also have an inability (or at least it seems to me for now) to make things exact.  I'd like to be able to enter the size of the rectangle and then enter the coordinates.  And although it's pretty fast for 3D modeling it does make you wait quite a while for some tasks and I think it could be a whole lot faster!  It seems to be written in Ruby and my guess is that it does not take advantage of hardware acceleration and that if it were written in a language like C++ or C# than it would be much faster!  Also, I hate the name!  Couldn’t they have named it Google 3D, G-3D, or even GSketch?

All said, for a free pice of software it does help a lot in convincing my wife that a 30-35 shop will not look too big for our yard!

http://sketchup.google.com/

--Nathan Zaugg

6月9日

Silverlight 2.0 Beta 2 Released & Installation Help

Microsoft Silverlight 2.0 Beta 2 has been released.  This version is supposed to be pretty stable as I understand it.  The tools on the other hand, still feel very much like a beta!  I had a heck of a time getting this junk installed!

The link to download Silverlight 2.0 Beta 2 for Visual Studio is here: http://silverlight.net/GetStarted/
(note: This installation package includes all you need including Silverlight runtime and SDK)

 

My Installation Isssues

image 
Installer splash, so far so good.

 

image
I got to know these dialogs pretty good as I'd tried this many times!

 

image
It makes you close all browsers!  Ok, sure!

 

image
DANG IT!  What now? 

 

image
So you're telling me that I can't have a patch?

 

Here is the output of the error:

Created new ExePerformer for Exe item

[6/9/2008, 13:48:11] Action: Performing Action on Exe at c:\6472026481f78458c12aa62cd2\silverlight_uninstallrtmpatches.exe...

[6/9/2008, 13:48:11] (IronSpigot::ExeInstallerBase::Launch) Launching CreateProcess with command line = c:\6472026481f78458c12aa62cd2\silverlight_uninstallrtmpatches.exe /q /uninstall
[6/9/2008, 13:49:11] (IronSpigot::ExeInstallerBase::PerformAction) c:\6472026481f78458c12aa62cd2\silverlight_uninstallrtmpatches.exe - Exe installer does not provide a log file name
[6/9/2008, 13:49:11] (IronSpigot::ExeInstallerBase::PerformAction) Exe (c:\6472026481f78458c12aa62cd2\silverlight_uninstallrtmpatches.exe) failed with 0x80070643 - Fatal error during installation. :
[6/9/2008, 13:49:11] (IronSpigot::ExeInstallerBase::PerformAction) PerformOperation on exe returned exit code 1603 (translates to HRESULT = 0x80070643)

[6/9/2008, 13:49:11] Action complete

[6/9/2008, 13:49:11] (IronSpigot::LogUtils::LogFinalResult) Final Result: Installation failed with error code: (0x80070643), Fatal error during installation.

so I hit the net and find these instructions: http://weblogs.asp.net/bradleyb/archive/2008/03/06/installation-tips-for-sivliverlight-tools-beta-1-for-visual-studio-2008.aspx

try to uninstall the KB:
image
(found under updates)

 

image 
Kept asking me for some location!  Wasn't going to work....what is the backup solution?

 

image
Ok, extract the files in the installer...sure.

 

image
I put them in a dir called "Install"

 

Then RUN: msiexec /uninstall VS90-KB949325.msp /L*vx VS90-KB949325-2.log

image
Double Dang!  Ok, whats up??

 

Hit the web agian: http://silverlight.net/forums/p/17663/58925.aspx
and download MSI ZAP: http://support.microsoft.com/kb/290301

 

image
Tripple Dang!  Updates are not listed!

 

Downloaded tool: MSIINV

Download Link:
msiinv.zip

RUN:

msiinv.exe -p > Installed.txt

No luck!  Still not giving me the GUID for KB949325! 

RUN:

msiinv.exe -v > Installed.txt

Took SEVERAL minuets to run and created a 10MB text file!  When it was done I tried to run msizap but it wouldn't go.  I'm just going to install these packages seperatly now that I have them extracted from silverlight_chainer.exe.

 

RUN THE FOLLOWING:

  1. Silverlight.2.0_Developer.exe
  2. msiexec /p VS90-KB949325.msp /L*vx VS90-KB949325.log REINSTALL=ALL
    image
    (gave me an error -- ok, I'm skipping it!)
  3. silverlight_sdk.msi
  4. VS_SilverlightTools_Beta2_Setup.exe

 

image
Sat here for quite a while!
devenv.exe seems active though.

 

image
Install Completed!

 

This is also a good resource:

http://www.microsoft.com/downloads/details.aspx?familyid=50A9EC01-267B-4521-B7D7-C0DBA8866434&displaylang=en

 

This seems to only be a problem if you were an early adopter of the Visual Studio 2008 SP1 Beta 1 fix. 

Avoiding Circular Dependencies (Tangles)

The term "circular dependency" may be foreign to some programmers (especially if you do Java as it is a pretty common practice).  However, anyone who has done some scripting for a referential database knows that you have to run scripts in a certain order.  Running scripts out of order causes errors when you run.  The interesting trick is that if you run that same incorrectly-ordered DDL script again and again you will eventually get it to run without errors.  If you were unaware of the order being incorrect and thought to yourself in that moment "Stupid database!" then this blog post is for you!

What is a circular dependency?

It is simply two libraries that use each other (either directly or indirectly) as shown below:

image 

Figure 1: Circular Dependency

 

 

image

Figure 2: Complex Circular Dependency

 

The complexity of a circular dependency may vary.  If you are using Visual Studio and have all of your projects loaded into a single solution AND you add Project References (Right click on project -> Add Reference -> Projects Tab -> {Project Name}) then the IDE will not allow you to create Circular Dependencies.  In fact, this is a good practice as Visual Studio will ensure the correct build order. 

Why are circular dependencies bad?

Just like our Database example above, a circular dependency makes it so you can not guarantee that your application has the latest code.  That is a big deal!  Here is why:

  1. I make changes to Application 1 (in Figure 2)
  2. I build my project, The changes I made in Application 1 may or may not have gotten into Application 2 (depending on build order).  It may have taken a copy of the compiled code that was left over from the last time I built.
  3. Application 2 depends on this new functionality to provide services to Application 3; This functionality will not work correctly with this build.
  4. Application 3 may or may not depend on these same services to provide back to Application 1

As you can see in this scenario, there is no such thing as a "correct" build order when there are these circular dependencies.  The only way you can arrive at the correct version of the code is to build it as many times as there are nodes in our circle.  That would mean for Figure 1 that we would need to build twice and three times for Figure 3.  Some of these dependencies can get really ugly!  Here is some actual code running in an actual company that I did analysis on some time ago using a tool called Structure 101.

image image image image

 

How do I fix circular dependencies?

There are some steps to take to solve even the most complex tangles!  They all involve refactoring your code though.

  1. Refactor common code into a "base" dependency; I usually call this "Common" (figure 3).  BEST SOLUTION
  2. Remove code that is unused.  In the tangles shown above many of them are using deprecated/unused code.
  3. Duplicate the sections of code used.  This should be seen as a last resort but given the choice between code duplication and circular dependencies, I take code duplication ever time!

 

image

Figure 3: Refactor a Common

 

Summary

There are two kinds of design concepts for nTier (and other types of architectures as well) called Logical Layout Design and Physical Layout Design.  The Logical Layout is simply that your software occupies the same project/package but leverage different classes.  In contrast Physical Layout Design forces each tier to be separated into different Projects/Packages.  So long as we are careful to manage the dependencies between these packages from the start this is the preferable way to code.  While the logical layout does not suffer from the dependency problem eventually you may wish to break these classes apart and find that there are a lot of inner-dependency that should not exist simply because they occupied the same project.  Remember to keep it clean!

5月28日

XAML Cheat Sheet

A few weeks ago I gave a presentation on Silverlight at the Utah Code Camp.  I was really impressed by a presentation I saw last time on Ruby and everyone really liked the cheat sheet that was provided.  For my presentation this year I created an XAML Cheat Sheet.  For those who are learning XAML it is a pretty good resource but it's most helpful for me when I know how to do something but I can't remember the syntax.  This is a work in progress so keep on checking back.  It can be downloaded in the Media section of my website (http://www.InteractiveASP.NET) or by clicking here.

Please drop me a line if you think you have something useful to add or you want to thank me for the hard work it took to put this thing together!

Nathan Zaugg

5月19日

SP1 for the .Net Framework 3.5 and Visual Studio 2008 Released to Beta

As promised by Microsoft when Visual Studio 2008 launched late last year, there is a service pack for available both for the .Net framework 3.5 and Visual Studio 2008.  Information about the release can be found on ScottGu's Blog and mostly include bug fixes and performance enhancements, but the points of interest for me are:

  • ASP.NET Routing Engine which gives you the ability to map URL's to route handlers. For example the URL http://www.mysite.com/myapp/data/234/editComment
  • ASP.NET AJAX Back/Forward Button History Support gives you the ability to control the forward & back button clicks on the browser.  This will be very useful for "single page" ASP.NET AJAX implementations.
  • Performance improvements on the web editor in VS 2008.
  • JavaScript Formatting Settings
  • CLR performance improvements including startup times that are 40% faster and faster ASP.NET requests (up to 10% faster).
  • WPF New Features and Performance Enhancements!
    • Performance enhancements using GPU
    • New "WritableBitmap" which allows for tear-free bitmap updates.
    • ListBox, ListView, and TreeView now support "item container recycling" and virtualization which results in better performance.  This will have a huge effect on large amounts of data.
    • Deferred Scrolling which doesn't render until the mouse up on a scroll event.  This will can have a enormous effect on huge data sets.
    • StringFormat support within binding expressions
    • New Alternating Rows support for controls derived from ItemControl
    • Events tab support within the property browser in VS 2008
    • Go to Definition and Find All References now support things declared in XAML
  • SQL Server 2008 Support
  • The long awaited ADO.NET Entity Framework which includes integration with any database
  • Improvements in WCF including scailability, ADO.NET Entities in service contracts, and Improved Debugging support for WCF.
  • Improvements to C#; The C# code editor now identifies and displays red squiggle errors for many semantic code issues that previously required an explicit compilation to identify. The debugger in VS 2008 SP1 has also been improved to provide more debugging support for evaluating LINQ expressions and viewing results at debug time
  • Fixes to TFS

 

Installation Cautions

  • If you are running this on Vista, be sure Vista SP1 is installed!
  • If you have installed the VS 2008 Tools for Silverlight 2 Beta1 package on your machine, you must uninstall it - as well as uninstall the KB949325 update for VS 2008 - before installing VS 2008 SP1 Beta
  • If you are running anything earlier than Expression Blend 2.5, then you need to update it to the latest.  Earlier versions will cease to run.
  • This is still beta software -- Install at your own risk!

 

A direct download link can also be found here: http://msdn.microsoft.com/en-us/vstudio/products/cc533447.aspx

 

--Nathan Zaugg

4月20日

Utah Code Camp :: Spring 2008 Announcement

I have been doing Code Camp for over a year now (that may not seem like a lot but this will be my 3rd time presenting there).  Code Camp is awesome!  It's a full day of free training in a verity of topics that most developers find interesting. 

Topics Include:

  • Silverlight 2.0
  • Building websites with the ASP.NET MVC framework
  • C# 3.0
  • Writing Manageable Services in .NET
  • Database Performance tuning  Part 1
  • IronRuby + C# = Awesomeness
  • Game Development in XNA for the Xbox360
  • Introduction to Mac OS X programming using Cocoa and Objective C
  • Developing For Windows Vista
  • T-Sql Querying
  • Why C# Namespaces are not the same as Java Packages
  • An Introduction to CakePHP

You can visit http://www.utcodecamp.com for more information (Yes, I know I put the Microsoft technologies first -- I'm an unpaid unofficial self-proclaimed Microsoft Technologies Evangelist!).  Wither you are just starting out in your career or have been doing this stuff for years you will get something out of Code Camp!  It's not one of those Microsoft "For developers" class sessions where it's just a giant power point and you didn't get any real substance!  In fact, that is part of the Code Camp Manifesto (http://blogs.msdn.com/trobbins/archive/2004/12/12/280181.aspx)

Information:

Date: April 26, 2008 (This Saturday)
Time: 9:00AM - 5:00PM
Please register here.

I will be doing the Silverlight 2.0 presentation so please come!! 

Thanks!
Nathan Zaugg

4月18日

Disable an ASP.NET button after clicking

I was creating a payment form recently and I wanted to disable the submit button after the user had clicked it so that there was no chance of them clicking it twice on accident. 

This seems like one of those things that just ought to be a slam dunk!  Back when I was doing ASP, this was one of the easiest things I ever did.  I have done it with asp.net before, but I never needed validation to work as well.  It took me a long time, many searches and trial and error but I found a solution that will disable the button and doesn't get in the way of validation.

protected override void OnInit(EventArgs e) { // We need this to get our button event Form.SubmitDisabledControls = true; btnProcessPayment.UseSubmitBehavior = false;   // Attach javascript code to the OnClientClick event btnProcessPayment.OnClientClick = "javascript:if ( Page_ClientValidate() ) " + "{this.disabled=true; this.value='Please Wait...'};";   base.OnInit(e); }

The javascript is pretty straight-forward.  We are simply calling the validation function ourselves, if it validated we disable the button and change the text.  What does the rest of the code do then? Well, normally when a control is disabled it doesn't post data on postback.  Fortunantly, ASP.NET makes it easy to override that default behavior.  Without this data our button click event would never fire!

You can also do this in the HTML as well.

 

<form id="form1" submitdisabledcontrols="true" runat="server"> <asp:button id="btnProcessPayment" onclick="btnProcessPayment_Click" runat="server" onclientclick="javascript:if ( Page_ClientValidate() ) {this.disabled=true; this.value='Please Wait...'};" usesubmitbehavior="false" text="Process Payment" />

 

I hope this is useful to someone!  If you end up using it on one of your sites, please leave a comment!

Thanks!
Nathan Zaugg

4月1日

Worst Objective Ever!

I do a lot of tech interviews.  If I'm really into it that day I'd say I give one of the better Interviews your likely to receive.  I can honestly say that no one has what I would call a decent resume, but this one takes the cake for the worst objective ever!

 

Objective:

Secure wealth and comfort for my family and employer in an orderly, organized fashion, using my current expertise and learning new

technologies to maximize profits and reduce bad stuff.

I have been looking for a long time for someone to secure wealth in an orderly fashion.  My three favorite parts are 1) Organized acquisition of wealth. 2) The hard return inside of the sentence. and 3) "reduce bad stuff". (my favorite!)

--Nathan Zaugg

3月31日

Holey Tax-rate, Batman!

I recently ran across this in an MSN article.  They say that from January 1st until the time your taxes are due (April 15th) that during all of that time you are working for the government in the form of paying taxes!   It turns out that it varies per state.  If you live in Connecticut it's May 20 (on a leap year like 2008).  In Oklahoma it's April 12th.  In Utah, where I live, it's April 20th.  (Calculation: 365.25/Tax burden = days + Jan 1 = Date)

I really wonder what the ideal tax rate should be.  I know first-hand that tax will only increase over time and that we get less and less for it.  We slowly become a socialistic society and the founding principals our forefathers came here for erode away.  In the UK (at least while I was there) you pay 17.5% VAT (Value Added Tax).  This is in addition to a hefty income tax.  The UK may boast low unemployment rates but that is only because people don't have to work to make a decent living.  The mountain of tax on the "rich" pays for the "poor" to remain "poor" (as though you could call anyone rich or poor in England).  I am opposed to the division of riches into "rich" and "poor"; it is good to have a large, healthy "middle" working-class. A very large middle class is very good for a country.  There are two truisms here:

  1. You can't create middle class by taxing the upper class.
  2. A tax rate has almost nothing to do with creating a middle income working class.  In fact, you might say the opposite is true.

By my estimation, in the year 2050 the average tax rate will increase to 56% and with the so-called middle income squeeze, there will be far less middle-income working class around.

 

--Nathan Zaugg

Taxes by state
  Sales Gas/gal. Cig./pack Beer/gal. State burden Rank State/Fed. burden Rank

Alabama

4.0%

$0.20

$0.43

$1.05

8.8%

46

28.0%

49

Alaska

none

$0.08

$2.00

$1.07

6.6%

50

28.1%

48

Arizona

5.6%*

$0.19

$2.00

$0.16

10.3%

31

31.3%

25

Arkansas

6.0%

$0.22

$0.59

$0.21

11.3%

13

30.7%

32

California

7.3%

$0.46

$0.87

$0.20

11.5%

12

34.3%

8

Colorado

2.9%

$0.22

$0.84

$0.08

10.4%

30

31.8%

23

Connecticut

6.0%

$0.44

$2.00

$0.20

12.2%

8

38.3%

1

Delaware

none*

$0.23

$1.15

$0.16

8.8%

47

31.2%

26

Florida

6.0%

$0.33

$0.34

$0.48

10.0%

38

33.6%

12

Georgia

4.0%

$0.26

$0.37

$0.48

10.3%

32

30.9%

28

Hawaii

4%*

$0.33

$1.80

$0.93

12.4%

6

33.0%

16

Idaho

6.0%

$0.25

$0.57

$0.15

10.1%

35

29.6%

42

Illinois

6.3%

$0.40

$0.98

$0.19

10.8%

22

33.2%

14

Indiana

6.0%

$0.32

$1.00

$0.12

10.7%

25

30.8%

30

Iowa

5.0%

$0.22

$1.36

$0.19

11.0%

18

30.6%

33

Kansas

5.3%

$0.25

$0.79

$0.18

11.2%

15

31.0%

27

Kentucky

6%*

$0.19

$0.30

$0.08

10.9%

20

30.4%

34

Louisiana

4.0%

$0.20

$0.36

$0.32

11.0%

17

29.1%

44

Maine

5.0%

$0.29

$2.00

$0.35

14.0%

2

33.9%

10

Maryland

6.0%

$0.24

$2.00

$0.09

10.8%

23

33.1%

15

Massachusetts

5.0%

$0.24

$1.51

$0.11

10.6%

28

34.4%

7

Michigan

6.0%

$0.36

$2.00

$0.20

11.2%

14

31.9%

21

Minnesota

6.5%

$0.22

$1.49

$0.15

11.5%

11

33.9%

11

Mississippi

7.0%

$0.19

$0.18

$0.43

10.5%

29

28.1%

47

Missouri

4.2%

$0.18

$0.17

$0.06

10.1%

34

30.2%

38

Montana

none

$0.28

$1.70

$0.14

9.7%

41

29.8%

39

Nebraska

5.5%

$0.24

$0.64

$0.31

11.9%

9

31.8%

22

Nevada

6.5%

$0.33

$0.80

$0.16

10.1%

36

35.2%

4

New Hampshire

none*

$0.20

$1.08

$0.30

8.0%

49

30.8%

29

New Jersey

7.0%

$0.15

$2.58

$0.12

11.6%

10

35.6%

3

New Mexico

5.0%

$0.18

$0.91

$0.41

9.8%

40

28.8%

45

New York

4.0%

$0.41

$1.50

$0.11

13.8%

3

37.1%

2

N. Carolina

4.3%

$0.30

$0.35

$0.53

11.0%

19

31.3%

24

N. Dakota

5.0%

$0.23

$0.44

$0.16

9.9%

39

30.2%

37

Ohio

5.5%*

$0.28

$1.25

$0.18

12.4%

5

32.4%

18

Oklahoma

4.5%

$0.17

$1.03

$0.40

9.0%

45

27.8%

50

Oregon

none

$0.25

$1.18

$0.08

10.0%

37

30.7%

31

Pennsylvania

6.0%

$0.32

$1.35

$0.08

10.8%

24

31.9%

20

Rhode Island

7.0%

$0.31

$2.46

$0.10

12.7%

4

35.1%

6

S. Carolina

6.0%

$0.17

$0.07

$0.77

10.7%

26

30.3%

35

S. Dakota

4.0%

$0.24

$1.53

$0.27

9.0%

44

29.3%

43

Tennessee

7.0%

$0.21

$0.62

$0.14

8.5%

48

28.8%

46

Texas

6.25%*

$0.20

$1.41

$0.19

9.3%

43

29.8%

41

Utah

4.7%

$0.25

$0.70

$0.41

10.7%

27

30.3%

36

Vermont

6.0%

$0.20

$1.79

$0.27

14.1%

1

35.1%

5

Virginia

5.0%

$0.20

$0.30

$0.26

10.2%

33

32.9%

17

Washington

6.5%*

$0.36

$2.03

$0.26

11.1%

16

34.0%

9

West Virginia

6.0%

$0.32

$0.55

$0.18

10.9%

21

29.8%

40

Wisconsin

5.0%

$0.33

$1.77

$0.06

12.3%

7

33.3%

13

Wyoming

4.0%

$0.14

$0.60

$0.02

9.5%

42

32.1%

19

*State collects Gross Receipts Tax applied before retail level.

Updated March 27, 2008

Source: http://articles.moneycentral.msn.com/Taxes/Advice/TheBestAndWorstStatesForTaxes.aspx?page=2

3月26日

Gigantic Bug in SQL Server 2005 Full Text Query

You know you've done something wrong when it takes 30+ seconds to run a full-text query.  The most annoying part of this bug is the fact that it is something very small and inconsequential that "triggers" the bug.  It's a lot like an murder investigation where the killer turns out to be a Nun. 

Here is the setup---

  1. I have a full text index on a text field in my database.  This table happens to be our Phrase table (for data localization)
  2. I do a very simple full text search on that field in a SQL Server proc
  3. I want to test my proc so I add some fixed input
  4. Setting a value after the fact causes my full text to be *very* slow!!!

Here is the code

ALTER PROCEDURE [dbo].[AdvancedTrackSearch_TEST] ( @TrackTitleCrit xml ,@TrackDescCrit xml ,@RecordLabelCrit xml ,@CategoryCrit xml ,@ComposersCrit xml ,@TrackDuration int ,@TrackDurationOperator int ,@LangID int ,@PageSize int ,@PageNumber int ,@UserID int ) AS BEGIN   -- Temporary input DECLARE @TrackTitleStr nvarchar(2000) SET @TrackTitleStr = '"booty poppin"'   -- *********************************** -- * THIS LINE CAUSES THE PROBLEMS * -- * BY SIMPLY REMOVING THIS LINE * -- * THE QUERY TIME WILL GO FROM 30+ * -- * SECONDS TO LESS THAN 1 SECOND! * -- *********************************** SET @LangID = 66     DECLARE @TitlePhrases TABLE ( PhraseID int, DictionaryID int )   INSERT INTO @TitlePhrases SELECT PhraseID, DictionaryID FROM [dbo].[Phrase] WHERE --PhraseID NOT IN (SELECT PhraseID FROM @TitlePhrases) CONTAINS([TEXT] , @TrackTitleStr) --[Text] like @Phrase AND LanguageID = @LangID   -- Check the output SELECT * FROM @TitlePhrases   END   -- ****************************** -- NOW WE TRY TO EXECUTE THE PROC -- ****************************** DECLARE @return_value int   EXEC @return_value = [dbo].[AdvancedTrackSearch_TEST] @TrackTitleCrit = NULL, @TrackDescCrit = NULL, @RecordLabelCrit = NULL, @CategoryCrit = NULL, @ComposersCrit = NULL, @TrackDuration = NULL, @TrackDurationOperator = NULL, @LangID = NULL, @PageSize = NULL, @PageNumber = NULL, @UserID = NULL   GO  

It seems so simple and stupid but setting the LangID (even if we pass null into the actual query) causes the query to take a substantially longer time doing the full text search.

I hope someone finds an explanation!

--Nathan Zaugg

 

UPDATE:

As a matter of fate, me and my friend Phil Gilmore stumbled on the answer.  The trick is to "SET ARITHABORD ON" for one of the first things that you do in the query.  This is usually linked to arithmetic exceptions and overflows, but for some reason with out it there is little chance your query will perform.  If you look at the difference between the execution plans before setting that variable vs. after you can see that the execution plan changes a lot!  After ARITHABORT is ON the execution plans are again identical!  Check out my post on MSDN forums. 

-- Nathan Zaugg

3月21日

Removing an account from the login screen in Windows XP and Windows Vista

You have no idea how it got there but one day you start your computer and get several new "accounts" you can login as.  This is very annoying and frustrating!  Fortunately there is a way to "hide" those accounts without affecting the applications that added them. 

Here is the process:

  1. Open up the "Run" dialog. (Windows Key + R)
  2. Type "Regedit".  Note: Vista Users will require Administrative approval
  3. Navigate the registry keys to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList
  4. Right click in the window New -> DWORD(32-bit Value)
  5. Type the name of the account you wish to ignore as the name of the value
  6. Leave the "Data" at what it defaults to.
When you are done it should look like this:

image

3月11日

Registering a Control Defined inside of a web solution

 
I've come across this several times.  You build a custom control inside of your web_code folder and you can't reference it from your project because you can't figure out what assembly your supposed to reference (as your web code doesn't normally have a set assembly name).  I finally figured out how to do this recently.
 
Normally you're tempted to put something like this:

<%@ Register Assembly="MyWebComponent" TagPrefix="as" %>

When really you need to put something like this:

<%

@ Register Namespace="NSM.WebControls" TagPrefix="as" %>

The only trick is that you need to make sure you put your custom class inside of a set Namespace.  Normally any class inside of a web project doesn't belong to a specific namespace.

Now we can reference our control:

<as:MyWebComponent ID="MyControl1" runat="server" />

--Nathan Zaugg

3月8日

SmartRename :: File Renamer

Last week our camera card filled up.  Like most people, we'd almost rather buy a new, bigger card rather than try to go through the process of getting the photos onto the computer, processed, and burned to CD's.  We decided that with about 2GB of pictures and videos on our cards we better download them.  My wife, Tiffany, likes to rename all of the photo's from their naturally intuitive name like "DSC0001253.JPG" to something a little more clear like "February 2008-01.JPG" and so on.

With literally hundreds of images to rename (and she did this all by hand) I literally felt pain as I watched he do this for only a minuet or two.  I got an idea for a program and I was sure I could have it written before she could finish her current folder.  Well, it was a tie but now we have this nifty little application that will rename the files for us.

Here is a screen shot:
image

Instructions:

  1. Select the path of the photo's you wish to rename.  If, for example, you want to rename a months worth of photo's, move them into their own folder first.
  2. You may use the "..." button to browse to the folder.
  3. Select a name format.  This is the way the photo's will  be renamed.  The tricky part is to make sure and put the "{0:000}" in the string.  This is where the number is going to go.  The first zero indicates that is is the first (only) parameter passed into the string format function.  The "000" after the colon is the numeric formatter.  The formatters are explained here.
  4. Select the type of file you wish to rename.  For example if your camera is like ours it will also take videos.  You don't want to accidentally rename a .AVI to a .JPG because it will no longer work. 
  5. When you are done, press the "Run" button.  Before it renames any file it will verify the format with you (see below).
  6. You will see full progress indicators and it should only take a second or two even to do thousands of files.

image

As always, please drop me a line when you download it and let me know if you like it, hate it, or whatever!

 


Thanks!
Nathan Zaugg

3月3日

January 2008 NUNUG Notes

I am a little behind on my Blog but I wanted to be sure and post my notes from January's NUNUG meeting on Visual Studio 2008 and the new features in the C# 3.0 framework.

I also wanted to post notes from a remoting presentation I did for STG a year or so ago.

Enjoy!

iGen :: Open Source XSLT Code Generation Application

I have decided to open source a project that I have been working off and on since 2003.  I have always been a big fan of code generation and felt like I knew what it takes to do it right. iGen is actually the second separate attempt.  My original attempt is named SmartDAL and is also included in the downloads below.

What is iGen?

iGen is simply a fancy XSLT processing engine.  It works by having 2-3 main concepts.

  1. XML Provider - The XML provider is responsible for providing XML to the XSLT templates.  Currently it has Oracle provider and SQL Server provider.  Each of these will generate SQL that will be used in the XSLT transformation. 
  2. XSLT Transformations - The XSLT transformations are a set of files that will transform the XML that is generated from the XML Provider.  The transformations also use a standard set of variables and accepts custom variables.
  3. File Splitter - The result of an XSLT transformation results in a single file only.  If you wish for multiple files as the output then you need to use the built-in splitter. 

Main Screen

This is the main screen.  The top portion is our XML Providers.  You can see that both SQL Server and Oracle are there.  This is where you configure which tables, proc's, and database relationships will be used to generate the XML data.  It may be desirable to leave out certain tables or proc's so you can choose which ones you wish to include. 

Options

The options screen is used to setup project workspaces.  The idea behind this concept is that ever developer has their favorite place they like to develop code.  I like to have a D:\Projects\[Client]\[Project] structure.  Others use C:\Source.  Whatever the path it's nice to keep those different and still be able to generate code!  We will use  these workspaces in later screens.

XSLT Properties

This next screen shot is of the XSLT settings dialog.  Let me go through the controls one by one.

  1. Settings Description - This is simply the text that will be displayed in the parent dialog.  Generally a short description of what you this template does is best.
  2. XSLT Template - This is the location of the template you wish to process.  Notice that there is a drop-down box and a partial path.  This is part of the workspaces mentioned above.  Of course the path does not need to be part of the workspace provided. This should always be a valid XSLT transformation.
  3. Data Provider - This selects which XML Data Provider will be used for this transformation.  Because the XML that is generated does not have to follow any specific schema you are required to select a provider that is compatible with the XSLT.
  4. Filename Extension - This gives the user the ability to name the file output.  If you are generating a single file then type the entire file name here.  If you are generating multiple files then put a suffix if desired and the filename extension.  In the example above the files will end with "_INSERT.sql".  The rest of the filename is generated by the XSLT transformation.
  5. Workspace / Path - This is the output directory for the transformation.  Again, you can see that we are using a different workspace than defined above.  If you browse to a directory that is inside of the selected workspace path then you will only see a partial path in this box.  Otherwise you will see a full path.
  6. Parameter Window - This is where you can add custom parameters for your XSLT.  These parameters can be found inside of the XSLT defined at the top of the file.  These parameters can be optional but it really depends on how the XSLT was written.

You press the generate button and away we go.  You will see what is happening and how long until it finishes.  When you are done you may choose to save your settings (after all it can be a lot of work setting these templates up). 

Template Params

This is an XSLT template.  You can see from the screen shot (params highlighted in yellow) that this transformation expects 5 params.  ProcPrefix, FileNameExtension, DatabaseSchema, DatabaseName, and DatabaseUserName (in no particular order).   The FileNameExtension parameter is provided by the XSLT properties window in the "Filename Extension" fields.  The rest are custom parameters and the XSLT generation engine will not know if they are required or not.  As you can see from the screen shots above I have defined all but the "ProcPrefix".  This template is designed to make ProcPrefix optional.  It will run just fine without it.  But for those who like all of their stored procs to start with "proc_" or "sp" then they may choose to set a value for this parameter in the Parameter window in the XSLT properties dialog. 

Note also the use of "#[<xsl:value-of select="@name" /><xsl:value-of select="$filenameextension" />]#" in the example.  The #[ and ]# are used by the file splitter.  The value inside of the tokens is used as the filename.  Ex: #[proc_USERS_INSERT.sql]#

If you wish to create a custom XML Provider you simply need to implement the correct interface and place the DLL in the application directory during startup. 

 

Known Issues:

  • The Oracle XML provider is a little more advanced than the SQL XML provider.  The oracle provider will provide relationship information that the SQL provider does not yet.
  • The Oracle provider is dog slow!  This is actually a performance issue with querying relationship information from an Oracle database.  For those who have to use this, I am sorry!  If it makes you feel better the XML data is cached once it is created so if you goof up on the first run the second one will be much faster.
  • The generated classes are somewhat geared toward an Oracle Smart-Client application.  These templates and classes were all "perfected" with the Oracle client.  I much prefer to use Microsoft SQL Server 2005/2008 but sometimes you don't get to choose!  If you wish to modify the templates to work for SQL Server it probably isn't a lot of work.
  • .tmp files are left over after generation. These are the original results from the transformation.  They can be useful for debugging.
  • There is a "lib" directory inside of the templates directory.  This is an open source XSLT function library.  We use it to mainly make sure the case of our objects is what we need it to be.

Screen Shot of SmartDAL:

 SmartDAL

I hope you enjoy it!  Please drop me a line if you download it and if you are using it.

Downloads:


Thanks!
Nathan Zaugg

Credits
I wasn't alone in working on iGen.  I had a lot of help from the team that used it.  Bret Cutler, Richard Brower, and Garth Harris.  An awesome team -- I would love to work with these guys on another project!

2月18日

Ten Rules for Financial Preparedness

1) Pay your tithing first. Pay a generous fast offering.
2) Save Money. Pay yourself first and plan for retirement.
3) Avoid Debt, especially junk debt (anything you buy that is not an asset). Pay off any debt as quickly as possible; once something has been paid off, apply that amount to any other debt you may have until you have no debt remaining.
4) Use a budget and track all your expenditures. Know where your money is going and learn to manage money before it manages you.
5) Live with-in your means. Spend much less than you earn.
6) Learn self-discipline and self-restraint in money matters.
7) Make education a continuing process.
8) Build a reserve and keep at least $500 in it.
9) Keep appropriate insurance.
10) Teach your family how to manage their finances.
1月28日

Tribute to Gordon Bitner Hinckley - Prophet of God

Wither you are part of the Mormon faith or not there is a good chance that you know the name Gordon B. Hinckley.  His passing is sad for many of us.  He has been the prophet for 13 years and has been in the first presidency since 1981.  For many who are younger or new converts he was the only prophet they have known.  His wisdom, character, humor, courage, and capacity to express love toward all were some of his trademark attributes.  He has been known as the face of the Church of Jesus Christ of Latter-day Saints (LDS Church) for seven decades. 
 
I remember when President Hinckley became the prophet.  I remember the feeling that "ahh, we have a 'dream team' and we're going to see the Church move faster than it has before".  I also remember at that Stake Conference we were asked to sustain him as our new prophet.  I got an overwhelming feeling that I knew he was supposed to be the prophet and that I needed to follow his council. 
 
I have always felt a special bond with President Hinckley.  We both served our missions in England; both with about as much success.  It was very uplifting for me to know that even he got discouraged while serving and wondered if his time there was well spent.  I spent two years teaching people the gospel of Jesus Christ day-in and day-out.  Eleven hours a day 6 and 1/2 days a week I searched for people looking for truth and light.  I taught hundreds but I baptized a single person on my mission.  I know that you can not measure the success of a mission by baptisms -- I do not know how to measure such a thing; But I do know that it was worth the time I spent and hearing of his experiences gives me even more confidence that my service was valuable. 
 
I know that I am not alone in thinking that his combine contributions to the Church and to humanity in general were very, very great! 
 
We prayed for him daily and we were blessed that he could stay with us as long as he did.  He is our beloved prophet.  And while I will miss him deeply this is an exciting time as we get to sustain a new prophet.  While it is not easy to feel right now that same confirming spirit I felt when President Hinckley became the Prophet will again testify to us that a new prophet is hear to lead us in this next era of faith.
 
President Hinckley, we love you!  God be with you 'til we meet again.
 
--Nathan Zaugg