Friday, April 25, 2014

How to use the phone call task

using Microsoft.Phone.Tasks;


PhoneCallTask phoneCallTask = new PhoneCallTask();

phoneCallTask.PhoneNumber = "2065550123";
phoneCallTask.DisplayName = "Gage";

phoneCallTask.Show();

Source:

http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394025(v=vs.105).aspx

Saturday, April 19, 2014

Win 8.1 with virutalization enabled on box with RAlink bluetooth for HP envy 700-056

I wrote about this issue earlier at http://fetchmytip.blogspot.de/2014/03/issues-with-wp8fullexe-windows-phone.html

Problem:
Installed windows 8.1 upgrade with virtualization enabled and box rebooted but never finished the install!  This occurred when I was trying to do windows phone development with the WP8 SDK.  The phone emulator requires that virtualization is enabled.


Solution:

The Bluetooth driver for the RAlink 3290 board was for win 8 and not win 8.1 each time the reboot occurred it would attempt to load the driver and prevent the reboot.  The solution was to locate the correct drivers. 

Mediatek 802.11 Wireless LAN Adapter Driver
Type: Driver - Network
Version: 1.00 (19 Sep 2013)
Operating System(s): Microsoft Windows 8.1 (32-bit), Microsoft Windows 8.1 (64-bit)
File name: sp63302.exe (38 MB)

Type: Driver - Network - Mediatek Bluetooth Software Driver
Version: 2.9.19.0 (22 Oct 2013)
Operating System(s): Microsoft Windows 8.1 (32-bit), Microsoft Windows 8.1 (64-bit)
File name: sp64041.exe (89 MB)

Installing both still did not solve the issue.  What is weird is that once I uninstalled the drivers for the Bluetooth device the virtualization started to work.  Since I do not need the Bluetooth device then leaving it disabled is fine and will allow me to do WP 8.1 development!

Friday, April 18, 2014

Virtualize Windows Phone 8/8.1 development

Problem:
Microsoft has released Windows Phone 8.1 for developers.  Naturally I am just finishing my first real WP8 app using the 8.0 SDK.  Until now I have hosted the bits on my native system with no virtualization.  I thought I should have a vm for each version of the phone os. I was getting ready to dive into Hyper-V but realized an issue.  You see the windows phone emulator runs as a separate vm on top of the native OS.  If I did manage to build my dev environment in one vm I would either need to run the emulator within the vm.  That is a vm inside another vm which Hyper V will not support or connect a phone emulator vm to the dev vm in hyperv.  This sounds terribly complex for my peabrain.

Solution:
I decided to go old school and use an old Scott Hanselman post about boot to VHD.  In fact, the Nokia site actually links to Scott's site directly.  Here is the solution long and short:

1.) Create a vhd on your native os.  Mine is Win 8.1 Enterprise x64.
2.) Change your BIOS'es boot order. We want boot to usb.
3.) Create the USB thumbdrive with requiste OS bits (Scott describes this in his article)
4.) Boot to usb and initialize the vhd with the target OS Windows 8.1
5.) Complete setup
6.) Install VS 2013 RC2 which will include the 8.1 SDK
https://dev.windowsphone.com/en-us/downloadsdk

Done!
Source:
 
How to virtualize the Windows Phone environment

Windows Phone 8 Emulator in a Windows 8 VHD
Create VHD from Scott Hanselman

Where are Windows Phone 8.1 development tools

Appears that the SDK requires VS 2013.  I have been running VS 2012 with WP8 SDK to this point.

Windows Phone 8.1 development tools
https://dev.windowsphone.com/en-us/downloadsdk

8.1 Dev preview app
Sample Apps source code

Wednesday, April 16, 2014

Sharepoint 2010 - Delete this List link missing

I have been making custom list definitions and list instances in Visual Studio.  I was building and deploying the lists and noticed on the list details screen that the menu item "Delete this List" in  list settings is missing. 

Problem:

My mistake was to set Allow Deletion to false

  <ListTemplate
        Name="ListDefinition1"
        Type="10001"
        AllowDeletion="FALSE"
        DisallowContentTypes="FALSE"
        BaseType="0"
        OnQuickLaunch="FALSE"
        SecurityBits="11"
        Sequence="410"
        DisplayName="Equipment Booking"
        Description="My List Definition"
Image="/_layouts/images/itgen.gif"/>
Once this is done you no longer see the "Delete this List" link in the list settings and is intended to protect lists with items declared as records. 
Solution:
So how do you fix it.  Not through the UI but with powershell
1.) Start > Programs > Microsoft SharePoint 2010 Products
2.) Select SharePoint 2010 Management Shell which opens a power shell session
3.) Punch in following script:
$assignment = Start-SPAssignment
$web = Get-SPWeb -Identity "http://yoursite" -AssignmentCollection $assignment
$list = $web.lists["Your List Title"]
$list.AllowDeletion = $true
$list.Update() #after this is entered, the "Delete this List" link will reappear in the UI for the List Settings
$list.Delete() #this will delete the list
Stop-SPAssignment $assignment



source:http://webdevshareetc.blogspot.com/2012/01/sharepoint-2010-delete-this-list-link.html

Friday, April 4, 2014

Windows Phone 8 Emulator connecting to localhost...

Problem:

Well this getting the Windows Phone emulator to work with a web service running on localhost turned out to be more work then I thought.  There are a multitude of blogs and postings to walk you through the process. Each implementation is slightly different and my issues may be unique to my box.  That said I did want to document what caused me so many issues. 

Solution:

1 – Bind your application to your public IP address

Normally when you run an application in IIS Express, it’s only accessible on http://localhost:<port>.
In order to access it from another machine, it needs to be bound to your public IP address as well.
Open D:\Users\<YourName>\Documents\IISExpress\config\applicationhost.config and find your site.

