My PowerShell Deep Dive Talk Video

by Doug Finke on March 8, 2010

in Uncategorized

Paul Mooney attended my NYC Code Camp talk and was nice enough to record and post the session. Thanks Paul!

{ 0 comments }

I posted a C# version HERE based on Ted Young’s Java version HERE. Then Professor Roger Crawfis commented and we traded emails.

I do not see the point to the DateBuilder class here. Extension methods would be a better approach (IMHO) for all of the methods.

New and Improved version with Extension Methods

   1: using System;

   2: using System.Diagnostics;

   3:  

   4: namespace ConsoleApplication1

   5: {

   6:     class Program

   7:     {

   8:         static void Main(string[] args)

   9:         {

  10:             var earlierDate = new DateTime(2010, 1, 10);

  11:             var laterDate = new DateTime(2010, 1, 31);

  12:  

  13:             Debug.Assert(earlierDate.IsBefore(laterDate));

  14:             Debug.Assert(!laterDate.IsBefore(earlierDate));

  15:  

  16:             Debug.Assert(laterDate.OnOrAfter(earlierDate));

  17:             Debug.Assert(laterDate.OnOrAfter(laterDate));

  18:             Debug.Assert(!earlierDate.OnOrAfter(laterDate));

  19:  

  20:             Debug.Assert(earlierDate.OnOrBefore(laterDate));

  21:             Debug.Assert(earlierDate.OnOrBefore(earlierDate));

  22:             Debug.Assert(!laterDate.OnOrBefore(earlierDate));

  23:  

  24:             Debug.Assert(laterDate.On(laterDate));

  25:             Debug.Assert(!laterDate.On(earlierDate));

  26:         }

  27:     }

  28:  

  29:     public static class DateExtensions

  30:     {

  31:         public static bool IsBefore(this DateTime firstDateTime, DateTime otherDate)

  32:         {

  33:             return (firstDateTime < otherDate) ? true : false;

  34:         }

  35:  

  36:         public static bool IsAfter(this DateTime firstDateTime, DateTime otherDate)

  37:         {

  38:             return (firstDateTime > otherDate) ? true : false;

  39:         }

  40:  

  41:         public static bool OnOrAfter(this DateTime firstDateTime, DateTime otherDate)

  42:         {

  43:             return (firstDateTime >= otherDate) ? true : false;

  44:         }

  45:  

  46:         public static bool OnOrBefore(this DateTime firstDateTime, DateTime otherDate)

  47:         {

  48:             return (firstDateTime <= otherDate) ? true : false;

  49:         }

  50:  

  51:         public static bool On(this DateTime firstDateTime, DateTime otherDate)

  52:         {

  53:             return firstDateTime.Equals(otherDate);

  54:         }

  55:     }

  56: }

{ 6 comments }

I gave a PowerShell Deep Dive talk at the NYC Code Camp. You can get the zip file that is posted.

It was a great group of people. Lot’s of discussion around using PowerShell interactively, extending apps from a maintenance point of view to reduce complexity and UI extensibility by embedding the PowerShell engine into GUIs.

I want to thank Lab49, where I work,  for being a platinum sponsor of the event. Also thanks to the volunteers and organizers who offered up their Saturday from 5AM till the evening to ensure the sessions run smoothly.

Grab the bits

{ 4 comments }

In Bb

image

{ 0 comments }

Getting Results the Agile Way

by Doug Finke on March 1, 2010

in Agile

J.D. Meier, Principal Program Manager at the Microsoft finished the writing for his book and you can follow along for the ride and read Getting Results for free online in HTML.

Here’s a one-page guide for getting started with Agile Results.

{ 0 comments }

Devfarm Software has released PowerWF Studio.

PowerWF Studio™ unleashes the potential of Microsoft PowerShell and Windows Workflow Foundation by providing a visual integrated development environment (IDE) that virtually eliminates the need to write scripts.

Also check out their features page to learn about agents, VMXBuilder tools, deployment options and activity packs.

{ 0 comments }

For those familiar with Debug.Assert, you may be thinking this is a solved problem. But Debug.Assert only allows you to express that a particular condition should be true at a particular point in the code. Code contracts allow you to declare once that a particular condition should hold any time certain events occur, such as every exit point from a method.

MSDN Magazine Code Contracts

A Precondition Example

After enabling static checking, you can write code and VS 2010 will indicate Code Contract issues with squiggles and tooltips.

image 

Use the project properties Code Contracts tab to enable Squiggles

To get the tab to appear, you need to download the static checker from DevLabs: Code Contracts.

image

{ 1 comment }

Saturday, March 6th, 2010. Thank you to the NYC Code Camp reviewers for selecting my talk.

I’ll be giving one of the 75 minute presentations at the all-day event.

I am looking forward to presenting and sitting in on the other sessions as well.

{ 0 comments }

Looks like interesting steps towards infrastructure automation.

There was an immediate demand for an automation API that would fit into the standard toolset. Given the adoption and penetration of PowerShell, we determined that cmdlets would be the most effective way forward.

  • WASM Cmdlets Updated blog post
  • MSDN Code Gallery Project

  • { 0 comments }

    Hello HTML5

    There haven’t been many Gears releases or posts on the Gears blog lately, it’s because we’ve shifted our effort

    { 0 comments }