Category Archives: Thought crime

Thought crime Windows Phone 7/8

“Unfortunately, you can’t do that on Windows Phone”

As I’ve started answering questions about Windows Phone on Stack Overflow, MSDN and Nokia forums, I noticed that many of my answers were essentially paraphrased “Unfortunately, that is not possible to do on Windows Phone.” And it is not as if people wanted to change default search provider to Google (you can’t) or setup your device without Live account (you cannot either), these were developers either anxious to port existing applications from Apple/Android world or fresh ideas for improving Windows Phone platform.

But they’ve all hit dead end in their development career. You simply cannot do lots of cool and interesting applications since you don’t really have access to many APIs, or because you don’t have true multitasking. True, the situation is vastly improved with Windows Phone 8, but some features are still missing. And not only developers are hurting, users are hurting too.

For example, you don’t have read API for accessing SMS messages, mails, internet usage, podcasts, videos, etc. You also don’t have write access to many interesting things. How is that useful, you may ask. Well, I want:

  • …a cool application that tells me with whom I talk or message the most in a given month.
  • …to see cool visualization of my recent activities
  • …backup SMS messages somewhere else
  • …to measure which application is spending most of my expensive bandwidth and maybe block it from accessing internet.
  • …to share which podcast channels I subscribe to and which episodes were my favorite
  • …be able to detect incoming calls and display additional info on screen, like last SMS sent to that person
  • …to be able to hangup a call and send SMS from some template
  • …etc.

Windows Phone features one really cool concept – hubs. The built-in ones cover most of your phone activities: messages, people, games, media. But think of the ways you could extend Message Hub, People Hub, Music+Video hub, Games hub to further increase both my usage of the platform and better engage in various activities.


I could add Steam achievements to Games or put links to HTML5 games directly into the Games hub. I could synchronize custom podcasts from the web – like adding YouTube channels as podcasts or I could add them in music or video libraries. Heck, I might even add my own library. How else am I going to send, receive or edit videos. As for People Hub, the central source for all your social clients, I could add Yammer or Flicker integration. Messaging could also be extended with various clients. Oh, and don’t get me started on music player limitations – you cannot play your own playlists in system player! SongCollection doesn’t have public constructor. How else am I going to turn my phone into cool gadget that I wear all the time with me and recommend to all of my friends. You cannot synchronize cool info for all your local songs, like Last.fm stuff or add scrobbling.

How hard is to enable applications to receive events like “Next Song” or “Pause” from the overlay menu into some sort of application handler?

Really, think about all the possibilities. That would be wonderful for the developers.
That would be wonderful for the users.

But sadly, even with Windows Phone 8 you cannot do any of these stuff. You don’t even have the basic thing like notification center. How hard is to create a ListBox with collection of strings? So how am I going to recommend Windows Phone to someone who wants basic things as internet quota manager or who wants to send template SMSs (e.g. for paying ticket in public transports). Many great ideas, but sandboxed application with severely limited APIs have crippled the platform. And you can’t have podcasts if you are not in USA or something like that.

And don’t compare WP to iOS or Android. Instead of catching up, lead the way for once. If you want people to jump ship, add stuff others don’t have, but sure as hell don’t forget the stuff they already have. Unless Windows Phone evolves, it will be a platform of limited reach and the only people who buy them are going to be the ones that are faithful to the platform.

Others won’t care that much.

Thought crime

Look ma’, I redesigned Facebook

After reading Simple user styles I immediately downloaded Stylish (Chrome extension) and started messing around with Facebook. I always found UI filled with unnecessary stuff and I could finally remove certain parts (i.e. hide them).

Since I also like darker themes, quick result is something I call Darkbook :) Take a look:

Darker version of Facebook using user styles

Darkbook

I changed the default fonts, removed the right layout (who uses it anyway) and stretched the middle column a little bit to the right. I really like Google Web Fonts, you should check them out. I used Ubuntu for left column and Open Sans for everything else.

You can find the code on Github. Please note that this is merely an attempt at restyling, not a complete and usable style. I will continue to work on it (probably) and make it better over time.

Thought crime

“This site uses cookies” – annoying and useless message

A few sites started showing up messages that either inform you that you must use cookies to use their site or they simply inform you that by using the site you agree that you accept cookies.

