A Night at the Opera

October 20th, 2009

Opera is incompatible with some Silverlight applications at nevlab.com. That’s no great surprise, since Microsoft does not officially support Silverlight on Opera. Nonetheless I will describe some of my experiences, and report them to Microsoft and the Opera guys.

Opera’s incompatibilities with my Silverlight applications are not necessarily symptoms of incompatibilities between Opera and Silverlight. For example, my code could contain a race condition that escapes detection in other browsers. I haven’t done a proper diagnosis.

The problems are best experienced by visiting nevlab with Opera and a nevlab compatible browser in a side by side comparison.

Try the Perils of Resizing demo. Notice that the first button click has no effect in Opera.

The Boyer-Moore demo usually doesn’t start on the second visit in Opera until the user scrolls the page.

Sometimes the Silverlight applications are simply not displayed. It happened much more frequently before I added a brief disclaimer at the top of the page for Opera users. The slight change in page layout seems to have affected initialization of the Silverlight applications.

Visit any of the interactive algorithm demos. Resize the source code with the drag bar below it. No luck in Opera.

The algorithm demos resize themselves. In Opera, this sometimes doesn’t work, especially at the end of a demo. In addition, the text below the Silverlight application can disappear.

The state of the demo player’s buttons is sometimes in disagreement with the state of the demo. This doesn’t happen in other browsers.

Boyer-Moore Search

September 25th, 2009

NevLab Theater has a new interactive Boyer-Moore search demo. Take it out for a spin!

Boyer-Moore Search Screenshot

Chrome hiccup

August 26th, 2009

Yesterday I encountered a problem with Chrome on NevLab Theater. The algorithm demos are implemented as Silverlight applications. They share some cached assemblies. Sometimes Chrome will work fine for one of the applications, but not the others, which simply appear as blank spaces on the web page. Reloading an offending page has no effect. Once Chrome fails to run an application, it continues to fail on that application until the browser’s cache is cleared. Perhaps the issue is related to Silverlight’s new assembly caching feature.

Today I have been unable to reproduce this problem. Maybe it depends on the phase of the moon.

Silverlight Unit Test Framework

August 5th, 2009

The Silverlight Unit Test Framework was updated in July with new binaries for Silverlight 3. Unfortunately the project templates have not been updated to reflect the new version. No problem. You can easily fix this issue for your own unit testing.

SilverlightTestProject_CSharp.zip contains the project file, SilverlightTestProject.csproj, with Reference elements for the Unit Test DLLs. Unzip, change the versions from 2.0.20930.1042 to 2.0.5.0, and re-zip.

SilverlightTestProject_CSharp.zip should be located in Visual Studio’s Templates\ProjectTemplates folder. If you are a VB user, then update SilverlightTestProject_VB.zip instead.

Now I can go back to unit testing some of my Silverlight code.

Assembly Caching

July 16th, 2009

My algorithm demos have been updated to use the brand new assembly caching feature in Silverlight 3. This should reduce the delay experienced when switching between demos.

NevLab Theater Now Viewable in Chrome

July 13th, 2009

Until a few days ago, the Chrome Stable Channel was unusable with the Silverlight applications at NevLab Theater. The latest stable version of Chrome works with my website. I don’t know whether the problem was fixed in Chrome, or by the upgrade to Silverlight 3, which happened at about the same time. Welcome Chrome users!

Binary Search with Chrome

Thumb’s DragDelta Event Lost in Space

June 26th, 2009

While dragging a Thumb control, a large and rapid movement that ends suddenly can unpredictably result in a seriously postponed DragDelta event. If the mouse remains motionless with the left button down, the event can be postponed indefinitely, or at least for a few seconds. A second movement of the mouse causes the large missing event to suddenly appear. The event is lost forever if the left mouse button is released before the mouse moves again. This behavior is most apparent when the application is very busy.

You can experience this problem in my quicksort animation. There is a drag bar (thumb) at the bottom of the ScrollViewer containing the source code. Drag it with large, quick vertical motions. End each vertical motion suddenly, but do not release the left mouse button. After a few tries, you will suddenly find your mouse cursor far from the thumb. If you release the left mouse button, the thumb’s position will never be properly updated. On the other hand, if you make another movement of the mouse, the thumb will catch up.

To experience the issue in its full glory, keep the quicksort demo running while you are experimenting. Click the play button if the demo stops.

I have done tests with a specially instrumented version of the quicksort demo to verify that the behavior in question does in fact involve delayed DragDelta events. Yup.

Click on the image below to try your hand at confusing the thumb control.

Quicksort Screenshot

Visual Trees in Silverlight

June 23rd, 2009

One of my Silverlight applications failed to work with the current Google Chrome developer channel. An ItemsControl’s visual tree did not yet reflect the template when my code first accessed the visual tree. A Silverlight SDK blog entry discusses the timing of visual tree creation, and states that the visual tree is available immediately after ApplyTemplate is invoked. That wasn’t the case in this instance.

I found that it is more reliable to use the LayoutUpdated event handler to access the visual tree, as it is the last step of control creation. The event may also be raised earlier, so the handler needs to check that the visual tree is in the desired state. The visual tree will be ready prior to some invocation of the event handler.

The Silverlight application in question is now compatible with the Google developer channel.

Windows Safari 4 Works on NevLab Theater!

June 14th, 2009

Safari 4.0 for Windows eliminates a Silverlight incompatibility that made earlier versions unusable for NevLab Theater. I’m told that an earlier version of Safari for Intel Macs was already free of the problem, though I have not personally verified that assertion. Chrome 2.0.172.31, the most recent stable version, unfortunately still suffers from the fatal flaw. The current developer channel version of Chrome does not have the bug. You can test your browser for the required functionality by clicking on the image below.

Safari Screenshot

Bit Twiddling

June 11th, 2009

NevLab Theater has a new page of bit twiddling demos. Give it a try!

Bit Counting Screenshot