Freigeben über


PowerShell Diversion #1: The ‘70s, a time of Flares, Disco and poorly scheduled shows …

Just for fun, I thought I’d post some ‘diversions’ for new PowerShell scripters.  They will probably be no surprise/challenge to  experienced users, but if you’re a PowerShell newbie, then they will hopefully make you think about features of PowerShell and aspects of scripting you haven’t thought about before and/or will get you solving problems outside the normal ‘admin’ world PowerShell is mainly used for (and, to be fair, was designed for).

So, let’s start of with this fairly straightforward problem (which inspired the whole idea):

Recently, I was reading a magazine article* on graphic design and one of the illustrations was a poster for a design show from some time in the 1970s. On closer inspection, the poster contained the date of the show:

“Thursday, 11 November”.  

However, it didn’t state the year.

Can you use PowerShell to work out in which year the show took place?

Yes, I really did put down the magazine and write some PowerShell to work this out.  The solution is quite easy (a short 1-liner will do the trick), but if you need them, you can get a couple of hints by clicking here

Once you have the solution, you can use the same technique to work out lots of related stuff, so as a bonus, try these two additional problems:

    1. How many times did “11 November” fall on a Thursday since 1970?
    2. When does “11 November” next fall on a Thursday?

I’ll post the answer next week.

Have fun!

 

* Read it yourself in the April 2011 issue of Creative Review .