Blowing Off Oil. *Non-programming*

May 15, 2010 09:42 | NOLA, Uncategorized | 1 comment

My apologies if this is not this blog’s standard fare but I need to vent my frustration.

Today it finally came out in the national news that the Macondo Oil Gusher is pouring an order of magnitude more oil per day than the previous estimate and two orders of magnitude more than BP’s initial statement. The people who have been tracking this disaster obsessively since it first went public were not surprised.

Why? Because at every single level every single part of this disaster has reeked of optimism and under-valuation of risk.

I don’t think I’m unreasonable. I think BPs engineers are probably the most qualified to be dealing with this. I don’t think that BP executives are eating pelican stew and shrugging off the serious ecological, economical, and health-related implications.

I do think that there is a suspicious lack of well warranted hysteria. The estimates of worst-case scenarios are seriously lacking in imagination. An issue we’ll have to deal with for years? Give me a break. Barring some miraculous technological advancement (which I hope for daily) the amount of oil that has *already* been pumped into the gulf will not stop being a problem within our lifetime. What is the real worst case scenario? Well the flow can be far worse than reported…check. It can decimate one of the region’s strongest economies…ah. It can be an especially bad hurricane season…hmm. It might prove impossible to clean oil out of the wetlands…oh. Oh, and what if there’s some horrifying toxic air effects from the giant oil slick…shit. Want more? What if the oil in the wetlands causes their complete and utter disappearance within a year or two? Then New Orleans becomes a barrier reef. What if the relief platform fails? What if (the rest of the US pay attention – this concerns you) it gets in the gulf stream? Let me be clear:

THE EARTH IS SPEWING
HUGE AMOUNTS OF BLACK POISON
MILES FROM WHERE WE LIVE

Hey, that’s a haiku!

How the hell are people not panicing? Is it perhaps that we’re optimistic and underestimating the risk? It’s friggin’ tragic.

And what the hell is BP doing anyways? My understanding is that they’re following along with the stop-a-blowout playbook. I don’t have any problems with this except they’re being too damn optimistic. Why on earth did it take so long to get the first dome into place? It seems because there was a lack of preparation based in poor risk assessment. When it failed and they decided to try a smaller one why the hell was it not already on the way? Because they were so damn sure the first one would work. There are dozens of different high-quality ideas pouring in (my favorite: bunker buster aimed right at the pipe). What are they going to try next? How close are they to pulling that off if the current attempts fail?

Under current law, BP liability is capped at 75 million dollars. This is a number that they have already reached and surpassed. Easily. If I was a cold-hearted, hand-wringingly-evil executive I would tell my engineers to stop trying so hard. Why expend more money and effort? Why take risks and keep the story in the limelight. I would say let ‘er rip until we get that second rig into place. We’re paying the 75 mil already anyways.

I don’t think that anyone at BP is actively this evil. I’m a strong believer in that there is no “they”. Corporations and governments don’t have plots and opinions. I am always the first to point out that “they” are always just people, usually with contrasting motivations, goals and ideas. I think “they” are all concerned and consciencious. But I also think that they have a clear conflict of interest and a poor track record of correctly assessing risk.

So why in the world are “they” still in charge? I’m not saying that everyone should be canned. I do not think that Obama needs to park himself over the pipe and try to figure out how to clog it (chucking executives and regulators at it sounds like a decent enough idea). But I do think that the urgency of the situation warrants new incentives be introduced. I’m a fan of putting the military in charge. They have actual experience running things when lives are on the line. They know that being optimistic is anathema. Give them the keys to the kingdom.

Obama has never expressed much kinship with the Bayou though I do believe that he is trying to make the best decision for the situation. I think eventually he will declare a natuional emergency and command the military to take over. I think he is delaying because he doesn’t want the Federal government to be in charge of an operation that might be doomed to failure. I think he hopes that BP can stop this. I think he’s being optimistic. I do not get a sense of urgency from him.

I think its high time that we all panic.

Tags:

Online Collaboration Tools List

February 24, 2010 00:26 | Other, Programming | 2 comments

