john's profileJohn West - Technology, ...PhotosBlogLists Tools Help

John West - Technology, continued...

john west

Occupation
Location
Interests

Zune Card

 
April 20

What Windows Mobile Needs, from a Developer Perspective

I’ve been thinking a lot about Windows Mobile 6.5 and 7.0.  Everyone is very focused on the user experience that Microsoft will provide.  Will they show the hexes or hide the hexes… Will it have Multitouch or not?  Zune integration?  Will it be more stable?  These are all great questions, but as a developer, none of them are the right question for me.  I mean, I want the Zune Marketplace on my WM device, no doubt about it.  However, there’s one thing I want more than any other as a developer.

WPF for Windows Mobile!

Yes, that’s what I want as a developer.  I want my .net, but I want it pretty and usable.  Is that too much to ask?  Let’s face it.  The .net compact framework is extremely powerful once you get past the UI.  But the UI is what makes the experience, and CF is sorely lacking.  WM isn’t competing against dumbphones anymore.  It’s competing against the iphone and the Pre and others like it.  Each of these devices does a tremendous job of making applications easy to use, and, dare I say it, fun!  WM, not so much.

Why not WPF?

I can think of a few reasons why we don’t have WPF.  I have no inside knowledge; these are just guesses.

  • Memory?  Maybe WPF will take up too much memory on these devices.  Newer devices come with a significant amount of memory, so don’t think this is it, at least not with devices that will officially support 6.5+.
  • Non-touch screens?  This is a biggie.  Many WM phones don’t support touch.  It’s much easier to create a Winform app that can be controlled with buttons than it is to create a WPF app that is built from the ground up for touch.  It can be done, but it would take more work.  My response to this is that MS could just make WPF for touchscreens only.  I’d rather not see this, but I’d prefer it over not having WPF at all.
  • No developers to get it done?  Maybe Microsoft just got caught resting on their laurels when the iphone came out.  Maybe they simply didn’t recognize that their UI would be mocked the minute iphone v1 was released and the first comparisons went online.  It continues to amaze me how I see small companies come out with great, innovative software that is better than MS, but when MS sets out to do something, it seems to take forever.  I have to believe that a WPF v1 could be released in a matter of a few months with the right resources on the job (I hate it when other people do this to me… presume to know how quickly something *should* be able to be done, so I beg forgiveness if I am way off base here).

Those are some reasons I can think of off the top of my head.  I’m sure there are more reasons.

Now, there is one wildcard in all this…

Silverlight for Windows Mobile

MS has announced that Silverlight will be released for Windows Mobile.  Since Silverlight (v2+, at least) is a subset of WPF, this really shows that it can be done.  I don’t count SLOOB (Silverlight Out-of-Browser, coming in v3) as a viable alternative, since it runs in a sandbox, and therefore is too limited for many apps I, and others, would want to write for WM.

So, what to expect?

I have no expectations.  I wish I had inside knowledge.  I have none.  I’m extremely hopeful, but extremely doubtful, that MS might announce WPF for WM at Tech-Ed when they officially launch WM 6.5.  I just don’t see it happening, though, since there haven’t even been the slightest rumors on the interweb.  Maybe with WM7.   If you know anything I don’t, and you care to share, feel free in the comments below.

February 20

Getting Windows Mobile Internet Sharing to work with an AT&T phone

I have an AT&T Fuze with the original, stock Windows Mobile 6.1 installed.  I have tried repeatedly on two different machines to get Internet Sharing working over either bluetooth or usb.  No dice.  Finally, I stumbled on this blog: http://stevenharman.net/blog/archive/2008/10/03/windows-mobile-internet-connection-sharing-hack.aspx.  The important part wasn’t how to hack the registry.  What I needed was to know that the AT&T ISP connection needed to point to wap.cingular instead of isp.cingular.  I made that simple change and my connection worked flawlessly!  Hopefully this helps someone else.

November 20

Take Your Music Everywhere

I’ve always wanted to have and play my music from anywhere.  As of today, I’m getting really close.  Two things happened to make it easier.

First, Zune Pass with Free MP3s (if you have MP3s from other sources, skip this section and move on to “Mesh” below)

First, I’m a Zune Pass guy.  For $14 a month, you get unlimited music to listen to on your PCs and Zunes.  Of course, if you end the subscription, you don’t keep the music.  That’s mostly true as of today, with a great exception.  As of now, every month you’re a Zune Pass subscriber, you get to download 10 DRM-free MP3s from the Zune library.  These credits show up as you browse your music, and when you go to buy an MP3, you’ll see ‘NO CHARGE’ as long as you have credits remaining (note: these aren’t rollover credits – you need to use them every month).

image

These MP3s are yours forever, regardless of whether you have a Zune pass, or even Zune hardware or software.  They’re POMP3s (plain-ole MP3s) to do with as you like.

Second, Mesh

