SmartyPantsCoding.com Reboot Coming Soon

You might have noticed that this blog has been dead as a doornail as of late. It's hard to believe it's been over a year since my last blog posting. Things have changed quite a bit since the inception of this blog - 4 years ago this week. I wanted to write a quick blog post to close out this first chapter of SmartyPantsCoding.com, and talk a bit about the next chapter and the changes that will be coming as the site gets a much needed reboot.

This blog started back in 2008 when I decided I wanted to learn WPF (mostly XAML) and dove head first into it - I wanted to blog my efforts to help others trying to learn the same thing. I later moved on to Silverlight, and even became a Silverlight MVP. Later I became focused on Windows Phone - the new frontier for Silverlight - and ended up working on a handful of apps for the platform ranging from personally developed games to apps for large brands through the agency I work for. After that there was a little snafu with my app Imagewind being banned from the Windows Phone marketplace - and that was pretty much the last time I blogged on Silverlight, Windows Phone, or anything else for that matter.

Part of the reason I stopped blogging was that my position at work went from a development position to a director position. I was no longer coding in Silverlight everyday, and was now overseeing projects across a wide range of technologies including HTML/CSS/JS, Flash, PHP, and Android just to name a few. Making this change in my professional life while at the same time seeing Silverlight (and Flash) essentially die on the web made me pause quite a bit and reassess where I wanted to invest my development efforts going forward. A few months ago I won 2nd place in a Samsung development contest with MazeRacer - my first Android game. I've also been doing a lot more in the HTML/CSS/JS space lately as well - and I'm looking forward to blogging about some of these topics soon.

I'll be rebooting this blog with a new design and all new content focused on a wider variety of topics soon. The homepage of SmartyPantsCoding.com will become more of a focus on the various creations I have out in the wild while the blog will remain development centric and contain updates for the various apps and games I have as well. I will likely merge in all the content from SmartyPantsGaming.com and unify everything under SmartyPantsCoding.com going forward to make things a bit simpler. You will see a slow roll out of the changes over the next month or so - while that happens some things (ex: comments) may not work. I look forward to sharing more of my coding adventures with you soon, and I hope you'll stick around for the ride.

Publishing a Windows Phone App? Enter to Win a Free Windows Phone

Have you published an app to the Windows Phone marketplace recently? Are you about to? Have you got 4 apps already in the marketplace?

There is a contest going on right now until June 30th to win a free Windows Phone 7. All you have to do is get an app into the marketplace, and fill out a simple form. Each time you release a new app you can submit another form and increase your chances of winning. I don't have exact numbers, but my understanding is that the chances are pretty good. If you've already got apps in the marketplace then use those for the contest as well.

