Dave's Things

Eat Pants - Interactive Fiction Sessions from my Server Logs

Tue, 2009 Jun 30 06:19:23 GMT

I've looked at my web server logs previously to see if anyone had used my Web Frotz Interpreter and until recently didn't realize that awstats (the web server log report generator) was truncating the query from my URL, so I couldn't tell that anyone was actually using it. But after grepping the logs manually I've pulled out the URLs of visitor's text adventure sessions. If you'll recall, my Web Frotz Interpreter stores the game state in the URL so its easy to see user's game states in the web server logs.

I've put some of the links up on the Web Frotz Interpreter page. Some of the interesting ones:


server-logs technical zork frotz pants interactive-fiction uri if
Comments...

PowerShell Scanning Script

Sat, 2009 Jun 27 17:42:25 GMT

I've hooked up the printer/scanner to the Media Center PC since I leave that on all the time anyway so we can have a networked printer. I wanted to hook up the scanner in a somewhat similar fashion but I didn't want to install HP's software (other than the drivers of course). So I've written my own script for scanning in PowerShell that does the following:

  1. Scans using the Windows Image Acquisition APIs via COM
  2. Runs OCR on the image using Microsoft Office Document Imaging via COM (which may already be on your PC if you have Office installed)
  3. Converts the image to JPEG using .NET Image APIs
  4. Stores the OCR text into the EXIF comment field using .NET Image APIs (which means Windows Search can index the image by the text in the image)
  5. Moves the image to the public share

Here's the actual code from my scan.ps1 file:

param([Switch] $ShowProgress, [switch] $OpenCompletedResult)

$filePathTemplate = "C:\users\public\pictures\scanned\scan {0} {1}.{2}";
$time = get-date -uformat "%Y-%m-%d";

[void]([reflection.assembly]::loadfile( "C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll"))

$deviceManager = new-object -ComObject WIA.DeviceManager
$device = $deviceManager.DeviceInfos.Item(1).Connect();

foreach ($item in $device.Items) {
	$fileIdx = 0;
	while (test-path ($filePathTemplate -f $time,$fileIdx,"*")) {
		[void](  $fileIdx);
	}

	if ($ShowProgress) { "Scanning..." }

	$image = $item.Transfer();
	$fileName = ($filePathTemplate -f $time,$fileIdx,$image.FileExtension);
	$image.SaveFile($fileName);
	clear-variable image

	if ($ShowProgress) { "Running OCR..." }

	$modiDocument = new-object -comobject modi.document;
	$modiDocument.Create($fileName);
	$modiDocument.OCR();
	if ($modiDocument.Images.Count -gt 0) {
		$ocrText = $modiDocument.Images.Item(0).Layout.Text.ToString().Trim();
		$modiDocument.Close();
		clear-variable modiDocument

		if (!($ocrText.Equals(""))) {
			$fileAsImage = New-Object -TypeName system.drawing.bitmap -ArgumentList $fileName
			if (!($fileName.EndsWith(".jpg") -or $fileName.EndsWith(".jpeg"))) {
				if ($ShowProgress) { "Converting to JPEG..." }

				$newFileName = ($filePathTemplate -f $time,$fileIdx,"jpg");
				$fileAsImage.Save($newFileName, [System.Drawing.Imaging.ImageFormat]::Jpeg);
				$fileAsImage.Dispose();
				del $fileName;

				$fileAsImage = New-Object -TypeName system.drawing.bitmap -ArgumentList $newFileName 
				$fileName = $newFileName
			}

			if ($ShowProgress) { "Saving OCR Text..." }

			$property = $fileAsImage.PropertyItems[0];
			$property.Id = 40092;
			$property.Type = 1;
			$property.Value = [system.text.encoding]::Unicode.GetBytes($ocrText);
			$property.Len = $property.Value.Count;
			$fileAsImage.SetPropertyItem($property);
			$fileAsImage.Save(($fileName   ".new"));
			$fileAsImage.Dispose();
			del $fileName;
			ren ($fileName   ".new") $fileName
		}
	}
	else {
		$modiDocument.Close();
		clear-variable modiDocument
	}

	if ($ShowProgress) { "Done." }

	if ($OpenCompletedResult) {
		. $fileName;
	}
	else {
		$result = dir $fileName;
		$result | add-member -membertype noteproperty -name OCRText -value $ocrText
		$result
	}
}