I do a lot of online collaboration. So here is my list of online collaboration tools that I like to use.

  • Jing – The absolutely best way to capture screenshots and video, upload and share it immediately
  • Charting
    • Yuml.me – Insanely awesome tool for UML diagrams
    • Websequencediagrams.com – Insanely awesome tool for sequence diagrams
  • Dabbleboard – Great online whiteboarding utility
  • Mockups
    • Balsamiq – Incredible quick mockup builder
    • Moquingbird – Similar to Balsamiq but with different strengths. I think its better for capturing screenflows
  • Online meeting
    • Webex – The best (I used it to screenshare and do live meetings with India) but prohibitively expensive
    • Microsoft Livemeeting
    • GotoMetting
    • Dimdim
  • Bubbl.us – A really promising mindmapping tool
  • Trac – Simple integrated wiki/issue tracker and svn. I just really like this wiki for its simplicity and I’ve used it in the past to great effect
  • Google groups – Make a private group for your project and have everyone sign up. Now you have an effective mailing list which gives you threaded conversations and an online-accessible and fully searchable repository. A big plus is that this is achieved with the communication lowest-common-denominator – email
  • Google Wave – I’m not convinced that this is ready for prime-time yet but it has some promise
  • Google Docs – Great for getting a survey, spreadsheet, anything Q&A up and running super-quick. Also online collaboration with documents and having an web-accessible powerpoint is great
  • Dropbox – Perfect for file sharing

Plus this site has some great ideas.

I am going to add to this post as I encounter more tools that I find useful.

C# 4.0 Dynamic and No More Annoying Casts

February 23, 2010 18:05 | Uncategorized | 2 comments

I have a strong distaste for things that works in a way that I dislike. I am very unique that way.

Right at the top of that list is any time that I am forced by language limitations into redundant code. Notably, casting. Take the following for example:

var dictionary = new Dictionary();
dictionary["name"] = "Snoopy";
dictionary["number"] = 8;
int dictinary["number"] = (int)dictionary["number"]

That last line bothers me a lot. I already told you that I expect an integer on the left hand side, why do I have to cast too?!.

Last night I thought I had it figured out. The get by index handler would return a new “TypedObject” instance which would then contain an implicit converter that would do all the casting for us. However, due to the hopelessly (and stupidly) limited nature of the implicit operator this was a no-starter.

Half an hour after I went to bed defeated, I leaped back out of bed full of vigor and brainy-ness. With hands trembling I made my changes and ran my tests:

[TestClass]
public class When_retrieving_from_TypedDictionary {
  TypedDictionary _dictionary;
  MemoryStream _stream = null;
  [TestInitialize]
  public void Setup() {
    _dictionary = new TypedDictionary();
    _dictionary.Add("DateTime", DateTime.Parse("01/01/2010"));
    _dictionary.Add("String", "hello friends");
    _stream = new MemoryStream();
    _dictionary.Add("MemoryStream", _stream);
  }
  [TestMethod]
  public void can_get_datetime() {
    DateTime dt = _dictionary["DateTime"];
    Assert.AreEqual(DateTime.Parse("01/01/2010"), dt);
  }
  [TestMethod]
  public void can_get_string()  {
    string str = _dictionary["String"];
    Assert.AreEqual("hello friends", str);
  }
  [TestMethod]
  public void can_get_reference_type() {
    MemoryStream stream = _dictionary["MemoryStream"];
    Assert.AreSame(_stream, stream);
  }
  [TestMethod]
  public void dont_need_to_cast_at_all() {
    Assert.AreSame(_stream, _dictionary["MemoryStream"]);
  }
}

They passed!

I’m a genius! I’ve figured out how to do something nobody ever had before!

Well not really, though it is an unexpected application of a C# language feature. You see, at my new job at EPS we’re using C# 4.0 on a project. As we all know the biggest hullabaloo with C# 4.0 is the introduction of the unassuming dynamic keyword. Honestly, as a fan of dynamic languages like javascript and ruby I’ve been concerned that I would abuse it and always abstained – it doesn’t do anything that you couldn’t do with a dictionary after-all.

Well, it can do one thing – implicit type-casting! So presenting, the above mentioned (and dead-simple) TypedDictionary:

