Archive for December, 2009

Happy New Year

Thursday, December 31st, 2009

I just wanted to wish you a happy new year. Thank you for taking the time to stop by and read what I write. This site is tiny by the standards of the Internet, but that just means each reader is that much more special. Best wishes for a prosperous 2010.

If all goes well, I should be launching a new iPhone app in January. If you’re interested in joining a (free) Beta for an app that will Change Your Life, please send me your e-mail address.

The Prince: Chapter 18

Wednesday, December 30th, 2009

Today we look at the eighteenth chapter of Niccolo Machiavelli’s “The Prince“. This chapter discusses “In What Way Princes Must Keep Faith”, and concludes the dastardly tetralogy of chapters on which, in my opinion, the popular conception of N.M. is based. You will not be surprised to learn that N.M. feels that a prince cannot be entirely honest at all times. (A prince should “not deviate from what is good, if possible, but be able to do evil if constrained”.) You may be surpassed to see him engaging in some surprisingly (post-)modern literary analysis.

(more…)

The Prince: Chapter 17

Tuesday, December 29th, 2009

Today we look at the seventeenth chapter of Niccolo Machiavelli’s “The Prince“. This chapter is “Of Cruelty and Clemency, and Whether It Is Better to Be Loved or Feared”, and, if you know N.M. by reputation (or have been following along thus far) you can probably write a good summary of this chapter without even reading it. At only 3 pages, however, it’s still worth a quick look.

(more…)

Welterweights

Monday, December 28th, 2009

Since the Floyd Mayweather/Manny Pacquiao fight seems to have run up on the rocks at the moment, let me seize this opportunity to issue a modest proposal: Paul Williams (who says he can still make 147) vs. the winner of Mosley/Berto for the generally recognized position of #1 welterweight.

Mayweather and Pacquiao are good fighters, but, I would argue, not really welterweights; they’ve only fought one consensus top welter between them, and that at a catch weight. They’re just roaming around 147 in order to make as much money as possible and, hey, good luck with that. But when it comes to determining the best guy in that weight class, I’d like to see it fought out between guys who’ve put the rounds in to establish a meaningful record in that division.

Deep Copying (Built-In)

Sunday, December 27th, 2009

I’d previously presented some code that made deep copies of plists. I recently discovered that this code is superfluous, due to the CFPropertyListCreateDeepCopy method. You can invoke this function with a call such as this:

testData = CFPropertyListCreateDeepCopy(kCFAllocatorDefault, [NSDictionary dictionaryWithContentsOfFile:path], kCFPropertyListMutableContainersAndLeaves);

(This assumes that path has previously been set to something meaningful, and that testData will later be used for some good purpose.)

Better late than never, I suppose.

The Prince: Chapter 16

Saturday, December 26th, 2009

Today we look at the sixteenth chapter of Niccolo Machiavelli’s “The Prince“. This chapter is “Of Liberality and Niggardliness”. It is an interesting chapter which argues that a prince who is generous with his (people’s) money will ultimately earn their enmity and ruin his state. This prefigures modern discussions of government spending.

(A quick aside: “niggardly” is not etymologically related to “the N-word”, so please don’t write.)

(more…)

Merry Christmas

Friday, December 25th, 2009
s = 's = %s; print s %% repr(s)'; print s % repr(s)

(Put it in a file, e.g. ps.py, then run python ps.py | python | python | python | python | python | python | python | python | python | python | python | python | python | python | python | python | python | python | python | python | python | python and see what happens.)

C99 Arrays

Thursday, December 24th, 2009

Today, I learned that a cool “new” C feature had snuck up on me. This was added in C99, and it has apparently been integrated into Objective-C (where I stumbled across it) as well. Briefly, this sort of thing is now legal:

void quux(int x)
{
    char someArray[x];    // Illegal in K&R or ANSI C, ok in C99

    ...other, less interesting code...
}

(Previously, “x” would have had to be a constant that could be determined at compile-time.)

I guess I should pay more attention to this sort of thing.

The Prince: Chapter 15

Wednesday, December 23rd, 2009

Today we look at the fifteenth chapter of Niccolo Machiavelli’s “The Prince“. This chapter is “Of the Things for Which Men, and Especially Princes, Are Praised or Blamed”, and is perhaps the most stereotypically “Machiavellian” of the book. It’s still worth reading.

(more…)

The Prince: Chapter 14

Tuesday, December 22nd, 2009

Today we look at the fourteenth chapter of Niccolo Machiavelli’s “The Prince“. This chapter discusses “The Duties of a Prince with Regard to the Militia”, and in it N.M. argues that making war is the essence of being a prince; he also offers some suggestions for how one may prepare to do so.

(more…)