Here are two examples: the first screenshot comes from Humans Invent and the second one comes from XBox 360 the official XBox magazine.

Site screenshot

Where is the “I do not want cookies?” button


Screenshot of a web page

Again, what if I don’t want to use cookies?

In both cases you cannot opt out. Why can’t you use their sites without cookies? Sure, you can install add-ins for all major browsers that can block everything from cookies to kitchen sinks, but why can’t I choose “no cookies for me”? I don’t care about cookies that much, and if I did care, I would install cookie blocker. But to put up that ugly interface that gives me literally zero information about what is it in the cookies that is so valuable and that literally doesn’t give me an opt-out scenario.

That is almost unacceptable. Luckily, there are always handy add-ins that solve the problem :)

Thought crime

2012 in review

Happy new year everyone.

I want to say thanks to my friends and colleagues for their support. I also want to thank Nokia, Rich Dunbar and guys from Windows Developer Show for getting me a brand new Lumia 800 :)

Thought crime

I wish that C#…doesn’t throw when iterating over null collection

Consider the following code:

List<string> list = null;
foreach (var element in list)
  //... NullReferenceException above

Boom, in your face! We want to go through all elements in the nonexisting collection. Not empty, but nonexisting. While you may argue that semantically there is some difference, when do you actually want that exception to blow up? Fix is easy, but ugly:

if (list != null)
{
    foreach (var element in list)
        //
}

One way to implement this would be to allow a compiler flag that will expand foreach (var element in list) into:

if (list != null)
    foreach (var element in list)

This is the same question as before: should you ever return null collections.

My answer is no, forget the null and make code prettier :)

Thought crime

Would you like Steam RT?

Valve drops another bomb – Valve: Linux More Viable Than Windows 8 for Gaming [ubuntuvibes.com]. Quote:

In a presentation at Ubuntu Developer Summit currently going on in Denmark, Drew Bliss from Valve said that Linux is more viable than Windows 8 for gaming. Windows 8 ships with its own app store and it is not an open platform anymore.

First of all, Windows 8 is still an open platform. Last time I checked you can install Steam without any problems and two “app stores” can coexist peacefully. You cannot install Steam on Windows RT however, since there are platform limitations. You cannot, for instance, install or even run another application from the Windows Store application.

In one scenario, Microsoft could allow linking to an existing Store applications the same way you can link to Windows Phone Marketplace Content and you could then open Marketplace directly from third party applications. But this would then reduce Steam to nothing more than a gallery of apps and you would still have to push application to the regular store with 30% cut going directly to the Microsoft. This makes no sense.

Steam for WinRT would have to have special privileges to install applications and Microsoft would have to forfeit its cut if Steam publishes an application. If Microsoft would allow such thing for one company, what prevents them from allowing same API and same set of functionality for any store application wannabe? Sure, no one obliges them to do so, but think about the potential. You would have Desura, Origin and perhaps even some new store applications which could unleash entire new level of creativity on Windows RT.

But it would also compromise the basic tenets of Windows RT or Windows for Consumers – security, stability and guarantee of quality. Microsoft couldn’t simply let someone else judge what makes a good Windows RT application. On the one hand, they could “outsource” quality checking to third party providers and make sure that all hardships created from bad application fall on such third party store. If user downloads a game through Steam and it crashes, should he or she blame Steam for letting such application to the store or Microsoft, the underlying creator of the entire platform.

On the one hand you could import entire Steam ecosystem on the new platform, something that could boost Microsoft in many ways:

  • You could import your Steam friends directly into the People hub and still maintain friendship whilst playing same games
  • Your already purchased games could be recompiled for the new platform and with touch and location sensors, you could give an entire new dimension to the already existing games
  • Competing platforms could integrate directly through people’s hub and benefit from Share and Search contracts.

But you could also require Steam to give access to its underlying data. There is no API that can read all information from your Steam account and if given for naught, it could increase the value for all participants.

Proponents of open systems would love having everything on a single device. Microsoft could create strategic partnership(s) for mutual benefits. Maybe this is just a dream from a small percentage of the entire potential population and the entire idea is bad from the beginning. But maybe, just maybe, you cloud bridge ecosystems and instead of building yet another walled garden, you could coexist and create a beautiful harmony for the future.

