test page 4 - Dave's Blog

Search
My timeline on Mastodon

Obama should back up Google with more than rhetoric: The US should challenge China’s “firewall” before the WTO. : First Amendment Coalition

2010 Jan 25, 5:25"...file a complaint with the World Trade Organization, contesting China’s internet censorship as a breach of the international trade rules to which China, as a WTO member, is subject. The US can argue that China’s “Great Firewall”–a system of filters and bottlenecks that effectively shutters the country within its own intranet–is an illegal restraint on international trade because it bars foreign companies from competing, via the internet, in the vast Chinese market."PermalinkCommentseconomics wto politics google china internet censorship us

Auto-appendectomy in the Antarctic: case report -- Rogozov and Bermel 339: b4965 -- BMJ

2010 Jan 20, 2:03The only doctor in Antarctica has to remove his own appendix. "When Rogozov had made the incision and was manipulating his own innards as he removed the appendix, his intestine gurgled, which was highly unpleasant for us..." Oh wow, Rogozov should for sure appologize for making you uncomfortable. Jerk. There's photos in the report too. Gross.PermalinkCommentshistory science medicine antarctic appendix russia via:kottke

GameSetWatch - Special: The Best Of The 2009 Demoscene, Part 1 - Demos

2010 Jan 19, 2:21"In the latest of an occasional series of demoscene-related posts on GameSetWatch before, AteBit's Paul 'EvilPaul' Grenfell presents a multi-part retrospective on 2009's best demos - starting out with the top ten real-time PC demos of the year."
PermalinkCommentsdemo demoscene graphic game videogame video programming

WPAD Server Fiddler Extension

2010 Jan 5, 7:42

I've made a WPAD server Fiddler extension and in a fit of creativity I've named it: WPAD Server Fiddler Extension.

Of course you know about Fiddler, Eric's awesome HTTP debugger tool, the HTTP proxy that lets you inspect, visualize and modify the HTTP traffic that flows through it. And on the subject you've probably definitely heard of WPAD, the Web Proxy Auto Discovery protocol that allows web browsers like IE to use DHCP or DNS to automatically discover HTTP proxies on their network. While working on a particularly nasty WPAD bug towards the end of IE8 I really wished I had a way to see the WPAD requests and responses and modify PAC responses in Fiddler. Well the wishes of me of the past are now fulfilled by present day me as this Fiddler extension will respond to WPAD DHCP requests telling those clients (by default) that Fiddler is their proxy.

When I started working on this project I didn't really understand how DHCP worked especially with respect to WPAD. I won't bore you with my misconceptions: it works by having your one DHCP server on your network respond to regular DHCP requests as well as WPAD DHCP requests. And Windows I've found runs a DHCP client service (you can start/stop it via Start|Run|'services.msc', scroll to DHCP Client or via the command line with "net start/stop 'DHCP Client'") that caches DHCP server responses making it just slightly more difficult to test and debug my extension. If a Windows app uses the DHCP client APIs to ask for the WPAD option, this service will send out a DHCP request and take the first DHCP server response it gets. That means that if you're on a network with a DHCP server, my extension will be racing to respond to the client. If the DHCP server wins then the client ignores the WPAD response from my extension.

Various documents and tools I found useful while working on this:

PermalinkCommentsproxy fiddler http technical debug wpad pac tool dhcp

curlies - Project Hosting on Google Code

2009 Dec 23, 9:58Results of a set of black box tests on various characters in various parts of URLs in various popular browsers.PermalinkCommentsvia:mnot url uri iri idn dns browser web technical

Android eBook Reader And Makers

2009 Dec 13, 1:27

I was reading Makers, Cory Doctorow's latest novel, as it was serialized on Tor's website but with no ability to save my place within a page I set out to find a book reading app for my G1 Android phone. I stopped looking once I found Aldiko. Its got bookmarks within chapters, configurable fonts, you can look-up words in a dictionary, and has an easy method to download public domain and creative common books. I was able to take advantage of Aldiko's in-app book download system to get Makers onto my phone so I didn't have to bother with any conversion programs etc, and I didn't have to worry about spacing or layout, the book had the correct cover art, and chapter delimiters. I'm very happy with this app and finished reading Makers on it.

