September 2007 - Posts

Using Bluetooth in .NET

I am busy preparing for a talk on Windows XP Embedded. The talk is aimed at developers showing an example of an end-to-end embedded device being developed. The 2 part talk focuses in part 1 on the development of the application and in part 2 on the XP Embedded operating system for this embedded device.

The application that will be developed is similar to the Kodak Picture Kiosk. The application will accept content (photos) via Bluetooth and allow the user to manipulated and print this content. Technologies that will be used includes: Bluetooth, OBEX, WPF and XPe.

While preparing I discovered a wonderful C# library for interfacing with the Bluetooth radios from In the Hand called 32feet.net. These libraries are created by Microsoft MVP Peter Foot.

Here is how simple it is to setup an OBEX listener using this library:

Include the correct namespaces

using InTheHand.Net;
using InTheHand.Net.Bluetooth;

Define a global OBEX Listener

ObexListener ol;

Next, we need to start the listener

ol = new ObexListener(ObexTransport.Bluetooth);
ol.Start();

Lastly we need a thread to accept the new content

public void DealWithRequest()
{
    while (ol.IsListening)
    {
        try
        {
            ObexListenerContext olc = ol.GetContext();
            ObexListenerRequest olr = olc.Request;

            string filename = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "\\" + DateTime.Now.ToString("yyMMddHHmmss") + " " + Uri.UnescapeDataString(olr.RawUrl.TrimStart(new char[] { '/' }));
           
            olr.WriteFile(filename);
        }
        catch (Exception ex)
        {
            break;
        }
    }
}

Don't forget to start the thread...

Thread t = new Thread(new System.Threading.ThreadStart(DealWithRequest));
t.Start();

And that is all that is required to get a Bluetooth OBEX Listener setup! All the content that gets received will be saved in the My Documents. Very cool...

Posted by rudi | 2 comment(s)
Filed under: , ,

Halo 3 Beats all records

Halo 3 was released in the US and rewrote the record books with a stagering $170 million in sales in the first 24 hours in the US alone!!!

Here is the trailer: http://www.xbox.com/en-US/games/h/halo3/20061204-trailer-starrynight.htm

The official press release

Xbox 360 Exclusive “Halo 3” Registers Biggest Day in US Entertainment History with $170 Million in Sales

Microsoft today announced that the Xbox 360 exclusive game “Halo 3” has officially become the biggest entertainment launch in history, garnering an estimated $170 million in sales in the United States alone in the first 24 hours. The Xbox 360 title beat previous records set by blockbuster theatrical releases like “Spider-man 3” and novels such as “Harry Potter and the Deathly Hallows.”

“Halo 3” is the conclusion to the epic trilogy and picks up where “Halo 2” left off, answering questions around the fates of the beloved protagonist Master Chief and his artificial intelligence sidekick Cortana as they struggle to save humankind from destruction at the hands of the alien coalition known as the Covenant. In addition to the rich storyline, “Halo 3” continues the franchise’s grand tradition of delivering innovative online multiplayer experiences via Xbox LIVE, the world’s largest social network on TV.

“Halo 3 has become a pop-culture phenomenon,” said Shane Kim, corporate vice president of Microsoft Game Studios. “Not only is “Halo 3” setting sales records, it’s also redefining entertainment. 

Within the first 20 hours alone, we’ve seen more than a million Xbox LIVE members come online to play Halo 3 – that makes September 25 the most active Xbox LIVE gaming day in history.”

Retailers have also expressed their excitement about the launch of “Halo 3.” 

Bob McKenzie, Senior Vice President of Merchandising for GameStop Corp commented that, “With consumer demand for Halo 3 and related products, we expect it to be the biggest video game title generator in GameStop's history."

“The initial demand we’ve seen for ‘Halo 3’ has been astounding, and the game is on track to become the number one gaming title of all time.  ‘Halo 3’ is a genuine entertainment phenomenon and our customers have responded very enthusiastically to the release,” said Jill Hamburger, vice president of movies and games at Best Buy.

Developed by Bungie Studios, the “Halo” franchise is exclusive to the Xbox 360 video game and entertainment system and optimized for the Xbox LIVE® online entertainment network. The more than 7 million Xbox LIVE users will get a continually evolving gaming experience with “Halo 3.” Its online multiplayer and cooperative gameplay for Xbox LIVE Gold users, the much-talked-about Saved Films feature that enables players to capture and save their favorite moments on their hard drives, and Forge, an innovative map editor that enables infinite customization options are just some of the new features to experience.

More than 10,000 retailers hosted Midnight Madness events to celebrate the launch of this third installment in the billion-dollar franchise. In New York, Seattle, Miami and Los Angeles, Microsoft and retail partners hosted marquee launch events that featured contests and appearances by local celebrities and professional athletes who are fanatical about the “Halo” franchise, including Ludacris and Zac Efron and Microsoft Chairman Bill Gates. 

