Friday, December 07, 2007

Another weekend of hard work is approaching, and it feels great! I have some cool technology to look forward to, like a brand new ASP.NET 3.5 architecture design and Windows Mobile Web Services along with some plain old WinForms and Reporting Services. The blog title comes from an informal event (read; socialize with beer) every late Friday afternoon that I heard of today. The term refers to "After Ski" which is a similar event after a great day of skiing. There are several reason why I think that it's a great term.

First of all, the idea of relaxing after doing something funny all day, like coding, is a nice concept. That is really how I see it! I take both pride and joy in my work as a developer because I create all day long; how many people do that every day? The creation makes us artists, and that is where most of the pride comes from. Another aspect I like is the focus on code, and the "code" of our business is exactly that - code! We are the modern "workers" that create the products that other people use. We are mostly still craftsmen like most professions a few hundred years ago (shoemakers, tailors, etc), even if parts of our "industry" is moving towards an approach focusing more on customization (building with standard products and components). We are the brain-brawn, and I take pride in that too. In Wikipedia's definition of code you find "...code is a rule for converting a piece of information...into another form or representation...", and that is how I see my role as a developer. I convert business information, according to rules, to another (better) form - applications!

Although I will probably not have much "After Code" this weekend, I think it's a great concept ;-)...

posted on Friday, December 07, 2007 6:05:01 PM (E. South America Standard Time, UTC-03:00)  by Chris  #    Comments [0]
 Saturday, November 24, 2007

I had an idea back in the 80's of a portable book that would have a great screen, that would be connected, that had access to all the books. I thought that the biggest obstacle was to get the authors (or rather the publishers) to believe in electronic books, and that the copyrights was my biggest challenge. Hey, I even started the drawings for the patent (ok, give me some slack, I was young then), but I never actually made any serious attempt. Then, I bought my first handheld, a Casio Cassiopeia E10, I thought that the screen wasn't great and it wasn't connected but still, I was amazed. I showed it to my friend Andy, and he was amazed, and that was almost 10 years ago.

Now, when I look at the Kindle, I see that Jeff Bezos has another idea that is far from new, but he has some points. He aimed for a great screen and he aimed for connectivity. I still think that he missed out on the first one (even if a bunch of authors say it's great, I'll wait for the color display ;-)), but he really got it on the second. I agree with Rob Tiffany on all points, but as a WM developer, it's the connectivity that gets me. I'm tired of reading all the connectivity small print ("...Connectivity and synchronization may require separately purchased equipment and/or wireless products...") on many WM pages. On an event back in 2000 I asked if Microsoft would enter the operator business because I believed (and still do) that the operators don't understand what an open wireless Internet can bring to everyone (it doesn't have to be free, but free us from abuse). I still ask the same question when I see they offer great devices without specifying the operating system. What is that? If I could reformat any phone (Nokia, etc) and install WM, they did have to inform me, but now I'm almost always stuck with what the manufacturer and/or the operator put in there. How could the mobile phone industry go so wrong?

Please Microsoft, the operators is not doing their job, let us free, get our users an open Internet...

posted on Saturday, November 24, 2007 1:01:20 AM (E. South America Standard Time, UTC-03:00)  by Chris  #    Comments [0]
 Friday, November 09, 2007

As you may have seen so far, there's a lot of love on my blog ;-)!

Even since I started programming (yes, it was called that back then), I always wanted to share my apps. It was always a great pleasure to see someone starting up you application and start trying it out. When I started to work as a developer, it was natural that my colleges got the code, rather than the binaries, as I wanted feedback both on the app and the code. Then the code sharing got organized within source control, version handling, and even configuration management systems. It was even easier to share, and we worked together on the same code, but I always felt that the tools was a limitation. I've used everything from raw CVS and SourceSafe to ClearCase, and I've had problems with them all.

TeamPlain bug report

First of all, they are no fun! For me, code is fun, and I want my code to stay in a fun place. A place where I can follow its development, its growth, its progress, and even its problems and issues. When I saw the TFS the first time, I thought that Microsoft was on the right track (as usual), and using it was more fun than before. But still, something was missing, and when CodePlex came around, there was an idea of how it could work. Then I saw TeamPlain. They put the extra effort in creating a great UX, and now the code was treated with respect and it was really fun.

Just check out the bug report on the left - that's fun!

I want to follow the progress of my code on a site like this. The fact that it was built on WSS is even better as it gives me even more "for free" (like free-text searching, site management, ability to extend and customize it using a standard approach, etc, etc).

Then, when I saw that Microsoft went and bought the creators, and made it available as a free download called Team System Web Access (TSWA), I was in heaven. Even if there's always more to dream about, there is already a lot to be grateful about too.

