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.
Random babblings about creating, using and generally considering software.
Saturday, December 17, 2011
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.
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.
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.
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.
And we can implement a quick and dirty drag and drop:
CodeProject
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.CodeProject
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.
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.
Sunday, December 26, 2010
Extend ViewModelLocator to be a bit more dynamic
I've been using MVVM Light in my Windows Phone development. It's lightweight, has all the base functionality I need and seems pretty solid.
One pattern that MVVM Light uses is a static ViewModelLocator class that holds all of the main/root view models in the application. You declare it as a data source in the app.xaml:
Then in the page Xaml you can do:
This is great when there is basically a 1:1 mapping between the page and the contents of each view model. What it's not so good at is dealing with the situation where you want the same page to bind to multiple view models are structurally equivalent but have different data contents.
Take for instance an RSS viewer (which coincidentally enough I'm working on at the moment). You might have a feed that represents articles form a website and another feed that is discussion posts from the same website. Each feed is further broken down into topic channels. So if we wanted to display each feed as a page, with each topic as a Pivot Item on that page we could distill the page xaml down to:
So rather than parameterizing the ViewModel how about we parametrize the page? Let's declare the linkage between ViewModel in page on the ViewModel. We'll declare an attribute that specifies the linkage and allows a parameter to be passed the page in the form of a query string.
In this app the set of navigable items are collections of viewmodels that are displayed in ListBoxes wherein each ViewModel can be selected and navigated to:
I find that moving the linkage between View and ViewModel onto the ViewModel gives us the flexibility to reuse the same UI to display the contents of multiple, structurally equivalent ViewModels, while still maintaining a loose coupling between those two layers.
CodeProject
One pattern that MVVM Light uses is a static ViewModelLocator class that holds all of the main/root view models in the application. You declare it as a data source in the app.xaml:
<vm:ViewModelLocator d:isdatasource="True" x:key="Locator"/>
Then in the page Xaml you can do:
DataContext="{Binding Main, Source={StaticResource Locator}}"This is great when there is basically a 1:1 mapping between the page and the contents of each view model. What it's not so good at is dealing with the situation where you want the same page to bind to multiple view models are structurally equivalent but have different data contents.
Take for instance an RSS viewer (which coincidentally enough I'm working on at the moment). You might have a feed that represents articles form a website and another feed that is discussion posts from the same website. Each feed is further broken down into topic channels. So if we wanted to display each feed as a page, with each topic as a Pivot Item on that page we could distill the page xaml down to:
<controls:Pivot Title="{Binding Name}"
ItemsSource="{Binding Topics}"
ItemTemplate="{StaticResource RssTopicTemplate}"/>Now if the ViewModel is statically linked to the page (as above) we need to parametrize the ViewModel as the user navigates from articles to discussions and back. It can be made to work but it violates the Single Responsibility Principle and I just don't like it.So rather than parameterizing the ViewModel how about we parametrize the page? Let's declare the linkage between ViewModel in page on the ViewModel. We'll declare an attribute that specifies the linkage and allows a parameter to be passed the page in the form of a query string.
[Page("/RssPage.xaml?vm=ArticlesStatic")]
public class ArticlesViewModel : ViewModelBase
...
[Page("/RssPage.xaml?vm=ForumsStatic")]
public class ForumsViewModel : ViewModelBaseIn this app the set of navigable items are collections of viewmodels that are displayed in ListBoxes wherein each ViewModel can be selected and navigated to:
public class ContentsViewModel : ViewModelBase
{
public ObservableCollection<ViewModelBase> Contents
{ get; private set; }
public RelayCommand<object> SelectViewModel
{ get; private set; }
private void Select(object vm)
{
if (vm != null)
{
var page = vm.GetType().GetAttribute<PageAttribute>();
Navigate(page.Page);
}
}
}Then we need a wee bit of code in the page codebehind:protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (NavigationContext.QueryString.ContainsKey("vm"))
{
string key = NavigationContext.QueryString["vm"];
DataContext = ViewModelLocator.FindViewModel(key);
}
base.OnNavigatedTo(e);
}where FindViewModel is a method added to the ViewModelLocator that returns the correct ViewModel using reflection:public static object FindViewModel(string key)
{
var prop = typeof(ViewModelLocator).GetProperty(key,
BindingFlags.Public | BindingFlags.Static);
return prop.GetValue(null, null);
}I find that moving the linkage between View and ViewModel onto the ViewModel gives us the flexibility to reuse the same UI to display the contents of multiple, structurally equivalent ViewModels, while still maintaining a loose coupling between those two layers.
CodeProject
Subscribe to:
Posts (Atom)