Scott Hanselman

Phidgets Library for .NET released

September 27, '05 Comments [3] Posted in Coding4Fun
Sponsored By

PhidgetsdotnetI'm all about the Phidgets. I used them under .NET 2.0 Beta 2 for a Coding4Fun Article a few month back. I used COM Interop to talk to the phidgets library, but I just noticed that a .NET Phidgets Library was released yesterday at the University of Calgary. They've included lovely documentation and even plan to remove the COM dependancy and work directly via P/Invoke.

If you've ever considered working with Phidgets for a personal project, this is an even better time.

Got any ideas on a new project - and consequently a new Coding4Fun article - I could do using this new library?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Creating my own Mame Arcade Cabinet, Mame for Media Center PC, and the X-Arcade Joystick

September 27, '05 Comments [2] Posted in Nant | Gaming
Sponsored By

XArcade1This last week saw the release of MAME 0.100, the Multi-Arcade Machine Emulator. An amazing technological accomplishment is MAME and a nice milestone. At this rate it'll hit 1.0 in 2048. If you're using Windows, you'll find MAME32 more to your liking.

When I noticed this milestone it spurred me into action. I decided on the spot to write a MAME front-end for Media Center (hoping to put my fallow MCPC back to work). As with all good ideas, it's long ago been done - and in .NET to boot. GameEx is it's name and it's fabulous. It integrates nicely into Media Center and is totally worth the $15.

I immediately visited XGaming who is currently selling a refurbished version of their amazing Two-Player Arcade Joystick for a cool $99.95. (It also works with XBox via Adapter) I ordered it and it was here in five days. Interestingly it came "broken" in that one of the primary buttons didn't work. I assumed it was misconfiguration or something I'd done, but I fired up KeyboardTest and confirmed it from a software POV. I opened it up and traced the wires one at a time and found one slightly disconnected. Once it was reconnected I was back in business.

Mame2xarcadeThere was a little trouble initially as I found myself remapping all the buttons manually. Then I realized that a product this good and the MAME32 team being as clever as they are, I must not be taking advantage of their wisdom. MAME32 includes a "Default Game Properties" option and the "Controllers" tab include an option for XArcade. Paydirt. Once this was selected, everything fell into place.

Now I can move seamlessly from the Media Center interface (using the Joystick) into the GameEx menu and into Mame32. Took about 4 hours (while the pregnant wife napped) on a Saturday. Very slick. Now I have to figure out how to explain to her how the infant will develop fine motor skills playing PacMan in his own Arcade.

Summary:

  • MAME32 - $0 - Arcade Emulator
  • GameEx - $15 - MediaCenter Front End for MAME (and other emulators)
  • XArcade - $99.95 (limited time) - Arcade Joystick

Next I'm looking at Arcade Cabinets and Games on Craig's List, and I think I'll build an Arcade System for the home, powered by MCPC/GameEx/Mame32.

For the children.

 

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Pasting Unformatted Text a Better Way - PureText

September 26, '05 Comments [3] Posted in Musings
Sponsored By

Puretext_options

Lately the bane of my existence has been Alt-E, S, End, Enter. I do that all day long - to bring up the Word "Paste Special" Dialog, go to the bottom of the list and select "Unformatted Text" and paste my freshly vanilla-ed text into some application that's not digging Word's RTF schmutz.

Enter PureText (via LifeHacker). A little application, that I've bound to previously unused Windows-V, that pastes the clipboard's unformatted text to the current window. Fantastic. I've just replaced 5 keys with 2. That'll save me like 20 seconds a day, which over the course of the year will save me like 66 minutes. I will spend that 66 minutes watching reruns of Firefly.

(Oh, and it's 28k, which is just classy as heck. Points for style.)

Now playing: Kanye West - Gold Digger (Featuring Jamie Foxx)

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Migrating Content from Random Blogs to DasBlog

September 23, '05 Comments [9] Posted in ASP.NET | DasBlog | XML
Sponsored By

This guy Ernie emailed me saying that he had some random, possibly home-grown, blog with content in Access that he wanted to migrate to his new DasBlog. I don't ordinarily do this (and don't plan to ever again) but it's so easy to move content into DasBlog that I decided to take this opportunity to write an example I could point other folks to.

Note: this is just an example that converted Ernie's blog. It's not something that will work unchanged for you, so don't ask. :) Ernie had a "news" table and a "comments" table. Blog posts were in news and used "blogid" as a unique id.

