Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.

Quick

  • ($a, $b....) = unpack("A2A7...", $packed)
  • push( array, list )

Friday, January 29, 2010

file object

Files returned by get-childitem have a length, not a 'size'.

Friday, January 22, 2010

stuff

Attempting to stuff() to a start position beyond the end of a string results in null!

This does not happen merely when stuffing a multi-character string so as to produce a result longer than the original string. (Eg stuffing "xyz" into position 2 of "ab").

go

'go' is purely a batch delimiter. It just divides a load of SQL in the client up into 'batches' that get sent to the server one at a time.

select 9

go

select 8

go

is the exact equivalent of

connection.Execute("select 9")

connection.Execute("select 8")

mp3 data in filenames

To count songs by artist, from a file containing a list of filenames with format C:\blah\blah\bling\99 Artist - Song.mp3

get-content \0.txt

| foreach-object -process {

if ($_ -match "\\\d\d ([^\\]+) -") {$_ = $matches[1] }

else {$_ = "X"}; $_

| group-object

| sort-object -property count

}


  • the count property belongs to the objects that group-object produces
  • the -process part of foreach-object doesn't output anything by default, hence the trailing $_
  • $matches[n] == $n in Perl

Followers

Blog Archive