Thought crime

PC is not dead, it has been re-Surfaced

It seems popular nowadays to write about the imminent death of PC, written mostly by people who don’t use it. Who is going to slaughter and replace PCs? It seems that consumer devices like tablets or even smartphones are the usual suspects. However, consumption devices are not creation devices and lots of people actually do need to sit for 8 hours or more on their laptops and work. Do you really think that touch interface and tablet form factor is sufficient for most tasks?

Enter Surface – PC in a tablet form factor. Brent Ozar describes his experience:

I plugged in my USB presentation remote and it just worked.

I plugged in a 64GB micro SD card with all my presentations and files and it just worked.

Although the rest of his posts deals in his dissatisfaction with the Surface, these two lines capture the essence of the post-PC era. PC is not dead, it is changed.

Changed in the way we think about its form, its peripherals, its usability and its interface. Most of the people do not work on their computer most of their time. PC is too powerful and, most of all, too complex for most people. I want to use my device in the simplest possible manner. And that is why PC must change.

But it will not die. You want to run Office on it. Students will need to program on it, use MATLAB, Catia or any other special software designed for their particular area of study. You could, in theory, write iOS, Android or Windows RT applications that could do that, but most of the software still uses the full power of x86 world.

Or should I say that it uses the full complexity and long history of interoperability. You cannot discard that in a few years while toying around with a tablet. Long history of computing is resilient to such abrupt changes.

Thought crime

Windows Store accepts and rejects applications inconsistently

Jeffrey Harmon has an interesting post over at his blog about his woes. His application was rejected with generic errors that do not explain in great detail how to reproduce the error. Finally, the errors have occurred in strange condition that would indicate that the testing is really thorough.

But if the tests really are that vigorous and Microsoft tests your application on all devices it can find (both ARM and x86, low-spec and high-spec), how come the following applications passed the tests:

Mind you, this is the default logo that is added to your application when you create new application in Visual Studio. You absolutely have to change it and use an image suitable for your application. They should have never appeared in the store.

Thought crime

Why you should (almost) never write void asynchronous methods?

I came across this interesting post by Christian Jacobsen titled async/await in C# – a disaster waiting to happen? in which he describes that simple refactoring can introduce serious bugs in async code. While there is definitely something to be said about possible problems with the new Async feature, his example can teach us something.

I will borrow his code to illustrate the point:

async void AcquireFromCamera(object sender, RoutedEventArgs e)
{
    try
    {
        var imageStream = await _cameraCapture.Shoot();
        var dto = new Dto(){ImageStream = imageStream};
        _handler.ImageCaptured(dto);
        Frame.Navigate(typeof(EditDataPage), dto.Id);
    }
    catch (Exception ex)
    {
        new MessageDialog(ex.Message).ShowAsync();
    }
}

async void ImageCaptured(Dto dto)
{
    dto.Id = Guid.NewGuid().ToString();
    var file = await _fileHndlr.CreateFileAsync(dto.Id);
    dto.ImageFilePath = file.Path;
    _fileOperator.StoreStream(dto.ImageStream, file);
    SaveNewDataItem(dto);
    var dataItem = dataSource.GetItem(dto.Id);
    StoreData(dataItem);
}

Christiansen argues that this is a buggy piece of software since the AcquireFromCamera method calls ImageCaptured as if it was a synchronous method. And he is right since both methods are non-returning. This usage of asynchrony is called fire and forget.

To fix this one needs to change the return type from void to Task and the compiler will now warn you with the following warnings:

warning CS4014: Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Void returning asynchronous methods are called fire and forget simply because you don’t need to know when they complete, you initiate them and that is it. The code above requires the ImageCaptured function to complete before continuing and for that you need to await it.

Change the return type for all asynchronous methods from void to Task or Task<T>. If the asynchronous method does not return any value, use Task. If it returns an instance of type T, use Task<T>.

So which methods can be both void and async? Only event handlers since the caller does not need to know when the method completes.

Thought crime

No more Twitter in IFTTT

From TheNextWeb

The internet service glue product IFTTT has been forced to remove its Twitter triggers after recent changes to Twitter’s API policies. The change was confirmed in an email sent out to IFTTT users today (Thanks to Federico Viticci for the contents of the email.)

Well, that escalated quickly