I ran into a few issues:

  • MODI doesn't seem to be in the Office 2010 Technical Preview I installed first. Installing Office 2007 fixed that.
  • The MODI.Document class, at least via PowerShell, can't be instantiated in a 64bit environment. To run the script on my 64bit OS I had to start powershell from the 32bit cmd.exe (C:\windows\syswow64\cmd.exe).
  • I was planning to hook up my script to the scanner's 'Scan' button, but HP didn't get the button working for their Vista driver. Their workaround is "don't do that!".
  • You must call Image.Dispose() to get .NET to release its reference to the corresponding image file.
  • In trying to figure out how to store the text in the files comment, I ran into a dead-end trying to find the corresponding setter for GetDetailsOf which folks like James O'Neil use in PowerShell for interesting ends.


technical scanner ocr .net modi powershell office wia
Comments...

Linking to or Embedding a Portion of a Video

Sat, 2009 Jun 20 00:12:14 GMT

I'm excited by HTML5's video tag as are plenty of other people. Once that comes about and once media fragments are adopted, linking to or embedding a portion of a video will be as easy as using the correct fragment on your URL thanks to the Media Fragments WG who has been hard at work since the last time I looked at fragments.

However, until that work is embraced by browsers, embedding portions of videos will continue to require work specific to the site from which you are embedding the video. On the YouTube blog they wrote about how to "link to the best parts in your videos", using a fragment syntax like '#t=1m15s' to start playback of the associated video at 1 minute and 15 seconds. Of course if you want to embed part of a Hulu video it will be different. Although I haven't found an authoritative source describing the URL syntax to use, you can follow Hulu's video guide on linking to part of a video and note how the URL changes as you adjust the slider on the time-line. It looks like their syntax for linking to a Hulu page is to add '?c=[start time in seconds](:[end time in seconds])' with the colon and end time optional in order to link to a portion of a video. And the syntax for embedding appears to be "http://www.hulu.com/embed/.../[start time in seconds](/[end time in seconds])" again with the end time optional.

For more sites, check out the Media Fragments WG's list of existing applications' proprietary fragmenting schemes.


hulu technical media fragment wg url youtube video html5 uri fragment
Comments...

Mostly Moved Into New House

Fri, 2009 Jun 19 22:07:56 GMT

New House ExteriorThe weekend before the previous, Sarah and I moved our belongings into the new house and spent a lot of time packing and unpacking, and now we're officially living there (interested Facebook friends can find my new address or just ask me). The Saturday of the previous weekend Sarah's family came over for a half house warming and half Sarah's birthday celebration which was fun and served to force us to do more unpacking and forced me to take trips to Home Depot, Bed Bath and Beyond, etc. On Sunday, Sarah and I went out to her favorite restaurant and she opened her gifts that I had to hide to keep her from opening before her birthday. Happy Birthday Sarah!

While at Home Depot I had trouble finding what I was actually looking for, but I did find everything I needed to terminate the Cat5e cables that are wired in the house. Each room has a wall plate with two RJ45 sockets, both sockets wired to Cat5e cable. One of the cables per plate was already hooked up to a standard phone service punchdown board and the other cables per plate were all hanging unterminated next to the punchdown board. So now I've terminated them all with RJ45 connectors and hooked them up to my hub, wireless router, cable modem, etc. I had the same sort of fun setting all that up as I did playing with model train sets as a child. Hopefully no therapy will be required to figure out why that is.


train address sarah house new-house birthday nontechnical
Comments...

OpenSearchDescriptionToHTML Tool

Thu, 2009 Jun 11 05:36:05 GMT