public class TypedDictionary {
  readonly Dictionary _storage = new Dictionary();
  public dynamic this[string key] {
  get { return _storage[key]; } }
  public void Add(string key, object obj) {
    _storage[key] = obj;
  }
}

It works, I promise. How awesome is that?

kick it on DotNetKicks.com

NOLA People – Respond to Google’s Fiber RFI

February 10, 2010 13:17 | NOLA | 1 comment

Hey New Orleans people. It seems like Google wants to get into the fiber-optic game. According to their blog (thanks Mike for the tip) Google is looking to invest in a community by laying down some fiber!

So now until March 26th they’re putting out a Request for Information for people to nominate their communities. You know what I want you to do? That’s right, go here and nominate New Orleans.

Here are the reasons I gave:

  1. We desperately need an influx of new ideas.
  2. In a depression, we’re undergoing a technology boom. Seriously. Everyone that comes down here and checks us out leaves impressed. We were the cover story of Entrepreneur magazine, had articles in the NYT and a half dozen other places. We’ve hosted Microsoft employees who were impressed enough to proclaim that Austin has nothing on us.
  3. And we’ve done that on a practically inexistent tech foundation.
  4. Did I mention Microsoft? They’re doing all sort of nice things for us. TechEd 2010 will be here. Doesn’t Google to get in on the ground floor?
  5. We just elected a new mayor who understands the potential of being a tech hub.
  6. In the near future there will be a project to fix up a large part of the city’s sewer system, it will be a lot easier to lay down fiber alongside.
  7. We need cheap, high-speed internet in our schools. What we have now is pathetic and is not helping the already resources-strapped system one bit.

I could have gone on but 1000 character limit…

They also ask for evidence. There’s only one link per nomination and I gave them this excellent post from Taylor Davidson cataloging the NOLA start-up scene.

So what are you waiting for? Go go go!

Google’s site about the project

My List of Tools I Cannot Live Without

February 2, 2010 13:47 | Programming | 4 comments

This one goes out to…me. I’ve recently spent a lot of time setting up new workstations and am soon going to be spending a lot more. This post is a rundown of all the tools and litter helper apps that I absolutely positively cannot live without. Are there some gems in here that you would like? Probably. But mostly this one is for my own sake.

  • Launchy - Simple, fast, open source application launcher
    • Launchy Plugin – Ty to post to twitter from Krzysztof Ko?mic
    • Launchy Plugin – GCaly to post to your Google Calendar
  • ClipX - Tiny little clipboard history manager.  I use this one about 70 times each day
  • WinSplit Revolution – Awesome utility to throw applications between dual monitors and tile them easily
  • Deskpins - A simple utility to force windows to stay on top. Not the love of my life, but the best that I’ve found since xNeat went for-pay
  • Firefox - With the firebug and Web Developer plugins. I really only use it for debugging pages and playing with javascript. This is mostly because I use
  • Chrome - Web browser. It just feels faster, ok? Oh and the too many tabs extension.
  • EditPad Pro – Great notepad utility. Has an unlimited trial version, and I’ve had a license for it for years. I might give Notepad2 a try, but I doubt I’ll make the jump.
  • jZip - Open source zip utility. Handles all the stuff that Winzip and WinRar do with less whining.
  • TortoiseSVN - Windows Explorer – Integrated SVN source control. As I use git more and more for personal projects I’m starting to regret how heavyweight the integration is though, might try something new next time.
  • MSysGit - While we’re on the subject.
  • Fiddler2 - Http viewer, debugger. Don’t use it too much but its handy to have around.
  • IE 8 Developer Toolbar – Its actually quite good
  • GIMP - I ain’t a fancy-nancy designer and I’m not paying for Photoshop.
  • Paint.NET – When I want to draw stuff but don’t want something as heavyweight as GIMP
  • Inkscape - For working with svg images. I use it surprisingly often
  • WinMerge - Great little application for comparing two files/directories/whatever
  • Console2 - Could never really get it to work better than the powershell default but it deserves another shot
  • Powershell – Are you a developer on windows and don’t use this? You need to be punched in the face (or at least have you mouse stole).
  • AutoHotKey – For scripting windows
    • AutoHotKey Script – BDD names from JP Boodoohoo. I had made some customizations to it but they were lost with the lastdisk crash. Oh well
  • Gallio Icarus – Sometimes you just want a stand-alone test runner GUI and this is the best
  • Putty - For SSHing
  • TweakUI – For Windows XP. Hopefully that’s a game I won’t have to play for much longer
  • Reflector - Must have for .NET development
  • Jing - Oh I love this. The best for quick screen captures (though it would be nice if it had a lighter memoery footprint).
  • FileZilla Client – Ftp I usually do with windows explorer (you knew it could do that, right?) but SFTP we need to bring in the pros
  • Ruby – I’m going to try just running IronRuby next time, I swear.
  • SQLite.NET – Tends to come up sooner or later, good for quick free file-based database
  • KeePass – I keep all my passwords in here – shh don’t tell anybody
  • Growl for Windows – I wrote a friggin’ log4net Growl Appender, obviously I want something to read it.
  • Synergy – To share mouse and keyboard with multiple computers
  • Visual Studio – duh, but also the following plugins/extensions
    • TestDriven.NET – can’t live without youuuuu
    • T4 Toolbox – gotta have it since I like Sharp Architecture so much
    • ASP MVC – nuff said
    • ZenCoding – I haven’t had a chance to use it yet but I really can’t wait till I do
    • Refactor Pro and CodeRush – It’s a love affair, though I just picked up a ReSharper license at the last VAN so I guess I should compare and contrast or something
      • CR_ClassCleaner Plugin for DxCore
  • Microsoft Live Meeting – For the virtual alt net sessions
  • Skype
  • Dropbox
  • SharpDevelop - I got to get into using this interesting IDE more
  • RubyMine – Great for ruby, and I have a license!
  • VLC Media Player – Way more lightweight feeling than the others and plays anything

