blog.reis.se

It's all about looks

JayPokerI was trying out a few things on the windows phone 7 platform and wanted to come up with a simple application idea. There are numerous of simple list application examples out there like twitter and RSS readers but I wanted to try something different, something both useful and a bit more playful. And with a limited time.

So why not a planning poker application? Most of the graphics was already there like the coffee cup, infinity mark and the logo so it was simple to whip it together. But I still think there are a few interesting parts in this.

As it’s static data, there are no more than the numbers, coffee cup, question mark and the infinity sign.  I didn’t bother with any complicated view model, just went along with static buttons. And one big button as the currently selected card. I re-styled the button to make it look like a card and added the graphics and text. The big card is normally hidden but when I select a card it is populated with the selected cards content and the popped up.

The trick here is that if the selected card is an Image the I create a new image and assign it to the content and if its text I assign that directly to the content.

if (_currentCard.Content is Image)
  BigButton.Content = new Image
    {
      Source = ((Image)_currentCard.Content).Source, 
      Height = 234, 
      Width = 202
    };
else
  BigButton.Content = _currentCard.Content;

Next up is the animation. I wanted the card to flip over while I tuned up the dark overlay. The basic animation was easy to set, I just used a combination of scale and plane transforms to get the big card from the small size and up to the full screen view with a flip. It was a bit trickier to get the card to start and end the animation on the right spot. A little calculation together with naming of the places where I should modify the animation, with  an “x:Name” property, did the trick. Now I was able to modify it from code using the following to set the position:

int xValue = -180 + 120 * 
    int.Parse(_currentCard.GetValue(Grid.ColumnProperty)
     .ToString());
int yValue = -260 + 190 * 
    (int.Parse(_currentCard.GetValue(Grid.RowProperty)
     .ToString()) - 1);

((EasingDoubleKeyFrame)FindName("startX")).Value = xValue;
((SplineDoubleKeyFrame)FindName("endX")).Value = xValue;
((EasingDoubleKeyFrame)FindName("startY")).Value = yValue;
((SplineDoubleKeyFrame)FindName("endY")).Value = yValue;

It's not the most elegant code, with no safeguards when I cast between stuff, but I whipped it together during an afternoon and it was rewarding to see what could be accomplished with some 50 lines of code and a little blend. And who knows I might clean it up and publish it as soon as the devices are out and the market place is up.

Time to plan the next sprint // Håkan Reis


There is always a time, in configuring and setting up deployment with MSBuild, when you want to start and stop services on a specific machine. You could always run the sc command from an Exec task. But there must be a better way, an of course there is. For most things you need to do in MSBuild there seem to be a task for it in the MSBuild community task library.

So while poking around I find a couple of gems, ServiceQuery and ServiceController. Both are powerful tools in MSBuild deployment and works both locally and remote. The only problem is that the documentation is quite sparse, especially when handling remote services. So I Just figure I write down what I did to get it working in my scripts.

A little background: a web project that should be deployed to different sites, test, stage and production. The stage and production is redundant with clustering so its really stable, but need some extra attention for each node to be updated. You shut down one node, shut down the IIS and state services, clean out a few folders and then update with new web and finish up starting it all up again.

So to the script, add the community tasks to the script, go on with setting up some default properties and some paths and create a default target. After this you are ready to start and stop services:

<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\ MSBuild.Community.Tasks.Targets"/>
 
<PropertyGroup>
  <DeployFiles>$(MSBuildStartupDirectory)\DeployFiles.msbuild</DeployFiles>
  <Machine>localhost</Machine>
</PropertyGroup>

<Target Name="deploy">
  <CallTarget Targets="Shutdown"/>
  <MSBuild Projects="$(DeployTargets)" Properties="Machine=$(Machine)"/>
  <CallTarget Targets="Startup"/>
  <CallTarget Targets="CheckAccess"/>
</Target>

You see the basic structure here, shut down, call a separate MSBuild file that do the actual file copying the start up the services as well, and finally do a smoke test to test that the site is up and running again.

Next we see the actual shutdown part, first we do a ServiceQuery to check if there in fact is a SMTP service, if it reports other than Unknown, the service is in place. This makes it possible to do a conditional shutdown. The MachineName attribute is of course for remote shut down but works on localhost as well, making it possible to have the same script for local and remote handling. Make sure that the account that the TeamCity agent is running under, have access to perform shutdown/startup on the remote machine. Now we can go ahead and shut down the services:

