 |
|
 |
|
|
|
Blog Tagged |
|
Andy's Blog
|
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 |
|
Andy's Blog
|
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)
|
|
|
|
|
|
By Your Command |
|
Andy's Blog
|
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 www.irblaster.info.
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 127.0.0.1 8765
...after which you will be logged into the WinLIRC telnet service. There are a few basic commands you can type here, such as:
LIST (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("127.0.0.1", 8765);
Stream s = client.GetStream();
StreamWriter sw = new StreamWriter(s);
sw.AutoFlush = true;
sw.WriteLine("password SONY-TV 4 1");
sw.Close();
s.Close();
client.Close();
NEXT STEPS 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 |
|
Andy's Blog
|
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 |
|
Andy's Blog
|
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
else
if (window.event && window.event.keyCode)
nKey = window.event.keyCode; // IE
if (nKey == 13)
{
document.getElementById(submitButton).click();
return false;
}
return true;
}
|
 |
|
Comments (0)
|
|
|
|
|
"Atlas" gets a Name |
|
Andy's Blog
|
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)
|
|
|
|
|
 |
|
 |
|
|