I've made an OpenSearchDescriptionToHTML XSLT that given an OpenSearch description file produces HTML that describes that file, lets you install it, or search with it. For example, here's a Google OpenSearch description that uses my OpenSearchDescriptionToHTML XSLT.

I had just created an OpenSearch description for WolframAlpha at work and was going about the process of adding another install link to my search provider page so that I could install it. Thinking about it, I realized I could apply an XSLT to the OpenSearch description XML to produce the HTML automatically so I wouldn't have to modify additional documents everytime I create and want to install a new OpenSearch description. While I was in there writing the XSLT I figure why not let the user try out searching with the OpenSearch description file too. And lastly I made the XSLT apply to itself to produce HTML describing its own usage.

Incidentally, I added WolframAlpha at work to replace my FileInfo search provider for the purposes of searching for information about particular Unicode characters. For instance, look at WolframAlpha's lovely output for this search for "Bopomofo zh".


technical xml wolframalpha opensearchdescriptiontohtml xslt opensearch
Comments...

A Brief History of Microsoft's Live Search's New Domain Bing

Tue, 2009 Jun 02 01:07:04 GMT

Logo for bing! from 2003 via The Wayback MachineLogo for BING* from 2006 via The Wayback MachineKimberly Saia's flickr photo of the Microsoft bing search logo.
When I heard that Live Search is now Bing one of my initial thoughts was how'd they get that domain name given the unavailability of pronouncable four letter .COM domain names. Well, the names been used in the past. Here now, via the Wayback Machine is a brief, somewhat speculative, and ultimately anticlimactic history of bing.com:

  • 2003 July: The first archived version of bing.com features "bing! is a small device (e.g., possibly even a small Band-Aid(R)-like sticker!) that vibrates when a person's cell phone rings." I can't recall 2003 cell phones, were they big enough to require this device?
  • 2004 August: Site for the same device is rewritten and looks much better, IMHO.
  • 2006 June: The domain is now parked by easyDNS. I guess the "bing!" device didn't work out?
  • 2006 November: Its now "BING*" and they won't say what they're working on ("we're still in stealth mode") but they are hiring C#/.NET developers.
  • 2007 January: And they're gone. Without even exiting stealth mode. Too bad, I liked their logo. Their domain is now for sale...
  • 2007 February: Looks like EasyMail buys the domain and offers a physical mailing service in Australia: "By simply clicking a button on your computer, mail is beamed electronically to a bing post office. Your mail is automatically printed, folded, enveloped and dispatched into the Australia Post network the very same day."
  • Present: Now its the new home for Live Search of course.

The new name reminds me of the show Friends. Also, I hope they get a new favicon - I don't enjoy the stretched 'b' nor its color scheme.


microsoft domain history search archive dns bing
Comments...

Infrared Paint Link Roundup

Sat, 2009 May 30 04:50:40 GMT

I like the idea of QR codes, encoding URLs and placing them on real world objects, but the QR codes themselves are kind of ugly. To make them less obvious I thought I could spray QR codes on to an object with an infrared reflective paint and shine infrared light on the QR codes, since most cameras, for instance the camera in my G1 phone, pick up infrared that our eyes do not.

In my search for infrared paint I've found a seller of IR ink (via programming forum) and an Infrared Paint Recipe (via IR FAQ).

In looking for this paint I've found that it comes up a lot in relation to the military for things like paint markers that are visible at night with proper equipment, and paint that absorbs IR light to make vehicles less obvious to night vision goggles. Even though the first reflects infrared light and the second absorbs it websites end up refering to both as infrared paint which made it difficult to search.

Additionally I found links to some other geeky infrared projects:


ir paint ir infrared qr qr code
Comments...

Caught with Fake Info for Albertson Grocery Card

Tue, 2009 May 26 05:02:49 GMT

QFC grocery card barcodeChecking out at a grocery store to which I rarely go, the cashier asks me if I want an Albertson's card. I respond sure and she hands me the form on which I give up my personal information. I ask if I need to fill this out now, and she says yeah and it will only take two minutes, which surprised me because at QFC they just hand me a new card and send me on my way. I fill in my phone number as the first ten digits of pi so I don't have to worry about getting phone calls but its something I can remember next time I'm there and don't bring the card.

