The Daily Parker

Politics, Weather, Photography, and the Dog

Lost passwords

I spent part of this afternoon rooting around in my email correspondance from 1999 and 2000. Forgetting the wherefores and whatnots of the emails themselves, just getting into the Outlook files proved difficult. How many passwords does anyone remember from nine years ago? I actually remember a few, but not, unfortunately, the ones I needed.

Sure, I found them eventually, but heavens. That's half an hour of my life I'll never get back, and it was my own fault.

Gabler on the origins of the modern GOP

Writer Neal Gabler says it's not about Goldwater, it's about McCarthy:

McCarthy, Wisconsin's junior senator, was the man who first energized conservatism and made it a force to reckon with. When he burst on the national scene in 1950 waving his list of alleged communists who had supposedly infiltrated Harry Truman's State Department, conservatism was as bland, temperate and feckless as its primary congressional proponent, Ohio Sen. Robert Taft....

McCarthy was another thing entirely. What he lacked in ideology—and he was no ideologue at all—he made up for in aggression. Establishment Republicans, even conservatives, were disdainful of his tactics, but when those same conservatives saw the support he elicited from the grass-roots and the press attention he got, many of them were impressed. Taft, no slouch himself when it came to Red-baiting, decided to encourage McCarthy, secretly, sealing a Faustian bargain that would change conservatism and the Republican Party. Henceforth, conservatism would be as much about electoral slash-and-burn as it would be about a policy agenda.

Speaking of the GOP's legacy, we could be looking at spending $8.5 trillion ($8,500,000,000,000) to clean up the post-Shrub mess:

Just last week, new initiatives added $600 billion to lower mortgage rates, $200 billion to stimulate consumer loans and nearly $300 billion to steady Citigroup, the banking conglomerate. That pushed the potential long-term cost of the government's varied economic rescue initiatives, including direct loans and loan guarantees, to an estimated total of $8.5 trillion -- half of the entire economic output of the U.S. this year.

Nor has the cash register stopped ringing. President-elect Barack Obama and congressional Democrats are expected to enact a stimulus package of $500 billion to $700 billion soon after he takes office in January.

The spending already has had a dramatic effect on the federal budget deficit, which soared to a record $455 billion last year and began the 2009 fiscal year with an amazing $237-billion deficit for October alone. Analysts say next year's budget deficit could easily bust the $1-trillion barrier.

Happy times, happy times.

Feels like winter

Ah, Chicago in December: gray, sleet, snow, wind, rain. Builds character:

The snow has begun falling in Chicago, and more is on the way.

There are flurries downtown, though nothing is sticking. Matt Smith of the city's Department of Streets & Sanitation said in an e-mail that no trucks have been sent out, noting that "We have good air and ground temps and that could continue to be the case for quite some time."

Snow has started to accumulate on the ground and roads in the south suburbs around the intersection of Interstate Highways 57 and 80, according to observers.

The National Weather Service has issued a winter storm warning for Boone, DeKalb, Kane, Lake, Livingston, and McHenry counties and a winter weather advisory for Cook, DuPage, Grundy, Iroquois, Kankakee, Kendall and Will counties.

Yesterday Parker and I walked about 8 miles altogether. Today he'll be lucky to go twice around the block.

It's (un)official: Hillary to Foggy Bottom

Via Talking Points Memo, President-Elect Obama will announce Hillary Clinton as his nominee for Secretary of State tomorrow in Chicago:

Obama plans to announce the New York senator as part of his national security team at a press conference in Chicago, [Democratic officials] said Saturday. They requested anonymity because they were not authorized to speak publicly for the transition team.

In unrelated news, today is the last day of the Atlantic hurricane season.


Why? Why? Why?

The only thing that makes sense to me: someone wants to start a war. I hope to all humanity India and Pakistan keep their senses over the next few days. So do the Indians and Pakistanis, I expect.

Buy Nothing Day

Today (in North America; tomorrow worldwide) is the 17th Annual Buy Nothing Day, "sponsored" by Adbusters:

Suddenly, we ran out of money and, to avoid collapse, we quickly pumped liquidity back into the system. But behind our financial crisis a much more ominous crisis looms: we are running out of nature… fish, forests, fresh water, minerals, soil. What are we going to do when supplies of these vital resources run low?

There’s only one way to avoid the collapse of this human experiment of ours on Planet Earth: we have to consume less.

It will take a massive mindshift. You can start the ball rolling by buying nothing on November 28th. Then celebrate Christmas differently this year, and make a New Year’s resolution to change your lifestyle in 2009.

It’s now or never!

LINQ to FogBugz fun

