Itty Bitty Rants

Infrequent posts about stuff.

  • Finding an item in an array of PSCustomObjects

    (This is mostly so I can find it again someday when I need it again.) When working with REST interfaces with PowerShell it’s pretty common to get JSON responses that have information that is returned as arrays of PSCustomObjects. If you need to update a property of one of those objects you can’t just do something simple like: PS C:\> ($result.objArray | Where-Object { $ -eq "whatever" }).value = "SomeNewValue" In order to set the value of a property you’re going to have to find the index of that particular object in the array and then manipulate it directly.

    Read more…
  • Standardized Tests for Standardized Parameters

    Something that you find when writing PowerShell modules to wrap API functions for external systems is that a lot of your functions tend to have a consistent subset of parameters that get used for things like credentials and specifying an endpoint. For example in the private TeamCity module that I maintain the parameter block for every function that interacts with a server has: [Parameter(Mandatory=$false)] [System.Management.Automation.PSCredential]$Credential = ( Get-Credential -Message "Please enter your credentials for the TeamCity server at $server"), [Parameter(Mandatory=$true)] [ValidateNotNull()] [string]$Server (Whether that is the best pattern I’m still not sure, but it’s beside the point of what I’m talking about here.

    Read more…
  • Reporting Pester Code Coverage Metrics to TeamCity

    As previously mentioned I’ve been doing a lot of work with PowerShell modules at work where I have recently gotten all the parts for a full continuous delivery pipeline working for those modules. A big section of that pipeline runs through TeamCity and while the existing ability to have Pester test results show up in the build results is really great, code coverage is slightly less obvious but in the end fairly simple.

    Read more…
  • Simple test coverage check for script modules

    I’ve been spending a lot of time at work writing PowerShell modules and as part of that effort we’ve been trying to make sure we’re doing at least some unit testing on those module functions (Using Pester of course!). Unfortunately we’ve had a few instances where a new function gets added to a module without any unit tests being added. We’ve structured our modules so that every function has it’s own source file and accompanying tests file and all of them are located in a \Functions\ folder in the project.

    Read more…
  • My Year in Soda: 2014

    I’ve been trying to remember to post my impressions of sodas that I try to Twitter through the year and figured I’d put together a Year In Review to collect all of the notes for posterity. This year’s high points: Phancy Sparkling Limeade and Empire Spruce Beer.

  • Virtual Micropolis: Progress and Upcoming Display!

    I mentioned back in March that I had started working on a wiki to provide further information about our Micropolis modules and I am fairly proud to say that we’re definitely making progress on filling the site with content. It’s not complete yet, by any stretch of the imagination, but it’s got a good base of content and the visual style is starting to come together as well. If you haven’t had a chance to look at it, or you haven’t looked since last March, now is a great time to go take a peek at http://www.

    Read more…
  • How To Hard Boil Eggs

    The observant among you may be thinking something along the lines of, “I didn’t think he was a Christrian:” and in fact I am not. At least I have not been for approximately the past nearly twenty years. My faith in that particular range of beliefs was already starting to fall apart during high school despite my family and community’s sincere and steadfast efforts to the contrary and getting out into the world on my own took care of the rest of it pretty quickly.

    Read more…
  • Introducing Virtual Micropolis

    After a few years of owning the domain name, I am finally getting off my proverbial butt and doing something with My original idea had been, as is somewhat usual for me, a bit grandiose. I was going to get the spec moved over there and make it a community for everyone who built Micropolis to come and post their stuff. Because there aren’t any other places on the Internet to build a community (like Flickr, MOCPages, Facebook, Google+, ad infinitum:), or something.

    Read more…
  • Good Display at the Library

    As I mentioned a couple of weeks ago, Jennifer and I put together a little display of our Micropolis modules at the library yesterday. I took the photo above just before we started to take it apart and get it home. I have no idea who the kid is, but I think the image turned out pretty well even if a solitary figure like that doesn’t given any good idea of how busy it got.

    Read more…
  • Little LEGO Show – March 2, 2013

    width=“620” height=“802” My partner Jennifer and I are doing a little display at the local library with our friend Peter. Anyone who has been over to our house will have seen the shelves filling our living room with various parts of Micropolis. I attempted my very first module back in August of 2008 and Jennifer built her first module only a month or two later. Since then we’ve both built quite a few different contributions, but Jennifer more then most.

    Read more…