Module Border
  Andy's Blog
Module Border
Author: host Created: 3/6/2006 9:55 PM
Adventures in .NET

Ajax Talk at CNY .NET Developer Group
By Andy Beaulieu on 1/11/2007 8:22 PM

Thanks to everyone who attended my ASP.NET Ajax talk at our local .NET Developer Group!! We also had a great sponsor, Telerik, who supplied the pizza and soda.

For those interested, here are the slides and demos.

And, if you want to play around with the game behaviors I showed during the talk, check out the Ajax Sprite Toolkit!


Comments (0)

Blog Tagged
By Andy Beaulieu on 1/3/2007 7:19 AM

Let's play Blog Tag - because even I was tagged today by David Laribee

So here's how the game goes: I list 5 things you might not know about me, followed by 5 people that are tagged "it". Basic chain letter type stuff that typically clogs the internet :)

1. I grew up in the Adirondacks, and went to a very small school - with just 29 people in my graduating class!

2. My first summer job as a teenager was as a camp counselor at Camp Overlook - teaching a computer class on Apple II's.

3. While attending Potsdam College as a Computer Science major, I helped pay the bills by joining the Army Reserves as a Combat Engineer and working at a Chinese Restaurant as a waiter and fry cook.

4. Like most programmers, I am a Trekkie and find ST2 to be the best of the franchise.

5. I, too used to be an avid Visual FoxPro programmer... and with the advent of LINQ, maybe VFP had it right so long ago...

And now, TAG YOU'RE IT: (and my apologies if you've already been tagged!)

Thom Robbins   Julie Lerman   Susan Wisowaty   Chris Bowen   Chris Miller


Comments (2)

Codeplex Adventures
By Andy Beaulieu on 12/28/2006 3:43 PM

I published the Ajax Sprite Toolkit as a Codeplex project today, which was my first experience using Microsoft's open source hosting.

It wasn't a hideous experience, but it wasn't perfect either.

After requesting a new project, I only had to wait a few days for an approval email which included login and some other basic information. Not bad considering they are limiting the number of new projects and I submitted the request right around the holidays!

I was surprised to find out that Codeplex uses VS Team Foundation Server as a Source Control Provider. So what does an open source developer do if he doesn't own VS Team System? Well, Microsoft provides a free Team Explorer Client which can be used for developers wanting to contribute to a Codeplex project. But the download is an immense 246 MB .img file. ugh.

On a positive note, I have so far found the Codeplex project management functionality to be pretty good. They provide basic Forums, Issue Tracker, License, and Wiki pages which (aside from some less than intuitive interface design) all worked as advertised.


Comments (0)

Ajax Sprite Toolkit
By Andy Beaulieu on 12/22/2006 8:23 AM

When I first learned of the cool Animations in ASP.NET AJAX, I was thinking, maybe it would be easier to make simple javascript games - you know, like DHTML Lemmings or Bunny Hunt or these other games.

But, I was frustrated over the lack of collision detection and frame-based image support... So I thought, why not try and create a few behaviors to make simple javascript games easier to develop using ASP.NET AJAX?

So here is what I came up with: The Ajax Sprite Toolkit. It contains a couple of behaviors and extender controls for Sprite support as well as a behavior for Scott Schiller's Javascript to Flash Sound API. Scott's API uses a Flash object to provide mixed sound to Javascript.

There are a couple of tutorials as well as this Fish Game to get an idea of what its all about.

This is an initial beta that I've tested under XP and Vista using IE6, IE7, and Firefox. If anyone has other flavors, especially Mac browsers, please let me know how it does.

[Ajax Sprite Toolkit Project Page]

Comments (2)

WPF/E CTP Released
By Andy Beaulieu on 12/5/2006 7:51 AM

WPF/E allows you to use a subset of XAML on multiple platforms (Windows and Macintosh so far but there are rumors of "possibly" even Linux and Solaris). Microsoft has released the first public CTP which you can download here.

Once you install, there is a collection of WPF/E Samples on Channel9 including this Sprawl Game which (what can I say) feels a lot like a Flash game!

Comments (0)

By Your Command
By Andy Beaulieu on 12/1/2006 9:15 AM

Controlling stuff from a web page is really cool. By stuff, I mean stuff in the real world, like lights, household appliances, or perhaps... killer robots.

While it's still tough to find an affordable automaton in the "killer robot" category, there are some fairly inexpensive alternatives like the version 1.0 Robosapien. This model is a bit less expensive because the Robosapien Version 2.0 is now the hot item for Christmas.