Makers is set in the near future and features teams of inventors, networked 3d printers, IP contention, body modifications, and Disney -- just the sort of thing you'd expect from a Cory Doctorow novel. The tale seems to be an allegory for the Internet including displacing existing businesses and the conflict between the existing big entertainment IP owners and the plethora of fans and minor content producers. The story is engaging and the characters filled out and believable. I recommend Makers and as always its Creative Commons so go take a look right now.

PermalinkCommentstor aldiko cory doctorow g1 makers ebook android book

GameSetWatch - 15th Annual Interactive Fiction Competition Winners Announced

2009 Dec 11, 9:00"Organizers for the 15th Annual Interactive Fiction Competition (IFComp 2009), a contest centered around short text adventures lasting under two hours, recently announced this year's winners: Rover's Day Out, Broken Legs, and Snowquest."PermalinkCommentsif interactive-fiction game fiction text

How to be the world's greatest ISP

2009 Dec 9, 1:32"We're not always aware of it here in the USA, but there are many ISPs out there in the world who do things quite differently than what we're used to. Some of these ISPs ideas are even really good. Ars surveys the global ISP landscape and paints a picture of what a dream ISP might look like."PermalinkCommentstechnical internet isp web article

Latest ‘Square’ Details Include Free Dongles, Craigslist, Alyssa Milano | Epicenter | Wired.com

2009 Dec 7, 3:25Cool, I've been waiting for this: "Twitter creator Jack Dorsey’s Square application, which is like a smartphone PayPal for credit cards, attracted lots of warranted attention for its potential to enable peer-to-peer and merchant credit card transactions in the real world far beyond what’s capable today in most countries." Oh, never mind... "As a customer, all you need to buy from a Square merchant is a credit, debit or pre-paid card"PermalinkCommentscredit-card money via:louis cellphone square

Android Developer Challenge

2009 Dec 3, 2:20"We're pleased to announce the overall winners in the Android Developer Challenge 2. These winners were selected after two rounds of scoring by thousands of Android users as well as an official panel of judges. Please see our official page for more information about the challenge."PermalinkCommentscellphone android google app contest

Framing « Experimental Turk

2009 Dec 3, 1:54Uses Amazon's mechanical Turk program to test framing: "Framing the outcomes in positive vs. negative terms produced a reversal of participants’ preferences for the two programs. In condition 1, the majority of respondents (69.4%) favored Program A, exhibiting risk aversion. In condition 2, the majority of respondents (65.3%) favored Program B, exhibiting risk seeking."PermalinkCommentsvia:pskomoroch science experiment social risk security mechanicalturk amazon

All bow before the mighty power of the nocebo effect – Bad Science

2009 Nov 28, 3:50The downside of the placebo the nocebo: "This is the amazing world of the nocebo effect, where negative expectations can induce unpleasant symptoms, in the absence of a physical cause.", "In two of them, the consent form contained a statement outling various gastrointestinal side effects, and in these centres there was a sixfold increase in the number of people reporting such symptoms and dropping out of the trial, compared with the one centre that did not list such side effects in the form."PermalinkCommentsnocebo placebo science medicine ben-goldacre

Time/Date Conversion Tool

2009 Aug 28, 3:39

I built timestamp.exe, a Windows command line tool to convert between computer and human readable date/time formats mostly for working on the first run wizard for IE8. We commonly write out our dates in binary form to the registry and in order to test and debug my work it became useful to be able to determine to what date the binary value of a FILETIME or SYSTEMTIME corresponded or to produce my own binary value of a FILETIME and insert it into the registry.

For instance, to convert to a binary value:

[PS C:\] timestamp -inString 2009/08/28:10:18 -outHexValue -convert filetime
2009/08/28:10:18 as FILETIME: 00 7c c8 d1 c8 27 ca 01

