Installing Bash on Windows


Why I am installing it.

As you can see from by the direction of my blog, I have been working on the command line a lot.

I will have to admit, for someone who was a GUI man, it was painful at first.  But now I am used to it.  In addition to just command line, I have been working with Linux quite a bit.  There comes a point where you want to use the same commands wherever you are so that you don’t have to remember two commands for one thing (one on windows and another on linux).

During the //Build 2016 keynote, Microsoft announced that we would have Bash on Windows 10.  This is not Bash running as a VM but these are native bash Linux binarys running on Windows via Ubuntu.  This means that all of the commands that I find myself running on Linux I can run on Windows so as my vocabulary (command line vocabulary that is) increases, I can use it everywhere.  Now, I have been kind of doing this using Cygwin, which is a command line utility for Win32, but it was not the same.

How do I install it

First of all, you have to be on Windows 10.  Next you will have to be a part of the Windows Insider Program.  Make sure you sign up using the same Microsoft ID you use to sign onto windows 10.  Next, you want to change your Windows Update settings.

Hit the Windows Key, Type “Windows Update”  and select Check for Updates from the list



Next, click on the Advanced Options link at the bottom.



Under Get Insider Builds select Get Started.



It will warn you as to what you are about to do.  Please read this because of course this is beta.



It will prompt you to restart your PC.

Once rebooted, you will need to set the builds to the “Fast Ring” in order to get Bash. You do this by sliding the slider all the way to the right. (In Update Advanced Options




Once you do this, you are on your way to using Bash on Windows.



Live Tiles in WP Mango

Ever since Windows Phone came out, I have always contended that Live tiles are the coolest feature and one that is :

1) Not on any other platform (Yes, I know that Android has widgets… not the same thing)

2) A great way to drive people into your application. (Which you want if it is add based.)


I will do another post later about why you should do Live Tiles from a Monetizing standpoint, but for this post, I just want to show you how easy it is to work with live tiles.


To begin with, live tiles have been around since 7.0 but to really take advantage of them you had to use Push Notifications.  While this is not THAT difficult, it did add quite a bit of complexity and the need to host your own service (or use scheduled tiles).  In the Mango release, we have made 4 great additions to live tiles.


1) You can change the live tiles from your code.

2) You can create secondary tiles to deep link into specific pages of your application

3) You can write on the back of tiles and have them flip

4) You can use background process to have them change when not even in your application


To create and modify live tile is fairly simple.

This firs thing we want to do is create a simple windows phone page that has three buttons on it:

  • Create App Tile
  • Create Second Tile
  • Delete Secondary Tile

Next we need to go to code behind and add a using statement for the phone shell.


using Microsoft.Phone.Shell;

Then inside the first button click we add the following code :


 private void button1_Click(object sender, RoutedEventArgs e)

            //Tile is always the first Tile, even if not pinned .
            ShellTile TileToFind = ShellTile.ActiveTiles.First();

            if (TileToFind != null)

                StandardTileData NewTileData = new StandardTileData();

                NewTileData.Title = "My Cool Tile";
                NewTileData.BackgroundImage = new Uri(
                    "CoolTile.jpg", UriKind.Relative);
                NewTileData.Count = 5;

                NewTileData.BackTitle = "Tiles Got Back";
                NewTileData.BackBackgroundImage = new Uri(
                    "CoolTileBack.jpg", UriKind.Relative);



  • The first thing we do is get a reference to the Live Tile that comes with your application. (TileToFind)
  • Once we have a reference to it we can create our new tile data using the StandardTileData class.
  • We set the properties including the image we want on the live tile (a 173 by 173 png or jpg… make sure that your image is set to “content” in your project or you will not see it)
  • Next we set the back of the tile
  • And finally call the update method to change the live tile.


That is all you need to do to change your live tile.

If you want to create a secondary tile, it is slightly different.


for the second button click event we do the following

private void button2_Click(object sender, RoutedEventArgs e)
            ShellTile SecondTile = ShellTile.ActiveTiles.FirstOrDefault(
                x => x.NavigationUri.ToString().Contains("Page2.xaml"));

            StandardTileData NewTileData;
            NewTileData = new StandardTileData();

            NewTileData.Title = "Secondary Tile";
            NewTileData.BackgroundImage = new Uri(
                "CoolTile.jpg", UriKind.Relative);
            NewTileData.Count = 5;
            NewTileData.BackTitle = "Second Tiles Got Back";
            NewTileData.BackBackgroundImage = new Uri(
                "CoolTileBack.jpg", UriKind.Relative);

            if (SecondTile == null)
                ShellTile.Create(new Uri(
                    "/Page2.xaml", UriKind.Relative), NewTileData);


