Feed on
Posts
Comments

I’m working on my book for O’Reilly this month (HLSL and Pixel Shaders for XAML Developers).  If you’ve written books or articles yourself you know there is a lot of prep involved in getting your machine into a clean state for screenshots.  You don’t want to show a list of client project names to the readers, for example, when taking a screenshot of the Open Projects list in Visual Studio.

Today I am doing screenshots for the Getting Started chapter.  One of the examples uses Expression Blend 4.  Here is what my current MRU list looks like in Blend.

image

Nothing incriminating or confidential in that list, but I still want to trim it down to a few apps.  I’ll keep Shazzam on the list, as I’m using it for many of the HLSL examples.  But the throwaway projects like WfpApplication2 are on their way to the electronic dustbin.

Some applications, like Visual Studio, keep their MRU data in the registry.  Expression Blend is a newer application, it keeps the data in a XML config file located in my profile folder.

On my computer the config file is located at:

C:\Users\WaltRitscher\AppData\Roaming\Microsoft\Expression\Blend 4\user.config

When you open the config file in your favorite text editor you see a bunch of <ConfigurationService> elements. In my case, the element I am looking for has a name property = "RecentProjects". It’s on line 99 in this screenshot.

image

If you look closely you can see a pipe delimited list of file names.

  • M:\CodeDemos\WpfApplication2\WpfApplication2.sln|
  • E:\Projects\Shazzam\Shazzam.sln|
  • E:\Projects\PhoneApps\QuietPlease\QuietPlease.sln|

Edit that list and save the file.  Take your usual precaution for backing up the file before changing the content.

Now look at that clean screenshot.

image

It’s a bit hard to know the version numbers for Expression Blend releases as the information is scattered about the Internet.

Version Name Number Release Date
Expression Blend 4, original release 4.0 June 7, 2010
Expression Blend 4 Service Pack 1 (SP1) 4.0.20901.0 Sept 7, 2010
Windows Phone SDK 7.1 version

4.0.30816.0

Sept 28,2011
Microsoft Expression Blend Preview for Silverlight 5 4.1.10819.0 Sept 9, 2011

Microsoft is starting their fall marketing campaigns for Windows Phone developers.   They have announced a number of contests.  This one caught my eye.

image

If you publish a quality Windows phone app to the phone marketplace and submit you app to this contest you could win ONE MILLION AD IMPRESSIONS.  

Doing the numbers

So how much money would that net you?   Let’s run some calculations.

I hear the conversion rates for apps in other ad campaigns is around 4%. That’s about 40,000 units sold.  If you set your price at 2.99 (it is a quality app right, why would you sell it for .99 cents?) that works out to ~$120,000 gross sales.  After Microsoft’s 30% cut you’d net about $84,000.  And that’s on top of your other sales via other marketing efforts.  Of course I could be off on the numbers, so don’t be mad at me if you sales are less!

FAQs

Be sure and read the contest rules to see if you qualify.  Learn more about the contest at

https://windowsphone.promo.eprize.com/appdevelopercontest/ 

This contest awards quality, your app will be judged against other entries.   Submitting a flashlight app is not going help you win this contest.

Entering this and other contests

Sign up for other phone contests at http://bit.ly/MangoOffer

You’ll need a promo code to enter the contest. Here’s my promo code.  Feel free to use it when entering. WRITS

image

I seems that the performance claims from Microsoft that Windows Phone 7.5 is faster than the 7.0 version are true.  I’ve heard from several of my friends that their benchmarks prove that Mango is faster.  I didn’t profile my phone before updating so I don’t have my own numbers to share.

Here are some stats from WP7 Labs.  They benchmarked the Mango upgrade with the WP 7 Bench application.

Wow.  Look at the Data Storage throughput!  Over 250% improvement.

Test Type

v.7.0

v.7.5

Improvement

Sequential CPU

11,353 ms

8,297 ms

36%

Parallel CPU

10,921 ms

7,873 ms

39%

       

Data Storage

4.9 Mb/s

13.07 Mb/s

267%

       

GPU

22 FPS

23 FPS

5%

Here’s a problem that comes up occasionally.   I have a list of words  that are in a specific order.

apple, banana, cherry, durian,  eggplant, fig, grape, honey, ice, jam

I need to preserve the order, but start the list with a item found later in the list.

eggplant, fig, grape, honey, ice, jam, apple, banana, cherry, durian.

As you can see the original list started with apple, and the new list starts with eggplant.  The words that were at the beginning are now appended after the former last word (jam).

Stated another way, I need to shift the data in the list.  I’ve used different techniques in the past to solve the problem but this time I decided to try LINQ to Objects.

