All posts by Jon

Market share, market share, market share

First, why is a developer writing about this? The most obvious reason is that there has to be at least some market to make it worthwhile to create and promote apps. What I find misleading, however, is raw percentage numbers. There’s no denying that if a raw percentage is too low, e.g. Blackberry, you’re wasting your time. That platform is dead in the water.

But I also have doubts over the value of Android’s seemingly commanding 80% of worldwide smartphone users. And I find it amusing/disturbing that many still dismiss Windows Phone because it has 1/4th the share that iPhone does. While no one writes off Apple because it has 1/4th the share of Android.

From a developer perspective, it (literally) pays to look deeper into the numbers. Recently I’ve read that a good number of Android apps are simply pirated, which in certain countries is also true for iPhone, since a good many are jailbroken. I’m sure there are many reasons, including the “free” OS ethos Google likes to promote, that Android users don’t pay for apps. And that seems to apply across national boundaries. But in some places, Apple faces the same problem.

80% market share is not as impressive if only 1% of users ever pay for your apps. Granted, that can still be a large actual number. But the point is, again, it’s worthwhile to not just take raw numbers at face value. Because of the underlying lack of value, I’ve never been interested in developing for Android. Technically, it would seem more feasible for a C# developer to move to Java. Prior to Xamarin (which doesn’t solve all my problems), the main barrier to iOS development for me has been finding the time to fit in learning Objective-C. C# has been my bread-and-butter, actual make-a-living, development language for quite some time.

Going forward, I will develop or work with other developers to get into the iOS market. I’ve read a few negatives such as many iPhones in places like China are jailbroken. And that apps are mercilessly copied and slowly purged by an indifferent Apple App Store. (But the latter has happened somewhat to me too in the Windows Phone store, where elements of an app were poorly aped – like some sort of Bizarro Superman version). Yet – if one can do enough outside promotion – the iOS market is definitely worthwhile.

Much has been written about the diminishment of Apple (reflected in its stock price) and even its potential demise if developers ever switch to an Android-first policy en masse. But I doubt I’m the only developer that has noticed that Apple still holds almost half the American smartphone market (never mind tablets). And that, along with European/ANZ markets, is almost certainly where people are not adverse to shelling out 1/3rd the price of a Starbucks latte for apps.

