Friday, January 29, 2010

Open Cygwin/Powershell Here directory context menu entrys

For years one of the first things I installed on new windows machines was the Open Command Window Here powertoy. I'm not much of a fan of cmd and generally use cygwin for my command-line stuff, but the ability to quickly open a terminal at a particular directory was very useful.

Lately I've started to use powershell in place of cmd wherever I could. I still don't like it nearly as much as I do cygwin (probably mainly due to familiarity), but it's a lot better than cmd. I also use it in cases where cygwin doesn't play nice with windows command-line apps.

Saturday, January 23, 2010

SortedQueue in Ruby

I've started working on the solver class for my ES project. I'm essentially implementing Dijkstra's algorithm where the graph nodes are the different board states and the edges are the turns. It's a little different as I'm generating the graph while traversing it instead of starting with a known graph.

One of the data structures required for implementing Dijkstra's algo is a priority queue. A strict priority queue won't quite work for me, as that requires numeric values for the priority, which I don't have. Instead I've defined a compare function for my nodes and want the queue to simply be sorted based on that.

Wednesday, January 20, 2010

Quickly check out all files in TFS that contain a certain string

We use Team Foundation Server at my place of gainful employment for source control and bug tracking.  It's adequate for both tasks, but isn't what I would prefer.  One of the reasons I don't really care for it is that it doesn't integrate well with most of the tools I use.

If I'm working on the C++ dll then it actually works rather well, as I'm already using Visual Studio as my IDE.  Any time I need to change a file it automatically checks it out.  Sadly I don't get any of that automation when working in netbeans or flex builder (yes, there's an eclipse plugin for TFS, but it's $200 and I'm not quite _that_ annoyed with it).

Today I needed to refactor a class in my Flex code that's used in a number of places.  The refactor included moving the class to a new package and renaming it.  FlexBuilder could handle the refactor, but couldn't handle checking out all the files it needed to modify.  Doing so manually was also annoying, as I'd first have to grep for all the files it would need to change and then find them in TFS to check them out.

Friday, January 15, 2010

How I learned to stop worrying about types and typos in ruby.

I had a bit of an "aha!" moment earlier while working on my ES project that helped me get over one of the major sticking points I had with dynamic languages like ruby.  But I'm going to make you read through some background before I actually share the moment itself.  If you don't like it, well, too bad.  You'll just have to skip a paragraph or three.

Saturday, January 9, 2010

Improving ImmutableProxy

My initial version of ImmutableProxy worked perfectly for methods that were specific to the object being wrapped, but it didn't work properly for the built-in Object methods.

Most of the built-in object methods aren't actually used in my code and probably aren't needed by the players, so I didn't want to waste time overriding them all.  But some of the basic ones were needed, like eql?, and is_a? (is_a? is used by the eql? methods defined by the classes being wrapped).

Friday, January 8, 2010

Easy immutability in Ruby

One of the first paradigm shifts (did I really just use that term?) I ran into when going through ruby koans was the idea that function calls are actually just messages being passed between objects.  Though I had heard of this idea before I'd never actually dealt with it, and at first I wasn't sure what the big deal was.  The about proxy koan showed how to create a basic proxy class, but the utility of such a class wasn't immediately apparent.

Tuesday, January 5, 2010

Extreme Solitaire

After finishing Koans I was looking for another project I could work on to help learn ruby. Unfortunately I had a lot of trouble coming up with an idea for a project to work on. All the tools I've needed recently have already existed, and since I actively needed them it made more sense to use what I found than spend the time to create one.

Sunday, January 3, 2010

Unit tests, as a learning tool?!

As I mentioned before the first project I looked at for help learning Ruby was  Ruby Warrior.  It was a great idea for a way to get into programming Ruby, but as someone who didn't even know much of the ruby syntax I had trouble discovering how to write the code I wanted to write.

Then I remembered a project my friend had mentioned to me earlier.  This project was Ruby Koans.  Koans is a collection of unit tests where most of the code is written, but the expected values in all the asserts are left blank.

Saturday, January 2, 2010

Syntax Highlighting and Blogger

I spent an hour or so poking around trying to get code highlighting working in blogger.

My first attempt was to use tohtml, which I've used at work a number of times to get colored code to paste into Outlook when doing code reviews.  It does code highlighting for a TON of languages and generally creates stuff that looks pretty good.  The coloring options aren't too impressive, but they work.

My intro to Ruby

I started poking around with Ruby a month or so ago.  Prior to this I had seen a little bit of ruby code but had a lot of trouble following it.  I had modified a single line of Ruby in a documenting tool I was using for my Actionscript 2 code, but that was just changing a false to a true and doesn't really count.

My first real involvement with Ruby was to join my friend and coworker Matt at the December meeting of the Pittsburgh Ruby Users Group.  I was worried that everything would go over my head, but the guys and gals there were quite helpful.  I ended up learning about a couple ruby projects that helped get me into writing Ruby code very quickly.

Friday, January 1, 2010

Who are you? How did you get in here?

I mean seriously, I just created this thing. How'd you already find me?

Well, doesn't matter. You're here now. Or you aren't and I'm just talking to myself. But that's not unheard of, so...onward!