Tags: ,

New Job – I’m the Man

12:57 | Uncategorized | 1 comment

Those who know me in real life (and the roughly zero others that read my blog) know the big news.

I have put in notice at my current company and starting February 21st I will be working full-time at EPS Software.

For me? That’s a big deal. For anyone else? Not so much. This post is a placeholder for expounding on this later.

Hey, I Think I’ve Invented a New Pattern

January 17, 2010 01:58 | Programming | 4 comments

Ok maybe not totally new, I am sure that its just a projection of something I once noticed subcionscioiusly in a F# project. But in the C# space, I’ve yet to see something quite like it.

The problem is that programs are complicated. I don’t tend to help the issue. In a flash I don’t hesitate to layer on additional complexity with domain models, frameworks, and complex infrastructures. Entities, sevices, repositories and aggregate roots – they’re the tools that we reach for all too often. That is not to say that Domain Driven Design is a poor paradigm – I’m a big fan – it’s just not always necessary.

Take for example a typical scenario. You are given an integer which uniquely identifies a customer and are asked to generate a report of all their orders, export it to a pdf file and return as a Stream. My first impulse is to start with the customer and order objects, identify the bounded context, figure out the aggregate roots, start writing data access mapping code, and so on. If I’m lucky, I only do this for a few hours before hearing the voice of an incorporeal Ted Neward yelling at me to STOP. I was not asked to build a domain model, I do not need to keep track of state, there is no validation, or (much) business logic. The problems that DDD is intended to solve are simply not present here. I need to do one thing and one thing only, map an integer to a Stream!

And yes, I do realize that this is exactly what the CQRS guys have been harping on for years.

My Solution:

Each of my last few projects has contained a very simple interface.

public IMapper<INPUT_TYPE, OUTPUT_TYPE> {
  OUTPUT_TYPE Map(INPUT_TYPE obj);
}

Get it? Put in an integer, get back a Stream, what could be simpler? Ok, maybe that’s too simple. Any change at all would require modifying the implementation. This is all that icky procedural programming stuff. What about reusability, encapsulation, separation of concerns, and our other OO goodies? Fortunately, we don’t have to give these up. All we have to do is introduce a couple of obvious seams. We no longer transform an integer directly to a Stream. Instead we:

  1. Take the id and map it to a DataSet that contains the report data.
  2. Map a DataSet to the appropriate fully built Crystal Reports ReportDocument.
  3. Map a ReportDocument to a MemoryStream of a pdf file.
