My Favorite String Extensions

I know, it doesn’t quite roll off the tongue like the old black-and-white TV show title.

As early as Visual Studio 2008, C# has provided a special kind of static method called extension methods.  We can use these extension methods to extend a class or interface, but not override it.  This provides the ability to “add” methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type.

Think of it as Microsoft’s answer to prototype in Javascript, letting you add methods on the fly to any type you want.  I took advantage of them  in a recent article I wrote on extending enum using custom attributes.

By far my favorite use of extension methods are when it comes to manipulating Strings.  It must be the Perl in me.  So, without any further ado, here are a few of my faves.

Continue reading My Favorite String Extensions

The Steampunk Color Palette

At our house, we love steampunk!  So, when I came across an interview in STIR Magazine with the founder of Steampunk By Design, I had to read it.

By far the best part for me was a list on the second page of a steampunk color palette, with links to a popular paint manufacturers website where they provided the hex values for the colors.

So, I aim to share them here with you, in all their glory, but in no particular order.

Continue reading The Steampunk Color Palette

Attributes, Extensions and Enums, Oh My!

Extending Enum in C# Using Custom Attributes and Methods

I love enumerations.  Simple, consistent and – in OO languages like Java and C# – enforced by the IDE.  But I know I’m not the only one who has lamented over the apparent inability to extend the Enum data type in C#.  If you stumbled upon this post, you’ve probably had the same problem.

Keep reading to see what I did to alleviate this shortcoming.

Continue reading Attributes, Extensions and Enums, Oh My!

The Office : Six Stages of Debugging

I recently discovered The Office Stare Machine, which captures every time a character on The Office stares into the camera and says nothing, then categorizes these “stares” based on the emotion being expressed.

I found this to be the perfect opportunity to capture  the apocryphal Six Stages of Debugging in the expressions of the ever intrepid Jim Halpert (with a few other pop-culture references sprinkled in the links).

Continue reading The Office : Six Stages of Debugging

Making Memes : Han Duo

Weekend meme-making-marathon with my kids, and here is the best one.  If we had been able to find our Playskool Han, it would’ve been a Han Trio!

He shoots first AND second!
He shoots first AND second!

One thing to note: as with much user-created content on the internet, many of the memes that show up in a google image search can be VERY kid-inappropriate.

And now you know…

3 Simple Reasons Why Your Site Needs A Favicon

You recognize those logos up there, don’t you?

The favicon (Favorite icon), shortcut icon, Web site icon, tab icon or bookmark icon is nothing new.  It’s been around for well over a decade now.  There are tons of articles and sites out there to help you make a favicon and upload it to your site.

And yet, so many sites – mostly blogs – don’t have one.  Why not?

Seriously, with how easy it is to do, the only reason I can think of that your site would not have a favicon is because you don’t know why you should have a favicon.

So, here are the reasons your site should must needs to have a favicon.

Continue reading 3 Simple Reasons Why Your Site Needs A Favicon

Particle Groove: A Groovy Test Case for Particle Man

A Groovy test case I whipped up the other other day (if, by “the other day”, I mean August 10, 2012 – and I do!) for one of my favorite They Might Be Giants songs, Particle Man!

Hit the link the below to see the whole #!, and feel free to sing along…

Continue reading Particle Groove: A Groovy Test Case for Particle Man

Registering Amazon's SendToKindle Behind A Proxy

If you are a Kindle user – the tablet or the app – Amazon has a great (free) service that allows you to select files on your computer – PC or Mac – and send them to your Kindle (or registered Kindle app) using the Kindle native format.  This is great for when the file you want to send is too large for email attachment restrictions – corporate or otherwise – and you can’t use their email service.

But if you are just installing the application, and trying to register it behind a corporate proxy, you might run into the same problem I did: the dreaded and ambiguous “Network error occurred”!

Continue reading Registering Amazon's SendToKindle Behind A Proxy

Remote Git Repos Behind A Proxy

A few colleagues and I recently started Mercenary as an open source project. One of the first problems we faced was accessing our GitHub repository when we were behind the corporate proxy.

The easiest way to resolve this is by installing and configuring Cntlm, as I described in my previous post.

Then, just update your Git configuration file (usually located at %UserProfile%\.gitconfig) and add (or updated) the following lines:

proxy = http://localhost:3128

proxy = http://localhost:3128

Restart your Git client and problem solved!

Solving Proxy Problems With Cntlm

Cntml is easy to install and configure, and supports multiple platforms.  This post, on the other hand, is specific to Windows.  For more information on using Cntlm on a different platform, consult their official wiki.

 What Proxy Problems?

Corporate proxy server are a pain.  If you don’t know why, you haven’t been working in a corporate environment very long.

  • The proxy server ignores your Windows host file
  • Most 3rd party Windows applications don’t support NTLM natively
  • For those that do, they usually store your credentials in plain text (bad)
  • And whether they do or not, when your credentials change (i.e., regularly scheduled forced password changes) you now have multiple places to update your credentials

While some of these are specific to being a software developer, most of these will impact you at some point in time.  All of these problems drove me to look for a solution – or in some cases, a better solution than whatever hack I was using.

Enter Cntlm, “…an NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy… It stands between your applications and the corporate proxy, adding NTLM authentication on-the-fly.” – from the Cntlm homepage.

Continue reading Solving Proxy Problems With Cntlm