These robots are controlled via an Infrared remote, much like your TV or cable box. So how do we go about controlling Infrared devices from our PC using .NET?

STEP 1: Get an IR Blaster
First your PC needs a device to transmit IR signals. You can certainly build your own IR transmitter, but I found that for just $12, you can get a very good quality device from

Here is what the $12 device looks like. It has a basic DB9 Connector to fit into an available COM port:

STEP 2: Setup WinLIRC
WinLIRC is an open source program that allows you to transmit and receive infrared remote signals. When you run WinLIRC, you get a config dialog where you select the COM port that your IR transmitter sits on.

Notice the "Config" textbox at the bottom. WinLIRC works off config files which store remote code information for different devices. There is an extensive database of remote codes already available for a whole bunch of IR devices.

For the Robosapien, Eric Buehl created a compatible config file as part of a project. You can download his config file here

Once you download your config file and enter it into the WinLIRC configuration screen, you can select OK.

Now you will be at the WinLIRC test screen. Here you can select a remote (defined in your config file) and send a code to the IR device. I call this a "test screen" because that's all its really good for - making sure that your IR Blaster and config file are all working happily.

Is it working? Is your PC making the device do stuff? Cool, then you can click the "Hide Window" button which will make WinLIRC disappear into your system tray and appear like a little virtual LED light:


STEP 3: Using WinLIRC as a Server
Using the WinLIRC test screen is fun and all, but we want to control our IR device from some .NET code! To do this, WinLIRC provides a telnet server which we can communicate with on TCP port 8765.

To test the telnet server you can open a command prompt and type:

telnet 8765

...after which you will be logged into the WinLIRC telnet service. There are a few basic commands you can type here, such as:

(gives a list of available remotes from your config)

LIST [REMOTE name]  
(gives a list of remote codes available on a remote)

Now, to send an actual IR command, there is some security in place here. After all, this is a telnet server and if you are not behind a firewall, any lame hacker could come in and start using your killer robot against you!! 

So to send IR codes through the telnet server, we need to add a password to our registry. Run Regedit and go to the HKEY_LOCAL_MACHINE\SOFTWARE\LIRC node. Add a new String value named password with the value of a password:

Now, in a telnet session, you can use a command to send IR signals in this format:

