Jimmy Engström

NAVIGATION

2015

Download all the videos from Build 2015

2015-05-11 17:25:00 +0000

Build 2015 was epic, there was so much content so Microsoft even recorded some content before build (now available at Channel9).
I usually download everything to my laptop and watch it to and from work, this script will download all videos from Build 2015 =)

This is an updated version of my script I previously blogged about here.

cd "d:\build15"

$pattern = "[{0},\:,\']" -f ([Regex]::Escape([String][System.IO.Path]::GetInvalidPathChars()))             
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$a = ([xml](new-object net.webclient).downloadstring("http://s.ch9.ms/Events/Build/2015/RSS/mp4high"))
$a.rss.channel.item | foreach{ 
    $url = New-Object System.Uri($_.enclosure.url)
    $file = [Regex]::Replace($_.Title + " " + $url.Segments[-1] , $pattern, ' ') 
    Write-host  ("{0}  -  {1}" -f "Downloadning" ,$file)
    if (!(test-path $file))
    {
            (New-Object System.Net.WebClient).DownloadFile($url, $file)
    }
}

 

Just copy the code, paste it into a file called “Build2015.ps1”, create a directory (in my case “c:\Build15”) and change the path in the first line of the script.

Right click on the file and choose run with PowerShell.

 

In case you get a problem similar like “Build2015.ps1 cannot be loaded because running scripts is disabled on this system.”

Start PowerShell as an administrator and run “set-executionpolicy unrestricted”, this is probably a bad thing to do for security.

Build2015.ps1 (677.00 bytes)

2014

Controlling an iKettle with Windows phone

2014-06-06 23:15:00 +0000

A week ago I found a kettle that can be controlled over Wi-fi.
It is called iKettle and can be found over here.

When I find a device I look for two things:
Is there an app for Windows (Phone or 8)?
Can I make one?

If the answer is yes to at least one of those questions (well actually none is ok too) I know I need to buy one.

Mark Cox had already done most of the heavy lifting so I only had to implement the protocol found on this blog (Thanks Mark).
I’m a bit sad that it didn’t use http protocol, it could have replied with status 418 Ler

There are still features missing, some because I haven’t gotten around to it yet and some because there are hardware or software limitations, like you won’t be able to set up the iKettle from a Windows phone since you can’t connect directly to it.

</param></embed>
Short app demo


 

Download the app MyKettle


Hope you enjoy the app and if you have any suggestions or comments please let med know.
Still a lot of stuff coming up =D

Windows phone 8.1 and Bluetooth LE – Getting started

2014-05-04 17:03:00 +0000

With Windows phone 8.1 Microsoft also released the ability to communicate with Bluetooth Low Energy devices.
This is really exciting for Windows phone developers, this way we can start developing apps that can talk to devices without draining the battery dry.

Sadly this is not available in the developer preview of Windows phone 8.1, but will be available when Windows Phone 8.1 is released for general availability.

Pairing

The first step is always to pair with the device you want to connect to.
This is easy to do by going to Settings –> Bluetooth on your phone and tapping on the device you wish to pair with, just as you would do with a  “ordinary” Bluetooth device.

 

Capabilities

To be able to communicate with Bluetooth Low energy (or Bluetooth Smart, as it’s also called) you need to add a capability to your app.
This can’t be done from a GUI, you need to edit the package.appmanifest manually and add the following lines of code just above </Package>.

<Capabilities>
  <m2:DeviceCapability Name="bluetooth.genericAttributeProfile">
    <m2:Device Id="any">
      <m2:Function Type="serviceId:1803"/>
    </m2:Device>
  </m2:DeviceCapability>
</Capabilities>

Now you are are set to start coding =)

 

Iterate through devices

To keep this as simple as possible, I’ll just show you how to iterate through devices and pick up a predefined one.

BluetoothLEDevice currentDevice { get; set; }
string deviceName = "Philips AEA1000";
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
    foreach (DeviceInformation di in await DeviceInformation.FindAllAsync(BluetoothLEDevice.GetDeviceSelector()))
    {
        BluetoothLEDevice bleDevice = await BluetoothLEDevice.FromIdAsync(di.Id);
        if (bleDevice.Name == deviceName)
        {
            currentDevice = bleDevice;
            break;
        }
    }
}

Find out what your device can do

GATT (Generic Attribute Profile) provides profile discovery and description services for Bluetooth Low Energy protocol, it basically makes it possible to ask your device what it can do. The documentation for this is very thorough and shows how to communicate.

Here is how to get a list of the GATTServices your device supports.

