How to delete saved data on your UWP application

During development is often useful to delete the saved data. Here are a couple ways you can accomplish this task:

  • You can try to uninstall your app and reinstall it

Another alternative is:

  • Go to %localappdata%\Packages\<packageID>
    • Note: “%localappdata%” is “%USERPROFILE%\AppData\Local”. For example c:\users\rick\AppData\Local
  • Search closely for your file names under LocalState/RoamingState and delete them. Double check that other folders don’t have your files either.


How to setup your UWP project with Jenkins

Follow these steps to automatically pull your UWP project via Git using Jenkins:

  1. Install Jenkins
  2. In Jenkins (usually http://localhost:8080/ ), create a new item and select Freestyle Project
  3. Once created, in the projects configuration page scroll down to build and click on Add build step -> Execute Windows batch command
  4. Enter the following:
    call “C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat”
    msbuild C:\projects\sample\sample.jsproj /t:Clean;Rebuild /p:Configuration=Release
  5. Notes:
    1. The first line is assuming you installed VS 2015 in the default folder.
    2. If you want to compile the whole solution just target the .sln instead of the project in the second line
    3. If you want to target a specific platform, just add “;Platform=x86” (without quotes) in the second line
  6. Click Save
  7. You should be able to run the project by clicking Build now

Jenkins comes with support for source control systems such as CVS or SVN (Subversion). If you want/need Git support you’ll need to install a plugin. Here are the steps add Git integration:

  1. Go to Manage Jenkins
  2. Click on Manage Plugins
  3. Click on Available and search for Git
  4. Install the GitHub plugin
  5. After installing go to Manage Jenkins and click on Configure System
  6. Scroll down until you see Git / Git Installations
  7. Enter your path to Git executable, could be something like: c:\program files (x86)\git\bin\git.exe
  8. Save your changes
  9. Go to your project configuration
  10. Scroll down until you see Source Code Management and select Git.
  11. Enter the repository URL
  12. Add your credentials
  13. Enter branch to build if necessary
  14. Scroll down to Build section and change the msbuild line to
    msbuild sample\sample.jsproj /t:Clean;Rebuild /p:Configuration=Release
  15. Notes:
    1. This is needed so that Jenkins uses the project downloaded from Git
    2. The folder where Jenkins does this work is in: C:\Program Files (x86)\Jenkins\jobs\[project name]\workspace

Every time you click build it will pull the code from Git and make a build.

How to setup Facebook and Google Apps to work with OAuth on UWP applications

Follow these steps to get OAuth working in Windows Store applications (UWP).


  1. Go to Windows Dev Center
  2. Create a new application
  3. Once in app overview click on “App management” -> “App identity
  4. Take note of the Package SID (starts with something like: S-1-15-2-more-numbers)
  5. Open the WebAuthenticationBroker sample from Windows 10 Samples on GitHub
  6. Right click on the project name and select “Store” -> “Associate App with the Store
  7. Follow the steps until you see the application created in your Windows Dev Center to associate it with the current project.
  8. Open scenario1.js and change line 43 where it reads: scope=read_stream to scope=public_profile,email (or any other set of properties you want to access.)
  9. Register as Facebook developer
  10. Create a new application
  11. Go to “Settings” and click “Add Platform” -> “Windows App
  12. In the Windows Store ID field enter the Package SID that you took note before (refer to step 4)
  13. Click “Save changes
  14. Click on “Advanced” – tabs on the top of the page
  15. In the “Client OAuth Settings” make sure that “Client OAuth Login” is checked as “Yes“.
  16. Click on “Teat Apps” on the side menu.
  17. Click on “Create a Test App” and create a test application with the name of your choice.
  18. Once in the dashboard of the newly created application take note of the “App ID“.
  19. Click on “Roles” in the side menu.
  20. Click on “Test Users” -> “Add” -> “Create Test Users“.
  21. In the “Test Users” section click on “Edit” -> “Change the name or password for this user” and enter a password of your choice.
  22. Take note of the Test User’s email and password.
  23. Return to Visual Studio and run the application.
  24. Enter the App ID (refer to step 18) in the “Facebook App ID” field.
  25. Enter ms-app://Package SID (refer to step 4 to get the package SID) on the “Callback URL” field.
  26. Click on “Launch“.
  27. Enter the Facebook’s test user email and password (refer to step 22).



  1. Go to Google Developers Console (
  2. Create a new project
  3. In the “Use Google APIs” section click on “Enable and manage APIs
  4. In the “Social APIs” section click on “Google+ API“.
  5. Click “Enable API“.
  6. Click “Credentials” in the side bar menu.
  7. Click “Add credentials” and then select “OAuth 2.0 client ID“.
  8. Click on “Configure consent screen“.
  9. Enter a product name and click “Save“.
  10. In the “Application type” select “Other” give it a name (e.g. “Windows Store App”) and click “Create“.
  11. Take note of the client ID.
  12. Go to Visual Studio and run the WebAuthenticationBroker application.
  13. Switch to the Google OAuth using the hamburger menu.
  14. Enter the Client ID (refer to step 11).
  15. Enter google credentials.


Note: If your project crashes around line 57:

if (Windows.Security.Authentication.Web.WebAuthenticationBroker.authenticateAndContinue)

on desktop or tablet make sure to change it to

if (Windows.Security.Authentication.Web.WebAuthenticationBroker.authenticateAndContinue &&
Windows.System.Profile.AnalyticsInfo.versionInfo.deviceFamily == "Windows.Mobile")

How to connect to Raspberry Pi 2 with Windows 10 IoT

To connect from your local PC to your Raspberry Pi 2 follow the next steps:

  • Check your Pi IP and/or computer name. (Default computer name is MINWINPC.)
  • Search for PowerShell in Windows and run it with administrative privileges.
  • Type: net start WinRM
  • Type: Set-Item WSMan:localhostClientTrustedHosts -Value MINWINPC
    • You may need to click “Y” to allow this change.
  • Type: Enter-PsSession -ComputerName MINWINPC -Credential MINWINPCAdministrator
  • Enter the password which is: p@ssw0rd

You’re now connected.

For more complete and detailed instructions follow:

How to install Windows 10 IoT on Raspberry Pi 2 without Windows 10

For those who want to install Windows 10 IoT but don’t want to install Windows 10 follow the steps below:

  • Insert the SD card where you want to install Windows 10 IoT
  • Format it to FAT32 if needed.
  • Download Windows 10 IoT
  • Unzip the downloaded ISO and you should see a file called Flash.ffu
  • Download the Windows 10 ADK at the end of this page:
  • Search for Windows Imaging and Configuration Designer in your installed programs and run it.
  • Where it says deploy (top left corner right under the title bar) click on the down arrow and select the device where you want to install Windows 10 IoT (either a USB drive where your SD card is or a removable drive if you have one in your computer.)
  • Click on deploy.
  • Select the Flash.ffu file you downloaded before and click open.
  • Click next.
  • Make sure the target disk is correct and click next.
  • Click Flash.

After a few minutes you should have Windows 10 IoT installed in your SD card and you can now try it on your Raspberry Pi 2.

Generating TypeScript documentation generation

There’s a great little tool called TypeDoc that allows us to generate html documentation based in our comments inside our TypeScript files similar to what JavaDoc does. To use this tool follow these steps:

  1. Install nodejs:
  2. Open command line and run nodejs by typing: node
  3. In the nodejs prompt install typedoc by typing: npm install –global typedoc
  4. Type: typedoc -t ES5 –out doc/ references.ts

This will compile all the documentation (classes, namespaces, functions, etc.) that can be referenced by the file references.ts and it will be put under the doc folder in the current directory where that command is ran.

It’s preferred to update your project’s documentation from time to time and TypeDoc has integration with tools like Grunt but if you want this to run after you create a build you can add this command to the post build events list of commands the way I’ve shown in the previous post. For example:

<Exec Command="typedoc -t ES5 --out &quot;$(ProjectDir)/doc/&quot; &quot;$(ProjectDir)/tsDec/references.ts&quot;" />

TypeDoc follows JavaDoc comment tags:

@param <param name> <description>
@returns <description>


* This is a function.
* @param arg This is the argument.
* @returns Returns a value.
function func(arg: text): string;

* This is a name.
var name:string = "a name";

You can also use the @preferred tag if you have different comments for the same thing (e.g. a module that is declared in different files and has different comments in both files or an interface and its class implementation) and you want to use a specific comment over the other as TypeDoc will use the first comment that it finds.

Adding pre and post build events in Visual Studio (Windows Store / JavaScript projects)

In Visual Studio you can add pre and post build events, basically these are commands that you can program to run before the build command executes and after it finishes building the solution configuration. To configure these you can easily go to Project -> Properties -> Build Events and write whatever commands you want to run in the Pre and post build events boxes. Of course that this is only true for C# or C++ projects. If you tried to do this in a Windows Store JavaScript application project you most likely noticed that these pre/post build events were missing. Not sure what was the reasoning behind it but I guess the folks at the VS team thought it would be a good idea. Anyway, you can still get access to these by editing you jsproj file and looking for:

<Target Name="BeforeBuild">
<Target Name="AfterBuild">

You’ll notice that there’s a whole section that is commented out with this comment:

To modify your build process, add your task inside one of the targets below then uncomment that target and the DisableFastUpToDateCheck PropertyGroup.
Other similar extension points exist, see Microsoft.Common.targets.

So you just need to follow the instructions and add a command inside one or both of the pre/post build event xml nodes. To add a simple copy a file named lib.dll from the output directory to your project directory after building you’d do something like:

<Target Name="AfterBuild">
  <Exec Command="copy &quot;$(OutDir)/lib.dll&quot; &quot;$(ProjectDir)/&quot;" />

Note: the &quot; is intentional so that the string gets quoted when it’s used by the copy command.

TypeScript declarations for Player Framework

– Are you programming in JavaScript?
– Yes.
– Are you using TypeScript?
– No.
– Please stop! Do yourself a favour and go learn TypeScript to use it in your project.

I’ve been programming JavaScript for Xbox One projects and since I saw a TypeScript session at Build 2014 that I was completely sold to it.

TypeScript is a language that is a superset of JavaScript compiling the result to plain JavaScript. It makes JavaScript development easier to manage by adding types, classes, modules and interfaces. And because it compiles to JavaScript, you don’t really need to have any TypeScript compiler to run a project.

What if you already have a big JavaScript project?
No problem, you just start slowly converting the code to TypeScript or you can create declarations (similar to a .h file for C/C++ projects) for your utility libraries that work just as well.

My TypeScript contribution to the world is a Player Framework (MMPPF) declaration file available at the DefinitelyTyped GitHub repository.

Enjoy and start using TypeScript!

Raspberry Pi Wifi dropping connection

Started playing with my Raspberry Pi this weekend and noticed that the wifi connection would not stay up for long when connected through SSH. After some digging online I found that the wifi was getting put in sleep mode. Here’s how to fix it:

  • Create a new file named 8192cu.conf at the following location /etc/modprobe.d/8192cu.conf
    sudo nano /etc/modprobe.d/8192cu.conf
  • Write the following command
    options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

    (This makes sure that the power management is turned off thus preventing the dongle from going to sleep mode.)

  • You can go further and ensure that the connection remains up and stable by sending a ping request from your Pi to the router using crontab:
    crontab -e

    (Adds a new entry to crontab.)

  • Enter the following at the end of the file:
    */1 * * * * ping -c 1

    (Change the to the IP of your router. The IP of the router can be found by opening a command prompt in Windows and running the ipconfig command and checking the number besides “default gateway“.)

If you don’t have a Edimax wifi dongle you may have to find how to disable the power management for your device.