Subscribe to Feed

 

When you compile your windows phone app, it might build fine but throw an “unspecified error” when you try to deploy your app either onto your phone or to the emulator. The most probable reason that causes this is that there is style incompatibility in your xaml that the parser failed to resolve.

To fix the issue,

  • In you xaml verify if you are using any style with fixed values for one control. That is you use style resource and also give static values for font size etc. Usually when you do this for TextBlocks etc., it will throw off the Windows phone xaml parser.
  • Another situation is when you have templated pivot or panorama controls. Make sure that your header template for pivot or panorama controls is not funky. One common place where I have seen this is, during the 7.0 release, they allowed a static binding resource for the “FirstCharacter” in the pivot control. Access to this has been disabled starting 7.1 version of the Windows Phone SDK. To fix this all you have to do it remove the converter from your template.

For example, in your old 7.0 code, a pivot header template might look like

        <controls:Pivot>
            <controls:Pivot.HeaderTemplate>
                <DataTemplate>
                    <TextBlock
                        Text="{Binding Converter={StaticResource FirstCharacter}}"
                        Foreground="{StaticResource PhoneAccentBrush}"/>
                </DataTemplate>
            </controls:Pivot.HeaderTemplate>
        </controls:Pivot>

This does not work anymore after the 7.1 SDK. Change the above code to

        <controls:Pivot>
            <controls:Pivot.HeaderTemplate>
                <DataTemplate>
                    <TextBlock
                        Text="{Binding}"
                        Foreground="{StaticResource PhoneAccentBrush}"/>
                </DataTemplate>
            </controls:Pivot.HeaderTemplate>
        </controls:Pivot>

And you should be fine. (Just removed the converter part from  the Text binding). I did not see any functional difference from doing this.

 

Hope this helps,

CTRL+F5

 

Here is a list of Windows 8 Keyboard shortcuts that I think are most useful:

Windows key - Brings up the Metro start screen. You can start typing to search for an app, just like the Win7 start menu. Subsequent presses on the button will cycle through the open applications

Win + B - Switch to the (classic) Windows desktop and select the tray notification area.

Win + C - Brings up the Charms menu, where you can search, share, and change settings.

Win + D - Brings up the old Windows desktop.

Win + E - Launch Windows Explorer with Computer view displayed.

Win + F - Brings up the Metro File search screen.

Win + H - Opens the Metro Share panel.

Win + I - Opens the Settings panel, where you can change settings for the current app, change volume, wireless networks, shut down, or adjust the brightness.

Win + J - Switches focus between snapped Metro applications.

Win + K - Opens the Devices panel (for connecting to a projector or some other device)

Win + L - Lock PC and return to Lock screen.

Win + M - Minimize all Windows on the desktop

Win + O - Locks device orientation.

Win + P - Choose between available displays.

Win + Q - Brings up the Metro App Search screen.

Win + R - Switch to the (classic) Windows desktop and display the Run box.

Win + U - Switch to the (classic) Windows desktop and launch the Ease of Access Center.

Win + V - Cycles through toasts.

Win + W - Brings up the Metro Settings search screen.

Win + X - Launch Start Menu.

Win + Y - Temporarily peek at the desktop.

Win + Z - Opens the App Bar for the current Metro application.

Win + Page Up / Down - Moves tiles to the left / right.

Win + Tab - Opens the Metro application switcher menu, switches between applications.

Win + , (comma) - Aero Peek at the desktop.

Win + . (period) - Snaps the current Metro application to one side of the screen. (Right side)

Win + Shift + . (period) - Snaps the current Metro application to the other side of the screen. (Left side)

Win + Space - Switch input language and keyboard layout.

Win + Shift + V - Cycles through toasts in reverse order.

Win + Enter - Launches Narrator

Win + Arrow Keys - Switch to the (classic) Windows desktop and enable Aero Snap

- Ctrl + F5

 

It is very easy to convert a string to stream and vice versa in .Net.

Converting String to Stream:

MemoryStream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream);
writer.Write(myString);
writer.Flush();
 
if you already know the encoding of your string, you can also use
 
byte[] tempByteArray = Encoding.ASCII.GetBytes(myString);
MemoryStream stream = new MemoryStream(tempByteArray);
 

Converting Stream to String:

 
StreamReader reader = new StreamReader(stream);
stream.Position = 0;
string myText = reader.ReadToEnd();
 
 
 - CTRL+F5
 

 

When you upgrade your PHP version (Usually from PHP 5.2 to 5.3), you might see several “PHP Deprecated” error on the top of your page. Error seen are similar to

PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\Inetpub\wwwroot\wordpress\wp-settings.php on line 512
PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\Inetpub\wwwroot\wordpress\wp-settings.php on line 527
PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\Inetpub\wwwroot\wordpress\wp-settings.php on line 534
PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\Inetpub\wwwroot\wordpress\wp-settings.php on line 570
PHP Deprecated: Assigning the return value of new by reference is deprecated in C:\Inetpub\wwwroot\wordpress\wp-includes\cache.php on line 103