<Target Name="Shutdown">
 <ServiceQuery MachineName="$(Machine)" ServiceName="smtpsvc">
   <Output TaskParameter="Status" PropertyName="SMTPPresent"/>
 </ServiceQuery>
 <ServiceController MachineName="$(Machine)" ServiceName="IISADMIN" Action="Stop"/> 
 <ServiceController MachineName="$(Machine)" ServiceName="W3SVC" Action="Stop"/>
 <ServiceController MachineName="$(Machine)" ServiceName="aspnet_state" Action="Stop"/>
 <ServiceController MachineName="$(Machine)" ServiceName="smtpsvc" Action="Stop" Condition="'$(SMTPPresent)'!='Unknown'"/>
</Target>

The actual deployments of the files are easy, you can just perform a copy task, as in the remote service handling, make sure you have access to the folder on the remote machine you are deploying to. After the deployment we do the Start action on each of the services we want to start up. Last, we do the smoke test. To do this we can use the task WebDownload, we just specify the URL and an output file and this step will fail if you don’t get any access. The other benefit is that you kick the first time JIT compilation here.

<Target Name="CheckAccess">
  <WebDownload FileUri="http://site.to.deply.com" FileName="test.html"/>
</Target>

Now go deploy something!

-----

PS: I have previously run a series on TeamCity and MSBuild in my private blog so if you are interested to learn more go ahead and read:

Artifact handling in TeamCity 4.0
Deploy with MSBuild and custom targets part 1
Deploy with MSBuild and custom targets part 2
Version handling in TeamCity part 1
Version handling in TeamCity part 2


mockup I was trying to figure out what text size to use on the Windows Phone to make it readable. After using the 24” monitor where I get a “big ass” phone, also know as a … pad :),  I realized that it’s not going to work.

So I started out a little quest to find some data around the phone and what dimensions you could expect. However, there are no single specification around from Microsoft, so the actual size of the screen may vary. Searching around web brought very little technical specifications, but you know a few facts: It’s going to be 480x800 pixels, and 16:9 form factor on the screen. So I did a couple of educated guesses and assumed a 3.8” screen. Interesting enough, this told me that it actually is going to have a whopping 240dpi resolution, that's close to a an old laser printer, and in full color – amazing.

miniSo on to the mockup, as soon as I got the dimensions right I started to print out a few pages, checking fonts and sizes (and got a surprise by how small the texts and icons got in the actual size). I used the skin from the emulator as base. Next, I wanted to get a feeling of it in the hand as well, so I started adding some depth. A few minutes later I found myself creating a cut-out paper prototype you see to the right here.

If you like you can cut out some slits  and do a left/right and a top/bottom sliding version. That way you can even use it to user test panoramic and pivot applications as well as that big sliding home screen.

So here it is the Windows Phone 7 series paper prototype, enjoy.

// Håkan Reis


 

WindowsPhone7series_panorama_thmbI was trying to make a mockup in Balsamiq for a windows phone 7 series application and thought i needed a few items to get things right. So I started creating the parts needed. The basic phone, with a see through-screen so it's easy to create panoramas to lay behind. The keyboard variants (there are quite a few, default, text, email, web, search and a couple of dialer keyboards) and then a few of the buttons and checkboxes that’s needed. Most buttons are easiest mimicked by using the geometric shape in Balsamiq.

It’s quite heavy with all the details in the keyboards so pick and choose only the controls you need.

So there you are, just download and start using it.


You can also find it at the Mockups To Go site.

Microsoft MIX10 brain dump

Also cross-posted on my company blog

After three days of the Microsoft Mix10 event the brain tend to overflow. So I sit down at a Starbucks and try to summarize my thoughts before my mind explodes.

It’s easy to get caught up in positive buzz during events like this but I really think Microsoft is doing a lot of things right here with Windows Phone 7 series, the next level of .NET and Silverlight and Internet Explorer 9, among other things. Some of it, I believe, accounts to all the focus on User Experience and the influence that Bill Buxton have on this.

Also if you want to catch any of the sessions most of them are up at the mix10 site already.

Silverlight release pace

This was a big surprise to me; Silverlight 4 is going to be released as early as next month end the release candidate (RC) is out now. I was more in the lines of a beta and the an RC in the summer and a release late 2010. But it seems they try to align and do a big release with .NET 4, VS2010 and Silverlight 4. As a bonus the Pivot control will be in the controls toolkit so that’s going to be fun to play with.

Silverlight 4 Tools RC | .NET 4 RC | VS2010 RC

About the Windows Phone 7 series

The development platform for Windows Phone 7 series was, of course, one of the biggest news on the starting keynote and lot of sessions around it followed. I think they are on the right track with the platform. A few surprises surfaced, like the inclusion of DirectX to utilize HW backed video decoding and the Windows Phone development tools being released for free.

