An Experiment In Scotch

I write to discover what I believe

Month: May 2010

Remembering

Known But To God

Bloody Omaha Beach

“We, and all others who believe in freedom as deeply as we do, would rather die on our feet than live on our knees.” Franklin D. Roosevelt

Wasting Time

I have a confession to make: I’m a time waster. But worse than that, I hate it when other people waste time even though I have a strong tendency to do exactly the same thing whenever I sit down in front of the computer. Regardless of my hypocrisy, I’d prefer to not be a time waster but I haven’t had much luck succeeding in my efforts to be more productive. There seems to be three specific instances when I try to be productive but end up wasting time.

The first is when I just sit down mindlessly in front of the computer with no intention. This almost always leads to an hour lost to Twitter or Facebook or crappy news sites or whatever. This is obviously unsurprising given the lack of intention. Other times, I sit down wanting desperately to do something productive but I have so many projects going on, either in my head or in actual progress that I can’t manage to pick one specific thing to work on. The result is a kind of paralysis by analysis where I just think about all the things I could be doing but never manage to just pick one.

The final one seems to be a related common thread between the other two and that is that even when I sit down to work on a specific thing, the fact that I have limited time after working a full day, eating dinner and hanging out some with K, walking the dog or doing any other one of a number of requirements in my life, I find that there isn’t enough time to actually do something concrete, e.g. a task related to the project that is finite and achievable in one evening. This frustrates me and I end up doing nothing instead.

However, the more I think about it, the more I think any action on a task is better than no action, at least as far as it concerns personal hobby projects. Obviously, this is not true for business projects where doing things just for the sake of doing them adds terrible baggage to a project. No, I’m talking about a personal project where any sort of progress could march me farther down the line to completion. Oftentimes, I envy those people who are afflicted with an obsession, the need to focus narrowly on one thing that consumes their free time completely. I suffer from exactly the opposite, I am interested in many things but all shallowly with little depth. Even the personal projects end up being one-offs that rarely make it to a state of completion.

Strangely, by writing about it provides enough focus to delve into a specific project. I think my writing serves the purpose that many people find in a cofounder or project buddy. Working alone on things, even things you are very interested in, is difficult as the feedback loop is usually long or at least strongly biased. Getting a project to a successful state where iterations can start happening regularly would help though that again is difficult to do.

There are probably tools out there beyond the average todo list that might help have simple tasks available for nights like this when I have spare time but no ability to pick something to do. Or maybe I could just always write 550 words of blathering jibberish and then work on what I should have been working on all along.

Can Civilization's Birthplace Become Its Funeral Pyre?

Overreaching headlines aside, the Eurozone is a bit of trouble. Greece has been bailed out in an attempt to avoid a sovereign default. Those in the know think the Greeks are unlikely to be the last country in the Eurozone to require a bailout and the conditions the IMF are expecting Greece to conform with are likely to have unintended far-reaching consequences that we can’t possibly understand at this point. A lot of people I talk to seem to be of the opinion that the Greeks got themselves into this mess and that bailing them out serves little purpose. This is probably true though for reasons far more complicated than that.

A guest post over at Naked Capitalism outlines 11 points supporting the idea that the Eurozone will likely break down over the Greece bailout. One of the key points revolves around a basic accounting principle: if one entity has a deficit, some other entity must have a surplus. Fiscal accounting is essentially a zero sum game and this is very important in the Greek case. When thinking about this, it’s important to realize that Greece, being a member of the EU, does not control its own sovereign currency. Thus, for Greece to run a deficit, there had to have been complicity from within the EU, specifically from Germany. It’s the fiscally conservative Germans benefiting from their strong export driven economy who provide the opportunity for the Greek government to run a deficit.

This part about sovereign currency is important. Historically, countries that control their own currency have been able to inflate their way out of debt, at least to some degree. In Greece’s case, the country is unable to do this because their currency is the euro and is outside their control. Therefore, they essentially have two options: default or bailout and accept the draconian retrenchment terms the IMF is demanding. As the article above mentions, it is unlikely that these terms are created with the considerations necessary regarding the simple accounting fact above, e.g. if Greece successfully imposes financial austerity measures on its people (a HUGE if at this point, one that isn’t getting enough attention), this necessarily means that the export societies of Germany and other Eurozone countries will retract due to the cutbacks in spending in Greece and others.

On top of that, these austerity measures will likely have a deflationary effect on the Eurozone. The bailout of Greece is aimed at government debt and the austerity measures are aimed in the same direction. Based on the same simple accounting concept I talked about above, if Greek government debt obligations are reduced through austerity measures, the Greek private sector will see their debt obligations grow leading to more private defaults and less growth in the Greek economy. Shortsightedly demanding to lower government debt with no consideration of the interconnectedness of the government and private sector spending will lead to further pullbacks and lack of growth in Greece.

In the end, the issues that we are seeing with Greece and the like illustrates several problems with the Eurozone as it is currently existing. If the Eurozone collapses, as the article seems to think possible, the ramifications will spread out over a much bigger area than just Europe. My crystal ball is cloudy when it comes to the results of a Eurozone collapse but I can’t help but think it will be highly detrimental to our country as well. We should watch carefully how things play out in Europe since it’s quite possible we may have to deal with similar circumstances in the near future here at home as profligate states like California begin to encounter the same issues the Greeks are running into.

Mac Computers, Microsoft Keyboards and a Lost 3 Hours

I do my primary development at work on a Mac computer using a Microsoft Natural 4000 ergonomic keyboard. Because I’m predominantly a Microsoft .Net developer, function keys are reasonably integral to my day to day life, not just in the Visual Studio IDE but also in SqlYog, the MySQL client we use. Having to execute queries or debugging steps using menus with the mouse drives me insane. I’m no shortcut master but I know the main ones that I run into in my daily life. So when the function keys stopped working in an expected way, I pretty much had to shut down work and fix it.