IMapper<int, DataSet> _dataProvider;
IMapper<DataSet, ReportDocument> _reportGenerator;
IMapper<ReportDocument, Stream> _pdfReportExporter;

public Stream GetCustomerReport(int customerId) {
  return _pdfReportExporter.Map(
           _reportGenerator.Map(
             _dataProvider.Map(customerId)));
}

Pretty nice huh? Well not that nice. If you’re a naming perfectionist like I this should make you shiver. When it comes to maintainability, good intention-revealing namespace, class, and method names are worth a million unit tests and n-tier architectures. Forget requirements docs and self-documenting code, proper naming is the number one tool for communicating our intent.

I lecture my team on this constantly and yet I allow myself the use of the the term “Map”?! A generic term that could indicate anything except (unless you’re a cartographer) a concept from your ubiquitous langauge. I should be ashamed.

We want to keep our generic IMapper interface though, it’s so slick, allows us to write minimal code and you you could easily imagine it coming in handy. For example, perhaps as the domain itself becomes more complicated, it becomes useful to break our IMapper<int, DataSet> down further.
1. The integer is get mapped to a Customer entity.
2. This gets mapped to a ReportSpecification.
3. The ReportSpecification is evaluated and mapped to a StoredProcedureInvocation
4. The procedure is executed and finally returns our DataSet.

You could imagine all sorts of neat little tricks you could play with our IoC container – we could have it automatically link transforms together or subsitute out implemenations. Simply by knowing that all these components transform one object to another we could configure automatic caching, deferred execution proxies, and so on. All things that are made far easier because all transformations are achieved via IMapper.Map.

What we really need is a way to introduce aliases for the Map() method. Preferably ones that depend on the input and output type. So why sit there scratching our heads? C# is a flexible enough language, let’s just let’s do that thing that I just said.

public CustomerOrderReportGenerator : IMapper<DataSet, ReportDocument> {
  public ReportDocument Map(DataSet data) {
    // implementation
  }
}
public partial static class AliasExtensions {
  public static ReportDocument GenerateReportFrom(this IMapper<ReportDocument, DataSet> mapper, DataSet ds) {
    return mapper.Map(ds); }
}

And now we have aliases:

  _pdfReportExporter.Export(
    _reportGenerator.GenerateReportFrom(
      _dataProvider.GetOrderDataFor(customerId)));

The poor readability of this bothers me. The LISPers among us might not mind reading backwards through a stack of nested parentheses but as a fan of fluent interfaces I’d like to see my code read as close to natural english as possible.

Same trick, now featuring double dispatch!

public partial static class AliasExtensions {
  public static ReportDocument ComposeIntoReportUsing(this DataSet ds, IMapper<ReportDocument, DataSet> mapper) {
    return mapper.Map(ds); }
}

Allows us to do:

  return _dataProvider
    .GetOrderDataFor(customerId)
    .ComposeIntoReportUsing(_reportGenerator)
    .ToStreamUsing(_pdfReportExporter);

And there you have it. Nice, fluent, and composable.

What do you guys think? Aliased Maps a good name?

kick it on DotNetKicks.com

Tags: , , , ,

Enable/Disable FusionLog Powershell script

November 11, 2009 11:01 | Programming | No comments

If you use Windows and don’t use Powershell you should. Really you should. It’s great for getting all the little repetitive things out of the way.

Like for example enabling/disabling your Fusion Log every time you need to figure out why assembly binding has gone wrong. So here you go. Just put these in your profile:

function global:Enable-FusionLog {
	Remove-ItemProperty HKLM:Software\Microsoft\Fusion -name EnableLog -ErrorAction SilentlyContinue
	[void](New-ItemProperty  HKLM:Software\Microsoft\Fusion -name EnableLog -propertyType dword -ErrorAction Stop)
	Set-ItemProperty  HKLM:Software\Microsoft\Fusion -name EnableLog -value 1 -ErrorAction Stop
	Write-Host "Fusion log enabled.  Do not forget to disable it when you are done"
}
function global:Disable-FusionLog {
	Remove-ItemProperty HKLM:Software\Microsoft\Fusion -name EnableLog -ErrorAction SilentlyContinue
	Write-Host "Fusion log disabled"
}