Converting in the other direction, if you don't know what format the bytes are in, just feed them in and timestamp will try all conversions and list only the valid ones:

[PS C:\] timestamp -inHexValue  "40 52 1c 3b"
40 52 1c 3b as FILETIME: 1601-01-01:00:01:39.171
40 52 1c 3b as Unix Time: 2001-06-05:03:30:08.000
40 52 1c 3b as DOS Time: 2009-08-28:10:18:00.000
(it also supports OLE Dates, and SYSTEMTIME which aren't listed there because the hex value isn't valid for those types). Or use the guess option to get timestamp's best guess:
[PS C:\] timestamp -inHexValue  "40 52 1c 3b" -convert guess
40 52 1c 3b as DOS Time: 2009-08-28:10:18:00.000

When I first wrote this I had a bug in my function that parses the date-time value string in which I could parse 2009-07-02:10:18 just fine, but I wouldn't be able to parse 2009-09-02:10:18 correctly. This was my code:

success = swscanf_s(timeString, L"%hi%*[\\/- ,]%hi%*[\\/- ,]%hi%*[\\/- ,Tt:.]%hi%*[:.]%hi%*[:.]%hi%*[:.]%hi", 
&systemTime->wYear,
&systemTime->wMonth,
&systemTime->wDay,
&systemTime->wHour,
&systemTime->wMinute,
&systemTime->wSecond,
&systemTime->wMilliseconds) > 1;
See the problem?

To convert between these various forms yourself read The Old New Thing date conversion article or Josh Poley's date time article. I previously wrote about date formats I like and dislike.

PermalinkCommentsdate date-time technical time windows tool

DSC04581 on Flickr - Photo Sharing!

2009 Aug 13, 9:46An awesome health care protest sign. I've made a huge mistake.
PermalinkCommentshumor photo obama politics television arrested-development sign protest

IEBlog : Engineering POV: IE6

2009 Aug 12, 4:55"As a browser supplier, we want people to switch to the latest version of IE...", "Dropping support for IE6 is not an option because we committed to supporting the IE included with Windows for the lifespan of the product.", followed by a large number of comments from irate webdevs who missed the point.PermalinkCommentsblog microsoft ie ie6 dean-hachamovitch technical

Video: AI bot takes on Mario - Short Sharp Science - New Scientist

2009 Aug 6, 5:15Video of an entry to a Mario AI contest.PermalinkCommentsmario ai video youtube videogame

PowerShell Scanning Script

2009 Jun 27, 3:42

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:

PermalinkCommentstechnical scanner ocr .net modi powershell office wia

High Five Escalator at Improv Everywhere

2009 Jun 4, 11:08"For our latest mission, Agent Lathan gave out 2,000 high fives by standing next to a subway escalator during the morning rush. Five additional agents spread out along the adjacent stairs, holding signs that prepared commuters for the upcoming high five fun."PermalinkCommentshumor improv-everywhere high-five escalator video youtube nyc subway

Thoughts on registerProtocolHandler in HTML 5

2009 Apr 7, 9:02

I'm a big fan of the concept of registerProtocolHandler in HTML 5 and in FireFox 3, but not quite the implementation. From a high level, it allows web apps to register themselves as handlers of an URL scheme so for (the canonical) example, GMail can register for the mailto URL scheme. I like the concept:

However, the way its currently spec'ed out I don't like the following: PermalinkCommentsurl template registerprotocolhandler firefox technical url scheme protocol boring html5 uri urn

Best Funeral Ever at Improv Everywhere

2009 Apr 1, 9:48"For our latest mission, 30 Improv Everywhere agents found a random funeral in the obituary section of the newspaper and turned it into the best funeral ever... The family, especially the older couple in the middle, were seriously mourning. They seemed to be focusing on the priest and mostly ignoring us. Still, we had to be as serious as we possibly could. If anyone cracked a smile or giggled we would completely ruin the funeral for the family."PermalinkCommentshumor parody video improv-everywhere
Older EntriesNewer Entries Creative Commons License Some rights reserved.