But a few questions and problems surfaced as well, as you can se all over the web it seems they are not including cut & paste and market place being the only application deployment channel. Other things I thought about was:

  • How is the user interface is going to perform in right to left markets.
  • What the possibilities are to hook in other services, like for example Pandora, to provide music streams for the native Zune player.
  • And I still have a few issues with lag in the interface as well as accidental clicks, lets just hope the will get this issues out the door before they release it.

The user experience work that has been put into the new OS is really cool, the decision to remove all chrome and go for a real clean and consistent look is really fresh. And the decision to let the back button work on all levels across the phone, in-applications as well as between was a stroke of genius.

Windows Phone Dev tools | UI Design guidelines

What about HTML 5 and IE 9

It was pretty obvious that they should release some news around Internet Explorer 9 and its take on HTML 5. It is just an early technology preview but I have to say I’m impressed by the results. They did tone down the JavaScript speed issues but quite frankly they were on par with the other browsers and at those speeds it really is less of an issue. What still is an issue is standards, and anything but a 100/100 score on Acid3 is a failure in my eyes.

What they did show was the brilliant work they have done on the GPU acceleration part. This really was amazing 720p HD video streaming on a netbook was blazing fast, they even manage to pump two 720p streams without a glitch, impressive. And rendering HMTL5, CSS3 and SVG with hardware acceleration really looks promising.

If anything it shows that the Internet Explorer team is still in the game and might really get a decent browser out the door.

IE9 platform preview

Expression Blend 4

The things I saw done with blend was quite cool, this tool has come a long way from the first release and is now a potent tool. The tight integration with Adobe was finally in place, just point to the assets and start editing it in Illustrator or Photoshop. What’s more impressive, if I got it right, was that you were able to bind to a text object from the imported Illustrator assets directly to the object in your ViewModel! This really puts design control back into the hands of the designer.

Expression Blend 4 beta

Get real

So what’s left for me now is to find the time to play with all these new toys and and experience for myself what they are capable of before it’s time to Get Real and start creating.

Have fun // Håkan Reis


Time for Mix10

See You Just backing up the last stuff on my computer before shutting down. Checking the flight plan once more and packing the last items. Tomorrow I’ll get up early to catch a plane to Las Vegas and Mix10. This is really going to be fun. Especially I look forward to the HaaHa show, the key note, and of course the stuff on Windows Phone 7 Series (still a really bad name).

Of course its not that bad that its in Las Vegas, but well that’s just a bonus. You could of course expect some kind of report here from my visit when I had some time to digest the impressions.

See you // Håkan Reis


Soundbridge + Spotify

For some time I have bee using Spotify as a music service. And it have worked out very well. With one account as a premium account and then some extra free accounts its easy to play around and create some playlists and the connect and play from the premium account.

The other thing I use a lot at home for music is my Soundbridge, when I bought it, roku labs was making it. Then it was sold through Pinnacle, unfortunately I think its discontinued now. Anyway, when Windows 7 came I could also just look up a what music I like to play, and just send the along to play to my Soundbridg. Compared to other locked in standards, that is just brilliant.

The problem

But now that I have one device and one service that I really like, I would want them to play nice together, I want the full catalog of Spotify accessible from my Soundbridge. What I really would like is to have Spotify as a uPNP server implementation, then you could easily search the full database and have the playlists ready directly. But that’s maybe for the future,

The second best thing, however, would at least to be able to stream what you got from your server to the Soundbridge, or any other streaming device for that matter. After reading several hacks and looking at a lot of solutions I found two that works for me.

Two streaming solutions 

The first is for my work computer, where I alternate from OS X and windows 7 and when I’m on OS X, I can use a commercial app called Nicecast from rogue amoeba (the also make airfoil). It’s very easy to set up but you need to start Spotify from Nicecast and you can't just execute it as usual. What more is that it doesn't code the current song name and artist to the stream. Aöpart from that it works well, it even supports streaming to the world so it means more than one receiver. But for my setup I have Windows machine as a server, so why spend $40 to only stream from my work computer?

So I go with the second and even simpler solution, a little DirectSound wrapper called dsbridge. What this does it taking the output, encode it using lame ENC and then streaming it out. It even shows the current playing song and artist together with the source (Spotify). It’s quite intelligent to, if a receiver connects to the port it silences the local output and if you stop the streaming it just restores the normal output (can be configured). It's an early hack - single stream only but sound quality is ok, and there is something to its simplicity I really like. Very nifty. 

Hope you will be helped with this if you are looking for a similar solution.

// Håkan Reis

PS: Is there anyone with a solution on how to remote control Spotify from an iPhone? :)

Update:  Spotify Remotless is an iPhone app that works together with a helper and remote controls Spotify ($4). Doing a decent job, but the effect is a bit delayed due to the re-coding dsbridge needs to do before it streams it out. It even enables you to tweet the current song, nice twist.