Thursday, December 29, 2011

Saturday, December 17, 2011

WebOS? I like it...

So I picked up one of those HP TouchPads from their latest eBay firesale for $150. Mostly intended as a much nerdier replacement for an iPad. Root it, put Android on it, play around with other linux tablet builds, even get Windows 8 on there as soon as that's possible. At a $150 I'm much more comfortable taking the risk of bricking this thing than say the $5-600 pricetag of similar hardware.

So anyway, after a few days of playing around with it and the cyanogenmod 7 build I have to say of the 3 tablet OS's (IOS, WebOS, Android) that I've used WebOS is the most compelling. It's prettier and slicker than IOS and definately better organized and usable than Android. Maybe it's the newness of it for me, but i just plain "like it".

If I had to choose a single OS for every day tablet use (and I do use my tablet every day at work and home) WebOS is the easy first choice for me. If it had word's with friends and stumbleupon I wouldn't even hestiate.

Let's hope that HP's decision to open source it giives it some legs.

Sunday, April 3, 2011

I couldn't agree more

From Linus Torvalds' Linux Kernel style guide:

Now, some people will claim that having 8-character indentations makes
the code move too far to the right, and makes it hard to read on a
80-character terminal screen. The answer to that is that if you need
more than 3 levels of indentation, you're screwed anyway, and should fix
your program.

In short, 8-char indents make things easier to read, and have the added
benefit of warning you when you're nesting your functions too deep.
Heed that warning.


It amazes me how many professional software engineers don't follow this simple convention.

Tuesday, February 1, 2011

Turns out it is the former

As in "We're tidying up in prepartion for the final feature set".

Vail Release Candidate is supposed to be out this week.

I wonder what's going to happen to Vail

I've been running the household media and file storage off of Windows Home Server for over a year now and it works great as a centralized file store/media server.

I've been looking forward to version 2 of WHS, which goes by codename Vail, for quite some time. This is especially true since MS demoed a WP7 app that can access a WHS server from anywhere on the interwebs at CES. But alas Vail has also been through some trails and tribulations since MS announced they are dropping the drive extender technology (basically a software managed JBOD raid that allowed you set set up massive and arbitrary storage pools and easily manage them).

While there are rumors of an impending beta of Vail I am not seeing much out there. Today my one MS Connect product suggestion went from Proposed, to postponed and then to closed. I'm not sure if that means "we're cleaning things up in preparation for defining the final feature set" or "we're cleaning things up because we're closing up shop on this thing".

I sure hope they don't kill WHS. It is nice and easy to install and manage and most of the other competitors out there for a consumer based "server" slash media system are all linuxy; and my brains just to small for remembering how to configure a linux server, especially if I want my XBox to see it.

Sunday, January 16, 2011

GestureBehavior and GestureTrigger

The Silverlight toolkit has a GestureService and GestureListener that allows you to pick up events from gesture input. Oddly enough it doesn't include Xaml types to easily plug those into a page and bind those events to elements and MVVM commands.

Here is an example of using a simple behavior and set of triggers that allow you to do that.

<TextBlock Text="{Binding Welcome}">
    <i:Interaction.Behaviors>
        <li:GestureBehavior/>
    </i:Interaction.Behaviors>
    <i:Interaction.Triggers>
        <li:DoubleTapTrigger>
            <cmd:EventToCommand Command="{Binding DoubleTapCommand}" PassEventArgsToCommand="True"/>
        </li:DoubleTapTrigger>
    </i:Interaction.Triggers>
</TextBlock>
The TextBlock above is bound to a ViewModel that of course has a DoupleTapCommand. In this case a RelayCommand from MVVM Light:
public MainViewModel()
{
    DoubleTapCommand = new RelayCommand<GestureEventArgs>(e =>
    {
        MessageBox.Show("double tap " + e.OriginalSource.ToString());
    });

    DragStartedCommand = new RelayCommand<DragStartedGestureEventArgs>(Drag);
    DragDeltaCommand = new RelayCommand<DragDeltaGestureEventArgs>(Drag);
    DragCompletedCommand = new RelayCommand<DragCompletedGestureEventArgs>(Drag);
}

public RelayCommand<GestureEventArgs> DoubleTapCommand
{
    get;
    private set;
}

And we can implement a quick and dirty drag and drop:
Point _start;
private void Drag(DragStartedGestureEventArgs e)
{
    UIElement ui = e.OriginalSource as UIElement;
    if (ui != null)
    {
        if (!(ui.RenderTransform is TranslateTransform))
            ui.RenderTransform = new TranslateTransform();

        TranslateTransform t = ui.RenderTransform as TranslateTransform;

        _start = new Point();
        _start.X = t.X;
        _start.Y = t.Y;

        e.Handled = true;
    }
}

private void Drag(DragDeltaGestureEventArgs e)
{
    UIElement ui = e.OriginalSource as UIElement;
    if (ui != null)
    {
        TranslateTransform t = ui.RenderTransform as TranslateTransform;

        t.X += e.HorizontalChange;
        t.Y += e.VerticalChange;
        e.Handled = true;
    }
}

private void Drag(DragCompletedGestureEventArgs e)
{
    UIElement ui = e.OriginalSource as UIElement;
    if (ui != null && _start != null)
    {
        if (MessageBox.Show("Press cancel to abort this move.", "Really?", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel)
        {
            TranslateTransform t = ui.RenderTransform as TranslateTransform;

            t.X = _start.X;
            t.Y = _start.Y;
            e.Handled = true;
        }
    }
}

public RelayCommand<DragStartedGestureEventArgs> DragStartedCommand
{
    get;
    private set;
}

public RelayCommand<DragDeltaGestureEventArgs> DragDeltaCommand
{
    get;
    private set;
}

public RelayCommand<DragCompletedGestureEventArgs> DragCompletedCommand
{
    get;
    private set;
}
Code and example is available here.

Monday, January 10, 2011

XNA Here I Come

I'm thinking that an animated aquarium would be a fun little project for the Windows Phone so I've decided to port the WinForms version I did awhile back. After a couple of fruitless hours of trying to wrestle silverlight to do animated images I thought to myself "Wait a minute. This has to be a lot easier in DirectX".

Lo and behold it is because of course frame animation is a big part of game programming. Got the first version whipped up in a just a few hours.