List<string> serviceList = new List<string>();
foreach (var service in currentDevice.GattServices)
{
    switch (service.Uuid.ToString())
    {
        case "00001811-0000-1000-8000-00805f9b34fb":
            serviceList.Add("AlertNotification");
            break;
        case "0000180f-0000-1000-8000-00805f9b34fb":
            serviceList.Add("Battery");
            break;
        case "00001810-0000-1000-8000-00805f9b34fb":
            serviceList.Add("BloodPressure");
            break;
        case "00001805-0000-1000-8000-00805f9b34fb":
            serviceList.Add("CurrentTime");
            break;
        case "00001818-0000-1000-8000-00805f9b34fb":
            serviceList.Add("CyclingPower");
            break;
        case "00001816-0000-1000-8000-00805f9b34fb":
            serviceList.Add("CyclingSpeedAndCadence");
            break;
        case "0000180a-0000-1000-8000-00805f9b34fb":
            serviceList.Add("DeviceInformation");
            break;
        case "00001800-0000-1000-8000-00805f9b34fb":
            serviceList.Add("GenericAccess");
            break;
        case "00001801-0000-1000-8000-00805f9b34fb":
            serviceList.Add("GenericAttribute");
            break;
        case "00001808-0000-1000-8000-00805f9b34fb":
            serviceList.Add("Glucose");
            break;
        case "00001809-0000-1000-8000-00805f9b34fb":
            serviceList.Add("HealthThermometer");
            break;
        case "0000180d-0000-1000-8000-00805f9b34fb":
            serviceList.Add("HeartRate");
            break;
        case "00001812-0000-1000-8000-00805f9b34fb":
            serviceList.Add("HumanInterfaceDevice");
            break;
        case "00001802-0000-1000-8000-00805f9b34fb":
            serviceList.Add("ImmediateAlert");
            break;
        case "00001803-0000-1000-8000-00805f9b34fb":
            serviceList.Add("LinkLoss");
            break;
        case "00001819-0000-1000-8000-00805f9b34fb":
            serviceList.Add("LocationAndNavigation");
            break;
        case "00001807-0000-1000-8000-00805f9b34fb":
            serviceList.Add("NextDstChange");
            break;
        case "0000180e-0000-1000-8000-00805f9b34fb":
            serviceList.Add("PhoneAlertStatus");
            break;
        case "00001806-0000-1000-8000-00805f9b34fb":
            serviceList.Add("ReferenceTimeUpdate");
            break;
        case "00001814-0000-1000-8000-00805f9b34fb":
            serviceList.Add("RunningSpeedAndCadence");
            break;
        case "00001813-0000-1000-8000-00805f9b34fb":
            serviceList.Add("ScanParameters");
            break;
        case "00001804-0000-1000-8000-00805f9b34fb":
            serviceList.Add("TxPower");
            break;
        default:
            break;
    }
}
MessageDialog md = new MessageDialog(String.Join("\r\n", serviceList));
md.ShowAsync();


Time for some fun, Lets make it beep!

In my case I have a Key finder (key fob) and it implements (among other services) the Immediate Alert Service, which makes it possible to make it beep.
The GATT specification shows us how to communicate with the ImmediateAlertService
Download the PDF here.

image


The documentation shows us that if we want to set the alert level we need to do that with “Write without Response”.
The different values for Alert Level can be found here.

Value 0, meaning “No Alert”

Value 1, meaning “Mild Alert”

Value 2, meaning “High Alert”

This snippet will make the key finder (key fob) sound a high alert.

var immediateAlertService = currentDevice.GetGattService(GattServiceUuids.ImmediateAlert);
var characteristics = immediateAlertService.GetCharacteristics(GattCharacteristicUuids.AlertLevel).First();
byte[] data = new byte[1];
data[0] = (byte)2;
await characteristics.WriteValueAsync(data.AsBuffer(), GattWriteOption.WriteWithoutResponse);

 

In my next blog post I will go through more of the things you can do with a key finder (key fob).

Universal apps and NotificationsExtensions - Toasts (Part 3)

2014-04-14 00:50:00 +0000

Here is how to handle toasts the easy way in Universal apps.

First add the “NotificationsExtensions.UniversalApps” Nuget package.

See blog post showing how.

Toast templates:
http://msdn.microsoft.com/en-us/library/windows/apps/hh761494.aspx

It is possible to send any toast template to Windows Phone 8.1 but it will always be shown as an modified version of ToastText02.

You can add a Toast notification like this:

IToastText02 toastContent = ToastContentFactory.CreateToastText02();
toastContent.TextHeading.Text = "Tosty!";
toastContent.TextBodyWrap.Text = "Toasts, best invention since.. ehmm toast";

ScheduledToastNotification toast;
toast = new ScheduledToastNotification(toastContent.GetXml(), DateTime.Now.AddSeconds(10));
toast.Id = "SomeID";
ToastNotificationManager.CreateToastNotifier().AddToSchedule(toast);

Universal apps and NotificationsExtensions - Live Tiles (Part2)

2014-04-14 00:45:00 +0000

Here is how to handle live tiles the easy way in Universal apps.

First add the “NotificationsExtensions.UniversalApps” Nuget package.

See blog post showing how.


Tile templates comparison:
http://msdn.microsoft.com/en-us/library/windows/apps/hh761491.aspx


This is how to update your tile with a scheduled update.

//Create wide tile update
ITileWide310x150Text09 tileContent = TileContentFactory.CreateTileWide310x150Text09();
tileContent.TextHeading.Text = "Wide Tile Text";
tileContent.TextBodyWrap.Text = "More text on the tile";

//Always add a 150x150 tile update also  
ITileSquare150x150Text04 squareContent = TileContentFactory.CreateTileSquare150x150Text04();
squareContent.TextBodyWrap.Text = "More text on the tile";
tileContent.Square150x150Content = squareContent;


ScheduledTileNotification futureTile = new ScheduledTileNotification(tileContent.GetXml(), DateTime.Now.AddSeconds(15));
TileUpdateManager.CreateTileUpdaterForApplication().AddToSchedule(futureTile);

 

To update your tile right away you can use these lines instead of the last two above:

TileNotification tileNotification=new TileNotification(tileContent.GetXml());
TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);

 

Recources

Microsofts code sample:

http://code.msdn.microsoft.com/Alarm-toast-notifications-fe81fc74#content

Nuget version

https://www.nuget.org/packages/NotificationsExtensions.UniversalApps/

Universal apps and NotificationsExtensions (Part 1)

2014-04-14 00:31:00 +0000

 

This is a series of blog posts on how to do notifications in Universal apps.


