January 10, 2007

JPEGs in Subversion

Filed under: Tech — Chris @ 8:41 pm

If you’ve got a JPEG under Subversion and it looks like this

when it should look like this
maybe Subversion thinks it’s a text file. Try

svn propdel svn:eol-style MY.jpg
svn propset svn:mime-type image/jpeg MY.jpg

Brought to you courtesy of this guy

Bonus fact: if you’re accessing Subversion via svn+ssh and it asks for your password more than once, fret not. Subversion and SSH are just really dumb. See here.

Person of the Year Update

Filed under: Not Tech, Politics — Chris @ 4:57 pm

Twenty-four hours later my comment still hasn’t shown up. (And, no, it didn’t include any slander, profanity, or links to pornography.) Despite the fact this post is lighting up the left-of-center blogosphere like a Christmas tree, it has only 16 comments so far. Nice participating in your community,…

January 9, 2007

Joe Klein, Turd Blossom

Filed under: Not Tech, Politics — Chris @ 8:11 pm

I formulated a response to this Joe Klein drivel which has been shit-canned to the moderator queue for the last four hours*. In the meantime, BooMan has published the definitive take-down:

Friends do not let friends drive drunk. In the case of George W. Bush and the neo-conservatives, they not only are insisting on driving intoxicated, they won’t let us out of the car and they respond to all requests to slow down by stomping on the accelerator. In this situation the only rational thing to do is to wait for them to come to a halt at a stop sign (if they are sober enough to avoid running it) and smack them in the head with a sock full of pennies. We need to take away the car keys, Mr. Klein.

You can call me an “illiberal leftist and reactionary progressive”, you can say my “naivete on national security–and the left wing tendency to assume every U.S. military action abroad is criminal–just aren’t very helpful electorally.” You can talk all the shit you want. But you are still letting your friends drive drunk and criticizing anyone that wants to do something about it.

* I will take this opportunity to say that moderating blog comments is clueless and completely beside the point. Wake up, people! I am the Time Magazine Person of the Year! Why won’t you publish my brilliant writing?

January 6, 2007

The Unix Shell: Argh

Filed under: Tech — Chris @ 6:26 pm

Suppose you’re trying to write a simple shell script. And suppose you very badly want to put a command into a shell variable before you execute it. And suppose that command very badly needs to accept double-quoted strings as arguments. Oh, the layers of indirection! How will the shell tokenize such a thing?

Let the command in question be the following homely shell script.
#! /bin/sh
# Usage: [-s STRING]*
while test ${1+set}; do
case $1 in
if ! test ${2+set}; then
echo "no string after -s"
exit 1
echo "string arg=\"$2\""
shift 2
echo "bad arg: $1"
exit 1

Let’s see what happens.

% ./ -s "quoted arg"
string arg="quoted arg"
% cmd="./ -s \"quoted arg\""
% echo $cmd
./ -s "quoted arg"
% $cmd
string arg=""quoted"
bad arg: arg"
% eval $cmd
string arg="quoted arg"

AND REMEMBER, KIDS: echo `foo` gives you the output of foo and { foo; echo $? } gives you its exit value.

if foo 
then bar

executes bar if foo succeeds (conventionally), which is equivalent to

foo && bar

in the short-circuiting parlance.

if ! foo 
then bar

executes bar if foo fails (conventionally), which is equivalent to

foo || bar

in the short-circuiting parlance.

if `foo`
then bar

executes bar if the command output by foo exists and returns exit value 0 (if it doesn’t exist, it will just exit).

if test `foo`
then bar

executes bar if foo doesn’t produce any output.

[UPDATE] One more thing. Setting shell variables.

% CMD=cmd arg
bash: arg: command not found
% CMD= cmd arg
bash: cmd: command not found
% CMD= "cmd arg"
bash: cmd arg: command not found
% CMD="cmd arg"
% echo $CMD
cmd arg

This often trips me up, because make is much more forgiving and I hack more Makefiles than shell scripts.

[UPDATE 1/8/2007] I got the if-then stuff wrong the first time. Which goes to show you how desperately I need this tutorial. In shell-world exit code 0 is “true” and exit code not-0 is “false”. This is sort of the opposite of the C convention, with the caveat that exit values and arithmetic values shouldn’t be conflated.

Another trip-up from C to the shell is that whitespace makes a bigger difference. if ! foo; then bar; fi is not the same as if !foo; then bar; fi.

if foo
then bar

is not the same as if foo then bar fi. {foo; bar;} is not the same as { foo; bar;}. And so on, world without end.

January 5, 2007

The Top Chef Says: Nobody Likes You!

Filed under: Not Tech, Top Chef — Chris @ 4:45 pm

I’m trying to avoid too much basic cable blogging, but I feel moved to comment on the horror of this week’s Top Chef. Sam, Ilan, and Betty’s “nobody likes you, Marcel, and we’re going to prove it” act was straight out of my junior-high nightmares. Isn’t it strange that last year’s “villain,” Tiffany, earned everone’s loathing because she wasn’t a team player and picked on Dave and Miguel, whereas this year’s “villain,” Marcel, is visibly trying to be cooperative and is being picked on by everybody else?

I think the key fact here is that the contestants take what is said at the Judge’s Table very personally. Despite the fact that those in the “bottom three” are forced to opine on “who should go home”—and despite the fact that it’s generally good strategy not to choose oneself—naming names gets you in trouble. Tiffany did herself in by being excessively cut-throat at the Judge’s Table (and also the lying). The last straw with Marcel was probably when he failed to credit Sam with last week’s win (never mind that standing by and letting others take credit for success is hardly the path to victory).

I didn’t like Marcel to start, but his sense of humor in the face of everyone’s hostility has really won me over. He’s pretentious and arrogant (but, come on, he’s not Stephen “You will never succeed, and you will fail horribly” Asprinio (who also won me over in the end, now that I think about it)), he easily descends into self-parody (asked why his turkey roulade was dry, he responded that he didn’t have access to a thermal immersion circulator (or, um, butter)), and he probably doesn’t have the skill to win the competition. But at least he’s not a total dick!

I always hated Betty and I’m glad to see her go. Her excessive cheerfulness seemed to be tautly and thinly stretched over a chasm of extreme bitchiness. Up till this episode, I liked Sam and Ilan and had them figured as top contenders. I’ll be rooting against them from now on. And for Elia and Marcel.

P.S. To Ilan: Marcel will stop making foams when make something other than paella.

What’s Better-Than Armond White?

Filed under: Not Tech — Chris @ 4:32 pm

Finally, his whole critical style distilled to one infographic. Unfortunately, Steven Spielberg didn’t release a movie this year… we’ll have to wait until 2008 to find out why Indiana Jones IV is better than the entire oeuvre of Jim Jarmusch. (Via The House Next Door)

This reminds me: several weeks ago John Podhoretz of the National Review called Manohla Dargis’ review of Inland Empire “the most pretentious piece of writing in all of recorded history.” These can only be the words of a man who has never read Armond White.

« Newer Posts

Create a free website or blog at