Submitted by alastairs on 7 November 2011 - 9:38pm
So we ran into a little bit of bother with some pull requests to GiveCRM: I had submitted a feature that had been merged in, but it was subsequently lost (in part) when a later pull request was merged in. It seems the submitter of the later pull request hadn't updated from the central repository before submitting his pull request, so when his pull request was merged my feature was overwritten.
My experience with Git is almost entirely as an individual developer, so I'm learning how to use it in a distributed team as we go with GiveCRM. I turned to my friend, colleague and resident Git expert Adam Wood for some advice.
Submitted by alastairs on 15 September 2011 - 6:09pm
Here's a handy trick I discovered whilst fixing a bug. You can initialise a collection from another collection and add new items to it as follows:
Note that the collection initialiser on AllFoo runs before the constructor, so the Foo created with constructor parameter 4 will appear first in AllFoo, followed by everything in BaseCollectionOfFoo in the expected order.
Submitted by alastairs on 13 September 2011 - 11:12pm
Very often when I'm writing a script in PowerShell, I will need to obtain the directory in which that same script resides. This is sadly not completely trivial in PowerShell, but the following function achieves the desired result:
Hopefully, having created a gist for this and blogged about it, I won't have to keep resorting to Google in future to remind me how to do this. This particular version was posted to the PowerShell Code Repository by Andy Arismendi.
I've just been reading Brad Wilson's latest blog post, Interface Attributes != Class Attributes, and hit upon this interesting nugget regarding the implicit implementation of interfaces in .NET:
Implicit implementation (as seen above) is when a class implements the method/property in question as
a public method or property on the class. It's important to note that this method/property is NOT the
same thing as the interface method/property; it merely has the same signature, and thus can be used to
implicitly create the implementation of the interface. In reflection terms, the two are distinct and
different.
I was struggling to find a way to pretty-print a JSON string in .NET. I already have the excellent Json.NET package available and after a bit of hunting, I came up with this:
It wasn't obvious how to do this, for some reason - I spent a while investigating the JsonReader and JsonWriter classes to no avail.
In preparation for CAMDUG's first ever Dojo yesterday, I worked through the Leap Year kata, which I had intended to run in the first session, "Introduction to TDD". I ended up swapping it out for the Roman Numerals kata, because I got through two iterations of the exercise in about 20 minutes. However, I thought it would be useful to share the problem and my approaches to it with my readers.