[PASSWORD] [REMOTE] [CODE] [# repeats]

For example, to have my SONY-TV change to channel 4, I would use the command:

password SONY-TV 4 1

STEP 4: Using the WinLIRC Telnet Service from .NET
.NET makes a lot of things easy, including Telnet! To perform a telnet session to the WinLIRC server and send a command, the code is short and sweet:

TcpClient client = new TcpClient("", 8765);

Stream s = client.GetStream();

StreamWriter sw = new StreamWriter(s);

sw.AutoFlush = true;

sw.WriteLine("password SONY-TV 4 1");




Oh, so much to do! We could create an ASP.NET page to send whatever IR codes we want to our household appliances! We could create a queuing mechanism so that multiple users could submit commands to the devices simultaneously! We could create an army of Robosapiens equipped with Lasers and control them all from the comfort of our keyboard.

Comments (0)

Book Review: Foundations of WF
By Andy Beaulieu on 11/8/2006 7:56 AM

Looking for a good intro to Windows Workflow Foundation?

For most people, the best way to learn is by example. And that seems to be the creed behind "Foundations of WF" by Brian Myers. This book is short on theory and long on example as it takes the reader through scads of Windows Workflow Foundation activities.

It's a skinny book at just 224 pages plus index but no paper is wasted as the author fires up his first solution walk-thru on page 4. From there on, it's all code as the author builds on previous chapters to show how to use many WF activities.

Chapter 10 pulls together the previous sections with a final real world example: an Employee Performance Review application implemented in ASP.NET and SQL Server.

If you're looking for lots of WF theory and concepts, look elsewhere. But "Foundations of WF" by Brian Myers has much to offer to the kinesthetic learner.

Comments (0)

Submit using Enter on multiple controls
By Andy Beaulieu on 10/9/2006 6:48 PM

ASP.NET 2.0 adds the DefaultButton property, which allows you to specify which button causes a postback when the Enter key is pressed.

But what if you have multiple controls on the page that could potentially cause a postback? For example, maybe you have multiple search textboxes on your page - any of which the user should be able to press Enter on and cause a postback?

In the example below we will assume there is a textbox named "txtFind" and when the user hits <enter> on txtFind, we want to execute a Postback on btnFind.

First we add a client-side handler to the control that should cause the postback when enter is hit. You also pass in the ClientId of the element you want to cause the postback:

txtFind.Attributes.Add("onkeydown", "return OnKeyDown(event, '" + btnFind.ClientID + "');");

Then we need to add some script to handle that event in both IE and Mozilla -

    function OnKeyDown(e, submitButton)


        var nKey = -1;

        var sourceElement;


        if (e && e.which)

            nKey = e.which;    // NS


            if (window.event && window.event.keyCode)

                nKey = window.event.keyCode;  // IE


        if (nKey == 13)



             return false;



        return true;



Comments (0)

Notes for ASP.NET Class
By Andy Beaulieu on 9/13/2006 1:25 AM

Here are some various notes for the ASP.NET class that I am teaching this week (more to come):

A Visual Studio Add-In That Converts C# Code To Visual Basic
VB.NET Naming Conventions
CSS Friendly ASP.NET 2.0 Control Adapters (Beta 2.0)

Enterprise Library
(for .NET 2.0)
Exception Handling Block
Logging Application Block
(for .NET 1.1)

Upcoming Local Events
Next Code Camp in Waltham
Next MSDN Event in Syracuse

ASP.NET Performance Tips
Keep Sites Running Smoothly By Avoiding These 10 Common ASP.NET Pitfalls
10 Tips for Writing High-Performance Web Applications

A "Complete" Data Grid Example for ASP.NET 1.1
Zip Download

      Fiddler Tool

Data Access Layer
      ActionPack Video Intro

Simple Printing from the browser
(Method 1) Add some Javascript to an HTML button

(Method 2) Add some Javascript to a Button from the server side:
Button2.Attributes.Add("onclick", "window.print(); return false;")

Note that Method 2 can also be used for other things like a Confirm dialog for a postback

Button1.Attributes.Add("onclick", "return confirm('Are you sure?')")

Dynamically Enabling Page Caching, Based on DEBUG Mode
Because of the headaches that page caching can cause when you are in development mode, you may want to dynamically enable or disable page caching based on something like a compiler constant:

#If DEBUG Then
lblStatus.Text = "*NOT* using output caching (debug mode)"
lblStatus.Text = "using output caching (Production mode)"
#End If


Comments (0)

"Atlas" gets a Name
By Andy Beaulieu on 9/12/2006 6:49 AM

... from a post by Scott Guthrie where he also estimates the v1.0 release "around the end of this year."

1) The client-side “Atlas” javascript library is going to be called the Microsoft AJAX Library. This will work with any browser, and also support any backend web server (read these blog posts to see how to run it on PHP and ColdFusion).

2) The server-side “Atlas” functionality that nicely integrates with ASP.NET will be called the ASP.NET 2.0 AJAX Extensions. As part of this change the tag prefix for the “Atlas” controls will change from <atlas:>to <asp:>. These controls will also be built-in to ASP.NET vNext.

3) The “Atlas” Control Toolkit today is a set of free, shared source controls and components that help you get the most value from the ASP.NET AJAX Extensions. Going forward, the name of the project will change to be the ASP.NET AJAX Control Toolkit.

Comments (0)

Module Border Module Border
Module Border
Module Border
RSS   Twitter
Module Border Module Border
Module Border
Module Border

This Windows app was created using Physics Helper XAML, and the Farseer Physics Engine.


This Windows Phone app was created using Silverlight, the  Physics Helper Library,  and the Farseer Physics Engine. It gets interesting when you import your friends photos and have your way with them!


This physics game won first place in the Server Quest Contest. Created using Silverlight , the Physics Helper Library,  and the Farseer Physics Engine.


A scrolling shooter game where the objective is to destroy the invading UFO's flying over a neighborhood of your choosing. Imagery provided by Microsoft Virtual Earth. Created using Silverlight.


These demos were created for the Physics Helper Library, which makes it easy to create physics games and simulations using Expression Blend, Silverlight, and the Farseer Physics Engine.


This little basketball game took first place in the TeamZoneSports Silverlight Contest. Created using Silverlight and the Farseer Physics engine.


A game where you need to sort the good foobars from the bad ones. Created using Silverlight and the Farseer Physics engine.


A demo showing polygon physics where the user draws physics objects with the mouse. Created using Silverlight and the Farseer Physics engine.


Destroy the asteroids before they destroy your ship! Created using Silverlight.


A simple game of harpoon-the-fish. Written using the AJAX Sprite Toolkit.


Module Border Module Border
Module Border
Module Border
Module Border Module Border
Module Border
Module Border
Module Border Module Border
Copyright (c) 2014 andy.beaulieu.com - Login