Archive for the ‘Fun’ Category

Hands on labs at the Windows Phone 7 launch event

Saturday, October 2nd, 2010

728x90_Banner_WP7DevLaunch

I’ll be helping out at the Windows Phone 7 launch event October 20-21 in Dallas. Come by the hands on labs on day 2 (Thursday) to try developing for this platform. I’ll be walking around answering questions.

To see what I’m doing on the platform, check out the videos I posted earlier:

Survey Sez

Monday, September 28th, 2009

We just did a review session in Q.E.D. Hour. For our review, we divided the group into two teams and played a game of Survey Sez.

I searched in vain for a PowerPoint version of the game that met my requirements. Unfortunately, while the sub culture of PowerPoint game developers has produces several versions of the popular TV show, none of them worked the way I wanted them to. So I wrote my own using a tool better suited to the problem: WPF.

Survey Sez iz best played using a wireless number pad. You press the numbers 1-9 to reveal answers. And you press Enter and Backspace to navigate through the questions. The other keys on the number pad will eventually control other game options, like incorrect answers, bonus rounds, and game winning animation.

I posted the source code as-iz on CodePlex. Future versions will look better and include more game features. Eventually, I may even add some social networking aspect, like Twitter integration. After all, every system evolves until into a Twitter client.

If you would like to contribute, please post a comment. We'll talk about what you can work on.

A kindergarten example of historic modeling

Tuesday, June 9th, 2009

Historic Modeling may be a new concept, but you are probably already familiar with a popular example.

A person is a fact. The person exists. Time may pass, and perhaps she'll die, but the fact that she existed will always be true.

Old Lady 1

The same is true of an animal.

Old Lady 2

A person might consume an animal. Usually the reason is sustenance, but we can't be sure. We can document the fact that a person swallowed an animal for a reason.

Old Lady 3

Any of a number of reasons can be given. Maybe we just don't know. Or maybe the person swallowed the animal to catch an animal that they had previously swallowed. The fact that they swallowed an animal in the past is a prerequisite for the reason to swallow another. The prior swallow must come before the reason.

Old Lady 4

From model to instance
To demonstrate the model, let's create some instances of these facts.

  • There was an old lady.
  • There was a fly.
  • There was an old lady who swallowed a fly. I don't know why she swallowed the fly.
  • There was an old lady who swallowed a spider. She swallowed the spider to catch the fly.

Continuing in this manner, we construct a graph of fact instances.

old-lady-5.png

This recitation of facts could go on. Until she dies, of course.

The honest EULA

Tuesday, April 15th, 2008

If a EULA actually said what it meant:

This agreement is a legal contract that you (the USER) make to us (the VENDOR) concerning the product (the SOFTWARE).

The SOFTWARE that the USER is about to tolerate is a train wreck in progress. It is difficult to use. It is impossible to configure. It won’t behave as the USER any other rational human being would expect.

In short, it is no different than any other SOFTWARE the USER has ever installed.

The USER will not blame the VENDOR for the behavior of the SOFTWARE, even if the VENDOR would be found criminally negligent or deliberately maniacal. Rather, the USER agrees either to purchase additional SOFTWARE (the UPGRADE) from the VENDOR, or to abandon his data and admit his own foolishness in purchasing the SOFTWARE in the first place.

The USER grants the VENDOR an unlimited license to all information voluntarily entered into the SOFTWARE. If the USER wanted to keep something from the VENDOR, why would he be entering it into the SOFTWARE in the first place? What exactly does the USER have to hide, anyway?

The USER permits the SOFTWARE to contact the VENDOR periodically to transmit data collected about the USER. The USER will not inquire as to the content of the transmission. The USER will not interfere with the transmission. The USER will like it.

The USER agrees to allow the SOFTWARE to install additional products from third parties (the TOOLBAR). The USER will not expect a share of the compensation that the VENDOR collects from the maker of the TOOLBAR. The USER automatically agrees to any EULA attached to the TOOLBAR.

By reading this EULA the USER has already agreed to the terms herein. By ignoring this EULA, the USER is demonstrating his own ignorance and nevertheless agreeing to the terms herein.

Victory at the ODC

Friday, February 29th, 2008

ms-odc-champs-08.jpg

  • Kurt Guenther, Infusion
  • Me, Team Strongbad
  • Derek Sanderson, Team Strongbad
  • Ricky Ma, Team Strongbad
  • Rajesh Jha, Microsoft

Photo credit: Paul Raven

Ken Burns Effect in Javascript

Thursday, February 28th, 2008

The Ken Burns Effect is a popular way of adding emotional appeal to a slide show. It is named after the documentary film director who used it extensively in his series on the American Civil War and Baseball. It is used in the default OS X screen saver. It even makes an appearance as a presentation technique in the 2006 Tom Hanks movie The Da Vinci Code. I thought this would be a fantastic way to showcase photos in the web.