Additional note: Often you can use the same unique ids in DasBlog. You don't need you use a GUID for the DasBlog EntryId. In this case, Ernie's BlogID was just an int and it was unique enough. He could implement redirects if someone visited /myoldblog.asp?id=4 to /mynewdasblog/permalink.aspx?guid=4 and all his old content would get reindexed by Google and none of the old links would be invalid.

Just make a Console application in C# or VB.NET and add a reference to newtelligence.DasBlog.Runtime. I used a DataReader and just hard-coded the indexes of each column. It's not like this will ever be run again. It takes a little while to run because the DasBlog engine expects to run in the context of ASP.NET so it isn't able to use the ASP.NET Cache. The performance degrades O^n when run locally as your content folder grows. If that becomes a problem, run your converter in the context of IIS/ASP.NET and you'll get the high speed access.

In this example, the DasBlog dayentry.xml and dayfeedback.xml files will be left in the directory that the application was run in. I also converted newlines to <br> and when a blog post didn't include a title, I used the first 20 characters of the post as the title.

This took about 15 mins at lunch, so you really can transfer all your existing blog's data to DasBlog quickly, usually using just the Entry class and the Comment class. Note how they relate to each other using the EntryId as the key.

static void Main(string[] args)
{
    IBlogDataService dataService = 
BlogDataServiceFactory.GetService(AppDomain.CurrentDomain.BaseDirectory,null);
    string connStr = @"Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;
Data Source=ernie.mdb;Mode=Share Deny None";
    using(OleDbConnection conn = new OleDbConnection(connStr))
    {
        conn.Open();
        using(OleDbCommand newsCmd = new OleDbCommand("select * from News",conn))
        {
            using (OleDbDataReader reader = newsCmd.ExecuteReader())
            {
                while(reader.Read())
                {
                    int blogId = reader.GetInt32(0);
                    DateTime date = reader.GetDateTime(1);
                    DateTime time = reader.GetDateTime(3);
                    DateTime correctDate = 
new DateTime(date.Year,date.Month,date.Day,time.Hour,time.Minute,time.Second);
                    string blogText = reader.GetString(2);
                    string blogTitle = reader.IsDBNull(4) ? String.Empty : reader.GetString(4);
 
                    Entry entry = new Entry();
                    entry.CreatedLocalTime = correctDate;
                    entry.ModifiedLocalTime = correctDate;
                    entry.Title = 
(blogTitle.Length > 0 ? blogTitle :
blogText.Substring(0,Math.Min(20,blogText.Length)));
                    entry.Content = blogText.Replace("\r\n","<br>");
                    entry.EntryId = blogId.ToString();
                    entry.Categories = "main;old site";
                    entry.Author = "Ernie";
                    dataService.SaveEntry(entry);
                }
            }
        }
 
        using(OleDbCommand newsCmd = new OleDbCommand("select * from comments",conn))
        {
            using (OleDbDataReader reader = newsCmd.ExecuteReader())
            {
                while(reader.Read())
                {
                    int blogId = reader.GetInt32(1);
                    DateTime date = reader.GetDateTime(4);
                    string commentText = reader.GetString(2);
                    string commentName = reader.GetString(3);
 
                    Comment comment = new Comment();
                    comment.CreatedLocalTime = date;
                    comment.ModifiedLocalTime = date;
                    comment.TargetEntryId = blogId.ToString();
                    comment.Author = commentName;
                    comment.Content = commentText;
                    dataService.AddComment(comment);
                }
            }
        }
    }

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Jakob Nielsen at Corillian Connect

September 21, '05 Comments [8] Posted in Corillian
Sponsored By

Jakob Nielsen and Scott HanselmanI'm down in San Diego (Del Mar actually) at the Corillian Connect Conference (our annual Users' Conference). We had Jakob Nielsen give our keynote presentation. If you're not familiar with Jakob, you should be. He's a usability guru and has been since darn near the web's inception. He started the Nielsen Norman Group along with Donald Norman and added Bruce "Tog" Tognazzini a while back. They're giving a User Experience Conference in Boston and London this year that looks pretty amazing with talks from Amazon and Ebay.

I've been a fan since Jakob's original book Designing Web Usability. A classic and largely still valid today. He also runs UseIt.com. (No RSS though?)

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.