Awesome.

Also we talked Powershell at yesterday’s GNO.NET and Cody Gros showed PowerGUI - which a totally free and seemingly awesome powershell editor. Woo!

Tags: , ,

Rhino.Mocks 3.6 Intro – What You Actually Need To Know

October 21, 2009 09:28 | ALT.Net, Programming | No comments

What’s a Mock?

For the purpose of this essay a mock is an object that uses the object oriented concept of polymorphism to create an alternate implementation of a class or interface. Essentially, a mock is just a fake version of an object.

A mock is used for two things

  1. Stub: Stand in for a service and provide alternate, simpler method implementations. An example would be to substitute for an object that would normally query the database – instead of querying the database the stub object will simply return a canned response.
  2. Spy: Detect whether an object was used in a certain way. An example would be when testing an object that decides whether to call ui.NotifyUser() depending on some criteria. A spy can stand in for the ui object and call tell you if the NotifyUser() method was called.
  3. Don’t worry if that is a bit obtuse, it should become clear soon

Read more »

Tags: , , , ,

Like 300 only geekier

July 20, 2009 04:15 | NOLA, Programming | No comments

I just got back from the New Orleans Barcamp and I’m going to go ahead and join everyone in singing its praises.  Day 1 was great – full of interesting presentations, introductions and exchanging of ideas.  I even got to present twice, once on Test Driven Development and again later in the evening with Stephen Bohlen’s slide-deck on Domain Driven Design. However, fun as it was, it went roughly how I expected, so I probably would not be blogging about its success alone.

It is the second day that was destined for real magic.  The challenge was simple: “Do something to help with the organization of the leagues of people who donate their time to volunteer for the New Orleans public school district”.  Those familiar with software development in general – and the challenge of herding hungover techies who get in at 10am to start and complete a project by 4pm in particular – will recognize it as simply jaw-dropping.  Especially when “something” is expanded to mean “create a full blown, maintainable, multi-media website to bring together and thank volunteers” – wowee.  And yet I’m proud to announce http://www.nolaschoolvolunteers.org/ which as of this morning did not exist and now does all those things and more.  Everything you see, including domain name, CMS installation, layout, and much of the content was created in one afternoon by a group of dedicated barcamp attendees.

In a word, everyone there was just astoundingly professional.  How professional?  Well a room full of 15 geeks from different backgrounds and diciplenes spent all of 10 minutes debating language choice and platform.  The conversation was literally:

- So it sounds like  PHP is our lowest common denominator and we’ve got a PHP guru?

- Yup.  So let’s do PHP.

- Ok.  Can we do this in wordpress?

- I think so.  We’ve got a couple guys that are good at wordpress and some more that are familar with it.

- Wordpress it is.

And if that isn’t shocking enough then we did it!  In one fell swoop and in no small part through the leadership of Matthew Tritico and others; requirements were defined, refined, scoped back, matched up with a technology, assigned,  implemented, and integrated in a whirlwind six hour session that I consider among the most productive hours of my life.

Oh and luck.  I’m going to go ahead and say that a lot of luck was also involved.

So take aways:

  1. Never underestimate the collective power of an enthusiastic, experienced, and focused group.  The trick is getting all three.
  2. Value of someone who’s done it once before is that of ten bright people. Value of someone whose done it twice is that of twenty.
  3. Take the time and pick the right tool for the job.  The site was created in wordpress with a variety of plugins, and a healthy dose of google products.  A huge amount of functionality with hardly any code at all!  Microsoft take note – this is RAD developoment done right.  It is possible, but drag-drop and a fancy IDE is no replacement for true knowledge.
  4. Finally, equally as important as the availability of the right component is the ability to integrate with the rest of the application.  Do not take this for granted – the excellent ecosystem of wordpress plugins was a major deciding factor for us and cut down considerably on integration time that we did not have.

So again, a spectacular job by all.  A lot of great relationships fostered, a lot of tech talk, and one kick-ass site banged out in an afternoon.  Frankly, given the glacial pace at which I see projects progressing in the enterprise space, I really needed to see this.  I’m not even sure what I think about this yet – was it all luck or did I really learn something interesting?

I think likely the latter.