Managing notifications can be a bit “tricky”, you need to edit xml (or write the xml as a string yourself).
Luckily Microsoft has provided an Universal app project in their sample code that helps with creating notifications, it uses nice interfaces and classes to create the notifications.
I took their help classes from the sample, compiled and uploaded it as a Nuget package to make it simple to do notifications.

Right click on the solution then choose “Manage Nuget packages for solution”

Search for NotificationsExtensions.UniversalApps, press install.

image

You need to make sure you add the package to both the Windows phone and the Windows Store project (you don’t need to add it to the shared project).

To be able to do notifications you also need to enable Toasts, open edit Package.appxmanifest in the Windows phone and Windows 8 project and set Toast capable to “yes”.

image

Now you are good to go!

Microsoft has made the tiles and toast templates available on both platforms (Awesome!), they may look a bit different, see links in each blog post:
Live Tiles

Toasts

 

Recources

Microsofts code sample:

http://code.msdn.microsoft.com/Alarm-toast-notifications-fe81fc74#content

Nuget version

https://www.nuget.org/packages/NotificationsExtensions.UniversalApps/

Download all the videos from Build 2014

2014-04-06 04:51:00 +0000

Build 2014 was packed with announcements and fun stuff.
Still have a lot of videos to watch =)

Here is an updated version of my script I previously blogged about here.

cd "d:\build14"

$pattern = "[{0},\:,\']" -f ([Regex]::Escape([String][System.IO.Path]::GetInvalidPathChars()))             
$pattern
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$a = ([xml](new-object net.webclient).downloadstring("http://s.ch9.ms/Events/Build/2014/RSS/mp4high"))
$a.rss.channel.item | foreach{ 
    $url = New-Object System.Uri($_.enclosure.url)
    $file = [Regex]::Replace($_.Title + " " + $url.Segments[-1] , $pattern, ' ')
    $file
    if (!(test-path $file))
    {
            (New-Object System.Net.WebClient).DownloadFile($url, $file)
    }
}

 

Just copy the code, paste it into a file called “Build2014.ps1”, create a directory (in my case “d:\Build14”) and change the path in the first line of the script.

Right click on the file and choose run with PowerShell.

 

In case you get a problem similar like “Build2014.ps1 cannot be loaded because running scripts is disabled on this system.”

Start PowerShell as an administrator and run “set-executionpolicy unrestricted”, this is probably a bad thing to do for security.


Using RC API on Windows Phone

2014-01-12 01:51:00 +0000

This is a short blog post on how to get RC API working on your Windows Phone Device.

Setup

Download RCAPI from Nuget

image

 

Capabilities

To be able to communicate thru Bluetooth you need to enable ID_CAP_Proximity.

Open WMAppManifest.xml and make sure ID_CAP_Proximity is ticked.

  image

 

Pair with the device

Open Settings, Bluetooth and pair the phone with your device.

 

The Car

Instantiate the car and you are good to go, the car class connects to the correct Bluetooth device automagically.

Ferrari458Italia ferrari = new Ferrari458Italia();

To start sending commands to the car you need to call the ConnectAsync method and call the Start method.

await ferrari.ConnectAsync();
ferrari.Start();

 

Controlling steering and speed

There are two properties controlling speed and steering.

Steering is –1 to 1 (left to right) and speed –1 to 1 (backward to forward).

In the sample projects I have used the Virtual Joystick project available on Codeplex for speed and steering.

 

Controlling the lights

The lights are exposed through properties, to turn the light on use:

ferrari.HeadLightOn = true;

The lights available on the Ferrari 458 Italia is Headlights,blinkers (left and right) and break.

To get the lights to blink it is possible to supply an array with a light enum so if you want the blinkers to blink left

ferrari.LightSequence = new byte[] { (byte)LightEnum.LeftBlinker, 0 };

To get a more fun blinking sequence you might want to try something like this

ferrari.LightSequence = new byte[] { (byte)LightEnum.Head, (byte)LightEnum.RightBlinker, (byte)LightEnum.Break, (byte)LightEnum.LeftBlinker };

 

Trimmer

Trimmer property makes it possible to adjust the wheel orientation 0 to 15 and 8 is straight forward.

RC API now available

2014-01-12 01:08:00 +0000

Backstory

For Christmas 2 years ago my mother-in-law got me a Silverlit Bluetooth car.

Sadly it was a MFI device (Made for iPhone) and it seems to be more or less impossible to connect to an MFI-device without an iPhone (if someone has more info on this please let me know).

After talking to Silverlit, trying to convince them to share the protocol I got a Silverlit Ferrari 458 Italia (for android) and managed to figure out how the protocol worked.

RC API is an open source project on Codeplex which currently support controlling the Silverlit Ferrari 458 Italia from Windows 8.1 and Windows phone 8.

 

How to use

Windows 8.1

Windows phone

 

The future

I hope to be able to add more veichles and helicopters to the API, please let me know (or contribute) what you want me too add =D


If you are an RC device manufacturer and would like to include your device in the API, please let me know and I’ll make it happen.
Making the API I have used inspiration from the Lego EV3 codeplex project, I liked how they solved Bluetooth communication and I decided to do it basically the same way.

Source code for RC API is available on Codeplex and also available as a nuget package.

 

Let’s bring more gadgets and RC-stuff to the Windows platforms =D

2013

Developer Christmas list

2013-12-06 00:54:00 +0000

Here is my take on what is the most exciting products for the 2013 Christmas.
Some are available and some will be available early 2014, I mention these cause they are so awesome it could be worth the wait.
For those who know me, wait isn't what I do best so I feel your pain and I am sorry, I just had to include them.

 

Lumia 1520

6” Screen, 20 MP camera, enough said =)

