April 2005 - Posts

Every Job Ad You've Ever Read

Job ads these days are monotonous. They all seem to blur into the following:

Come put your skills to work at a fast paced and growing company! Our work environment is highly collaborative, exceedingly innovative, and vastly stimulating!!

Required skills:
    - blah
    - blah
    - blah de blah de blah blah

This position also requires excellent communication skills from a detail oriented self-starter who likes to mentor others and thinks out of the box.

Salary commensurate with experience and our mood. We offer a competitive benefits package, meaning it’s the least we can get away with.

Email your resume for immediate consideration by our automated resume scanning tool, which will shred your document into keywords and bulk insert records to a database for someone to search. When they feel motivated. Maybe next month.

Our lawyers would like to point out that we are an equal opportunity employer, even though it is safe to assume this fact considering U.S. federal laws like the Civil Rights Act of 1964, the Equal Pay Act of 1963, the Age Discrimination Act of 1967, and the Disabilities Act of 1990.

No agencies, H1B visas, or ugly people need apply.

posted by scott with 12 Comments

Machine.config Shrinks

Something I just noticed in 2.0: my machine.config is around 17 KB in size, compared to over 200 KB in 1.1. The file seems practically empty. A little comment at the top of the file reveals why:

“To improve performance, machine.config should contain only those settings that differ from their defaults.”

posted by scott with 2 Comments

Debugging Tools

Many thanks to the BaltoMSDN user group for having me present at their monthly meeting last week. The topic was “Debugging – Tips, Tools, & Techniques”. In a few weeks I’ll give the talk again at the MAD Code Camp. The Code Camp schedule is online – there are some great topics and speakers. If you are in the area - it will certainly be worth your time to attend. Register here.

Here are some of the tools and libraries I use during the presentation (besides VS.NET):

Enterprise Library

Microsoft Debugging Tools For Windows (includes WinDbg)

CLR Profiler

SysInternals.com – for Process Explorer, FileMon, and RegMon

Fiddler 

posted by scott with 1 Comments

Debug Code In Production

Milan Negovan has a nice article on the web: “Beware Of Deploying Debug Code In Production”. Includes a nice analysis of what is happening in the ASP.NET temporary files directoy.

posted by scott with 2 Comments

Speaker's Night Out

One of the highlights of my Toronto trip was walking downtown and dining with the collective brain trust of Richard Hale Shaw, Walt Ritscher, Chris Kinsman, Rocky Lhotka, Brian Randell, Kevin McNeishDerek Hatchard, David Totzke, and Rebecca Diaz. Here is a shot of Dave, RHS, Walt, Kevin, and Rocky. Kevin is looking up at the CN Tower.

 

I also want to thank those who came to my sessions. I hope you enjoyed the presentations and found them informative.

posted by scott with 0 Comments

C++ Habits

I came to the conclusion this week that I have at least one C++ habit I can’t kick. When I want to check an object reference for null, my fingers automatically type:

Widget woo = GetWidgetFromSomewhere();

if(woo)

{

    // …

}

     Error: Cannot implicitly convert Widget to bool.

After five years of working together, the compiler still doesn’t understand me.

posted by scott with 2 Comments

GROUP BY and Column Aliases

Here is a subtle bug you can introduce into a query. Let’s pretend we are tracking coffee sales.

CREATE TABLE CoffeeSales

(

    TransactionID int IDENTITY PRIMARY KEY,

    Customer varchar(10) NOT NULL,

    CoffeeType varchar(10) NOT NULL,

    TransactionDate datetime NOT NULL,

    Cost money NOT NULL

)

 

INSERT INTO CoffeeSales

   VALUES('Joe', 'Decaf', '2004-04-17 07:30:00', 2.25)

INSERT INTO CoffeeSales

   VALUES('Joe', 'Decaf', '2004-04-17 09:00:00', 3.25)

INSERT INTO CoffeeSales

   VALUES('Joe', 'Mocha', '2004-04-17 17:00:00', 5.00)

 

INSERT INTO CoffeeSales

   VALUES('Amy', 'Maple', '2004-04-17 15:00:00', 1.25)

INSERT INTO CoffeeSales

   VALUES('Amy', 'Mocha', '2004-04-17 16:00:00', 4.75)

INSERT INTO CoffeeSales

   VALUES('Amy', 'Mocha', '2004-04-17 17:00:00', 3.50)

Here is a query attempting to total up the sales for each customer by coffee type and date.

SELECT

    Customer,

    CoffeeType,

    CONVERT(varchar(10), TransactionDate, 101) AS TransactionDate,

    SUM(Cost) AS TotalCost,

    COUNT(*) AS TotalTransactions

 

FROM

    CoffeeSales

 

GROUP BY

    Customer, CoffeeType, TransactionDate

 

ORDER BY Customer

 

Customer   CoffeeType TransactionDate TotalCost            TotalTransactions

---------- ---------- --------------- --------------------- -----------------

Amy        Maple      04/17/2004      1.2500                1

Amy        Mocha      04/17/2004      4.7500                1

Amy        Mocha      04/17/2004      3.5000                1

Joe        Decaf      04/17/2004      2.2500                1

Joe        Decaf      04/17/2004      3.2500                1

Joe        Mocha      04/17/2004      5.0000                1

We have 6 records, and when eyeballing the resultset we don’t see why Amy’s mocha purchases and Joe’s decaf purchases are not grouping up, after all, the name, coffee type, and transaction date are identical.

To realize what went wrong we have to think about how the database engine executes the query. Records are grouped before the CONVERT expression in the SELECT list executes. We think we are grouping by the converted TransactionDate field used as a column alias, but what SQL is doing is grouping on the raw TransactionDate field from the table, then executing the CONVERT and showing the field as just a date.

A working version follows.

SELECT

    Customer,

    CoffeeType,

    CONVERT(varchar(10), TransactionDate, 101) AS TransactionDate,

    SUM(Cost) AS TotalCost,

    COUNT(*) AS TotalTransactions

 

FROM

    CoffeeSales

 

GROUP BY

    Customer, CoffeeType, CONVERT(varchar(10), TransactionDate, 101)

 

ORDER BY Customer

posted by scott with 0 Comments

On Tour

This week I am traveling to Toronto to speak at VSLive! I have presentations on Thursday and Friday afternoon. Toronto is a spectacular city to visit, and the conference location looks to be in a beautiful spot.

The following week I’ll be speaking at the BaltoMSDN user group meeting in Hunt Valley, MD, just outside of Baltimore. The meeting is on Wednesday, April 20th at 6:30.

In between the two, I’ll be spending some time here, and some time here.

I think I am addicted to satellite imagery.

Is there a support group?

 

posted by scott with 0 Comments

Scott's Blog @ OdeToCode.com

Completely unpredictable ...

.... since 2004.

posted by scott with 1 Comments