<site name="Test.Web" id="2">   
<application path="/">       
<virtualDirectory path="/" physicalPath="C:\Users\Jeff\Test\Test.Web" />   
</application>   
<bindings>       
<binding protocol="http" bindingInformation="*:39142:localhost" />   
</bindings>
</site>

In <bindings>, add another row:
<binding protocol="http" bindingInformation="*:39142:169.254.80.80" /> (But with your IP, and port number, of course)

2 - Allow incoming connections

If you’re running Windows 7/8, pretty much all incoming connections are locked down, so you need to specifically allow incoming connections to your application. First, start an administrative command prompt. Second, run these commands, replacing 169.254.80.80:39142 with whatever IP and port you are using:

> netsh http add urlacl url=http://169.254.80.80:39142/ user=everyone
This just tells http.sys that it’s ok to talk to this url.

> netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=39142 profile=private remoteip=localsubnet action=allow
This adds a rule in the Windows Firewall, allowing incoming connections to port 39142 for computers on your local subnet.


Key learnings:

1.) Command prompt
2.) ipconfig
Results may vary:

Ethernet adapter vEthernet (Internal Ethernet Port Windows Phone Emulator Internal Switch):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::c0fc:ebf2:755d:4a03%14
   IPv4 Address. . . . . . . . . . . : 169.254.80.80
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Default Gateway . . . . . . . . . :

3.) Emulator IP is 169.254.80.80

4.)Cut and paste line to add a second binding row.
binding ip needs to be exactly what the IP for the emulator is:

bingingInformation="*:<port>:<ip address>"

Sample:
bindingInformation="*:39142:169.254.80.80"

5.)Allow incoming connections
Open cmd as admin
>netsh http add urlacl url=http://169.254.80.80:39142/ user=everyone

6.)Adds rule in the Windows Firewall, allowing incoming connections to port 39142 for computers on your local subnet.
 Open cmd as admin
>netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=39142 profile=private remoteip=localsubnet action=allow

Addendum:
 Debugging was failing to connect on my VS 2013 build.  I realized that I was having firewall issues.
I started by turning off all the firewalls to determine if this was the issue.  Once the firewall was down I was able to connect from the emulator to localhost.  I then modified the netsh command.

Change the profile to public on the firewall connection.

> netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=58938 profile=public remoteip=localsubnet action=allow



Research How tos:

MVC Sample

http://blog.anthonybaker.me/2013/06/how-to-connect-to-local-web-services.html

Microsoft has drafted a how to guide using a wcf web service
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj684580.aspx

Robert McMurray has a great guide on connecting the emulator to a Web API project in Visual Studio.
http://blogs.iis.net/robert_mcmurray/archive/2013/08/20/connecting-the-windows-phone-8-emulator-to-web-api-applications-on-a-local-computer.aspx

Johan's succint post gave the key steps in the process
http://johan.driessen.se/posts/Accessing-an-IIS-Express-site-from-a-remote-computer

Tip using fiddler
You can install fiddler and go through the instruction on how to configure fiddler for windows emulator.
This article worked just fine for me:http://blogs.msdn.com/b/wsdevsol/archive/2013/06/05/configure-the-windows-phone-8-emulator-to-work-with-fiddler.aspx
One the configuration is done, emulator will automatically use fiddler as a proxy server and you localhost should work just fine from emulator too.
Remember to start fiddler before starting the emulator to route the traffic, otherwise it wont work. You will also be able to monitor http/https requests made by windows emulator.

Source:
http://stackoverflow.com/questions/13149304/windows-phone-8-emulator-access-localhost

Tuesday, April 1, 2014

Arvixe posting instructions for visual Studio


5.) In the Publish method dropdown box select Web Deploy
6.) For the Service URL enter in yourservername.arvixe.com
7.) For the Site/application enter in yoursitename.com
8.) For the User name enter in the username that was under your website’s Management Tab
Example: mywebsitename_admin
9.) For the Password enter the password for the user specified above
10.) For the Destination URL enter your website’s address: http://yourwebsiteaddress.com
11.) Click Validate Connection. If you receive an error here stop and review the previous
information and try again. If successful then click Next >
12.) Select Release in the Configuration dropdown box
13.) In the Databases section you should see the connection string that you added earlier in your
Web.configClick the dropdown box and select your connection string and also check the Use this
connection string at runtime
 checkbox. Then click Next >
14.) Preview the files that are about to be deployed to your site and once you’re done click Publish
15.) Congratulations! You have successfully deployed your ASP.NET Site to Arvixe. - See more at: http://blog.arvixe.com/arvixe-asp-net-web-deployment-how-to-guide/#sthash.gPhKWu4V.dpuf

http://blog.arvixe.com/arvixe-asp-net-web-deployment-how-to-guide/

BitMapImage into a byte array - XAML manipulation

I was messing with a listbox control for my windows phone app and needed to convert a series
of bitmap images.  Found this piece of code to convert the object.  Now I should be able to
use my httppost class to pass the image as a parameter.


public static byte[] ConvertToBytes(this BitmapImage bitmapImage) {    
          byte[] data = null;    
          using (MemoryStream stream = new MemoryStream()) {        
                      WriteableBitmap wBitmap = new WriteableBitmap(bitmapImage);        
                      wBitmap.SaveJpeg(stream, wBitmap.PixelWidth, wBitmap.PixelHeight, 0, 100);        
                      stream.Seek(0, SeekOrigin.Begin); data = stream.GetBuffer();    
           }    
return data;
}


Source:
http://stackoverflow.com/questions/4732807/conversion-of-bitmapimage-to-byte-array