word page 4 - Dave's Blog

Search
My timeline on Mastodon

No Media Kings - Sword of My Mouth #1 Out Soon

2009 Feb 28, 11:34"It's completely nuts... It's a book about what if the Rapture actually happened, and that's all I'm gonna tell you." -Junot Diaz, 2008 Pulitzer Prize Winner for FictionPermalinkCommentscreativecommons comic literature religion magic download pdf

Keepers of Lists - Top 278 Star Wars Lines Improved By Replacing A Word With Pants

2009 Feb 13, 9:29"I have altered the pants, pray that I don't alter them further."PermalinkCommentshumor pants starwars quote scifi geek

Cursebird: What the f#@! is everyone swearing about?

2009 Feb 10, 6:34Real time stats on folks cursing on Twitter. Shows percentage change in usage by curse word.PermalinkCommentstwitter humor language swearing mashup

It's Me, and Here's My Proof: Why Identity and Authentication Must Remain Distinct

2009 Jan 22, 9:48"Revocation presents another challenge. If a system relies only on a biometric for both identity and authentication, how do you revoke that factor? Forgotten passwords can be changed; lost smartcards can be revoked and replaced. How do you revoke a finger?"PermalinkCommentsarticle microsoft security identity authentication biometrics

Google search results for "KH(Ax)N" for x=1 to 100 on Flickr - Photo Sharing!

2009 Jan 16, 2:10A graph showing how many people use the word Khan spelled with varying number of 'A's.PermalinkCommentshumor via:boingboing graph data startrek khan google

Noisy Decent Graphics: All the ephemera that's fit to print *

2009 Jan 15, 9:41"Russell and I thought it would be interesting to take some stuff from the internet and print it in a newspaper format. Words as well as pictures. Like a Daily Me, but slower. When we discovered that most newspaper printers will let you do a short run on their press (this was exactly the same spec as the News Of The World) we decided to have some fun."PermalinkCommentsblog internet design art newspaper typography print publishing via:mattb

Everything you know about ARGs is WRONG

2008 Dec 29, 1:48"That's that sorted then. No more "alternate reality" bullshit. We can use the word "fiction" or "story" instead, so normal people can understand us."PermalinkCommentshumor fiction arg story presentation slideshow talk marketing game via:mattb

Dropped Calls: When Cell Phone Meets Toilet : NPR

2008 Dec 29, 12:21This reminds me of the case of the iPod in the toilet which I could have sword I already posted to delicious...PermalinkCommentsvia:claire npr humor phone cellphone toilet

STREET WITH A VIEW: a project by Robin Hewlett & Ben Kinsley

2008 Nov 22, 5:22"On May 3rd 2008, artists Robin Hewlett and Ben Kinsley invited the Google Inc. Street View team and residents of Pittsburgh's Northside to collaborate on a series of tableaux along Sampsonia Way. Neighbors, and other participants from around the city, staged scenes ranging from a parade and a marathon, to a garage band practice, a seventeenth century sword fight, a heroic rescue and much more."PermalinkCommentsgoogle map street view pittsburgh streetview internet art

Text/Plain Fragment Bookmarklet

2008 Nov 19, 12:58

The text/plain fragment documented in RFC 5147 and described on Erik Wilde's blog struck my interest and, like the XML fragment, I wanted to see if I could implement this in IE. In this case there's no XSLT for me to edit so, like my plain/text word wrap bookmarklet I've implemented it as a bookmarklet. This is only a partial implementation as it doesn't implement the integrity checks.

Check out my text/plain fragment bookmarklet.

PermalinkCommentstext url boring bookmarklet uri plain-text javascript fragment

Tab Expansion in PowerShell

2008 Nov 18, 6:38

PowerShell gives us a real CLI for Windows based around .Net stuff. I don't like the creation of a new shell language but I suppose it makes sense given that they want something C# like but not C# exactly since that's much to verbose and strict for a CLI. One of the functions you can override is the TabExpansion function which is used when you tab complete commands. I really like this and so I've added on to the standard implementation to support replacing a variable name with its value, tab completion of available commands, previous command history, and drive names (there not restricted to just one letter in PS).