More than 1.7 million copies of “Halo 3” were preordered in the United States before a single store opened its doors at midnight, Sept. 25, making this the fasting pre-selling game in history, surpassing the previous record-setting pre-sales of “Halo 2.” Well beyond just a U.S. phenomenon, the launch of “Halo 3” was a worldwide celebration that released in 37 countries and available in 17 languages.

Posted by rudi | with no comments
Filed under: ,

South African MVPs

Always when I find a great link on the internet, I am sure to find that the person who owns the blog is a Microsoft MVP. The same is true in South Africa. We have great MVPs who really know their stuff... just check out there blogs!  Based on this SADeveloper.net forum entry, here are the South African MVPs and there blogs:

Almero Steyn

Windows Server System - MIIS

http://www.puttyq.com/

 

Armand du Plessis

Visual Developer - Visual C#

http://dotnet.org.za/armand/

http://armanddp.net/

 

Arno Nel

Microsoft Office Sharepoint server

http://dotnet.org.za/arnon/

http://arnonel.com/

 

Ayal Ziv Rosenberg

Solution Architecture

 

Chris Quirke

Windows - Shell/User

http://cquirke.wordpress.com/

http://cquirke.blogspot.com/

 

Ernst Hermann Kuschke

Visual Developer - Visual C#

http://www.ernstkuschke.com/

http://ernstkuschke.blogspot.com/

http://dotnet.org.za/ernst/

 

Frank M. Palinkas

Windows - Help

http://frank.helpware.net/

 

Hilton Giesenow

Visual Developer - Visual C#

http://hilton.giesenow.com/

http://dotnet.org.za/hiltong

http://hiltong.blogspot.com/

 

Mario Lionello

Visual Developer - Visual C#

http://dotnetjunkies.com/WebLog/malio/

 

Nicolas Blank

Windows Server System - Exchange Server

http://blankmanblog.spaces.live.com/

 

Paul Somers

Windows Server System - BizTalk Server

http://blog.paul.somers.com/blog

 

Peter Willmot

Windows Server System - SQL Server

 

Pieter Germishuys

Windows - XNA/DirectX

http://www.pieterg.com/

http://dotnet.org.za/pieterg/

 

Willy-Peter Schaub

Visual Developer - Team System

http://dotnet.org.za/willy

Posted by rudi | 2 comment(s)
Filed under:

SELECT TOP

It is a real pain in the ... that every sql server uses it's own select top equivelent... Here follows a list of some of the ones I found:

SQL Server: SELECT TOP 10 * FROM [TABLE]
DB2: SELECT * FROM [TABLE] FETCH FIRST 10 ROWS ONLY
PostgreSQL: SELECT * FROM [TABLE] LIMIT 10
Oracle: SELECT * FROM [TABLE] WHERE ROWNUM <= 10
Sybase: SET ROWCOUNT 10 SELECT * FROM [TABLE]
Firebird: SELECT FIRST 10 * FROM [TABLE]
MySQL: SELECT * FROM [TABLE] LIMIT 10

I haven't tested all of these... I only needed the SQL Server and MySQL statements but will supply the rest as reference!!!

Vista "breadcrumb" bar progress indicator using ViewPort

Vista has a brand new "breadcrumb" bar replacing the old address bar. If you have a relative slow pc running vista (like me) and open a explorer window, the new "breadcrumb" bar acts like a progress bar showing the progress of the loading of the items. To recreate this in WPF is relatively simple! I first created a user control that looks similar to the "breadcrumb" bar. Next step is to add a grid, progress bar and a view box. Lastly add the user control to the view box.

Here is an excerpt from the code

<Grid Width="500" Height="20">
   <ProgressBar Value="50" />
   <Viewbox>
    <VistaBarTest:BreadcrumbBar Width="500" Height="20" />
   </Viewbox>
</Grid>
And this is the results...
Posted by rudi | 2 comment(s)
Filed under: ,

A great WPF presentation...

Josh Smith (who else) have posted a great presentation about some WPF features... This is possibly the most creative presentation I have seen

The presentation can be found here:

http://joshsmithonwpf.wordpress.com/2007/09/17/vslive-was-great/

Posted by rudi | with no comments
Filed under:

Facebook is growing...

Love it or hate it but Facebook is growing at an incredible pace. Just read the following statistics:

  • More than 41 million active users
  • More than 200,000 new registrations per day since Jan. 2007
  • An average of 3% weekly growth since Jan. 2007
  • Active users have doubled since Facebook expanded registration in Sept. 2006