One easy way to fix this is updating your wp-config.php file

  • Go to your wordpess installation file
  • Open the wp-config.php file
  • enter “error_reporting(0);" right after the "<?php" line
  • save the file and voila, the warnings are gone from the website

For Godaddy hosting users

If you are seeing this error on your GoDaddy hosting account, here is how to fix this

  • Log in to your Account Manager.
  • From the My Products section, click Web Hosting.
  • Next to the hosting account you want to use, click Launch.
  • From the Content menu, select FTP* File manager
  • Click on the folder your wordpress is installed in
  • Select the checkbox right by the wp-settings folder
    and click edit button on the top
  • In the edit window, enter “error_reporting(0);" right ater the "<?php" line
  • Click save button and browse to your web page to see the warnings magically gone.

Hope this helps,

CTRL+F5

 

If you are trying to export a virtual machine in Hyper-V and realize that you are missing the export option in the Action menu, don’t worry. This is most probably because your VM is in a non exportable state. Meaning, you virtual machine in any state other than off or saved. Hyper-V will only be able to export a VM if it is in either off state or saved state.  To get the export option back, hit ’save’ and then wait for the export option to show up in a minute or two.

-Ctrl+F5

 

I liked this quote from the Netflix Technology blog. Very interesting approach to testing a large scale high availability system

One of the first systems our engineers built in AWS is called the Chaos Monkey. The Chaos Monkey’s job is to randomly kill instances and services within our architecture. If we aren’t constantly testing our ability to succeed despite failure, then it isn’t likely to work when it matters most - in the event of an unexpected outage.

 

WinDbg has a built in undocumented feature that can be very useful to remember commonly used WinDbg commands. In essence it will build you a personalized GUI cheat-sheet of your commonly used commands.

They command to generate this is “.cmdtree c:\temp\myCommands.txt” , myCommands.txt here is a test file with a list of commands. You have to manually populate this file with commands.

Steps:

  • Create Commands file
  • Open WinDbg
  • Open a dump file.
  • Load the symbols
  • then use above command

Example commands file:

image

 

-CTRL+F5

 

I would definitely start with Channel 9 videos. Videos are always better than reading to start with in my opinion. 

Here are several links that can help you get started.

Videos:

Windows Phone 7 Development for Absolute Beginners: http://channel9.msdn.com/Series/Windows-Phone-7-Development-for-Absolute-Beginners

Books:

Free Book and best one to start with: “Programming Windows Phone 7” available at http://www.charlespetzold.com/phone/

Decent Book: http://www.amazon.com/Windows-Phone-7-Plain-Simple/dp/0735643423

Links:

“Learning Resources”  section from http://msdn.microsoft.com/en-us/library/ff402535(VS.92).aspx 

 

And then practice writing apps with

101 Windows Phone 7 Apps

Volume 1: http://www.amazon.com/101-Windows-Phone-Apps-Developing/dp/0672335522/ref=sr_1_2?ie=UTF8&qid=1309816618&sr=1-2-spell

Volume 2: http://www.amazon.com/101-Windows-Phone-Apps-Developing/dp/0672335603/ref=sr_1_1?ie=UTF8&qid=1309816618&sr=1-1-spell

Oh and do not forget the “MS Patterns and Practices Windows phone Developer guide” at http://www.amazon.com/Windows-Phone-Developer-Guide-applications/dp/0735656096/ref=sr_1_45?ie=UTF8&qid=1309816346&sr=8-45

 

- CTRL+F5

 

In a .Net 4.0 or later web application you may receive an error similar to

The configuration section yoursection cannot be read because it is missing a section declaration

when you try to get the web configuration information using Microsoft.Web.Administration.ServerManager API even when your web.config file looks alright and you do declare “yoursection” in the .Net framework web.config file located at “C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config”.

This is because prior to calling GetWebConfiguration, you have to explicitly tell ServerManager to use the 4.0 Framework. For example, here is a sample code on how to do this..

ServerManager manager = new Microsoft.Web.Administration.ServerManager(true, null);
config.SetMetadata("defaultManagedRuntimeVersion", "4.0.30319");
Configuration config = manager.GetWebConfiguration("yoursite", "/");
 
Hope this helps,
CTRL+F5  

 

One of the caveats with using RenderControl to spit out the HTML content that an ASP.Net server control generates is that any server control that renders client side JavaScript raises a http exception when rendering the content of the control to a HtmlTextWriter. There are couple of ways you can bypass this in .Net. One of the easiest ways is to disable the html rendering verification on the server side by overriding the “VerifyRenderingInServerFrom” method of the page. Here is how you can do this.. (Add the below method to your code behind page)

 

C#
public override void VerifyRenderingInServerForm(Control control)
{
    return;
}

 

VB
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
        Return
End Sub 

Usually you need to override this method when you receive an error similar to "of type ‘GridView’ must be placed inside a form tag with runat=server"

 

- CTRL+F5