I turn to leave and the cashier asks me is that a '759' or '159' in my phone number. I stop for a second because I only know the digits as a sequence from the start and pause long enough reciting it in my head that its clear its not my phone number. And she calls me out on it: "Is that your real phone number?" I sigh, "No, does it have to be? Are you going to call me?" "Yeah," she says, "I'll call you." (ha ha) "Well I'll try entering this number," she says doubting the computer will accept the fake phone number. "On the number's already registered," she says, "So you already had a card." "No," says the manager who had walked up during for this exchange, "It means someone else used that same number." So the moral of the story is, try your fake phone number before trying to use it to get a new card.


pi albertsons nontechnical
Comments...

Browser Versions Over Time

Sun, 2009 May 24 06:45:04 GMT

In honor of Google Chrome's recent v2 release and because I read they don't make too big a deal about version numbers, I thought to create a graph of browser major version numbers over time.

Yeah that's not too useful of a graph. I got the release dates from Wikipedia of course.

As you can see from the graph, Netscape and Opera are leading all other browsers in terms of major version number. The other browsers really need to get on that.


browser boring google ie graph
Comments...

New Home

Sun, 2009 May 24 06:28:28 GMT

New House ExteriorNew House Looking Out At DrivewaySarah and I have a new place in Redmond and we'll be moving there in a few weeks. Exciting! Incidentally, when researching the place on the Internet I found that the nearby park used to be a radar site for the Project Nike missile system in the fifties. Fun!


personal house home nontechnical
Comments...

Capitola

Fri, 2009 May 22 19:10:35 GMT

New House Looking Out At Driveway

Fri, 2009 May 22 18:26:12 GMT

Star Trek Thoughts

Fri, 2009 May 08 22:23:07 GMT

I watched the new Star Trek movie Thursday morning, along with many others who work on Windows. Microsoft rented out a theater and played the movie on all screens. I greatly enjoyed the movie!

Spoilers follow... I'm obviously not the biggest Star Trek nerd (or at least TOS nerd) since I didn't even pick up on the fact that Kirk's dad being dead was a discrepancy from the TV series. I only figured out the alternate time-line stuff when they killed most of the Vulcans. I was just surprised they didn't set right what once went wrong by the end of the movie with some more time travel magic to bring back Vulcan. On that note, I'm pretty sure the Spock-Spock conversation at the end, is Nimoy Spock sending Sylar Spock off to school so that Nimoy Spock can get freaky repopulating the Vulcan race. Although at first after his 'two places at once' comment I thought he was saying... something else. Also, was the main evil guy a random miner turned psycho? And his crazy looking spaceship that destroys the Federation fleet was just a mining vessel from the future? Once they invent time travel anybody can get drunk, go back in time, and conquer Earth.


nerd movie star-trek spoliers time-travel non-technical
Comments...

Netflix CSRF - Stolen Thoughts

Mon, 2009 May 04 00:36:47 GMT

Looking at the HTTP traffic of Netflix under Fiddler I could see the HTTP request that added a movie to my queue and didn't see anything obvious that would prevent a CSRF. Sure enough its pretty easy to create a page that, if the user has set Netflix to auto-login, will add movies to the user's queue without their knowledge. I thought this was pretty neat, because I could finally get people to watch Primer. However, when I searched for Netflix CSRF I found that this issue has been known and reported to Netflix since 2006. Again my thoughts stolen from me and the theif doesn't even have the common decency to let me have the thought first!

With this issue known for nearly three years its hard to continue calling it an issue. Really they should just document it in their API docs and be done with it. Who knows what Netflix based web sites and services they'll break if they try to change this behavior? For instance, follow this link to add my Netflix recommended movies to your queue.


technical stolen-thoughts csrf netflix security
Comments...

Netflix Watch Instantly Recommendations