Popularity in South Africa is also sky rocketing with 270,000 register users. Facebook is also growing as a development platform. Not even a month ago I wrote an article on how to write a desktop application for facebook and it already has 10,000 views in less than 30 days!

More and more applications are also being released. Over 3,000 applications have been built on Facebook Platform with a staggering 100 new applications added per day. More than 80% of Facebook members have used at least one application built on Facebook Platform. Even scarier is the fact that the platform is only 4 months old!

I will get more detail from Armand, but it also looks like there will be a Facebook Developer Garage hosted 14 November 2007. For those of you who haven't heard off this type of event:

"it is a forum to share ideas with local developers, look for partners on your latest project, see and participate in Facebook App demonstrations, seek technical support, or just network and socialize with other developers interested in the Facebook Platform."

If you haven't joined facebook yet, but want to know if any of your friends are on Facebook... Public search profiles were recently launched.

You can now search for you friends on facebook and see there limited public profile without registering!

Results 

Interesting links

Facebook Developer Garage

Creating a simple Facebook Application using WPF

Inside Facebook - Blog

 

 

 

Posted by rudi | 2 comment(s)
Filed under:

Codename Silver

Sounds like a game?

One of the goals for the WCF/WF teams was to integrate WCF and WF more closely in Orcas Beta 2. This project was names Silver. Once you really start using WF, sooner or later you would find it useful to instantiate a workflow using a WCF service. Well, in beta 2 this is now possible. Matt Winkle wrote an excellent blog post about Workflow Services (http://blogs.msdn.com/mwinkle/archive/2007/07/30/vs-2008-beta-2-shipped-0-to-workflow-service-in-60-seconds.aspx)

If you need more info about Workflows, then Matt Winkle is your guy! He also interviewed the Silver team on Channel 9 (http://channel9.msdn.com/Showpost.aspx?postid=335756)

Also check out Ron Jacobs from Arcast.TV's interview with Matt Winkle here: http://channel9.msdn.com/ShowPost.aspx?PostID=324455

Posted by rudi | with no comments
Filed under: , ,

Pumping with Windows Workflow Foundation

Weird title, I know. It will make sense soon...

The last week I had a relative simple project that I was busy with. I had to read a smart card, load the available amount of money onto the petrol pump and allow the client to start pumping his petrol! Easy enough...

After designing the software, I started thinking about using a simplified state machine to solve some of my problems. I have never worked with Windows Workflow Foundation but it seemed like this would map perfectly into my software! I bought a WF book and started learning how to use it. I have to start of by saying WF works great.

What is Workflow?

Well, workflow is simple put, the flow of work!

What is Windows Workflow Foundation?

It is very important to realize that Windows Workflow Foundation is JUST and API used to build upon. To quote Keith Elder, "It is really no different than building a house whereby you first pour the foundation and then build something on top of it". WF can also be hosted in any .NET application. Let me repeat that, WF can be hosted in any .NET application (including ASP.NET, Services, Windows Forms, WPF, etc.)

Why did I choose WF?

WF can easily be used to solve Human-to-system interaction

In my sample application, the workflow gets started by a Windows Forms application waiting for a client to insert a smart card. Once the smart card is inserted, the available balance is read from the smart card and a sequential workflow is started.

The sequential workflow basically sits in a while loop waiting for the pumps nozzle to be picked up. Once the nozzle is picked up, the available money read from the smart card is pre-loaded onto the petrol pump. This authorizes the client to start pumping. The workflow now basically just sit in another while loop waiting for the nozzle to be replaced or for a timeout. Once the nozzle gets put back, the totals gets retrieved form the petrol pump and deducted from the smartcard.

A simple workflow like this could easily be created within 60 seconds.

I also borrowed the WorkflowDesigner from the DinnerNow project. Basically, WF allows you to re-host the WF designer. This allows me to visually follow exactly in which state my application is currently! WF also offers out-of-the-box services like persistence & tracking. By enabling SQL tracking, I can easily generate reports or setup Key Performance Indicators (KPI). By writing NO code specifically to save this information I can generate a report of how many transaction I had at a specific date or even drill down and see the average transaction value, etc...

The learning curve for WF is not so steep and definitely an interesting way to write software that requires human intervention

Other areas were WF is very popular is in document management (Document approval, etc...). I also started seeing WF being used in ASP.NET applications as a Page Flow system (http://blogs.msdn.com/mwinkle/archive/2007/06/07/introducing-the-pageflow-sample.aspx)

Lastly, remember that Windows workflow Foundation is not the only Workflow engine available; there are loads of off-the-shelf workflow engines available. The most prevalent workflow products are K2.net and Skelta Workflow.NET

kick it on DotNetKicks.com
Posted by rudi | 7 comment(s)
Filed under: ,