For those following along at home, you can get function keys to work on a Mac by going to System Preferences -> Keyboard and then checking the “Use F1, F2, etc as standard function keys.” I had done that early on and everything worked fine. Suddenly, last Friday, those keys started opening up the Start menu in Parallels and Finder on the Mac. Not good. So I started digging around and didn’t really run into much on the interwebs. I then decided to use my extensive Twitter network and luckily, with some long distance debugging, David O’Hara got me to the right solution which was to turn off the F Lock key on the Microsoft keyboard.

Somewhere along the way, I guess that I had managed to hit that key and what that did was disable function keys from the Microsoft keyboard’s perspective. When that happened, the “Use F1, F2, etc. . .” checkbox in System Preferences disappeared because Mac OS thought the keyboard didn’t support it. Even reinstalling the keyboard software didn’t help. Once I hit that key (which is dangerously close to the Backspace key in my unbalanced UI design opinion), all bets were off.

So if you are having trouble with function keys on a Mac, try toggling the F Lock key and quietly curse whoever thought it was a good idea to have a key that changed the behavior of 12 other keys. This is terrible UI design in my opinion, you should have to work to change something like that, i.e. put this in the control panel. There are also ways to disable it should you so choose.

State and Identity

Thinking out loud here. I’ve been rededicating some of my attention to Clojure lately with some basic success. However, coming from a background of object oriented languages focused on imperative programming and mutable state, I’m having trouble really internalizing the concepts in Clojure. I recently read Rich Hickey’s essay Values and Change – Clojure’s Approach to Identity and State and while I understand it from a very high level, the details seem to escape me in some significant way when I think about writing programs in a functional style using mostly immutable data.

The real problem is that I don’t completely understand what I’m not understanding. There is just a fuzzy, nagging feeling in the back of my brain that says “This can never work”, examples to the contrary notwithstanding. As a C# developer, I’m used to just modifying anything as necessary in my programs, adding values to lists, modifying dictionaries, randomly changing object values just to screw with people. Ok, maybe not that last part. But with Clojure, the world is very, very different.

[clojure]Last login: Tue May 4 16:42:01 on ttys000
Bretts-Mac-Pro:~ admin$ clj
Clojure 1.1.0
user=> (def mylist ‘(1 2 3))
#’user/mylist
user=> mylist
(1 2 3)
user=> (cons 4 mylist)
(4 1 2 3)
user=> mylist
(1 2 3)
user=>
[/clojure]

Here, I create a list, show the list at the command line, cons another number to the list and then show that the original list is unchanged. This takes some getting used to. Rich recommends the following when coming from an OO language:

In coming to Clojure from an OO language, you can use one of its persistent collections, e.g. maps, instead of objects. Use values as much as possible. And for those cases where your objects are truly modeling identities (far fewer cases than you might realize until you start thinking about it this way), you can use a Ref or Agent with e.g. a map as its state in order to model an identity with changing state.

Conceptually, I can think of a map of maps to model the world but I’ll be damned if I can really accept it right now. I understand the benefits behind the immutable data of Clojure but I look at my day to day programming tasks and just don’t see where it’s important. Maybe that’s just a failure of my imagination. I’m continuing to plug away on learning Clojure, trying to work my way into the Concurrency chapter of Stuart Halloway’s Programming Clojure which has been excellent.

Clojure Highlighting On WordPress

I’ve spent the morning getting highlighting working with WordPress and thought it might be worth the writeup to detail my steps since there was one significant gotcha when using published information.

I’m using the SyntaxHighlighter Evolved plugin which you can search for on the Plugins page of your WordPress installation. Install that plugin first.

Once that’s done, you’ll need to follow the directions for creating third party brushes for Syntax Highlighter. Specifically, you’re going to need to create your own plugin, which is pretty simple to do. Here’s what I did.

First, create a new folder in your plugins folder called clojurebrush. In that folder, create a php file with the following code (feel free to change the details at the top):

[php]<?php
/*
Plugin Name: SyntaxHighlighter Evolved: Clojure Brush
Description: Adds support for the Clojure language to the SyntaxHighlighter Evolved plugin.
Author: Brett Bim
Version: 1.1.0
Author URI: http://yourblog.com/
*/

// SyntaxHighlighter Evolved doesn’t do anything until early in the "init" hook, so best to wait until after that
add_action( ‘init’, ‘syntaxhighlighter_clojure_regscript’ );

// Tell SyntaxHighlighter Evolved about this new language/brush
add_filter( ‘syntaxhighlighter_brushes’, ‘syntaxhighlighter_clojure_addlang’ );

// Register the brush file with WordPress
function syntaxhighlighter_clojure_regscript() {
wp_register_script( ‘syntaxhighlighter-brush-clojure’, plugins_url( ‘shBrushClojure.js’, __FILE__ ), array(‘syntaxhighlighter-core’));
}

// Filter SyntaxHighlighter Evolved’s language array
function syntaxhighlighter_clojure_addlang( $brushes ) {
$brushes[‘clojure’] = ‘clojure’;
$brushes[‘clj’] = ‘clojure’;

return $brushes;
}

?>[/php]

Note that this is the same file structure as the directions from the previous link with the exception of removing the version number from the wp_register_script() function call. That’s the thing that ate up a good chunk of my morning.

Once that’s done, you’ll need the JavaScript brush file for Clojure from Travis Whitton. Dump that into the clojurebrush folder that you created above. Go to your Plugins in WordPress and activate your new plugin. Once that’s done, you should have syntax highlighting in WordPress enabled.