Ok, so it’s great that I get free MP3s.  And since I can copy them around, I can take them with me on any device.  However, it’s time-consuming to copy files and make sure everything’s in sync.  It also doesn’t help if you’re at someone else’s computer.  That’s where Live Mesh comes in.  Live Mesh, although much more, includes file-synching capabilities.  Once you install Mesh (www.mesh.com) on the desired computers, you can join them into your own sort of personal network (called a Mesh, of course), simply by using your Live/Msn/Hotmail Logon.  Once they’re in the Mesh, you can add any folder on any computer to be synced, and specify that it should also be synced with any/all of the other computers.  So, Computer A and B sync a folder called ‘ZuneMP3s’.  Any changes on either computer will automatically be synced through the included computers without you doing a thing!  Add some MP3s on computer A and they’ll be on computer B, and vice versa.  Any problems with making sure all your devices have the MP3s is solved.  And you can have nearly unlimited computers in your mesh.

That’s great.  Your PCs all have your MP3s.  But wait, there’s more.  This is where it gets really, really good!  In addition to syncing the folders to your devices, you can sync it to your Mesh “Live Desktop”.  This is your mobile desktop on the web.  As you can see below, I’m syncing my MP3s to my Live Desktop.  (Note: there’s currently a 5gig limit to your Live Desktop while it’s in beta).

image 

Why is this important?  It’s important because your Live Desktop includes a built-in media player by way of the Silverlight plugin.  This means, yes, you can play your MP3s from the browser, from any computer that supports Silverlight (Mac, Windows, Firefox, Safari, etc)!  At a friends house?  Just log on to your Live Desktop and start playing your music!

Bonuses

Bonus #1: Soon you’ll be able to include Mobile devices and Macs in your Mesh.  That means you can have your MP3s sync to your phone for play on the road!

Bonus #2: Mesh includes remote desktop abilities.  That means that you can remotely connect to any machine in your Mesh as if you’re sitting in front of it.

Bonus #3: Mesh is set to be much more than just a file-synching solution.  Silverlight apps can be hosted within it, and developers can write apps that use it to sync whatever types of information is relevant. 

Summary

I can sync and play my MP3s from any PC in my Mesh, and I can play my MP3s anytime, anywhere, from a browser!  How’s that for cool?!?!

Setting an assembly's LINQ connection string via your web.config

Note: The examples are for VB.NET.

I have a separate assembly that hosts the layer containing my LINQ to SQL model. If you're going to use the L2S designer, you need to let L2S store the connectionstring in the settings.settings file, as shown here.

image

This is great, until you move your website to staging/production.  You need to be able to change this connectionstring by way of a web.config setting.  This method assumes that your L2Q data context has the following settings:

Connection: ExampleConnectionString (MySettings)
Connection String: xxx
Application Settings: True
Settings Property Name: ExampleConnectionString

It turns out that it’s really simple.  Just add a connectionstring entry to override the one in the assembly containing the L2S connectionstring.  Here’s mine for the example above:

  <connectionStrings>
    <add name="App.My.MySettings.ExampleConnectionString"
      connectionString="server=svrprod; uid=secureuser;password=xxx; initial catalog=db"
      providerName="System.Data.SqlClient" />
  </connectionStrings>

The key is the name.  You have to prefix your connection string’s name with “RootNamespaceForYourAssembly.My.MySettings.”.  That’s it.  Your web.config settings will now override the assembly’s settings when you view the website, and yet the designer will continue to use the settings in the assembly!

John

ps.  I do recommend you verify your changes before moving this to production to make sure your web.config connectionstring is being used.  To do this, simply make your production web.config connectionstring point to an invalid server and make sure you get the error on your website.  That way you’ll know for sure that it’s reading it correctly.

July 14

Silverlight 2 Beta 2 Animation Reuse Errors

I'm trying to reuse an animation that I create programmatically.  The why isn't important.  What is important is that the second time I try to run it with animation.Begin(), it bombs.  Well, with some properties it bombs.  With others, it works.  Transform properties cause the error, but standard properties like opacity and canvas location work when you run the animation multiple times.

Below is a sample app.  Button one and two are two instances of the same created animation.  Each of them will run once, but fail the second time.  This shows that it's not the object being animated, but the animation itself that is causing the error.  Button three and four are opacity animations, and show that animations that change opacity never fail when run multiple times.

I'm sure one suggestion will be to recreate the animation each time.  However, in my real-world app, I capture some object properties at the time the animation is created, and need to have these same values used each time the animation runs.  If I were to grab the properties over each time I recreated the animation, the object might be in a different state.  And I don't want to cache the initial values, because 1) it makes my animation library less flexible, and 2) I just want to do it this way, 'cause it's easier :).

I've added my code after the sample app.  If anyone has any idea what I can do to prevent this while still creating the animations programmatically, please add a comment.

Here is the xaml (Page.xaml).