Sun, 2009 May 03 23:17:50 GMT
WeedsAvatar The Last AirbenderPaprikaGrindhouse Planet TerrorOutsourcedThe King of KongPrimer

Netflix lets you watch a subset of their movies online via their website and a subset of those movies are available to watch on the Xbox 360's Netflix app. so its not always easy to find movies to watch on Xbox 360. Yet, I regularly see my Xbox friends using the Netflix app and its a shame they didn't make an easy way to share movie recommendations with your friends. Instead we must share movie recommendations the old fashioned way. Here's the movies I've found and enjoyed on my 360.

Weeds
You don't have to be a stoner to enjoy this humorous and dramatic satire featuring a widow trying to raise her children and deal pot in suburbia.
Avatar The Last Airbender
An American animated series that's an amalgamation of various Asian art, history, religion, etc. that maintains a great story line.
Paprika
If you enjoyed Paranoia Agent you'll enjoy this movie in the same animation style and by the same director and writer, Satoshi Kon. Its like a feature length version of a Paranoia Agent episode in which a dream machine lets outsiders view one's dreams but eventually leads to blurring the dreams and reality.
Grindhouse Planet Terror
I didn't see either of the Grindhouse movies when they first came out, but of the two, Planet Terror is the more humorous and exciting gore filled parody.
Outsourced
A refreshing romantic comedy that still has a few of the over played tropes but is easy to enjoy despite that.
The King of Kong
A hilarious documentary on the struggle between the reigning champ hot-sauce salesman and the underdog Washington state high school science teacher to obtain the Donkey Kong world record high score. After watching, checkout this interview with the creators of the movie and the villain.
Primer
I've mentioned Primer before, but I put it on here again because its really good and you still haven't seen it, have you?


movie personal netflix
Comments...

Red Tulips

Sat, 2009 May 02 20:43:30 GMT

Send URL to Cellphone - QR Encode Accelerator

Tue, 2009 Apr 14 23:26:56 GMT

I've made a QR Encode accelerator around Google Chart's QR code generator. QR codes are 2D bar-codes that can store (among other things) URLs and have good support on mobile phones. The accelerator I've written lets you generate a QR code for a selected link and view it in the preview window. In combination with the ZXing bar-code scanner app for my Android cellphone, its easy for me to right click on a link in IE8 on my desktop PC, hover over the QR Encode accelerator to have the link's associated QR code displayed, and then with my phone read that QR code to open my phone's browser to the URL contained inside. Its much easier to browse around in the comfort of my desktop and only send particular URLs to my cellphone as necessary.


technical boring accelerator android barcode ie8 google qr code
Comments...

Flickr Visual Search in IE8

Fri, 2009 Apr 10 23:48:49 GMT

A while ago I promised to say how an xsltproc Meddler script would be useful and the general answer is its useful for hooking up a client application that wants data from the web in a particular XML format and the data is available on the web but in another XML format. The specific case for this post is a Flickr Search service that includes IE8 Visual Search Suggestions. IE8 wants the Visual Search Suggestions XML format and Flickr gives out search data in their Flickr web API XML format.

So I wrote an XSLT to convert from Flickr Search XML to Visual Suggestions XML and used my xsltproc Meddler script to actually apply this xslt.

After getting this all working I've placed the result in two places: (1) I've updated the xsltproc Meddler script to include this XSLT and an XML file to install it as a search provider - although you'll need to edit the XML to include your own Flickr API key. (2) I've created a service for this so you can just install the Flickr search provider if you're interested in having the functionality and don't care about the implementation. Additionally, to the search provider I've added accelerator preview support to show the Flickr slideshow which I think looks snazzy.

Doing a quick search for this it looks like there's at least one other such implementation, but mine has the distinction of being done through XSLT which I provide, updated XML namespaces to work with the released version of IE8, and I made it so you know its good.


meddler xml ie8 xslt flickr technical boring search suggestions
Comments...
http://deletethis.net/dave/
Creative Commons License Some rights reserved.