R.I.P. Imagewind for Windows Phone [Update - It's gone]

R.I.P. Imagewind for WP7: 3/16 - 3/30

After being in the Windows Phone marketplace for just two weeks, I am very sad to say that Imagewind for Windows Phone is going to be pulled from the marketplace tomorrow. If you are reading this on March 30th, then you can act quick and grab it before it is gone.

I had a concern all along that Imagewind might not make it through marketplace approval, which is why I submitted a simple beta version of it in late February to test the waters. On March 3rd that version of Imagewind was approved, and I immediately doubled-down and invested more time into making Imagewind hot. After two straight weeks of late nights, and spending a few hundred bucks on design and website creation, Imagewind was re-submitted and approved on March 16th.

Since its release Imagewind has been doing great in the marketplace with 17 reviews and an average rating of 4 1/2 stars in just two weeks. In fact, just today Imagewind broke over 1 million images displayed across all Windows Phone users.

About 10 days ago I submitted an update to Imagewind which added pinch/zoom support and search abilities. After 10 days of no results from the marketplace approval team, I started to worry that maybe the search ability was pushing the boundaries a bit too far - I didn't however expect to get a notice this afternoon that the app was going to be pulled from the marketplace altogether:

Imagewind - app unpublish request
[..] While the images shown are dynamic, per your app’s disclaimer, a portion of the images’ content is too graphic for the app to be permissible in Marketplace. In order to be permissible, there would need to be a content filter before surfacing images since users are not querying a specific type of image and are rather pushed to them.

Given this, we ask that you unpublish your app within one business day until you are able to modify your application to comply with the certification guidelines.[..]

Thank you for your understanding in the matter, and we will hope to see an updated version soon.

Windows Phone Marketplace Policy team

Since Imagewind is entirely based on live unfiltered images from Twitter, there is no chance of me ever being able to comply with the policy team's request short of hiring a team to monitor and filter images 24/7. This rejection draws the line in the sand for what is and isn't allowed on Windows Phone, and it paints a distinct difference between what is allowed in the iPhone app store and the WP7 marketplace.

The screen above shows a common warning in the app store for iOS devices. Anytime an app brings in data from the web which could contain questionable content, you have to approve this warning. It is a bit ridiculous in that all Twitter clients, the Opera web browser, and even Wikipedia apps all have to show this warning - because they could show questionable content.

The Windows Phone marketplace doesn't have a warning like this yet, so I created my own shown every time Imagewind launches:

Unfortunately my warning won't cut it, and the marketplace won't currently allow an app like mine. The wording in the marketplace notice seems to suggest that it's not a problem that questionable content can be displayed, but that the questionable content is displayed without the user explicitly requesting said questionable content ("there would need to be a content filter before surfacing images since users are not querying a specific type of image and are rather pushed to them."). I am hopeful to work out some way to get Imagewind back into the marketplace, but I have little hope currently.

It is worth noting that the iOS marketplace would in fact allow Imagewind, and has another similar app already called Pingwire (which has apparently been covered by CNET, BBC, and The New York Times). Unfortunately as of now, such apps aren't within Windows Phone marketplace guidelines.

You can find the XAP for Imagewind v1.1 attached. If you are a developer and can side-load apps please continue to enjoy it. Hopefully the ads served up by continued usage can help me recoup my investment which is now all for naught.

It should be noted that I'm not totally ticked. I understood in the beginning it might be rejected for just these reasons. My biggest complaint is that it was approved twice before, and it is only now being rejected (and removed) after adding new features via an update. Had it been rejected on the beta run in early March I would've cut my losses then - that's why I submitted such an early version.

Please leave a comment on your thoughts regarding this policy. Obviously there is still room for the Windows Phone marketplace to improve, and maybe this can be one place to push for some changes.

[Update 3/31/2011 1:14pm EST]
I emailed back and asked for an extended grace period while the policy team and Brandon Watson talked about the app being removed. I am hopeful something good will come out of their discussions - like a way to get Imagewind back into the marketplace. Until I hear back from them Imagewind will stay available. Stay tuned.

[Update 4/1/2011 11:45 EST]
Unfortunately I got notice tonight that after further review the marketplace policy team are sticking with the decision to remove Imagewind from the marketplace. I only got about 60 minutes of notice to remove it myself, which of course happened at 7pm EST on a Friday, so it was removed for me, which means all 25 5-star average reviews are now gone forever. I guess if the app won't see the light of day in the marketplace then that doesn't matter much anyways. For what it is worth, I still haven't been contacted by Brandon Watson, so I don't really have any more insight as to if I have any further options here. My best bet now is that until marketplace regulations change, Imagewind won't be allowed in the marketplace. Perhaps most disappointing is that it could have been released in the iOS or Android marketplaces - but for now it can't be in the WP7 marketplace.

R.I.P. Imagewind for WP7

I guess for now Imagewind will continue to reside at imagewind.net in an online version, and folks who can side-load apps can continue to grab the .xap file attached to this post (and eventually at imagewind.net/wp7). I'm hoping that despite this rejection, Imagewind for WP7 will continue to thrive with folks who grabbed it before it was removed, and from folks willing to side load it. I guess now I'll start the journey of getting Imagewind on other mobile devices.

Examples of WP7 Marketplace Certification Failures

I have now made it through a baker's dozen Windows Phone Marketplace certification attempts for SmartyPantsGaming, and thought I would share the various ways in which I've failed in my apps. I generally think the best way to learn is to learn from your mistakes, but learning from someone else's mistakes is even better - so here is a rundown of ways I've failed WP7 marketplace certification so far.

The back button should close popup windows
In the release of Matchingo Free we received an app rejection because the name entry dialog popup could not be closed by pressing the back button.

If the current page displays a context menu or a dialog, the pressing of the Back button must close the menu or dialog and cancel the backward navigation to the previous page.

To fix the issue I setup a boolean flag to keep track of when the name entry dialog was open, and then override the back button event. If the dialog is open and the back button is pressed then I cancel the back button event so it doesn't continue to bubble up, and close the popup window. Here is the code block:

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
    if (IsNameEntryPopupOpen)
     e.Cancel = true;

(click 'read more' to keep reading..)

Day Long Silverlight Firestarter Streaming Live on December 2nd, 2010


Announcing Smarty Pants Gaming at SmartyPantsGaming.com

How to Customize Your XNA Game Tile on the Windows Phone 7 Start Page

Currently if you build an XNA game and run it on the WP7 emulator you'll note that once you exit the program, it isn't listed in the main application list like it would be for a Silverlight application. This can make it tough to validate how your icon looks, and makes it impossible to pin it to the emulator's tile-view start screen.

A Cheat Sheet for Unit Testing Silverlight Apps on Windows Phone 7

I've been planning on writing a quick overview of the basics of unit testing in Silverlight for a while now. Since Windows Phone 7 is the hot topic now, and there are a few quirks with using the Silverlight Unit Test Framework with it, I figured now would be a good chance to write a blog entry covering both. If you're just looking for the cheat sheet relative to both Silverlight and WP7 unit tests, then skip the first section on setting up the test harness on WP7.

Setting up the Test Harness for WP7
To get started, you'll need the Silverlight Unit Test Framework tweaked for Windows Phone 7 from Jeff Wilcox's blog here. I've attached the binaries to this post as well (SL3_UTF_May.zip).

Once you have the binaries, you'll want to create a new test harness project. Do this by creating a new project in your solution of type 'Windows Phone Application'. In the sample attached to this post I'm calling my test project SampleTestProject.

Next, add references to the two Silverlight Unit Test Framework DLLs*:

* you will get a warning about referencing Silverlight 3 assemblies, click 'yes' when asked if you want to continue

Because of recent changes in WP7, you can no longer set the root visual in the App.xaml.cs like normal. Instead, you'll setup the test page in the Loaded() event of your MainPage.xaml.cs in your test project. The following code hides the SystemTray on the phone (the bar at the top of the screen) which otherwise would cover up the top of test results screen, and hooks up the back button to allow you to return back from drilling into test results.

using Microsoft.Phone.Shell;
using Microsoft.Silverlight.Testing;
void MainPage_Loaded(object sender, RoutedEventArgs e)
    SystemTray.IsVisible = false;

    var testPage = UnitTestSystem.CreateTestPage() as IMobileTestPage;
    BackKeyPress += (x, xe) => xe.Cancel = testPage.NavigateBack();
    (Application.Current.RootVisual as PhoneApplicationFrame).Content = testPage;            

(click 'read more' to keep reading..)

Animating a Silverlight Object's Embed Size Using jQuery or MooTools

One of the projects I'm working on right now requires having a Silverlight object on a page grow to be larger and shrink to be smaller as its containing <div> area's size is changed using javascript. Below is the Silverlight embed code, and the relative javascript for using either jQuery or MooTools. All the javascript functions take action on a div section named 'resizableControlHost' which I added to wrap the normal 'silverlightControlHost' div section.

Basic HTML of Silverlight object embed (wrapped in a 'resizableControlHost' div):

<div id="resizableControlHost">
    <div id="silverlightControlHost">
        <object data="data:application/x-silverlight-2," 
                width="100%" height="100%">
        <!-- details removed -->

Resizing the 'resizableControlHost' div with jQuery:

function gotoSmallSize() {
        width: "200px",
        height: "100px",
    }, 500);

(click 'read more' to keep reading..)

Quick Tip: Windows Phone 7 Preprocessor Directive

If you're sharing common code between Windows Phone 7 and other platforms in either Silverlight or XNA, then you may run into a need to fork some code based on the platform. This is normally done with a preprocessor directive, which for Windows Phone 7 is WINDOWS_PHONE.