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) {
javascript webbrowser .net technical csharp 2011 Feb 17, 1:01Brian Christian on his involvement in the 2009 Turing Test and his goal of winning Most Human Human.
history ai science 2011 Jan 23, 4:49Sysinternals Mark Russinovich writes a novel (fiction) and gets a Bill Gates blurb for the cover: “Mark came to Microsoft in 2006 to help advance the state of the art of Windows, now in his latest
compelling creation he is raising awareness of the all too real threat of cyberterrorism.” —Bill Gates
book security microsoft sysinternals mark-russinovich novel fiction technical 2010 Sep 24, 8:38"Comedian Stephen Colbert joined the panel of witnesses at a House hearing on immigrant farm workers. Mr. Colbert has partnered with United Farm Workers and their campaign calling on unemployed
Americans to take jobs in the agriculture sector. The organization's president, Arturo Rodriguez, also testified at the Judiciary Subcommittee on Immigration and Border Security hearing chaired by
Rep. Zoe Lofgren (D-CA).
Washington, DC : 2 hr. 10 min."
humor video stephen-colbert politics immigration farm labor house 2010 Sep 14, 2:24Good idea and solves some of the head lamp problems: "...Enter the Hand Lights, a pretty simple and cheap DIY project that puts adjustable lights on your forearms to light whatever is in your hands."
light diy hand head-lamp tool 2010 Jul 14, 10:24This would be perfect to hook up to my automated test system. Everytime new tests pass the applause sign flashes.
applause sign howto 2010 Apr 29, 11:51Stats from the State of Web Development 2010 web survey including: "Few respondents use any form of Internet Explorer for their day to day web use, but IE8 is the number one browser developers test
their sites in. Google Chrome has jumped dramatically as the browser of choice for developers, to rank 3rd, at 17% just behind Safari at 20%."
ie web browser chrome statistics development html technical system:filetype:pdf system:media:document 2010 Apr 21, 6:53"Lindsey Simon has got a powerful update to BrowserScope, the community-driven tool to test and profile browsers. The new feature is exciting as it truly delivers the “community-driven” piece at
scale: you can now add your own tests to the corpus, TestSwarm style."
web browser test google browser-scope internet technical 2010 Mar 18, 7:15This article describes the largest problem with the Acid3 test: "Acid3 often didn’t test things web authors wanted, but instead it tested things that were broken or not implemented regardless whether
anyone truly cared."
acid3 web browser html dom test technical 2010 Mar 12, 7:56A tool to run Google's ECMA conformance test suite on your browser.
chrome web browser javascript technical tool test google 2010 Mar 12, 2:32Google's indexer now examines HTML5 microdata and they provide a tool to test out your pages microdata
html html5 google search microformats metadata rdf technical 2010 Mar 11, 3:39How to do audio & video in the latest version of Opera
html5 html video audio opera web browser technical development reference 2010 Mar 4, 1:00Its a game-ification link roundup on Dive Into Mark.
game achievement office unit-test foursquare humor 2010 Mar 3, 2:59'Imagine watching Raging Bull in a dilapidated ring, or Shawshank Redemption in an abandoned prison. That is the concept behind Banksy’s latest stunt, for the UK premiere of his film “Exit Through
the Gift Shop“.'
movie art banksy cultural-disobediance street 2010 Feb 22, 6:30Electric vehicles as components of the future smart electric grid, as roaming batteries providing power as necessary.
car electric-vehicle electricity power electric-grid 2010 Feb 3, 6:52"Unwittingly, he trained a dolphin to kill the President of the United States." It sounds like a sentence constructed one word at a time by different people
humor movie dolphin us poster 2010 Jan 30, 1:23"I Have a Sign" protest sign.
sign humor san-francisco 2010 Jan 29, 3:54
Raymond Chen has some thought experiments useful for discovering various kinds of stupidity in software design:
Tim Berners-Lee's principles of Web design includes my favorite: Test of Independent Invention. This has a thought experiment containing the construction of the MMM (Multi-Media Mesh) with
MRIs (Media Resource Identifiers) and MMTP (Muli-Media Transport Protocol).
The Internet design principles (RFC 1958) includes the Robustness Principle: be strict when sending and tolerant when receiving. A good one, but applied too liberally can lead to interop issues. For instance, consider web browsers.
Imagine one browser becomes so popular that web devs create web pages and just test out their pages in this popular browser. They don't ensure their pages conform to standards and accidentally end
up depending on the manner in which this popular browser tolerantly accepts non-standard input. This non-standard behavior ends up as de facto standard and future updates to the standard
essentially has had decisions made for it.
technical design principles software development