http://www.nokia.com/global/products/phone/lumia1520/

 

Xbox One

If you live in a country that gets the Xbox One in the first batch, I guess it won't be on any Christmas list cause you already should have bought it :D
For those (like me) who live in a country that is not included in the first batch there might still be time to import one :)


Lego Mindstorms EV3

There is no age restrictions for Lego, this is a really awesome product.
It has motors, sensors and you can build almost anything.
The best part is that there is a .net library so you can build your own apps.

LEGO.com Mindstorms

http://legoev3.codeplex.com/

Raspberry Pi

A micro computer that runs Linux. It has everything you might need, Ethernet, hdmi, USB, audio and controllable pins you can use to connect to other things.
Since it runs on Linux, Mono can be used to develop for it.

http://www.raspberrypi.org/


Agent Smartwatch

A wristwatch capable of running .net Micro framework code (how awesome is that?), much like the S.P.O.T watch back in the day.
As far as I understand they won't ship until after Christmas bit there is an SDK already available so start coding :)

http://agentwatches.com/


.NET Gadgeteer

Speaking of .NET micro framework, this is a fast prototyping kit, that makes building basically any electronics really easy.
It has standardized connectors that means you don't have to know any electronics. It is really simple to get going.

https://www.ghielectronics.com/catalog/category/265


Myo

A gesture controlled arm and, you can control your electronics by using gestures.
Becoming a Jedi is no longer a dream.
I have no idea how the development environment looks like, still want one.

https://www.thalmic.com/en/myo/


Nymi

It can use unique cardiac rhythm to authenticate your identity, allowing you to wirelessly take control of your computer, your smartphone, your car and so much more.

http://www.getnymi.com/


Kinect 2 for Windows

The new Kinect is even more sensitive than the first generation, it can even read your heartbeat *mind blown*.
I think wearable tech is the next big thing, but lets face it, tech you don't even have to wear is even cooler.

http://www.microsoft.com/en-us/kinectforwindows/ (this is still the old one)

 

Leap Motion

All devices that makes it possible to control your computer is always fun.
The leap motion can track your fingers and also other objects like pens and such.

https://www.leapmotion.com/


Anki

This is a racing track that connects to your iOS device (iPhone/iPad) using Bluetooth, the cars will drive around that track themselves but you control speed, lane and weapons. Yes weapons.
Real cars and real track but software shields and weapons *bummer*.
All the logic is in the iOS app and you can "upgrade" the cars with shields and new weapons.
If you shoot a car it will derail.
Very cool stuff so if you have an iPhone or iPad this is probably the must by Christmas gift this year.

http://anki.com/

 

If you don't find anything on the list or if you have a husband or wife that share my love for not waiting (eg already have or have ordered most of this stuff) you might consider printing your own.


3D Printer

There are many 3D printer out there. I like the cube 2, it is small and so is (sadly) the printing size. But it is large enough, the alternatives (having a reeeeally large one) isn't that appealing.
If you have trouble convincing your wife about a 3D printer, show her that it is possible to print chocolate :P
Besides that, Windows 8.1 has build in support for 3D Printers.

http://cubify.com/

http://makerbot.com/

Building your own Lego Mindstorms EV3 Windows Phone app

2013-11-20 19:14:00 +0000

I just love gadgets, especially those I can develop for.

I recently got the Lego Mindstorms EV3-kit and of course I wanted to make a Windows Phone app to control it =D.
Here is a tutorial on how to make your own.

The basics

The EV3 has 2 different types of ports, motors and sensors.
Motor ports are A, B, C and D, Sensor ports are 1, 2, 3 and 4.

Check the firmware

To be able to use the API you need to have a firmware version >= 1.03, You can check the version on the brick from the Settings tab-> Brick Info –> Brick FW
To update the firmware run “LEGO MINDSTORMS EV3 Home Edition” and choose Tools –> Firmware Update

image

Enable Bluetooth

To be able to connect to the brick you need to enable Bluetooth you can do that on the brick from the Settings tab-> Bluetooth.
Enable Visibility and Bluetooth.

Pair with the brick

Pair your phone with the brick by going to Settings –> Bluetooth tap on “EV3”, the brick will now ask Ii f its ok to pair and then show a pin code.
Accept the default pin “1234” and enter it on the phone.

We are now all set up to start coding.