Using LINQ to solve the problem

I love using LINQ to Objects to query and manipulate my data.   Thinking about my application data from a query perspective is so liberating.  LINQ is not always the best choice, at times you need to consider performance, but I thought I would see if I could write a LINQ query to solve this problem.

Using LINQPad

I suspect you know about LINQPad.  This free tool is the best utility I know for exploring LINQ syntax.  I’ll be using it for the screenshots in this article.

http://www.linqpad.net/

Better Version

Update [September 24th, 2011]

@ianmercer on twitter suggested an elegant solution to the problem. Shorter and simpler than my version. Here it his code.

string[] words = { "apple", "banana", "cherry", "durian",
                                                        "eggplant", "fig", "grape", "honey", "ice", "jam" };

    var offset  = 3;

    words.Skip(offset).Concat(words.Take(offset));

I’ve left the original content below, for context, but I suggest you use this improved version.

 

Indexing into a List

[Original solution][

There is a simple technique in LINQ for indexing into another list.  I'll use it in my final query.  Here are the basics of how it works.

First I create the source list.

string[] words = { "apple", "banana", "cherry", "durian",
                            "eggplant", "fig", "grape", "honey", "ice", "jam" };

Then I create an integer array that specifies the preferred order of the data.

// this integer array contains my preferred order for the word list
int[] preferredOrder = { 2, 4, 6, 8, 0, 9,7,5,3 };

Now I'll use this simple LINQ query to get the data and project it into an anonymous type.

var q =  from index in preferredOrder
            select new{Position=index, Word=words[index]};

And here are the results.

image

As you can see the word are presented in the order I chose.

Shifting the list

I use the similar technique to shift the list.  I start by creating the same source list as before.  Next I generate a list of integers, one for each item in the source list.  Note that the integer array starts at zero.

int[] preferredOrder = Enumerable.Range(0,words.Length).ToArray();

 image

Now I use an orderby clause and the mod operator to shift the data.

var offset = 0;

var q1 =  from n in preferredOrder
orderby ((n + offset)  % preferredOrder.Length)
select new{Position=n, Word=words[n]};

image

Problem solved!

UPDATE

September 22.

Here's another approach to the problem from @AbdouMoumen (Twitter).

 

string[] words = { "apple", "banana", "cherry", "durian",
                     "eggplant", "fig", "grape", "honey", "ice", "jam" };
var result = words
                      .Select (
                               (item,index) =>new {
                                Item=item,
                                Index=index
                                                   })
                  .OrderBy( indexedItem => (indexedItem.Index + 6 ) % words.Length )
                  .Select ( indexedItem => indexedItem.Item );
result.Dump();

Corporations will not create internal Windows Phone 7 applications unless they have a way to restrict deployment of their apps to controlled list of registered phones.  As it stands today, it is not possible to do private deployments.  The next version of Windows Phone 7, known as Mango, aims to change that.  Microsoft previewed the upcoming changes to the Marketplace at their web conference (Mix11).   There will be three areas to deploy apps: Public Marketplace , Private Marketplace and Beta Marketplace. Be sure and read the details below but be aware:  Private Marketplace as envisioned by Microsoft is not the much anticipated Enterprise Marketplace.

It’s still early times, Mango will not ship before September 2011, so realize that the details many change as we get closer to ship date.

Public Marketplace

Let’s start with the current marketplace offering. In Mango terms this is called Public Marketplace. To deploy an app to the phone currently you must do one of the following.

Developer Account:  Sign up for a developer account at AppHub ($99 USD).  Unlock your developer phones and sideload the app.  Limited to 10 sideloaded apps on the phone at any one time.

Jailbreak: Find a way to jail break your phone, then side load apps.

Public Marketplace:  Sign up for a developer account at AppHub.  Upload your app to the AppHub server.  The app will go through the certification process and if approved it is published to the marketplace.

Public apps are available for anyone with a phone and can be discovered by searching the Zune Marketplace.  The apps must pass certification before being published. 

Beta Marketplace

Currently if you want to test a new WP7 app you email a few of your developer friends and ask them if they will sideload your XAP onto their phone.  The new Beta Marketplace will make testing pre-release apps easier.

With Beta Marketplace you solicit testers for your upcoming release. These users can be company employees, or they can come from from the general public. If they volunteer they must provide you with their LiveIDs.  You can have up to 100 testers per beta marketplace.  The developer adds the tester LiveIDs to the beta marketplace and sends an invitation email to the tester. The invitation email includes a deep link to the beta XAP. 

Tester must login to Zune before they can install the beta application. If they are not on the approved list, they will not be able to install the application.

This is good.  The tester does not have to be a developer, doesn’t have to an unlocked phone and Microsoft controls the whether they can install the application.

Each beta marketplace is open for 90 days and then is automatically closed.  Though not stated by Microsoft I believe you can create more than one beta marketplace( to add more than 100 users). Obviously you can create other beta marketplaces as you release improved versions of your beta app.

Since you are releasing a beta, Microsoft doesn’t require the app to go through certification.  That means you can upload the XAP and instantly have it available to your tester community.

Private Marketplace

Some would call this the Enterprise Marketplace.  I’d say that they need to listen to what Microsoft said at Mix11.

"It is not an enterprise software distribution mechanism, by any means, but it is a way of distributing applications and games to a set of users "  -Todd Brix

The only difference between a Private and Public marketplace is the ease of discoverability to the general public.  Because the app in not listed in the Zune marketplace, you cannot search and find the app. Therefore, in order to distribute the app you must send a deep link to your intended audience. 

Other than the discoverability difference your app is handled the same as a public marketplace app. It must pass certification. It can be updated to a new version and users will automatically received update notifications.  You can create a free or paid version of your app. 

You can share the app deep link with friends, magazine writers, bloggers etc. and they can preview and use the application.  Since the app is certified, you can easily change it to public at a later time. 

Enterprise Marketplace

Microsoft has not announced an Enterprise marketplace yet.  That hasn’t stopped some people from assuming that the Private marketplace is the enterprise solution however. In fact I made the same mistake when I was live tweeting the Mix11 event this week.

Here is what make Private marketplaces unsuitable for enterprise distribution.

Private by obscurity

You give your users a deep link to the the application that takes them to the install page.  The app is not listed in the Marketplace, or findable through marketplace search. But if they share the deep link with with another phone user, then that friend can install that app too.  My guess it that the community will figure out how to find private deep links within days of the release of Mango.

No access control: 

Any phone user can install your application, provided they can find the deep link.  There is no way to restrict access to a set of users, like in the beta marketplace.

Summary

I’m really excited about the Beta marketplace as it makes it easy to test and share applications with a list of users.  I don’t see much benefit from Private marketplaces yet, perhaps I don’t understand the use case for them.

I’m severely disappointed that Microsoft hasn’t produced a better enterprise story.  I hope they are waiting until later in the Mango lifecycle to share there plans for real enterprise deployment. 

Here is a table that summarizes the differences between the proposed new marketplaces.

Details Public Private Beta
# of Users Unlimited Unlimited 100
App Price Free, Paid Free, Paid Free
Lifetime Forever Forever Closed after 90 days
Updateable Yes Yes No
Publicly Discoverable Yes No No
Access Control None None Restricted to published list of Live ID’s
Certification Required Yes Yes No
       

Trade conferences are a steady companion for the tech industry. And it not just for tech people. Gathering together in crowd for annual events is a human need.  We all do it.  Look at the thousands of different conference held each year.   Las Vegas’s economy is anchored to this obvious pattern.  Well, Vegas also caters to other human needs like gambling but you get the point.

What happens at conferences changes over time though.  For example, in the last few years the lightning session has appeared.   The idea: gather a handful of speakers, give each one a short time slot ( say 10 minutes), auto run the PowerPoint’s and have some fun.

Mix adds new event

So what about MIX11? I participated in one of these new ideas Monday night at Mix11, at least its new for a major Microsoft conference.  Microsoft hosted an pre-conference event call Open Source Fest. 

Open Source Fest is an event for open source project leaders to come and show off their great open source projects.  It will be open to all MIX11 attendees and those in attendance can vote on their favorite open source projects. The winners will get a prize and some recognition at MIX11, but the key is the chance to showcase the open source projects by the community, stir the collective brainpower, and network. There will be food, drinks, a fun atmosphere, and a chance to meet many of the MIX11 speakers and attendees. Voting results will be announced at MIX11

About three weeks before the show John Papa extended an invitation to .NET based open source project owner to participated in the event. Fifty people volunteered to show their open source project during the evening.   I decided to show my Shazzam Shader Editor.

Microsoft sponsored the event, provided the space, loaded a buffet table with free food and stocked the bar with free drinks. No one knew what to expect, as this was the debut for an event of this type.  It was a great success, 500 people showed up and spent the evening seeing .NET projects and talking to the project developers.

Positive Buzz

I heard a lot of buzz about the event over the next couple days.  The number one comment I heard was "I couldn’t believe how many great projects there were in the room." The attendees seemed to think it was a great event. Here’s why I think that is true.

1. Developer to Developer.  The people attending were overwhelmingly programmers or part of the software industry.  The presenters, were developers too.  I had wonderful conversations about how I implemented features or how to use Shazzam in attendees own projects.

2. Passion.  Every presenter I talked to was crazy happy to talk about their project.  You could feel the love for their work.  And the feeling multiplied throughout the evening.  Walk 5 feet to the next table and hear another impassioned  developer describing his application.

3. No sales.  These were not vendor tables.  No pressure to look at a tool and hear a sales pitch.

4. Real users.  I had many people tell me that they used our tool and were grateful that it was there.  Putting real faces on the people that use your tool is heartwarming.

I’d love to see this event next year at Mix12.

Conserving memory is a huge issue in Windows Phone 7 programming.  You must be diligent in checking your memory footprint during development for obvious reasons.   For one, your application is destined to run on a limited resource device.  For another, Microsoft will refuse to certify your app if you exceed the memory limits.  Here’s the relevant section of the certification guidelines.

5.2.5  Memory Consumption
An application must not exceed 90 MB of RAM usage, except on devices that have more than 256 MB of memory. You can use the DeviceExtendedProperties class to query the amount of memory that is available on the device and modify the application behavior at runtime to take advantage of
additional memory.

Keeping an eye on memory

As stated above, you can use the DeviceExtendedProperties to check memory use.  Like many tools you have to be careful how you use it.  For example, you may not want to use it on release builds because it adds another capability requirement to your phone manifest.  The good news is someone (Peter Torr) has build a nice wrapper for this functionality.

I use Peter Torr’s MemoryDiagnosticsHelper in my applications.   It monitors memory, shows an additional memory counter during debugging and uses Debug.Assert to alert you when you exceed the 90MB ceiling.  Read more about his tool at his blog.

Leaking memory with images

I’m working on a application that has a ton of images.  I don’t have the luxury of lazy loading the images from a server for this application and the images are constantly being swapped and animated on the screen.

Images are memory hogs on the phone.  You might think that your 85K .PNG file is small.  But when it get placed into your application memory it is much larger that 85K.  I’ve heard that even these small files can consume as much as 2MB in memory. Short story, you need to ensure that images are removed from your app memory if they are not in use.

For me I found that sometimes I need to specifically remove an image from its panel before the memory can be garbage collected.  In my app, when I made the following change I dropped ~20MB in memory usage.

 

grid1.Children.Remove(image1);
image1 = null;
Hope this helps.

There are times when I want to preview file content in Windows Explorer.  The Preview pane in Explorer makes this a simple task.  Just click the Preview pane button and select the file as shown in Figure 1 and Figure 2.

image

Figure 1: The preview pane button.

 

image

Figure 2: Viewing a .txt file.

In this example I am previewing a .txt file.   Use the Ctrl + mouse wheel to change the zoom level on the text. Also, ALT+P toggles the preview pane.

Adding your own extensions

Making a simple registry edit allows you to see other files, like .csproj and .xaml, in the preview pane.

Here’s how I did the XAML extension (see Figure 3).  

  • Open the HKEY_CLASSES_ROOT\.xaml key in Regedit. 
  • Add a string key named PerceivedType.
  • Set the value of the PerceivedType key to ‘text’.

 

image

Figure 3:  Adding a registry key.

 

Now you can preview the content.

image

Figure 4: Viewing the .xaml file

Microsoft created a compact on-screen keyboard for the Windows Phone 7.  The keyboard is winning praise among users for being fast and easy to use, even if you have big fingers.  But there is one task that seems to stump a lot of new users ; how to find certain symbol keys  on the keyboard.

I know from my own experience, it happened to me when I first started using the phone.  I needed to enter a passcode for a locked wireless network while in Europe a few weeks ago.  I couldn’t find the underscore key.  Until I remembered that the phone has two pages of symbols.

 

Finding the symbol keyboard is easy. Most people guess that you press the ‘&123′ key.

image  

Figure 1:  The main alpha keyboard.

 

That takes you to the number/symbol page as show in Figure 2.

image

Figure 2:  The number/symbol keyboard.

 

This is where people start getting panicky.   Where are the square braces?  What about the underscore or equal sign? 

They are on the second page of the number/symbol keyboard.  Just click the -> arrow in the lower left to see the second page (Figure 3).

image

Figure 3:  Alternate number/symbol keyboard.

 

Click the  <- arrow to return to the first symbol page.

 

See my other keyboard tips

Accented characters on the Keyboard

Punctuation shortcuts on the Keyboard

 

===========================

Learn about Silverlight with online Silverlight videos.  What are you waiting for?

Older Posts »