<UserControl x:Class="AnimationReuseTest.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="400" Height="300" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    <Grid x:Name="LayoutRoot" Background="White">
        <Rectangle x:Name="recMain" Height="54" Canvas.Top="225" Stroke="#FF000000" Margin="65,136,76,110" VerticalAlignment="Stretch" d:LayoutOverrides="Height" Fill="#FF941414" RenderTransformOrigin="0.5,0.5" Opacity="0.1" >
            <Rectangle.RenderTransform>
                <TransformGroup>
                    <ScaleTransform ScaleX="0.8" ScaleY="0.8"/>
                    <SkewTransform/>
                    <RotateTransform/>
                    <TranslateTransform/>
                </TransformGroup>
            </Rectangle.RenderTransform>
        </Rectangle>
        <Button Height="40" Margin="24,0,0,70" VerticalAlignment="Bottom" Content="Animate1-scalex" x:Name="btnAnimate1" Click="btnAnimate1_Click" Width="163" HorizontalAlignment="Left"/>
        <Button Height="40" Margin="0,0,37,70" VerticalAlignment="Bottom" Content="Animate2-scalex" x:Name="btnAnimate2" Click="btnAnimate2_Click" Width="163" HorizontalAlignment="Right"/>
        <Button Margin="24,0,0,26" VerticalAlignment="Bottom" Content="Animate3-opacity" x:Name="btnAnimate3" Click="btnAnimate3_Click" HorizontalAlignment="Left" Width="163" Height="40"/>
        <Button Height="40" Margin="0,0,37,26" VerticalAlignment="Bottom" Content="Animate4-opacity" x:Name="btnAnimate4" Click="btnAnimate4_Click" Width="163" HorizontalAlignment="Right"/>
        <TextBlock Height="124" Margin="8,8,8,0" VerticalAlignment="Top" TextWrapping="Wrap" x:Name="lblErrorMsg" FontSize="8" />
    </Grid>
</UserControl>

And here is the code (Page.xaml.vb).

Partial Public Class Page
    Inherits UserControl

    Dim s1 As New Storyboard
    Dim s2 As New Storyboard
    Dim s3 As New Storyboard
    Dim s4 As New Storyboard

    Public Sub New()
        InitializeComponent()

        'add storyboards to resources - not sure why, but I'm following examples I've seen
        LayoutRoot.Resources.Add("S1", s1)
        LayoutRoot.Resources.Add("S2", s2)
        LayoutRoot.Resources.Add("S3", s3)
        LayoutRoot.Resources.Add("S4", s4)
        'initialize the storyboard to animate the rectangle
        CreateAnimation(s1, "(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)")
        CreateAnimation(s2, "(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)")
        CreateAnimation(s3, "(UIElement.Opacity)")
        CreateAnimation(s4, "(UIElement.Opacity)")
    End Sub

    Sub CreateAnimation(ByVal s As Storyboard, ByVal Prop As String)
        'create new doubleanimation
        Dim d As New DoubleAnimation
        'set timespan to half a second
        d.Duration = New Duration(TimeSpan.FromSeconds(0.5))
        'reverse animation
        d.AutoReverse = True
        'set target to the rectangle
        Storyboard.SetTarget(d, recMain)
        'we're animating x-axis scale - other props, like (Canvas.X) will work, though
        Storyboard.SetTargetProperty(d, New PropertyPath(Prop))
        'animating from start value of to 1
        d.To = 1
        'add doubleanimation to storyboard
        s.Children.Add(d)
    End Sub

    Private Sub btnAnimate1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
        'begin animation when button is clicked - we'll get the error below the second time we click the button.
        'Cannot resolve TargetProperty (UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX) on specified object.
        Try
            s1.Begin()
        Catch ex As Exception
            lblErrorMsg.text = ex.ToString
        End Try
    End Sub

    Private Sub btnAnimate2_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
        'begin animation when button is clicked - we'll get the error below the second time we click the button.
        'Cannot resolve TargetProperty (UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX) on specified object.
        Try
            s2.Begin()
        Catch ex As Exception
            lblErrorMsg.text = ex.ToString
        End Try
    End Sub

    Private Sub btnAnimate3_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
        'begin animation when button is clicked - we won't get an error on animating
        s3.Begin()
    End Sub

    Private Sub btnAnimate4_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
        'begin animation when button is clicked - we won't get an error on animating
        s4.Begin()
    End Sub
End Class

 
Photo 1 of 12
Sites I've created to play with different web technologies

Xbox Live GamerCard

John West
Xbox Live GamerCard
Rep:
5/5 stars
Score:
2088
Zone:
Pro
Rock Band 2CatanGears of War 2Halo 3PGR 3

Xbox Live Recent Games

Rock Band 2
Achieve:
11/50
Score:
195/1000
Catan
Achieve:
8/12
Score:
120/200
Gears of War 2
Achieve:
26/79
Score:
380/1750
Halo 3
Achieve:
6/79
Score:
65/1750
PGR 3
Achieve:
2/25
Score:
35/1000