I have a Nokia Lumia 920 that I got from //Build, I can’t connect to the brick using that one, it might be a problem with all Lumia 920 developer phone (please let me know).
Luckily I also have a retail Lumia 920 and I have tested this code on a Lumia 1020, 720, 920 and HTC 8X and it works great (just not the //Build one).

Start a new project

image

 

Right click on references and click Manage Nuget packages

Search for "EV3”

image

Click install on “Lego Mindstorms EV3 API”


Enable Bluetooth by opening Properties/WMAppManifest.xml
Enable the capability ID_CAP_PROXIMITY

image

 

The API has the ability to connect to the EV3 by Wi-Fi, Bluetooth and USB for this project I will focus on Bluetooth only.

In MainPage.xaml
Create a button named “ConnectButton” and give it the text “Connect”
Create a button named “MotorAForwardButton” and give it the text “Motor A forward”
Create a button named “MotorStopButton” and give it the text “Stop”

Double click on each button to create the event handler in the code behind.

In MailPage.Xaml.cs att the following code:

private Brick brick;
private async void ConnectButton_Click(object sender, RoutedEventArgs e)
{
    brick = new Brick(new BluetoothCommunication(), true);
    await brick.ConnectAsync();
}

private void MotorAForwardButton_Click(object sender, RoutedEventArgs e)
{
    brick.DirectCommand.TurnMotorAtPowerAsync(OutputPort.A, 50);
}
        
private void StopStopButton_Click(object sender, RoutedEventArgs e)
{
    brick.DirectCommand.StopMotorAsync(OutputPort.All, false);
}

protected override void OnNavigatedFrom(NavigationEventArgs e)
{
    brick.Disconnect();
    base.OnNavigatedFrom(e);
}

 

I have kept this sample really simple so you can get a quick start.
You should always add error handling and you should disable the buttons unless you already connected and so on.
This is just to get you started.
I realize that this sample isn’t that exciting, but now we know how to control motors, time to kick things into gear and build some fun stuff =D

Related links

https://legoev3.codeplex.com/
The site for the EV3 API, with video instructions

http://www.lego.com/en-us/mindstorms/downloads/software/ddsoftwaredownload/download-software/
Download for LEGO MINDSTORMS EV3 Home Edition

Controlling a Bluetooth car with a Windows Phone

2013-11-13 21:58:00 +0000

Last Christmas my mother-in-law gave me a Bluetooth controlled car.
These kind of gifts are the best for a developer like me, its a toy/gadget and there is no app for Windows Phone which means I just got a gadget AND a development project.
I have been in contact with Silverlit (the company that manufacture the car) who sadly decided not to take my offer of developing their app/API for free, and also didn't supply me with any details regarding the protocol (I guess they where short of resources).

 

Challenge accepted.

 

After a couple of weeks I managed to figure out the protocol Open-mouthed smile.
Now I have an API for the car ready but I would like Silverlits permission to release it before I do so.
I am also working on making the API available for Windows 8.1.

 

</param></embed>
Me contorolling a Silverlit Ferrari 458 Italia with my Windows Phone

 

Currently Silverlit isn't returning my emails, not sure why (could be that the contacts I had doesn't work there anymore).
If you know a good contact at Silverlit please let me know, I really would like to release this API so that more developers will be able to develop for this BT car because it is really awesome.

download all videos from build 2013

2013-07-08 11:37:00 +0000

I’m currently watching all the videos from Build 2013 to be able to create a blog post with the best sessions from build.

If you also would like to watch all the videos here is a simple PowerShell script I found at Michael Crump’s blog with a small modification to get 2013 videos instead of 2011 and added more descriptive names.

 

cd "e:\build13"

$pattern = "[{0},\:,\']" -f ([Regex]::Escape([String][System.IO.Path]::GetInvalidPathChars()))             
$pattern
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$a = ([xml](new-object net.webclient).downloadstring("http://channel9.msdn.com/Events/Build/2013/RSS/wmvhigh"))
$a.rss.channel.item | foreach{ 
    $url = New-Object System.Uri($_.enclosure.url)
    $file = [Regex]::Replace($_.Title + " " + $url.Segments[-1] , $pattern, ' ')
    $file
    if (!(test-path $file))
    {
            (New-Object System.Net.WebClient).DownloadFile($url, $file)
    }
}

 

Just copy the code, paste it into a file called “Build2013.ps1”, create a directory (in my case “E:\Build13”) and change the path in the first line of the script.

Right click on the file and choose run with PowerShell.

 

In case you get a problem similar like “Build2013.ps1 cannot be loaded because running scripts is disabled on this system.”

Start PowerShell as an administrator and run “set-executionpolicy unrestricted”, this is probably a bad thing to do for security.

Build 2013 Day one

2013-06-27 22:53:00 +0000

What an awesome day!

A preview of Windows 8.1 is available for download and as if that isn’t awesome enough a preview of Visual Studio 2013 is also available.

 

At the keynote they showed the Windows Store version of outlook with social and newsletter filtering among other things.

Bing will be more integrated in Windows 8.1, in Sweden Bing isn’t that good, but as a visitor in the states I quickly realized that Bing is really good.

Sweden is still missing a lot of data.

When you search in Windows 8.1 you will get results from all the places, including web results.

 

Xbox Music has a new make over focused on playing music instead of discoverability and they showed off a function where you can share a web page to Xbox Music and it will parse the page and create a play list.

 

One of the biggest things here is 3d printing, Windows 8.1 has native support for 3D printing, its is just as simple as printing a piece of paper.

There are loads of 3D printers on display and they will start selling 3D printers in Microsofts stores soon.

I just wish Sweden will get one soon =D

 

Bluetooth is now available to developers (in windows 8.1) that means we have the opportunity to talk to all kinds of devices. I have really waited for that, going to be so fun to test how it works.

There are a couple of sessions at Build covering device communication I will try to catch them all.

 

Bing is brining a whole lot of APIs for searching, maps and much more.

 

The keynote ends with showing off Project Spark, a game development tool that makes it really easy to develop games.

 

Can’t wait for what day two will bring =)

Build 2013 – registration day

2013-06-25 16:18:00 +0000

The time is 6:30 a.m. still a bit jet lagged I guess, but lets be honest this kind of jet lag is good =D.

Waking up early and feeling great, I just love going to the states.

 

Today is registration day, still nothing revealed about the schedule, I hope we can rename this day as scheduling day after the registration, would be great to have some time to make plans.

 

Yesterday was a great day in San Francisco, we went down to Pier 39, took a couple of pictures of Alcatraz and a foggy Golden gate bridge.

 

Pier39_stitch

http://photosynth.net/view.aspx?cid=8ce83ae9-6065-4b65-a206-dd8005c7699d

 

Then we went to 7D experience, if you visit San Francisco you really should go there.

http://7dexperience.com/

Motion seats, wind, 3D AND shooting, pure awesomeness.

 