I haven't checked out the new features in VS2008 TFS, but I guess I won't be disappointed as I suspect that TSWA is already included.

posted on Thursday, November 08, 2007 11:32:45 PM (E. South America Standard Time, UTC-03:00)  by Chris  #    Comments [0]
 Wednesday, October 31, 2007

Today, seven years ago, I got my hands on the first beta of .NET Framework 1.0, and I was really excited. When I attended a partner conference about .NET in late 2000, I was blown away!

I had been working with Microsoft technology for year already, but I felt that the long awaited framework of reusable code for enterprise applications was being created. I mean that even if both the core Windows API and libraries like MFC all brought productivity, the new frameworks new capabilities in terms of data access, XML, communication, etc, was something new and necessary. We could let go of most of the code that we previously had to design, create, test, and deploy with our own proprietary frameworks. Even if we did that somewhat unwillingly, it was a good thing. The next amazing thing was the new language, C#, and I remember that thought; "-Bye, bye, sweet Visual Basic" who had been my friend for several years. The fact that I had been programming Turbo Pascal, C, and C++ before probably helped, but I thought that the creation by Anders Hejlsberg (who also created Turbo Pascal) was exactly what I had been looking for (combining the best of all languages, including Java). The things that remained the same, and that was already good, were the operating system (Windows) and the development environment (Visual Studio). So, the four pillars of a developer's world were there...

  1. Operating System
  2. Framework
  3. Language
  4. Tools

...and since that day, I haven't looked back once!

The great thing now is to see how Microsoft is taking the framework further. As I have been developing for Windows Mobile devices for some years, I have used the compact version of the framework. It's quite amazing how much of the full framework that is there considering the footprint. The framework was not on handheld devices and mobile phones. The things that are missing in .NET Compact Framework can almost always be handled in some way (by adding some third-party code, etc). Recently, I have come in contact with the .NET Micro Framework which is even smaller (yes, small IS beautiful, but still the managed code, the language, and the development tools that we have grown to adore. Just check out how he created a basic version of my all-time-favorite game space invaders. The framework is now in sensors, monitors, aux displays, remote controls, and even in robots. The next great example is Silverlight, which is actually a C++ implementation of a subset of the full framework. As the other smaller frameworks, it is focused on having a small footprint, but the new thing here is that it is now also portable. It works in the most common browsers and on both Windows and Mac (OS X). Still, the four pillars are the same!

My conclusion is that after watching the .NET Framework grow, move, and port for seven years is that we will live with this framework for years to come. It will still change in many ways, but this is the way to build the software of the future. Bill Gates was right, again, and I feel secure that my investments in the framework are very safe. I know that the code I write based on .NET Framework in C# is something that I can use for many years.

Again, keep up the great work, Microsoft!

posted on Wednesday, October 31, 2007 12:19:54 PM (E. South America Standard Time, UTC-03:00)  by Chris  #    Comments [0]
 Friday, October 26, 2007

