PowerShell script to create many directories

Here is a one-liner in PowerShell to create 100 directories under your current working directory:

0 .. 99 | %{ $dir = ("DIR-{0:0000}" -f $_ ) ; if (! (Test-Path -path $dir ) ) { New-Item $dir -type directory } }

This becomes more readable when we wrap the lines like so:

0 .. 99 | %{
  $dir = ("DIR-{0:0000}" -f $_ )
  if (! (Test-Path -path $dir ) ) {
    New-Item $dir -type directory
  }
}


1) We first create a list of 100 numbers.
2) For each number in the list, we loop through a set of intructions.
3) We assign the $dir variable to be "DIR-" followed by a zero-padded number corresponding, starting with DIR-0000.
4) We then check to see if the directory exists. If the directory does not exist, create the directory.
5) After DIR-0000, we proceed to create DIR-0001 if it does not exist and repeat for DIR-0002, DIR-0003, etc.
6) We stop after we create DIR-0099 if it does not exist.

no text attachments for Posterous

I was trying to move a lot of verbose text to an attachment to keep the main short but Posterous simply appending the text files to the end of the post. I am not sure there is an easy way to detect text attachments consistently across all e-mail clients and a MIME-aware e-mail library that is flexible enough to handle it.

These are notes for 1 e-mail client, Gmail.

The e-mail was sent MIME encoded. The first layer was split into 3 parts with multipart/mixed. The actual blog post was wrapped inside a second layer as multipart/alternative.

I. Content-Type: multipart/mixed
   A. Content-Type: multipart/alternative
      1. Content-Type: text/plain; charset=ISO-8859-1
      2. Content-Type: text/html; charset=ISO-8859-1
   B. Content-Type: text/plain; charset=US-ASCII
   C. Content-Type: text/plain

The actual attachments have Content-Disposition: attachment and Content-Transfer-Encoding: base64, so it is reasonably easy to see when viewing the raw text.

Probably the most important question is even if text attachments were supported, how would they be displayed? Will an HTML iframe work elegantly like the supported file types listed in the FAQ at http://posterous.com/faq/?

Spring!

I love the tribute to "The Very Hungry Caterpillar" on today's Google
front page: http://www.google.com/

Here is an interview of Eric Carle on Amazon: http://www.amazon.com/gp/mpd/permalink/m2STUY7R3580M2

   

Rebooting my Bloglines account

I have been using Bloglines since 2006 but realized that I had gotten very carried away with what feeds to follow. I committed to delete all my feeds and start fresh today.

Picture (Device Independent Bitmap)


I did not see an obvious way of making a backup with the beta interface and logged in using the classic interface to use the "Export Subscriptions" feature.

Picture (Device Independent Bitmap)


The deed is done: 0 updated feeds.
Picture (Device Independent Bitmap)

And now, back to the beta site to start anew.
Picture (Device Independent Bitmap)

Picture (Device Independent Bitmap)


         

808 new messages

Is someone trying to tell me something or I am I making something out
of nothing?

(http://www.google.com/search?q=area+code+808)