We also visited the arcade (next to the 7D Experience) my arm is a bit tender today after a tough shuffle puck game  full out war with @pihlen.

changing the cover on a Nokia Lumia 920

2013-06-02 22:53:00 +0000

I've been drooling over a yellow Nokia Lumia 920 for a while now, but since I already have two (one from Build 2012 and one from a contest) it was a bit hard to motivate another one =D.

After reading an article on WPCentral I decided to change the cover myself.

 

I bought a cover on ebay that includes the tools I needed to open the phone.

 

Opening the phone turned out not to be quite as simple as in this tear down video (You don’t have to do everything in the video).
Remove the Sim card tray.
Remove the screws at the bottom of the phone and bend in the corners, then carefully run you nail or plastic tool  along the sides of the phone to release the snaps.

 

The really scary part is when you need to move the charging coils from one cover on to the other.

It is glued to the cover so remove it very very carefully! One trick you can try is to use a hairdryer to loosen the glue (as mentioned in the guide, see link below, I’m not sure if it actually helped or not).

Same thing goes for the headphone jack.

 

When my phone was done I noticed that my power button was hard to press, and since I use that button quite a lot I decided to take the buttons from my old cover and put them into my new.

The plastic piece holding the buttons in place was glued with glue a from hell so it took me and my screwdriver quite some time to get the plastic piece off.

 

WP_20130602_010

Again be careful so you don’t break anything.

 

Here are a couple of blurry pictures..

I’m a developer, light hurt my eyes Blinkar

 

 

WP_20130602_001WP_20130602_002

 

WP_20130602_004WP_20130602_008

 

Check out these links

Lumia 920 Tear down

Lumia 920 black to yellow conversion

New covers on Ebay

 

Please note that changing cover like this will void your warranty!

 

Let me know how it goes =D

2012

Windows Phone 8 SDK IPv4 Problem

2012-10-31 12:40:00 +0000

I ran into trouble the first time i launched the emulator.

“Xde could'nt find an IPv4 address for the host machine”

In my case the problem was: I had a Cisco VPN network adapter that was disconnected (since I wasn’t connected to a VPN at the time).

Uninstalling Cisco VPN solved the issue for me (and another guy that had the same problem).

 

Hope this helps anyone running into the same problem.

2011

Testing the Nuance speech kit

2011-10-17 00:10:00 +0000

Nuance recently released a windows phone 7 SDK for their text to speech and dictation services.

I have been looking for some kind of text to speech that can handle Swedish and also being able to control things with voice commands in Swedish.

I noticed that Nuance supported that so I decided to sign up as a developer.

Windows Phone 7 already supports TTS for reading sms and also some voice control for searching and opening applications but only support the major languages (Swedish not included).

I have an application idea for the Swedish market that could use voice control (no I’m not saying what it is Ler med tungan ute ).

The SDK includes some sample code that makes it easy to get started.

What I didn’t find anywhere was instructions on how to get this working for languages other than English, and I couldn’t read the help files for some reason.

 

So here is what you need to do:

For dictation support: Replace all the _oemconfig.defaultLanguage() with a string containing your preferred language (sv_SE for Swedish).

For TTS: Add a voice that supports your language (Alva for Swedish)

That is it, now you can play with the app.

I think it works ok, but not as good as I hoped.

 

NDEV Mobile

http://dragonmobile.nuancemobiledeveloper.com/public/index.php

 

