ir page 22 - Dave's Blog

Search
My timeline on Mastodon

When Harry Met Sally 2 with Billy Crystal & Helen Mirren

2011 Apr 7, 2:28Better left unspoiled. Just watch...PermalinkCommentshumor parody video movie

Capturing HTTPS with FiddlerCore

2011 Apr 6, 10:00

I used FiddlerCore in GeolocMock to edit HTTPS responses and ran into two stumbling blocks that I'll document here. The first is that I didn't check if the Fiddler root cert existed or was installed, which of course is necessary to edit HTTPS traffic. The following is my code where I check for the certs.

    if (!Fiddler.CertMaker.rootCertExists())
{
if (!Fiddler.CertMaker.createRootCert())
{
throw new Exception("Unable to create cert for FiddlerCore.");
}
}

if (!Fiddler.CertMaker.rootCertIsTrusted())
{
if (!Fiddler.CertMaker.trustRootCert())
{
throw new Exception("Unable to install FiddlerCore's cert.");
}
}

The second problem I had (which would have been solved had I read all the sample code first) was that my changes weren't being applied. In my app I only need the BeforeResponse but in order to modify the response I must also sign up for the BeforeRequest event and mark the bBufferResponse flag on the session before the response comes back. For example:

    Fiddler.FiddlerApplication.BeforeRequest += new SessionStateHandler(FiddlerApplication_BeforeRequest);
Fiddler.FiddlerApplication.BeforeResponse += new SessionStateHandler(FiddlerApplication_BeforeResponse);
...
private void FiddlerApplication_BeforeRequest(Session oSession)
{
if (IsInterestingSession(oSession))
{
oSession.bBufferResponse = true;
}
}
PermalinkCommentshttp fiddler technical https geolocmock programming fiddlercore

RFC 6202 - Known Issues and Best Practices for the Use of Long Polling and Streaming in Bidirectional HTTP

2011 Apr 5, 3:23Best practices for Comet style polling in HTTP.PermalinkCommentstechnical rfc ietf http streaming polling

JavaScript & .NET interop via WebBrowser Control

2011 Apr 5, 10:00

For my GeolocMock weekend project I intended to use the Bing Maps API to display a map in a WebBrowser control and allow the user to interact with that to select a location to be consumed by my application. Getting my .NET code to talk to the JavaScript in the WebBrowser control was surprisingly easy.

To have .NET execute JavaScript code you can use the InvokeScript method passing the name of the JavaScript function to execute and an object array of parameters to pass:

this.webBrowser2.Document.InvokeScript("onLocationStateChanged",
new object[] {
latitudeTextBoxText,
longitudeTextBoxText,
altitudeTextBoxText,
uncertaintyTextBoxText
});

The other direction, having JavaScript call into .NET is slightly more complicated but still pretty easy as far as language interop goes. The first step is to mark your assembly as ComVisible so that it can interact with JavaScript via COM. VS had already added a ComVisible declaration to my project I just had to change the value to true.

[assembly: ComVisible(true)]

Next set ObjectForScripting attribute to the object you want to expose to JavaScript.

this.webBrowser2.ObjectForScripting = this.locationState;

Now that object is exposed as window.external in JavaScript and you can call methods on it.

window.external.Set(lat, long, alt, gUncert);

However you don't seem to be able to test for the existence of methods off of it. For example the following JavaScript generates an exception for me even though I have a Set method:

if (window.external && window.external.Set) {
PermalinkCommentsjavascript webbrowser .net technical csharp

Internet Explorer team sent us cake for shipping Firefox 4 #fx4 on Twitpic

2011 Mar 22, 12:51We've now got IE9 and FF4 which means time for more cake!PermalinkCommentshumor browser webbrowser firefox ie ie9 ff4 mozilla microsoft

BBC News - Polar bears get the better of spy cameras

2011 Mar 10, 6:14Polar bears destroy hiddern cameras (filming them for Science!) It is a well known fact that polar bears are very protective of their rights to privacy.
PermalinkCommentsvideo science nature animals bbc humor

Fire lane sign in snow

2011 Feb 24, 8:10

PermalinkCommentssnow sign firelane flickrmanager windowsphone7

Listen to Max Tannone and Watch Moon

2011 Feb 23, 1:13
Max Tannone does awesome remix albums:


Also, the movie Moon is really good on a variety of points. Sam Rockwell and the voice of Kevin Spacey! Its available on Netflix Watch Instantly so you have no excuse!
PermalinkComments

The ultimate Neuromancer t-shirt

2011 Feb 14, 6:56PermalinkCommentstshirt neuromancer fiction shirt wishlist

FORA.tv - WikiLeaks: Why It Matters. Why It Doesn't?

2011 Jan 23, 9:49PermalinkCommentswikileaks video law politics media technical clay-shirky

Reviewing the winners of the Design Julian Assange's Next Hairstyle competition. - Boing Boing

2011 Jan 19, 7:44Lol at Team Rocket Julian Assange.
PermalinkCommentsjulian-assange humor image photo photoshop

Ratatat Rocks

2010 Dec 28, 10:42
I just found out that I like the group Ratatat. I'd first heard them way back when the Zune was first released as the backing for Los Corazones on the zune-arts.net website.




But I didn't know who they were until today when I watched this Filmography 2010 video (via Kottke)



Until about 1:16 in, the music is Ratatat's Nostrand. On the first viewing it drove me crazy because I could only vaguely recall hearing something like that music before. I tracked it down via the zune-arts thing above and eventually found my way to the Nostrand video. Funny, all the recent comments on that one are from people who also just watched the Filmography video.
PermalinkComments

New Device Desirable, Old Device Undesirable | The Onion - America's Finest News Source

2010 Dec 27, 2:38"I feel a strong urge to purchase the new device. Owning the new device will please me and improve my daily life."PermalinkCommentsnews humor onion

SENSE of RIGHT ALLIANCE | Flickr - Photo Sharing!

2010 Dec 17, 9:16
PermalinkCommentshumor photo piracy knockoff super-hero

Spirit of Indiana (Jones) – syncing HTML5 Video with Maps ✩ Mozilla Hacks – the Web developer blog

2010 Dec 16, 1:12Nice! Indiana Jones style map fade in over video done in HTML5 with video tag, and Google maps API.
PermalinkCommentshtml5 video map technical demo google animation svg

WikiRebels, A Documentary on WikiLeaks

2010 Dec 14, 11:21Documentary on WikiLeaks: "From summer 2010 until now, Swedish Television has been following the secretive media network WikiLeaks and its enigmatic Editor-in-Chief Julian Assange."PermalinkCommentswikileaks technical video

Console Build Window Jump Lists Tool

2010 Dec 13, 11:14

I've made two simple command line tools related to the console window and Win7 jump lists. The source is available for both but neither is much more than the sort of samples you'd find on MSDN =).

SetAppUserModelId lets you change the Application User Model ID for the current console window. The AppUserModelId is the value Win7 uses to group together icons on the task bar and is what the task bar's jump lists are associated with. The tool lets you change that as well as the icon and name that appear in the task bar for the window, and the command to launch if the user attempts to re-launch the application from its task bar icon.

SetJumpList lets you set the jump list associated with a particular AppUserModelId. You pass the AppUserModelId as the only parameter and then in its standard input you give it lines specifying items that should appear in the jump list and what to execute when those items are picked.

I put these together to make my build environment easier to deal with at work. I have to deal with multiple enlistments in many different branches and so I wrote a simple script around these two tools to group my build windows by branch name in the task bar, and to add the history of commands I've used to launch the build environment console windows to the jump list of each.

PermalinkCommentswin7 jumplist technical console

Joss Whedon (and Angel) react to the new Buffy reboot [Buffy]

2010 Nov 22, 9:39Joss Whedon and David Boreanaz respond to the news about the new Buffy movie.
PermalinkCommentsbuffy angel Buffy The Vampire Slayer David Boreanaz Fb Joss Whedon Movies Television tweet Vampires technical

One more piece of Back To The Future ephemera: The full "Biff Tannen Museum" promotional video | Film | Newswire | The A.V. Club

2010 Nov 15, 9:27PermalinkCommentsbttf video biff

Everyone Hates Ticketmaster — But No One Can Take It Down | Magazine

2010 Nov 8, 3:32We were just talking about hating Ticketmaster. A brief history and business of Ticketmaster.PermalinkCommentsticketmaster software wired concert music business
Older EntriesNewer Entries Creative Commons License Some rights reserved.