There are a couple of noticeable change.  To find the secondary tile, we need to search for it since we are not guaranteed that it exists.  We do this by searching the ActiveTiles collection for the NavigationUri of the tile that we set lower in the event.  The only other change is creating the tile if it does not exist.  Otherwise we update it like before.

I have included all the code for the project HERE

If you want to run this code in the background so you can change the tile while users are not using the phone. You can check out my post on Background Agents



This work is licensed under a Creative Commons license.

WP7 Unleashed–Session II Hands On Labs

WP7 Unleashed Session I

WP7 Unleashed Session II

WP7 Unleashed Session III

This is Part 2 of a 3 part series on building a Windows Phone 7 application from scratch.  The goal of this series is to get you up to speed in Windows Phone 7 development.  This content can also be used to put on your own Windows Phone 7 Event.

Included in this series is

  • 3 Video Presentations
  • 3 Hands on laps (each build on the previous one)
  • Powerpoint Slides
  • Sample Code
  • The Completed Hands on labs exercises
  • Images and assets needed to complete the labs

This second session goes a little deeper into development for WP7 we discuss navigation, web services, the trial API and more.  Once you watch the video, move on to the second Hands on Labs. 


After watching the video, you can then move on to the HOLs Remember that these HOLs work together. You need to complete the Session I HOL to start on the Session II HOL

Download All Session II Hands on Labs and material here



WP7 Saving to Media Library

Update : My buddy Tim Heuer pointed out that when you are saving an image to the library, you need to make sure that you have the correct orientation.   Instead of repeating the information here, I will instead point you to his great blog post on the subject. GO HERE to check it out.


In the last post, we showed you how to capture a picture in your application when hooking to the ‘extras’ menu on windows phone.  Once you have manipulated the picture you will want to save it in the media library.  In this post we will walk you through the steps to do that.


Once you have made the changes to the picture you captured (Crop, Color, Black and White, whatever), you then want to save your image to IsolatedStorage.


To do this we first need to add a using statement to the top of our class file.


using System.IO.IsolatedStorage;


Remember in our last post we saved the image returned from the camera in a WriteableBitMap.  (see below code above //Save to Global Bitmap)


(This is the code from the last post –  We only added the last line)


MediaLibrary library = new MediaLibrary();
Picture picture = library.GetPictureFromToken(queryStrings["token"]);

//Create bitmap
BitmapImage bitmap = new BitmapImage();
WriteableBitmap picLibaryImage = new WriteableBitmap(bitmap);
retrievePic.Source = picLibaryImage;

//Save to Global Bitmap

App.CapturedImage = picLibaryImage;


We are going to continue this code by first adding it to a Global Variable placed inside App.xaml.cs called Captured Image

//Global variables for the WriteableBitmap objects used throughout the application.
public static WriteableBitmap CapturedImage;


Now that we have that saved globally, we want to first save the picture to IsolatedStorage THEN to the media library.  This would normally be done when an event is fired, like a user clicking a save button.


First save the image to isolated storage


//Create filename for JPEG in isolated storage
String tempJPEG = "TempJPEG.jpg";

//Create virtual store and file stream. Check for duplicate tempJPEG files.
var myStore = IsolatedStorageFile.GetUserStoreForApplication();
if (myStore.FileExists(tempJPEG))
IsolatedStorageFileStream myFileStream = myStore.CreateFile(tempJPEG);

//Encode the WriteableBitmap into JPEG stream and place into isolated storage.
Extensions.SaveJpeg(App.CapturedImage, myFileStream, App.CapturedImage.PixelWidth, App.CapturedImage.PixelHeight, 0, 85);

We then use the file we just saved to create a stream so we can save it to the media library


//Create a new file stream.
myFileStream = myStore.OpenFile(tempJPEG, FileMode.Open, FileAccess.Read);

//Add the JPEG file to the photos library on the device.
MediaLibrary library = new MediaLibrary();
Picture pic = library.SavePicture("SavedPicture.jpg", myFileStream);

And that’s all you need to do.


In the next post we will show you how to use the WPConnect.exe tool to Debug your application without using Zune.  This allows you to navigate to the pictures hub while still connected to Visual Studio.


Happy Coding – Daniel Egan – DotNetDoc

WP7 Minute Episode I : Hubs and Panorama

The Windows Phone 7 Minute is a show to discuss the features of the Windows Phone 7.  In the show we will talk about things that are important to both Consumers and Developers.  From Live Tiles, to Push Notifications, to cut-and paste, we will talk about the things that are important to you.  If you want a particular subject covered, please drop us a line.


Episode I : Hubs and Panoramas


In this episode, we discuss the difference between a hub and a panorama and what the benefits are of each.



What the heck are Live Tiles??

There has been a lot noise on twitter in the #wp7 and #wp7dev tags about the push notification app limit (Live Tiles) . If you want to read up on this limitation you can head over to Jamie Rodriguez’s blog here : 

In talking to people, I realized that those that did not have the phone yet, had no idea what Live Tiles were or why they should care.  So I created a short video to demonstrate what some of the developers are doing to create unique experiences for their applications on Windows Phone 7.


Enjoy Smile

Looking for some code??



If you are like me and are always on the lookout for good code samples then you will like this site.  The Microsoft All-In-One Code Framework is a free, centralized code sample library provided by the Microsoft Community team. Their goal is to provide typical code samples for all Microsoft development technologies.

They listens to developers’ pains in MSDN forums, social media and various developer communities, then write code samples based on developers’ frequently asked programming tasks, and allow developers to download them with a short code sample publishing cycle. Additionally, they offer an innovated free code sample request service.

There is already lots of code out there to use… Go Check it out.


Happy Coding

Daniel Egan

Working with WP7

The launch of the much anticipated Windows Phone7 (WP7) is just around the corner and with it will be the launch of the Windows Phone MarketPlace for WP7.  Now is the time to get the application you have been thinking about for years under way.  There is absolutely nothing stopping you. The tools are completely free and can be found here 


Starting next week I will begin a series of how-to blog posts/screen casts (depending on the amount of code) that will take you through everything you need to know to get started on WP7.  Among other things we will cover (Not necessarily in this order) :

  • The tools and environment
  • Working with the Emulator
  • Push Service \ Live Tiles
  • Location Based Services
  • Launchers and Choosers
  • The other Sensors (Accelerometer, Proximity,  Compass, etc..)
  • Multi-Touch
  • And More
  • Unlocking and Installing on the phone
  • Marketplace and Developer Resources

Start looking for these posts coming next week.  If you have a request for a post or a question you need answered feel free to post a comment or send me an email.

Happy Coding

Daniel Egan

Enhanced by Zemanta

Getting a Sense of Paris

ParisI have finally reached Paris. After 2 planes 15 hours, 3 naps, and a chicken dinner, we landed in Paris in the oui hours of the morning (6am to be exact).  We area staying in the 6th district near Notre Dame and on the way to our apartment, one of the funny things I noticed was how small the cars were, not an SUV in sight. This made a lot more sense once I saw the size of the street were were saying on ;)