Voices (this page is for another product but seems to be the same as the Mobile SDK

http://www.nuance.com/vocalizer5/languages/

The Wp7 Motion api part 2

2011-09-30 17:19:00 +0000

What does the Motion API do?


Well basically it combines the different sensors into one sensor.

 

Accelerometer + Gyroscope
The accelerometer can tell the orientation of the phone by measuring the gravitational forces.
The gyroscope measures the changes in the orientation which means when you start the gyro it won’t be able to tell you what orientation the phone has but it can tell when and how much the orientation changes.
The motion API combines these two values to get the phone's orientation with the accelerometers and uses that as a baseline and then adjust these values with changes from the Gyroscope.
The gyro has a tendency to drift over time so the accelerometer will be used to adjust the gyroscope from time to time.

 

Compass + Gyroscope
The compass is a slow sensor and is used the same way as the accelerometer as a baseline for the gyro.

The Motion API uses the compass to get the heading (North) and then uses the gyro changes to adjust the bearing.
Since the gyro has a tendency to drift (as I mentioned before) the compass will be used to adjust these values over time.

The compass is also very sensitive to magnetic fields and jumps around a lot, the gyro will smooth these readings out.

 

The gyro do not contribute with any “new” values, the accelerometer and compass will do just fine when it come to retrieving the phone's orientation and which way it is facing however it will speed up these readings and make them a whole lot smoother.

The gyro is also more precise for smaller movements.

 

I’m definitely seeing to that my next phone will have a gyroscope, it makes the augmented reality experience a whole lot better.

How to use BingMapsDirectionsTask

2011-09-30 17:04:00 +0000

Mango introduces a new way to show directions called BingMapsDirectionsTask.

The usage is very simple:

 

using Microsoft.Phone.Tasks;


BingMapsDirectionsTask directions = new BingMapsDirectionsTask();
directions.Start= new LabeledMapLocation("start",new System.Device.Location.GeoCoordinate(59.3362,18.0710);
directions.End = new LabeledMapLocation("stop",new System.Device.Location.GeoCoordinate(59.3360, 18.0679);
directions.Show();

Quite simple huh? But there is a catch, the above code won’t work if you are using a regions format that uses comma instead of dot as a decimal separator.
Swedish is one of those. I have tried some different ways of solving that by doing a reverse geocoding with the bing services but it didn’t help.
I haven’t done a deep analysis of this but what I think happens is that the BingMapsDirectionsTask wont recognize the GeoCoordinates as a correct point and then uses the text I have supplied (in this case "start" and "stop") to try to find the address instead. But in this demo I don’t have the correct address, and IF I did it wouldn’t understand the special character of the swedish language (åäö) which will result in a box asking which address is the correct one, even though I know the correct GPS coordinates.

I don’t want to ask the user, the user won't know.
My guess is that Microsoft will fix this soon, but perhaps not in Mango when it releases.

What can we do? There is a quite simple solution to solve this. Before you call the directions.Show() you can set the current culture to en-US and set it back.
This is how I solved it:

string realCulture = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
try
{
       BingMapsDirectionsTask directions = new BingMapsDirectionsTask();
    directions.Start= new new LabeledMapLocation("start",new System.Device.Location.GeoCoordinate(59.3362,18.0710);     directions.End = new LabeledMapLocation("stop",new System.Device.Location.GeoCoordinate(59.3360, 18.0679);
    Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
    directions.Show();
}
catch { }
finally
{
    Thread.CurrentThread.CurrentCulture = new CultureInfo(realCulture);
}

It will however still have problems with Swedish characters in LabeledMapLocation labels so you might want to avoid to supply special characters. In this particular case the important thing to me is that the direction task is working.

 

The Wp7 Motion api part 1

2011-08-29 23:35:00 +0000

Augmented reality has really caught my eye, I just love how the computer generated items interact with the real world.

I have played with the SLAR toolkit which is a really awesome library, but its a little bit limited in what it can do since you need a marker to get it to work.

 

How about augmented reality without markers?
In mango, developers are given access to two necessary components to make augmented reality a ehm.. reality.

Raw camera access (So we can show what the camera sees)
Compass (access to the compass)

With mango we also get a new sensor, the gyroscope (optional on mango phones).

 

When I first tried using the compass it didn’t work, that’s because I was running the Mango Beta supplied by Microsoft.

The drivers for the compass is not included in that build, it is supplied by the phone manufacturer later on in the process.

 

Let’s go through the available sensors


Accelerometer

An accelerometer measures acceleration forces. These could be static like measuring the constant pulling of gravity or more dynamic like moving (sudden starts and stops) or vibrating the accelerometer.

The normal use for an accelerometer is sensing if the phone is tilted (portrait or landscape) but can also be uses for example in games to steer something.

This sensor is available on all devices (including pre mango)

 

Compass

A compass (or magnetometer) measures the strength and/or direction of magnetic fields.

Using the compass we can get our bearing relative to the geographic north.

Keep in mind that the Earths magnetic field are relatively weak and the compass will be easily manipulated by other fields.

To test an app using the compass I would advice you to go outside, inside there is much disturbance (in the force.. oh I mean … the magnetic fields).

The compass is optional in phones.

 

Gyroscope

The gyroscope measures orientation changes, it will give you a more accurate measurement of how your device orientation has changed.

The gyro does not depend on gravity like the accelerometer, and unlike the accelerometer it will enable us to measure for example if you rotate your phone while placed on a flat surface.

Optional on Mango phones and missing on pre-mango.

 

 

So how do we use this?

Microsoft has provided us with the Motion API which takes the available sensors and some magic to help us get more accurate and faster readings.

For the Motion API to be enabled you need at least Accelerometer and Compass (so you will be able to use it on pre-mango devices \o/ ).

 

Here is my first video of an augmented reality app.
Its based on the code provided in the videos below in the resources section.

I also added a semi-transparent Bing map on top that the user can show or hide.

 

 

 

The videos below does a really good job describing how the Motion API works so I won’t get into any details for now.

 

Resources
Great  video explaining how things work
http://vimeo.com/27378156

Another great video to get started with augmented reality (with source code)

http://vimeo.com/27377090

Augmented reality zx spectrum part 2

2011-07-21 00:34:00 +0000

In my last augmented reality demo I showed a 3d model of a ZX Spectrum that appeared on a marker.

I got a few request on sharing the source so I cleaned up the code a little bit and posted the source for a version of that demo.

But let’s face it a 3d model on a piece of paper is cool but is there a way to make it even more exciting?

As you may or may not know I’m working on a ZX Spectrum emulator for Windows phone 7 and my goal is to have it ready very close to the mango release.

Perhaps integrate the two? How about an augmented reality ZX Spectrum emulator?

 

 
Short video

 

What amazes me is the performance of these phones, I have the Samsung Omnia 7 and it manages detecting the marker, showing the camera feed, rendering the 3d model and emulating a ZX Spectrum with sound and all at 25 fps.

I’m really impressed, imagine what we can do with compass and gyro.

Augmented Reality demo with Silverlight/XNA

2011-07-12 21:46:00 +0000

Got a question if I was willing to share the code for my augmented reality app.

There are some samples out there but they’re often trying to show off how insanely cool augmented reality is and has loads of code that can be hard to get thru and understand.

I don’t think I need to explain the code in this post, I have commented in the code, I hope it will be easy to understand.

In my app I used a Silverlight / XNA combination, that is probably a bit overkill only for this but for those not familiar to XNA it might be easier to read so I’ll go with the same approach here.

You’ll need to download the source code from codeplex for SLARToolkit since the current release doesn’t include everything you need.

For simplicity my sample code also includes the necessary SLARToolkit code (at the time of writing this Changeset 67779).

 

 

There is something wrong when navigating from the game page and then back again, haven't been able to find what yet, if you have any suggestions please send me an email.

 

If you have any suggestions on how to make the code better again please contact me I love to learn new things =)

 

AugmentedRealityDemo.zip (2.34 mb)

Augmented reality zx spectrum

2011-07-10 22:27:00 +0000

With the release of Mango, the new OS upgrade for Windows Phone 7, it will be possible to create augmented reality applications.

Sadly the beta version of the mango update doesn’t have drivers for the compass which kind of spoils most of the plans I had for augmented reality applications.

Then I realised maybe I could do something with the SLARToolkit. All the samples I could find used Silverlight (not a big surprise right?) no samples used the new XNA + Silverlight combination available in Windows Phone 7 so I decided to give it a try.

Since I’m working on a ZX Spectrum Emulator for Windows Phone 7 I used a ZX Spectrum 3d model that I made a couple of years ago (maybe this feature will make it in to the emulator =) ).

 

I’m not an XNA superstar and this project really showed me that I need to read more About Matrix Ler med tungan ute

 

I’ll blog later with some code samples.

translating an application bar in wp7

2011-04-11 21:31:00 +0000

When using the Applicationbar in WP7 I noticed that it can’t be translated like all the other controls.

Therefore I built a simple helper class to help with the translations.

The usage is simple, just add the translations in a resource file (like you normally would) and then set the text property on the buttons or menu items to the name in the resource file.
Change the access modifier to public.

The Resources:

image


The xaml:

image

 

Now in the page loaded event add:
ApplicationBarHelper
.LocalizeAppBar(new  AppResource (), ApplicationBar);


Your application bar will now be automagically translated.


Update 2011-09-30
Found a small bug where “No Translation” was shown the second time the page was shown (and the translation was already done).
I have updated the sample code to fix that problem.

AppbarHelperSample.zip (79.13 kb)

2010

Using unlocked phone from Tre and mms

2010-12-14 22:01:00 +0000

Update: Samsung just released an update for there network tool, read more here.

 

I bought a Samsung Omnia 7 from TRE in Sweden, after unlocking the phone (Since I have a work phone I couldn’t switch to TRE) I couldn’t get MMS to work.

TRE had somehow locked the ability to change Network profile and the application supplied by Samsung didn’t do the trick.

Next Best Geek has finally found a solution, an application that can solve the problem (I have tested and it works).

However you’ll need a developer licence to be able to deploy the application.

 

Read more here

 

To install the application use “Application Deployment” (From the Windows Phone SDK) point to the file and deploy it to your phone.

 

image

Comparison chart of Windows Phones to be released in Sweden

2010-10-20 11:24:00 +0000

 I still haven't decided what Windows Phone 7 to get and I couldn't find a simple comparison chart so I whipped one together.
Sadly it didn't help me, I still can't decide :P

 

  HTC Mozart HTC Trophy Samsung Omnia 7 LG Optimus 7
Screen size 3,7" 3,8" 4" 3,8"
Processor 1GHz Qualcomm QSD8250 1GHz Qualcomm QSD8250 1GHz Qualcomm QSD8250 1GHz Qualcomm QSD8650
Sceen type S-LCD  S-LCD  AMOLED TFT 
Memory 8 GB 8GB 8GB / 16GB 16GB
Camera 8MP 5MP 5MP 5MP
Flash Xenon flash LED flash LED flash LED flash
Video 720p 720p 720p@25fps 720p@24fps
Auto Focus Yes Yes Yes Yes
Weight (in grams) 130 140 138 ??
Resolution 800x480 800x480 800x480 800x480
Talk time 2G (min) 405 405 520 ??
Talk time 3G (min) 330 330 370 ??
Stand by 2G (hours) 435 435 390 ??
Stand by 3G (hours) 360 360 330 ??
Battery 1300 mAh 1300 mAh 1500 mAh 1500 mAh
Augmented reality No No No Yes
DLNA
No No No Yes
Sound Dolby Mobile, SRS Surround Sound Dolby Mobile, SRS Surround Sound    

Update: Here is a great comparison of all phones

ZX Spectrum emulator för Windows Phone Series 7

2010-03-20 19:00:00 +0000

Det har vart en tung vecka de senaste 9 dagarna har jag jobbat >110h så mängden fritid har varit hyfsat begränsad.
Den 15 mars så lanserades en CTP av Windows Phone 7 SDK:n och jag var tvungen att jobba över :S
När jag väl var hemma (kl 01:30) så frågade min fru mig:
-Varför är du fortfartfarande vaken?
-Det är en grej jag måste fixa bara
-Jobbar du nu!?
-Nääe?
-Det låter som du ljuger?
-Nääe .. asså ehm
-Vad är det annars du “måste” göra?
-asså… Windows Mobile 7 SDK:n släpptes idag så jag måste testa.
-Du är ju helt sjuk i huvudet ! *skrattandes*

När XNA för Xbox 360 annonserades så skaffade jag mig en licens och byggde en ZX Spectrum emulator från grunden.
Tyvärr kunde man inte generera egna ljud så den blev aldrig helt klar och licensen löpte ut.
När vi kom hem från bröllopsresa i Vegas så testkörde jag den på min nyinköpta Zune vilket fungerade utmärkt (även om det gick lite långsamt).
Nu när XNA för Windows Phone 7 annonserades så var det ju bara att sätta igång och testa =)

Just nu går den väldigt långsamt men då är koden optimerad för Xbox 360 (jag ville ha så läsbar kod som möjligt inte nödvändigtvis snabb och att den skulle vara utbyggbar).
Jag hoppas på att det går att optimera en del och att telefonhårdvaran kommer fungera bättre än emulatorn.

spectrum1

spectrum2