On to Windows Phone. While it has made some impressive gains in certain markets – particularly in Europe (http://www.kantarworldpanel.com/Global/News/Record-share-for-Windows-phone) – there is both good and bad for the developer. First the bad: Windows Phone still doesn’t have a great share in the U.S. It’s just 3.5%…up from about 3.0 from the same quarter last year.

Also (less bad), the people buying Windows Phones tend to be converting from feature phones. While I don’t have proof, I have concerns whether they’re willing to spend on apps. Furthermore, it’s not Android/iOS users jumping ship and giving mind share to Microsoft/Nokia.

Finally, (least bad but also potentially indicative of shallow pockets), the Windows Phones people are getting are not the trophy devices like the Lumia 1020. Rather, the 520 is the most popular phone. I say least bad because – from a developer standpoint – even the lowliest Lumia is still going to hold up pretty well to your coding demands. It might not support some games but that’s an invitation to put more creative thought into the game play rather than the special effects. I have both a 920 and a 620. While I’d never choose the 620 as my personal phone, it’s a dandy little device and runs my code just the same as its bigger, heavier brother.

Also, bear in mind that outside the U.S. phones are rarely subsidized. In Europe, too, everything tends to be more expensive (my wife still reminds me how I paid €3.00 for floss in Italy). Paying for a phone up front would, in my opinion, lead one to the cheaper models. So perhaps given that backdrop doesn’t mean users are going to be payment-adverse when it comes to apps. (More on that below).

The good news for the developer is that market share is growing. It may not be perfect and may not be widespread, but if it was contracting after all this time, there would be no clearer message to get out. What is also encouraging is that – at least for my two current apps in the Windows Phone Store ( 7-Minute Workout – http://www.windowsphone.com/en-us/store/app/7-minute-workout/879efccc-5c9e-4b19-b8e6-346b76ff0133 and Ballistica – http://www.windowsphone.com/en-us/search?q=ballistica) – conversion rates from trial to paid are quite good. 7-Minute Workout, which is a more broadly popular app and is priced at the sweeter spot of $0.99, has a 20.6% conversion rate. Ballistica, which is definitely a niche app (aimed at target shooters and hunters), has a 14.3% conversion rate.

I should point out that despite not (yet) being localized, 7-Minute Workout has done really well in non-U.S. markets, further strengthening my hypothesis (Isn’t that what you call any notion relying on anecdotal data?) that Windows Phone users tend to be more like their iOS counterparts, i.e. willing to pay for good apps.

So when it comes to percentages, a larger paid percentage of a smaller market share may well beat writing apps that never make a dime off a vast pool of freeloaders…did I say that?

On a topical note: I do hope (as expressed in the intro to Outkast’s Hey Ya http://www.youtube.com/watch?v=PWgvGjAhvIw) that Microsoft doesn’t screw up the acquisition of Nokia’s phone assets. It’s still critical that they find a way to build up U.S. market share.

Turning down a job offer

Here’s most of a reply I made to a potential employer that just offered me a pretty good position doing .NET web development:

I’m basically crazy to turn down any other work given the sad state of Windows 8 adoption and hardly better for Windows Phone. Yet I’m going to stick with that and eventually get my Xamarin/iOS skills up to speed. I thought about it and what I want to do quite a bit while being away from the computer for over a week. While the money sucks, being a micro-ISV is going to make me happier than doing what I’ve been doing for all my working life, which is building someone else’s equity. Don’t get me wrong. I’ve worked for some great companies/people and you’d be one of them. But now’s the time to really take a shot at this. Even when I ran my own business with 4.5 employees it was always working on somebody else’s projects. While all work is essentially working for somebody else – even apps – the crucial difference is that it’s me interacting with end users as customers.

Yes, I am f***in’ crazy to turn that down. Right now, my app income is measured in the hundreds of dollars. And if it wasn’t for working my butt off the last couple years, saving most of it and having a doctor for a wife I wouldn’t even be writing this. Lately, I’ve read two damning articles on Windows 8 and Windows Phone but time to put the blinders on, damn the torpedos and full speed ahead.

 

 

Localizable Balloon Tooltip Control

I wanted to create a tooltip in the style of the balloons used in Windows Phone apps like Messaging. Almost immediately, I realized it needed to be localizable, which would mean adjustable in width to accomodate text lengths in different languages.

In the past I’ve bound XAML elements, such as WPF menus to the ActualWidth of another element, e.g:

Width="{Binding ActualWidth, ElementName=window, Mode=Oneway}"

However, in this case I couldn’t get the desired result, which is to have a bit of padding on either side of the text. What documentation I read suggested that ActualWidth would take into account Margin settings. But I had to resort to a hack in the code-behind, adding a line to the constructor:

public MessageBoxControl()
 {
 InitializeComponent();

TextGrid.Width = MsgText.ActualWidth + 16;
 }

Here’s the XAML:

<UserControl x:Class="Controls.MessageBoxControl"
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 mc:Ignorable="d"
 FontFamily="{StaticResource PhoneFontFamilyNormal}"
 FontSize="{StaticResource PhoneFontSizeNormal}"
 Foreground="{StaticResource PhoneForegroundBrush}"
 d:DesignHeight="56" d:DesignWidth="440">

<Grid x:Name="LayoutRoot" Background="Transparent" IsHitTestVisible="False" Height="56"
 Width="{Binding ActualWidth, ElementName=TextGrid, Mode=OneWay}" MaxWidth="440">

<Grid.RowDefinitions>
 <RowDefinition Height="32" />
 <RowDefinition Height="24" />
 </Grid.RowDefinitions>

<Grid Name="TextGrid" Background="#FFD68B" Grid.Row="0" MinWidth="200" MaxWidth="440">
 <TextBlock Name="MsgText" Foreground="#2368B0" FontSize="24" Height="32" MaxWidth="424"
 HorizontalAlignment="Center" TextTrimming="WordEllipsis"
 Text="{Binding Path=LocalizedResources.ResetMessage, Source={StaticResource LocalizedStrings}}"/>
 </Grid>

<Grid Grid.Row="1">
 <Path Name="Tail" Fill="#FFD68B" Data="M-1,-1,24,24,24,-1,-1,-1"
 HorizontalAlignment="Left" Width="24" Height="24" Margin="24 0" />
 </Grid>

 </Grid>
</UserControl>

Note that a MaxWidth is assigned to Grid and Text elements. Also, the TextTrimming attribute is set. This is meant to safeguard against exceeding the width of the display in Portrait mode. 

And a sample screen shot of a (hopefully accurate) French translation of “Hold to reset to 0:00”:

balloon_example

Coming around to MVVM

This is a copy-and-paste from an email to a friend, but has a few observations worth sharing publicly

A couple discussions on knockout.js, angular.js and backbone.js:

http://stackoverflow.com/questions/11083316/angular-js-or-knockout-js-integration-with-other-ui-libraries

http://stackoverflow.com/questions/5112899/knockout-js-vs-backbone-js?rq=1

Previously, I didn’t pay much attention to any of these. But am changing my tune. Why? I finally found a way to use the MVVM pattern that really makes sense and plan to follow that when it makes sense with web programming too. Props to Microsoft evangelist Jerry Nixon for his walkthrough video: http://blog.jerrynixon.com/2012/08/most-people-are-doing-mvvm-all-wrong.html, which in particular had some binding tips for Visual Studio I didn’t even know existed and a nice DelegateCommand class.

My initial experience with MVVM was miserable. For one thing, it is incorrectly named…should be MVMV (as in Model – View Model – View). But then, so is MVC, which should be Model – Controller – View. Because in both cases, the View Model or Controller is the code that sits between a UI View and the task-related code, e.g. a method that grabs a bunch of image URLs based on a search term. The MVVM framework I chose to use was complicated and couldn’t handle everything. Lots of hacks went into Ballistica. So, ironically, the promise of better maintainability was so broken that I’ve never found the time to update the app.

I also found that there is a lot of strict adherence to one model per view model. Really a model is just a class file. So if, for example, you need one class that handles status messages and another that build outlines there’s no reason why a single View Model can’t talk to them both. Now that I have that straight and have learned how to use my IDE more effectively, it has made much more sense. My current project has 111 lines of XAML in the main Window (including whitespace), but just 12 lines in its code-behind C# file (including whitespace and curly brackets)…and all it does is launch the window:

using System.Windows;

namespace HorizontalBuilder2
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

All the controlling logic resides either in the View Model class file or in the model classes.

Here’s an example of XAML that helps explain why Microsoft saw fit to not use SVG:

<MenuItem Command="{Binding BuildOutlinesCommand, Mode=OneWay}" Header="_Build Outlines" InputGestureText="CTRL+B" IsEnabled="{Binding Done, Mode=OneWay}">

<MenuItem.Icon>

<icons:IconGeom />

</MenuItem.Icon>

</MenuItem>

First of all, they could create things like application menus. Then bind various attributes to logical code. In this example, for instance, selecting “Build Outlines” from the menu triggers the BuildOutlinesCommand method. The underscore in front of the Header text allows the user to use ALT-key shortcuts, although I’ve never enjoyed that bit of Windows UI. It’s always just seemed easier to remember something like CTRL-B, which cuts out at least one step, so that’s included. The command is enabled depending on various states of the application. While you can name an item and refer to it in code, e.g. myMenuItem.Enabled = true, one advantage of this way is the menu item is now just a “subscriber” to the Done value. If I had, say, another item on screen like a big “Start” button it to could just use the same snippet. The alternative would be to have to keep track in code of all the items that need to be enabled or not. Also, the programmer can look at the XAML and know where to look in code for what effects the change.

Soon I’ll be posting a nice example of an MVVM app using async Tasks with real-time UI updating…and no freezing the rest of the UI.

Burn Map

https://maps.google.com/maps/ms?msid=217066668344035014417.0004df0ab0046cd029a58&msa=0

The area burning is in a dense Ponderosa forest known as the Black Forest. I never went around there when living in the Springs from 1992-96. But remember it as a kid (much earlier). It was really pretty. But you look at the maps and can see why all the houses there have been destroyed. The map that shows lost houses (http://gazette.com/article/1502250) is somewhat marred spatially because they used lot centroids rather than pinpointing the structures. When it’s all over, I’m going to suggest to their fire marshals (as well as “fire community” people I know) that when pre-mapping lots they have their GIS people identify the center of the largest visible structure. Why? Because when analyzing the data post-mortem or trying to educate the public it will show which structures were the most vulnerable.

Of course it isn’t as simple as saying,  “Being right under the trees will guarantee destruction. Being in a clearing will not.” Embers travel for miles. And often it’s some structural or landscaping flaw, e.g. dry vegetation right up against the house and under the eaves that causes ignition. An informative public presentation would show time lapse fire and wind travel superimposed on aerial imagery, along with contextual images of damaged structures.

My condolences to anyone who has lost a home in that area.

New HICT 7-minute workout app for Windows Phone

Windows Phone users, you know who you are…the few and (mostly) proud, eh?
I got inspired by an article in the New York Times magazine (faithfully read by almost all ‘Hiders) on a 7-minute(ish) HICT workout and built an app to make it easy to run through the exercises and memorize the sequence. While I’d rather be out adrenalizing on my mountain bike, I’ve been enjoying going through the routine 3X a day. It’s a much better break than hitting the coffee pot and can be done almost anywhere. All you need is a chair and a section of blank wall big enough to fit your big behind against.
Check out the sped-up demo video:
And head on over to http://www.windowsphone.com/en-us/store/app/7-minute-workout/879efccc-5c9e-4b19-b8e6-346b76ff0133 where you can download a trial version for free.
As soon as I do some code cleanup and refactoring, I’ll be posting on some of the great things I learned (with a bit of pain) on async/await and creating accurate timers for Windows Phone and Windows 8 (using the same code of course!)

Kinda like Regex

So I’ve got this auto-incrementing C# TimeSpan that I need to format to just show single minutes and seconds, e.g. 3:48.

var timeSpan = new TimeSpan(0, 0, 0, secondsElapsed++);

Bugger took a while to figure out because I kept trying things like “m:ss” in my string formatter, not catching on that, just as in a Regex expression, I need to escape the colon. That can be done either by:

var timeStr = String.Format("{0:m\:ss}", timeSpan);

or:

var timeStr1 = String.Format(@"{0:m:ss}", timeSpan);

I find that things like this take longer to figure out not because I don’t know how to do them, but because I have these preconceived notions of how they’re supposed to be done. Ordinarily, a string formatter is very forgiving of input so I expected it to “just work” in a certain way.

On another note, displaying a timer looks much better if you use a mono-spaced font. Otherwise, the number jump around as they change. Since this is being used in a Windows Phone app, I set the text block like this:

<TextBlock Name="TBlockTimerDisplay" TextAlignment="Right" FontSize="36" FontFamily="Segoe UI Mono"/>

THere are a couple other typefaces, such as Courier New, included with Windows Phone, but Segoe UI Mono would be my first choice, since it matches the default typeface for the OS.

What’s In Your Wallet?

UPDATE: Use http://openidtest.uninett.no/jwt instead. The Google link below is okay, but I really get annoyed with all the web traffic that occurs every time you hit any page belonging to Google. And, in this case, every time you test a token. Fiddler just clogs up with a ton of web sessions. Openidtest uses javascript within the page. And it works with any browser I’ve tried.

https://developers.google.com/commerce/wallet/digital/docs/jwtdecoder – for those times when you want to see what’s in your wallet…or…er…just decode a JWT (JSON Web Token)…any JWT…without having to wire up something for testing. For instance, I just threw a brand new blank Windows Phone 8 project into a solution. So far I’d only added a Live Sign In button and wanted to verify that the same UID is being generated from there as is from a Windows 8 app. I have a JWT decoder in my server-side code but still need to wire it up to the WP8 client. The server is expecting more info than just a JWT. You have to appreciate when major competitors – unwittingly or not – work together to help the little guy, yeah?

BTW, if you do sign in with the same Microsoft Account, the UID will be the same. Some more on JWTs related to that subject in an upcoming post.

UPDATE: The decoder doesn’t validate that the JWT is actually signed. This brings up an important point: JWTs are not encrypted. They are signed, but all that means is that the data hasn’t been altered in transit. If you’re going to work with JWTs then SSL is a must…or if you couldn’t (for whatever unfathomable reason) use SSL, some sort of public/private key encryption from client to server.

WinRT Raw Notifications and Suspended State

Something to note if your WinRT app uses raw notifications. They will be received by the device but not by the app if it is suspended. This makes sense but may not be obvious sometimes because swiping the left side of the screen may still show the app on the stack. So it will appear to still be active, even if not in the foreground. The exception, of course, is if your app is registered to use a background service and the user has decided your app is important enough to be one of the “Lucky Seven” (those apps given permission to use the Lock Screen). I wouldn’t count on it.

It took me a bit to spot this behavior. I was noticing an instance of the app on one machine would sometimes receive raw notifications if it wasn’t in the foreground, sometimes not. The “not” occurred after a decent time lapse, which was the first clue. My server notification logs were no help because only client devices that were off or logged out of would return a status other than OK from the notification service. As mentioned, if the device is on and logged into, the notification service will successfully send the message. This makes sense. All it cares about is reaching the client at the specified URI. It’s up to the client to do what it wants with the received message. In this case, it appears the WinRT designers elected not to wake up an inactive app. Not a problem, but something to be aware of.

In my case, raw notifications are used to tell the app to update its data. It just means that the same sort of behavior also has to be triggered by resuming from a suspended state. BTW, for those who don’t know, you can suspend an app from within Visual Studio while debugging. To enable this, select TOOLS > Customize from the Visual Studio menu. Check the box next to “Debug Location”. If you have a solution with multiple projects you may have to select the right WinRT project from the Process pull-down menu.

SQL CASE Statement

Maybe knew of it, but hadn’t had reason until now to use a CASE statement in SQL:

UPDATE Devices

SET InUse = (CASE UserId WHEN 3

THEN 1

ELSE 0 END)

WHERE DevGuid = '94F74150-26B0-4396-982C-675A14A66FAD';

In this situation, there are multiple rows with the same device GUID because more than one user may use the same app on the device (but not simultaneously…unless they’re extraordinarily close). What this query does is get all the rows that share the same device GUID, then sets the InUse bit to true (1) if the UserId matches (3). Any row within that set with a different user ID gets its InUse bit set to false (0). This avoids having to make more than one call to the server.