Learning the new language was a bit of a chore but MSDN helped. A couple of things to note, a statement that has a return value that you don't do anything with is implicitly the return value for the current function. That's why there's no explicit return's in my TabExpansion function. Also, if you're TabExpansion function fails or returns nothing then the builtin TabExpansion function runs which does just filenames. This is why you can see that the standard TabExpansion function doesn't handle normal filenames: it does extra stuff (like method and property completion on variables that represent .Net objects) but if there's no fancy extra stuff to be done it lets the builtin one take a crack.

Here's my TabExpansion function. Probably has bugs, so watch out!


function EscapePath([string] $path, [string] $original)
{
    if ($path.Contains(' ') -and !$original.Contains(' '))
    {
        '"'   $path   '"';
    }
    else
    {
        $path;
    }
}

function PathRelativeTo($pathDest, $pathCurrent)
{
    if ($pathDest.PSParentPath.ToString().EndsWith($pathCurrent.Path))
    {
        '.\'   $pathDest.name;
    }
    else
    {
        $pathDest.FullName;
    }
}

#  This is the default function to use for tab expansion. It handles simple
# member expansion on variables, variable name expansion and parameter completion
# on commands. It doesn't understand strings so strings containing ; | ( or { may
# cause expansion to fail.

function TabExpansion($line, $lastWord)
{
    switch -regex ($lastWord)
    {
         # Handle property and method expansion...
         '(^.*)(\$(\w|\.) )\.(\w*)$' {
             $method = [Management.Automation.PSMemberTypes] `
                 'Method,CodeMethod,ScriptMethod,ParameterizedProperty'
             $base = $matches[1]
             $expression = $matches[2]
             Invoke-Expression ('$val='   $expression)
             $pat = $matches[4]   '*'
             Get-Member -inputobject $val $pat | sort membertype,name |
                 where { $_.name -notmatch '^[gs]et_'} |
                 foreach {
                     if ($_.MemberType -band $method)
                     {
                         # Return a method...
                         $base   $expression   '.'   $_.name   '('
                     }
                     else {
                         # Return a property...
                         $base   $expression   '.'   $_.name
                     }
                 }
             break;
          }

         # Handle variable name expansion...
         '(^.*\$)([\w\:]*)$' {
             $prefix = $matches[1]
             $varName = $matches[2]
             foreach ($v in Get-Childitem ('variable:'   $varName   '*'))
             {
                 if ($v.name -eq $varName)
                 {
                     $v.value
                 }
                 else
                 {
                    $prefix   $v.name
                 }
             }
             break;
         }

         # Do completion on parameters...
         '^-([\w0-9]*)' {
             $pat = $matches[1]   '*'

             # extract the command name from the string
             # first split the string into statements and pipeline elements
             # This doesn't handle strings however.
             $cmdlet = [regex]::Split($line, '[|;]')[-1]

             #  Extract the trailing unclosed block e.g. ls | foreach { cp
             if ($cmdlet -match '\{([^\{\}]*)$')
             {
                 $cmdlet = $matches[1]
             }

             # Extract the longest unclosed parenthetical expression...
             if ($cmdlet -match '\(([^()]*)$')
             {
                 $cmdlet = $matches[1]
             }

             # take the first space separated token of the remaining string
             # as the command to look up. Trim any leading or trailing spaces
             # so you don't get leading empty elements.
             $cmdlet = $cmdlet.Trim().Split()[0]

             # now get the info object for it...
             $cmdlet = @(Get-Command -type 'cmdlet,alias' $cmdlet)[0]

             # loop resolving aliases...
             while ($cmdlet.CommandType -eq 'alias') {
                 $cmdlet = @(Get-Command -type 'cmdlet,alias' $cmdlet.Definition)[0]
             }

             # expand the parameter sets and emit the matching elements
             foreach ($n in $cmdlet.ParameterSets | Select-Object -expand parameters)
             {
                 $n = $n.name
                 if ($n -like $pat) { '-'   $n }
             }
             break;
         }

         default {
             $varNameStar = $lastWord   '*';

             foreach ($n in @(Get-Childitem $varNameStar))
             {
                 $name = PathRelativeTo ($n) ($PWD);

                 if ($n.PSIsContainer)
                 {
                     EscapePath ($name   '\') ($lastWord);
                 }
                 else
                 {
                     EscapePath ($name) ($lastWord);
                 }
             }

             if (!$varNameStar.Contains('\'))
             {
                foreach ($n in @(Get-Command $varNameStar))
                {
                    if ($n.CommandType.ToString().Equals('Application'))
                    {
                       foreach ($ext in @((cat Env:PathExt).Split(';')))
                       {
                          if ($n.Path.ToString().ToLower().EndsWith(($ext).ToString().ToLower()))
                          {
                              EscapePath($n.Path) ($lastWord);
                          }
                       }
                    }
                    else
                    {
                        EscapePath($n.Name) ($lastWord);
                    }
                }

                foreach ($n in @(Get-psdrive $varNameStar))
                {
                    EscapePath($n.name   ":") ($lastWord);
                }
             }

             foreach ($n in @(Get-History))
             {
                 if ($n.CommandLine.StartsWith($line) -and $n.CommandLine -ne $line)
                 {
                     $lastWord   $n.CommandLine.Substring($line.Length);
                 }
             }

             # Add the original string to the end of the expansion list.
             $lastWord;

             break;
         }
    }
}

PermalinkCommentscli technical tabexpansion powershell

Sonja Eddings Brown is Rather Unpleasant - The Rehabilitated Student

2008 Nov 16, 10:13"Imagine my mild surprise when I discovered that the woman who terrorized me in my final days in high school is the face of Proposition 8. Sonja Eddings Brown is everything you would expect a Proposition 8 supporter to be: someone with misplaced values and a knack for being a big bully. Yes, a middle-aged mother of three went out of her way to threaten to kick a high school senior out of her valedictory speaking position simply because the student refused to have (strange) words placed her mouth and to be used as a propagandistic advertising vehicle."PermalinkCommentspolitics education california sonja-eddings-brown high-school via:kris.kowal

Amazon.com: A Million Random Digits with 100,000 Normal Deviates: RAND Corporation: Books

2008 Oct 31, 7:10Bruce Schneier pointed out this book: "A Million Random Digits with 100,000 Normal Deviates (Paperback)". Its 600 pages of random numbers. I'd get a copy if it didn't cost $90! From the stats page Amazon lists the 100 most used words in the book: "6 8 11 19 23 28 30 32 37 38 42 47 52 54 56 60 72 77 80 84 86 92 101 102 107 108 111 115 125 126 131 143 147 148 150 157 158 163 166 167 171 179 183 188 190 197 206 207 212 215 218 220 226 228 230 234 236 242 247 249 251 253 261 265 272 292 297 304 311 323 332 336 337 338 344 345 354 356 358 359 364 371 372 374 384 389 391 409 412 413 421 433 436 443 457 481 489 516 517 642"PermalinkCommentsvia:schneier random book humor math csc

OpenID being Balkanized even as Google, Microsoft sign on

2008 Oct 30, 12:13On hearing news of Live ID supporting OpenID this is pretty much exactly what I was thinking: "With every big portal acting as a provider but not a consumer of identity credentials, users are still going to wind up creating accounts for more than one service (says this user of Flickr and Google Calendars). When it comes to third-party sites, they may not need to remember a new username and password, but they will have to remember to which of the providers they chose to provide the credentials for their account. Anyone who slips up may wind up with three or more identities on a single website, with different data associated with each."PermalinkCommentsopenid identity microsoft google

Word Wrapping IE's Plain Text

2008 Oct 28, 11:23

If you view a plain text document in Internet Explorer 8, for instance the plain text version of Cory Doctorow's book Little Brother and press F12 to bring up the developer toolbar, you can see that IE simply takes the plain text, sticks it inside a

 tag, and renders it.  This means that word wrapping isn't supplied and the only line breaks that appear are those in the document.  However, since the text document is converted to HTML it means I can implement word wrap myself using a bookmarklet:
javascript:function ww() { var preTag = document.getElementsByTagName('pre')[0]; preTag.style.fontFamily="arial"; preTag.style.wordWrap='break-word'; }; ww();
After adding a favorite and setting the favorite's URL to the previous, I can view plain text documents, and select my Word Wrap favorite to apply word wrap and non-fixed width font.
PermalinkCommentsbrowser technical ie wordwrap

Mail Games: Testing the System | PSFK - Trends, Ideas & Inspiration

2008 Oct 15, 10:47The artist Harriet Russell encodes the destination postal address of her letters with anagrams, crosswords, and other puzzles: "Despite fears of a Royal Mail backlash, Russell found the system more than willing to play her game. The crossword edition was returned completed with the comment "Solved by the Glasgow Mail Centre". Only 10 of the 130 letters posted lost their way through the system, some held particularly testing anagrams, others were without a postal code."PermalinkCommentshumor puzzle crossword art mail postal-system harriet-russell book

Disemvowelment and Reemvowelment Tools

2008 Oct 3, 5:29I thought the disemvowelment of trolls was a pretty funny punishment -- much better than simply removing the comment: "Disemvowelment is - obviously enough - the act of removing the vowels from a passage of text, as well as a pun on the word 'disembowelling'. A number of blogs and websites do this to offensive text which has been placed in their 'comments' section. ... This site exists because I couldn't resists the challenge of trying to re-emvowel disemvowelled text. This is a challenging task, as the disemvowelled word 'dg' may well have been 'dog', but also 'dig', 'dug', 'doge', diego' and so on. I have a first cut of this functionality at the re-emvowel link at the side of the page. A more advanced version is in progress."PermalinkCommentstool disemvowelment web comment forum troll language

STGC Enumeration (Windows)

2008 Oct 1, 1:49One of the values in this enum is named 'STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE'. After reading (and re-reading to make sure I word broke correctly) I'm left with the lingering impression that I've had an extensive conversation with whoever named this variable. Anyway, I thought it was a fun name.PermalinkCommentshumor software msdn microsoft reference

Sarah Palin's Hacked Yahoo Email Account Timeline

2008 Sep 18, 10:05Sarah Palin's Yahoo email addresses were hacked. I agree with the commenter: "I was just about to post how I feel bad for her despite disagreeing with most of her politics. There are plenty of legitimate reasons to attack her (or any politician), but this is clearly personal, not politics. From what I've read, this wasn't even the account she used for those communications she wanted to hide from subpoena, so the vigilante justice angle is BS. This is just plain mean." Although the last sentence of the following made me laugh: "A good samaritan in the /b/ thread reset the password account with the intention of handing it over to Palin, a process known on /b/ as "white knighting". This locked everyone else out of the account. The "white knight" posted a screenshot to /b/ of his pending message to one of Palin's contacts about how to recover the account, but made the critical mistake of not blanking out the new password he set."PermalinkCommentssecurity politics hack privacy government legal email yahoo

Patenting reincarnation - Knowledge Jolt with Jack

2008 Aug 28, 10:58"The patent is really bad, which is all part of the fun: Abstract: The invention consists of the process of reincarnation or rebirth resulting in immortality. Description: [0001] This invention resulted from my combining Einstein's Theory of Relativity and Newton's Second Law of Physics. [0002] Reincarnation is defined in Webster's Third New Inernational Dictionary as "rebith". Thus my invention is a process of rebirth or in other words immortality."PermalinkCommentshumor patent via:kris.kowal reincarnation
Older EntriesNewer Entries Creative Commons License Some rights reserved.