When we finally reached our destination, we started getting settled in and when I popped open my laptop, I discovered that the Sensor and Location platform, or more specifically my IP location provider was able to determine I was in Paris and automatically changed my weather gadget to show me the local weather.   The sensor and location platform is one of the cool new things developers can use as part of Windows 7. Although it is very useful for gadgets, it can be used for any type of application that wants to be aware of its surroundings.  Go check it out, you will like it.

MSDN Event Win7 Multi-Touch, SketchFlow

A multitouch screen

Image via Wikipedia

Join me for one of the coolest things to come out of the dev community in quite a while. I will be doing a seminar on Windows 7 Multi-Touch, and SketchFlow.   You can see the Agenda below, but you will really want to see the MultiTouch and SketchFlow stuff.  See you there.


September 9, 2009

1:00 pm – 5:00 pm

Click here  to register

Event ID: 1032423014


Los Angeles
September 10, 2009

1:00 pm – 5:00 pm

Click here  to register

Event ID: 1032423015


San Diego
September 10, 2009

1:00 pm – 5:00 pm

Click here  to register

Event ID: 1032423016




MSDN Presents: The Next Generation Client Experience



Windows 7 for Developers (MULTI- Touch) = Cool ;)

Windows 7 is almost here! With it are numerous improvements and new features to take advantage of in your applications. Watch and learn as we demonstrate how to utilize the new taskbar, multi-touch support and more.


IE8 for Developers ( Showing how to create an accelerator)

IE8 makes your web better… faster, safer and easier.  This is true for developers too.  In this session, we will illustrate how developers can take advantage of some new technologies in IE8 such as accelerators to enhance a user’s web experience.  We will also illustrate the built-in developer tools in IE8 and how to take advantage of them.  These tools include a powerful CSS tool, script debugging and a script profiler.


Building Business Applications with Silverlight 3 and RIA Services

Silverlight 3 has launched.  In this session, we will illustrate how you can build powerful line of business (LOB) applications with Silverlight 3 and Expression Blend 3.  We will begin with illustrating how you can build powerful prototypes with SketchFlow in Blend 3.

Reblog this post [with Zemanta]