You can see the result with some family photos. I've included photos of all sizes, aspect ratios, and image qualities. This shows off the versatility of the code, but also demonstrates the tradeoffs between quality and speed. I should warn you that image processing in the browser is quite taxing on the client machine. This looks great on my MacBook Pro, but is not so smooth on a less expensive laptop. Flash or Silverlight would be a better choice for client technology.

To use this effect, download the Javascript file and the CSS file. Create two <div> tags within your HTML that occupy the same area. In the example, these <div> tags take up the entire screen.

Fill an array with the URLs of the images to display. You can optionally pass this list to the randomizeList function to shuffle it. Then call the startSlideshow function with this list and the IDs of the two <div> tags. Show source on the example page for more details.

How does it work
The effect uses the setTimeout function to schedule animation steps. It breaks down the animation into fading and panning. The panning is controlled by an object that converts a time index parameter into offset and size. A set of linear equations determine these properties, so that the effect is a smooth transition from one zoom rectangle to another.

The coefficients of these linear equations are determined randomly such that the beginning and ending points are within the bounds of the picture. Because the equations are linear, all points in between are also within bounds. The aspect ratio of the original image is preserved.

The most interesting part of this project was getting the CSS manipulation correct. The images use "position: relative" to indicate that they move relative to their natural resting place. This allows the containing <div> to crop them to fit. But this also means that the images could not coexist within one <div>. Relative positioning is affected by layout, so the second image would be offset by the size of the first.

Next steps
I've already created a SharePoint view of a picture library using this effect. I plan to package that as a web part and post the code here. I also plan to write code to extract images from Flickr library.

If someone beats me to it, just post a link to your code in the comments. I'll be sure to promote it to a post so that everyone can enjoy.

Update from the ODC

Tuesday, February 12th, 2008

I am currently at the Microsoft Office Developer's Conference in San Jose. My team won admission to the conference and the chance to compete in the national Infusion Sleepless SharePoint competition.

We coded all night Saturday into Sunday, then took a bus to San Jose for the ODC. We presented our solution last night in front of a crowd of attendees. We learn the results of the judging this morning at the keynote. I feel our team did very well.

I am learning tons of useful information about the SharePoint product and the ecosystem. The main thing that I was looking for was how to make SharePoint development a repeatable process. I found a breakout session by Andrew Connell that demonstrated exactly that.

Microsoft hasn’t had time to get their tools and documentation in order around SharePoint development, because the explosion of the platform caught them by surprise. But Andrew showed us how Microsoft does SharePoint development internally without strong tool support. Now I believe I can replicate the process.

The highlight of the trip was the Bill Gates keynote. I had the opportunity to ask him "What is the next killer app?" You'll hear his response - and the results of the contest - in the upcoming podcast.

External Display Hack for Vista on the Mac

Wednesday, January 2nd, 2008

While giving a presentation at the Dallas .NET User's Group, I gave the audience something to snicker about. I run Vista on a MacBook Pro. So everyone had a good laugh at my expense when I couldn't get the projector working.

I had used a projector from my laptop before, so I was quite confused when the Windows Mobility Center insisted that there was no display connected. I kept hitting the "Connect display" button, it would say "Detecting..." and then switch back to "No display connected". I eventually borrowed someone's Dell laptop, after converting my Power Point 2007 presentation to 2003.

The information I found on line led me to update Boot Camp, and to replace the display driver from Apple with the one from NVidia. Though it apparently worked for some, it didn't make a difference for me.

Here's my solution
I eventually found that the external display worked if it was connected during power-up. If you plug in the projector before you boot, all is well. And if you are already booted up, just hibernate, plug in, and resume. If you get up to the podium and things aren't working, close the lid, wait for the front light to start snoring, then open it again.

Give this a try before your presentation and see if it works for you. And always keep your presentation on a USB thumb drive in the 2003 compatible format just in case.

.NET Generics

Wednesday, November 7th, 2007

I've just launched a topic site for my upcoming .NET Generics presentation. I'll post audio and video when it's recorded, but you can get a preview of the slides and material.

If you are in Texas, please come to tomorrow's presentation at the Dallas .NET Users Group. It's at the Microsoft campus in Las Colinas, on November 8 at 6:30.

Generics are a powerful mechanism for code reuse. Most .NET developers have used generic collections, but few have used the language feature to its fullest potential. Generics let us declaratively build algorithms out of smaller components.

I'll present the syntax and some basic patters in both VB.NET and C#. All of the examples are based on practical scenarios. Complete source code is available in both languages.

Speaking at the Dallas .NET Users Group

Monday, October 15th, 2007

If you are in the Dallas/Ft. Worth area, please join me on November 8 at 6:30 at the Microsoft Campus in Las Colinas. I'll be presenting .NET Generics: More than containers. This is a bi-lingual presentation -- C# and VB. Details at the Dallas .NET Users Group.

For those of you who cannot attend, I'll post the slide deck and audio. But I hope you can be there, if not for me then for the free pizza and prize giveaways!