The great thing about hosting Silverlight plugins on your web page is that you can load it with any XAML (not just the popular use of video as I've shown in my recent posts). For example, you can start drawing on this grid...

...and this is made possible due to the powerful XAML InkPresenter element. By adding this markup/code to a web page (provided that the silverlight.js file is referenced like before, see my earlier post on that)...

<script id="inkXaml" type="text/xaml"><?xml version="1.0"?>
    <Canvas xmlns=
"http://schemas.microsoft.com/client/2007"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     Loaded="onXamlLoaded">
        <Image Source="images/gridpaper.png" Width="300" Height="221"/>
        <InkPresenter x:Name=
"inkPresenter"
         Background="transparent" Width="300" Height="221"
         MouseLeftButtonDown=
"onInkPresenterMouseDown"
         MouseMove=
"onInkPresenterMouseMove"
         MouseLeftButtonUp=
"onInkPresenterMouseUp"/>
    </Canvas>
</script>
<
div id="inkHost" style="width: 300px; height: 221px">
<
script type=text/javascript>

    Silverlight.createObjectEx({
        source:
"#inkXaml",
        parentElement: document.getElementById(
"inkHost"),
        id:
"inkPlugin",
        properties: {
            width:
"100%",
            height:
"100%",
            version:
"1.0",
            inplaceInstallPrompt:
true,
            background:
"white",
            isWindowless:
false
        },
        events: {}
    });

    
var plugin;
    
var inkPresenter;
    
var stroke = null;

    
function onXamlLoaded(sender, args)
    {
         plugin = document.getElementById(
"inkPlugin");
         inkPresenter = sender.findname(
"inkPresenter");
    }

    
function onInkPresenterMouseDown(sender, eventArgs)
    {
        inkPresenter.CaptureMouse();
        stroke = plugin.content.createFromXaml(
"<Stroke/>");
        stroke.StylusPoints.AddStylusPoints(
            eventArgs.GetStylusPoints(inkPresenter));
        stroke.DrawingAttributes.Color =
"#FF000DDD";
        stroke.DrawingAttributes.Width = 1;
        stroke.DrawingAttributes.Height = 1;
        inkPresenter.Strokes.Add(stroke);
    }

    
function onInkPresenterMouseMove(sender, eventArgs)
    {
        
if(stroke != null)
           stroke.StylusPoints.AddStylusPoints(eventArgs.GetStylusPoints(inkPresenter));
    }

    
function onInkPresenterMouseUp(sender, eventArgs)
    {
       stroke =
null;
    }
</script>
</
div>

...you have made it possibility for your users to make handwritten notes on your page. The XAML is fairly simple with the background (grid) behind the InkPresenter, and the scripts are used to create new Stroke elements for each mouse gesture (down, moves, up).

There are many things you can do with this, and for a more extensive sample, check out the Silverlight Ink SDK Sample. For example, as the ink (strokes) is basically XAML, it's definitely possible to save in on the server side (why not in a database). As the strokes are created on the client, this would require some functionality to upload the ink, probably implemented using scripts that communicate with the web server (a.k.a. AJAX). This means that you could create everything from a simple inking guestbook to capturing ink feedback on a CAD drawing (note that the grid above is an image file). I haven't seen much of this in real-world applications yet, but there is a sample called Journal Note Converter Sample which allows you to convert a Microsoft Journal note to a complete Silverlight application that allow further inking.

posted on Friday, October 26, 2007 10:16:17 PM (E. South America Standard Time, UTC-03:00)  by Chris  #    Comments [0]
 Thursday, October 25, 2007

I've realized that I made a mistake in my previous post about the simple video player. The problem with my video player was that it started loading the video when the web page was loaded. That is something users with low bandwidth are not so happy about (especially when the video is about 10 MB, as in this case). If you change the XAML to contain a play button like this...

<Canvas xmlns="http://schemas.microsoft.com/client/2007"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <
MediaElement x:Name="Video" Width="420" Height="236"
     MouseLeftButtonDown="onVideoMouseDown" MediaEnded="onVideoMediaEnded"/>
    <
Canvas x:Name="PlayButton" Canvas.Left="185" Canvas.Top="93"
     Width="50" Height="50" MouseLeftButtonDown="onButtonMouseDown">
        <
Rectangle Fill="#3F000000" Stroke="#FF000000" StrokeThickness="2"
         RadiusX="10" RadiusY="10" Width="50" Height="50"/>
        <
Path Fill="#FF000000" Stretch="Fill" Stroke="#FFD10000" StrokeThickness="0"
         Width="24" Height="34" Canvas.Left="15"
         Canvas.Top="8" Data="M224,184 L224,208 240,196.37082 z"/>
    </
Canvas>
</
Canvas>

...and add the following script...

function onButtonMouseDown(sender, eventArgs)
{
    sender.findName(
"PlayButton").Visibility="Collapsed";
    sender.findName(
"Video").Source="http://www.businessanyplace.net/chris/slintro.wmv";
}

...you will be much better off because the only thing that is loaded initially is the XAML. When the play button is clicked, it will disappear, and the video starts loading and playing. The play/pause functionality is still the same as before. I have updated my previous post now, so I hope all you with lower bandwidth will be happy about that.

posted on Thursday, October 25, 2007 2:44:22 PM (E. South America Standard Time, UTC-03:00)  by Chris  #    Comments [0]
 Tuesday, October 23, 2007

One of the coolest Silverlight features is the ease with which you can use media on your web site. There are numerous quickstarts, tutorials, videos, and webcasts to show you how easy you can build your own video player. The power of Silverlight can be released with a little XAML, and here is one of the simplest XAML video players around:

<MediaElement xmlns="http://schemas.microsoft.com/client/2007"
    Source="http://www.businessanyplace.net/chris/slintro.wmv"/>

You need a Silverlight control on your page to make it work, but it works. If you have .NET Framework 3.0 installed, you can change the namespace to...

<MediaElement xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    Source="http://www.businessanyplace.net/chris/slintro.wmv"/>

...place it in a file (e.g. videoplayer.xaml), and then you can open it file in Internet Explorer. That's already cool, but let's get back to how to use it with Silverlight.

In a minimal approach, there is only one file that you need to put up on your web site, it's called silverlight.js and comes with the Silverlight SDK. It basically takes care of creating the actual Silverlight plugin on the web page (with support for PC or Mac and the most common browsers). Put this file in a script directory (e.g. "js" below you web page root).

With that file in place, you are ready to create your first web page that include video playback, and it can look like this...

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<
head>
    <title>Video Player</title>    
    
<script type="text/javascript" src="js/Silverlight.js"></script>
</
head>
<
body>
<
p>Here's some text, and here comes the video...</p>
<
script type="text/xaml" id="firstXaml"><?xml version="1.0"?>
    <MediaElement xmlns=
"http://schemas.microsoft.com/client/2007"
                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Source="http://www.businessanyplace.net/chris/slintro.wmv" x:Name="Video"
    AutoPlay=
"false" MouseLeftButtonDown="onVideoMouseDown"
    MediaEnded="onVideoMediaEnded"/>
</script>
<
div style="width: 208; height: 160;" id="firstHost">
<
script type="text/javascript">
    Silverlight.createObjectEx({
        source:
"#firstXaml",
        parentElement: document.getElementById(
"firstHost"),
        id:
"firstPlugIn",
        properties: {
            width:
"100%",
            height:
"100%",
            version:
"1.0",
            inplaceInstallPrompt:
true,
            background:
"white",
            isWindowless:
false
        },
        events: {}
    });

    
function onVideoMouseDown(sender, eventArgs)
    {
        
if(sender.CurrentState != "Playing")
            sender.Play();
        
else
            sender.Pause();
        }

    
function onVideoMediaEnded(sender, eventArgs)
    {
        sender.stop();
    }
</script>
</
div>
<
p>...and some more text!</p>
</
body>
</
html>

...and note how I reference the script file mentioned above. The actual XAML is located in the firstXaml script tag, and you can see that I've added some attributes like a name (required by the event functions), event handlers, etc. Then I just call the Silverlight.createObjectEx method with the name of the XAML (script) tag, the script (div) host, and the name of this instance of the plugin. I have also added two methods to support the video playback by allowing the click of the mouse on the video player to play and pause, and to automatic rewind of the video when it's done. Note that there's nothing preventing me from adding various videos on the same page as long as I give all parts unique names.

Using this approach I have included the cool intro video from the REMIX 2007 event (click below to play/pause the video).

posted on Tuesday, October 23, 2007 10:40:46 PM (E. South America Standard Time, UTC-03:00)  by Chris  #    Comments [0]
 Friday, October 19, 2007

I've always liked the software from Microsoft, and especially Windows. Ever since I started my first Windows program back in 85, I knew they were on the right track. A few years I was frustrated because I had to code in character-based tools while my users had a better UX with the mouse, and when I could use Windows to do my work, I was delighted – and I still am! I don't know why many in our business are so afraid of being Microsoft "fan boys". Why not? It's a very successful company, and that success mostly comes from creating great software. I'm not ashamed; I'm a Microsoft fan boy!

Just take a look at my desktop on the right. Every morning when I turn on my computer I smile. I just love what I do (and of course my amazing woman on the photos from Greece this summer), and there are very few days that I don't want to write some code to create something amazing. My dear friend, Andy, always tell the story of his school paper about programming he named "Happiness", and I know exactly what he means. I'm happy! What I like most with the stuff from Microsoft is that I can use the same tools to program everything from a fat server to a tiny mobile phone (I'll never buy a phone where I can't install my apps).

Even if some of my friends and colleges complain about Vista (they say that they will go back to XP, that Microsoft is offering free "downgrades", maybe buy a Mac, etc), I haven't regretted installing it one second. I know it's not as fast as it should be, that all the drivers aren't there yet, and I say: -What's new? I have been installing new versions of Windows (and other OSs) for 20 years, and it's always the same thing. The hardware manufacturers need to catch up, that's all. I use Vista mostly for development, and I think almost everything works great. If I need to try something odd, I fire up a VPC image, and if it crashes with a blue screen, I only smile again, and restart it.

All in all, I haven't had any major problems, I have been able to sync my mobile devices with Windows Media Center since the installation (I guess I'm lucky). But I'm also very careful (I always unpack installation to see what they do before I run them) and I follow a golden rule: don't install too much of the other's stuff. I was forced to install QuickTime by the Expression Media setup, and after that my IE couldn't even show .png files, so QuickTime had to go. I haven't even thought about unnecessary things like Firefox (I have a great browser in IE) or RealPlayer (I have a great media player), and I'm more surprised when some actually work, like Skype, Nero, etc. I'm actually amazed that my favorite imaging tool, Image Composer (now 10 years since its last version), actually runs very well on my 64-bit Vista! I even like the name "Vista" as it means "View" in most of the Latin languages, and that's the feeling I get every morning as I turn on my laptop!

Keep up the great work, Microsoft!

posted on Friday, October 19, 2007 4:34:47 PM (E. South America Standard Time, UTC-03:00)  by Chris  #    Comments [0]