Most Daily Parker readers can skip this (long) post about software. But if you're interested in C# 3.0, LINQ, or FogBugz, read on.

I use FogBugz's time tracking tool to provide tracability in my billing. If I bill a client 2.75 hours for work on a bug, I want the client to see the exact times and dates I worked on the bug along with all the other details. And because I track non-billable time as well, and I often work in coffee shops or places like the Duke of Perth, I wind up with lots of tiny time intervals that I have to aggregate to produce a bill.

My time sheet today, for example, looks like this:

Start End Case Title
7:11 AM 7:23 AM 901 Walking the dog (November)
8:18 AM 9:32 AM 950 FogBugz to LINQ project
9:32 AM Stop Work 902 Blogging (November)

But what I need for QuickBooks looks like this:

Case Hours
901: Walking the dog (November) 0.20
950: FogBugz to LINQ project 1.23
902: Blogging (November)  

(The last bit has no time because I'm still working on it.)

This is the perfect kind of thing to waste a few hours on while learning some new programming tricks. (Code here.)

First: the entity

To use LINQ to SQL in its pure form, you first have to create entity classes that pretty much exactly mirror the tables you're interested in. My target, the FogBugz timeintervals table, yields an entity that looks like this:

class TimeInterval
	public int Identity;

	[Column(Name = "ixPerson")]
	public int PersonId;

	[Column(Name = "ixBug")]
	public int CaseId;

	[Column(Name = "dtStart")]
	public DateTime StartDate;

	[Column(Name = "dtEnd")]
	public DateTime EndDate;

Because I'm interested in the aggregate time spent on each case, I also created a simple structure to hold that info:

struct AggregateInterval
	public int CaseId;
	public double TotalHours;

Second: the console app

To use LINQ to SQL, you need to include a reference to the System.Data.Linq assembly, and import the appropriate namespaces:

#region Copyright ©2008 Inner Drive Technology

using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;


namespace InnerDrive.Research.FogBugz
	class Program
		static void Main(string[] args)

Next, set up the data context:

DataContext context = new DataContext(" (your connection string) ");
context.ObjectTrackingEnabled = false;
Table<TimeInterval> table = context.GetTable<TimeInterval>();

(I turned off object tracking because this is a read-only application. Setting ObjectTrackingEnabled to false improves performance, but the data context will throw an exception if you call DataContext.SubmitChanges().)

I actually need two queries, one to get the table rows and another to aggregate them. The reason for this is that my aggregation depends on getting the total hours each interval represents; LINQ to SQL won't do that. Here's the first query:

// FogBugz stores time as UTC; I want the time for today in Chicago, not London
DateTime startDate = DateTime.Today.ToUniversalTime();

var intervals =
	from interval in table
	where interval.EndDate <= startDate.AddDays(1) &
		interval.StartDate >= startDate
	group interval by interval.CaseId
	into grouping
	select grouping;

The second query does the aggregation, transforming the first query into an IEnumerable<T> and returning AggregateInterval structs:

IEnumerable<AggregateInterval> aggregation =
	from grouping in intervals.AsEnumerable()
	select new AggregateInterval
		CaseId = grouping.First().CaseId,
		TotalHours = grouping.Sum(t => t.EndDate.Subtract(t.StartDate).TotalHours)

Neither query has fired yet, by the way. That's another cool thing about LINQ. Both queries fire when I output the data, which is trivially simple:

foreach(var item in aggregation)
	Console.WriteLine(string.Format("Case {0} = {1:0.00}", item.CaseId, item.TotalHours));

That's it. Share and enjoy.

These just in

I've just gotten from Amazon two of the best movies ever made, worth the extra few bucks for Blu-Ray:

That said, I'm under my dad's orders to finish Deadwood before watching anything else...

Night flight last Sunday

I had to scrutinize my logbook to figure out when I last flew at night: 26 April 2006, in Nashua, N.H. So I took a flight instructor with me this past Sunday to get "recurrent." (Regulations require that pilots make three full-stop landings at night—further defined as 1 hour after sunset until 1 hour before sunrise—within 90 days in order to carry passengers at night.)

I had a good flight, they can use the airplane again, the instructor enjoyed flying with someone who knew how to fly (as opposed to a pre-solo student), and Chicago Center almost flew a jet up my butt. You can see the last bit in the KML, where I do two 360° turns, one of them at a mile-and-a-half short final. The jet got within 4 nautical miles of me before calling Chicago Executive Tower, which isn't illegal, but did make me a bit uncomfortable watching the TCAS. (Yes, the flight school now has a training plane with a TCAS. They are that cool.)