Tuesday, October 29, 2013

Azure DevDays

Marraskuun 11. päivä pidetään Microsoftilla (Keilaranta 7) Azure DevDays-tapahtuma joka nimensä mukaisesti keskittyy Azure-teknologioiden ympärille (ja nimestään huolimatta on vain yksipäiväinen Smile). Minäkin olen siellä kertomassa tekemästäni Azure-palvelusta Linnanmäen Windows Phone- ja Windows 8-appeja varten. Tervetuloa kuuntelemaan ja kyselemään!

Ohjelma ja ilmoittautuminen täällä.

Friday, September 20, 2013

Run your development workstation in the cloud

I have been working lately on projects that require me to use legacy versions of development tools (such as VS 2010, SQL 2008 R2 etc). I normally run the latest and greatest versions of everything on my personal development workstation so this has forced me to put up a Hyper-V virtual machine that has the required versions set up properly. Luckily MSDN has all of the legacy versions downloadable :)

I do development work using multiple workstations depending on where I happen to be. I have a more powerful, bigger laptop at my office as the primary developer workstation with external display, keyboard etc. Since it is a bit painful to lug that laptop around when visiting customers, I also have a more lightweight laptop that I use as my take-anywhere tool of choice. That leads to a problem of what to do with the locally hosted development vm? I could copy it to both laptops (the lightweight one is also a Win8Pro machine), but then it would be out of sync constantly on the other machine, although all project source code is managed via the Team Foundation Service at http://tfs.visualstudio.com/.

The solution I came up with is that instead of running a local vm I set up a vm in Azure as an IaaS virtual machine. There is even a platform image with a legacy OS and SQL Server version:

clip_image001

So that would solve my problem! This solution has the benefits of being able to access the same hosted vm from either of my active development machines (or any other machine that has remote desktop capability). It was also a positive surprise (although I knew that but hadn’t realized it in practice earlier) that hugely large downloads from MSDN get downloaded via the extremely quick network that Azure datacenters have. Downloading a 4GB ISO image took a mere 15 minutes or so!

In practice, I already had a vm set up locally, so I also explored the option of moving that vm to Azure instead of creating a new one. In a later post I will explain how to move an existing vm image to Azure.

PS. This post was mostly written in the inspiring environment of Aalto AppCampus open house event on the “national work from home day” in Finland where I met many old friends and made some new ones!

Friday, July 5, 2013

Photo Location Planner reaches 10k download mark

A few days ago the Windows Phone version reached 10 000 download mark on the Windows Phone Store!

Thanks for all the users for this unbelievable achievement! There are some open bugs that I will fix at some point. Also, I have a lot of development ideas as well, finding the time to implement them is the harder problem to solve :)

image

Monday, June 3, 2013

Unprecedented popularity of Photo Location Planner in WP Store

I submitted Photo Location Planner to Windows Phone Store just about a month ago. This weekend the statistics tell me that it has been downloaded from the store over 5000 times! That is way more than I anticipated, although the app is free but it has a fairly limited audience. The download stats look currently like this:

image

Past few weeks it has been fairly steady at 150-200 downloads per day, which is amazing! I have done very minimal marketing, just a few tweets and blog posts + word of mouth to friends + one post to a local photography forum.

To be honest there is currently at least one case when it seems to crash, stay tuned for an updated version. Many thanks for the individuals who have submitted a crash report via email!

Photo Location Planner in Windows Phone Store.

Friday, May 24, 2013

Photo Location Planner for Windows Phone 1.2

New features:

  • Finnish localization
  • Sunrise & sunset compass direction added to start screen
  • Error reporting added
  • Version history added
  • Link to rate & review added

Version 1.2 has been available in the store for a few days now.

Wednesday, May 8, 2013

Weird behaviour of DateTime.AddMilliseconds() on Windows Phone

I have recently released a Windows Phone App to the store, and it has received fair amount of attention. There has been, however, an annoying bug in the code that I did not have time to investigate closer until now.
The problem is that this piece of code
private static DateTime julianDateToDate(double julianDate)
{
    DateTime dt = new DateTime(1970, 1, 1);
    dt = dt.AddMilliseconds((julianDate + 0.5 - J1970) * msInDay);
    return dt;
}
results in an ArgumentOutOfRangeException if the argument julianDate is NaN (which happens when the app logic fails to calculate various twilight times – they cannot be calculated at all at certain times of year and place).
The weird thing is that the exception gets raised only when run on the emulator. If it is run on a real device, no exception is raised! Luckily it is possible to debug the code when it is running on a device, which revealed the problem.
The simple correction is to modify the method to manually check the argument and raise the exception:
private static DateTime julianDateToDate(double julianDate)
{
    if (double.IsNaN(julianDate))
        throw new ArgumentOutOfRangeException("julianDate");
    DateTime dt = new DateTime(1970, 1, 1);
    dt = dt.AddMilliseconds((julianDate + 0.5 - J1970) * msInDay);
    return dt;
}
The lesson here obviously is: the emulator is not the same thing as the real device. Remember to test your apps on the device as well!

Edit 10.5.2013: corrected the first piece of code to reflect reality!

Friday, April 26, 2013

Photo Location Planner

Are you a landscape photographer? Do you need to plan when and where you need to go to capture the perfect sunrise or sunset photograph?

Aalisoft has developed an app that lets you see when the sun rises and sets as well as the direction on an interactive map. The times and directions depend on two things: the date and place. Before the exact times can be calculated, the position needs to be pointed on the map and the desired date needs to be selected (by default it is today but you can plan ahead and select whatever date you desire).

There are three different types of twilights:

  • astronomical (dark enough for astronomical observations)
  • nautical (dark enough for nautical navigation based on stars)
  • civil (starting to get dark for the human eye)

All these three twilights will also be calculated and shown on the screen. See a good explanation on the different twilights here as it relates to photography.

Available in Windows Store…

Photo Location Planner has been available free for Windows 8 and Windows RT since December 2012.

screenshot_01302013_210442

Photo Location Planner in Windows Store

And now also in Windows Phone Store!

A version of Photo Location Planner is now available also for Windows Phone 7.5 and later (including Windows Phone 8).

WP4

Photo Location Planner in Windows Phone Store

Have fun and take great sunset/sunrise photographs! Or just enjoy the sun without a camera, now you know when it rises and sets!

Sunday, April 21, 2013

Photo Location Planner arvostelu

Aalisoftin tekemä Windows 8 –sovellus Photo Location Planner on arvosteltu mBnetin viikon ohjelmat-artikkelina. Jos olet Windows 8-käyttäjä, käy kokeilemassa!

Sovelluksen Windows Phone-versio on lähiaikoina myös saatavilla.

Monday, April 15, 2013

TF31003 error using Team Foundation Service + VS 2012

I have been a happy user of Team Foundation Service (aka TFS Azure) ever since it was released to general public. Today I ran into an issue that I could not get identified from within Visual Studio (running version 2012.1). I always got

TF31003: Either you have not entered the necessary credentials or your user account does not have permission to connect to the Team Foundation Server at https://***.visualstudio.com/. Ask your server administrator to add the appropriate permissions to your account

No login prompt was displayed at all.

TFS worked like a charm for me if I opened the browser portal, however. I could see all the projects etc. After a bit of searching around the internet it cleared to me: I had logged on earlier using a Microsoft account (Live id) that was not among the ids that have access to the service. Not sure how it really works, but it seemed to make a difference if I opened the browser with “run as admin”. I am also running Visual Studio with “run as admin”, so it sort of makes sense. Anyway, the problem was cleared by opening a “run as admin” browser, go to ***.visualstudio.com, let it tell me that I do not have access and then sign out the account.

And voila, after that Visual Studio asks me for login when I retry connect to team foundation server!

In some internet resources it says that it can be resolved by clearing all cookies, which probably also effectively forgets the auto-signin to TFS.

Publishing apps to both Windows 8 Store and Windows Phone Store

I just submitted a version of my app to Windows Phone marketplace. I thought I’d share some thoughts about publishing apps to Microsoft app stores while the new submission gets certified.

Accounts, accounts, accounts

I have already earlier published an app (Photo Location Planner) to Windows 8 Store. Before that submission was possible, I naturally needed to create an account for it. That account is a standard Microsoft account (formerly Live account). I am not sure if it has changed (probably not), but it is important to know that once an app has been submitted, the publisher account cannot be changed. I am not saying that it requires huge efforts on the publisher and is difficult to do. I am saying it is NOT technically possible at all.

While I naturally have more than my fair share of active and semi-active Microsoft accounts already, they have one problem: they are tied to me personally. If I wanted to transfer the maintenance of my apps later to someone else, I would need to hand the account used to submit the app. If I had used that same account for something else than app submissions as well, that would not be a wise thing to do.

Lesson #1: create a separate Microsoft account for app submissions and use it only for submitting apps, nothing else. That way you can share the account details with someone else without worries of breaching security of some other services you may have used with that account.

I created an alias in my Office 365 subscription and created a Microsoft account using that email address. That way I did not have to pay for an additional mailbox but have the benefit of a separate email address for app submissions.

Personal or company account?

Since I had just founded a company to run my professional life, I created a company account. That lead me to some additional trouble, since Microsoft wants to validate that I legally am allowed to represent my company (which is of course fair in itself).

In practice, they first suggested that I would need to get a signature of public notary to a notary letter. It would have been possible to use also a recent phone bill, but unfortunately my mobile phone is not officially registered to my company and therefore it does not state my company name in the bill. Ok, off to the notary then, I thought. I managed to get a signed notary letter, but with an exception that I wasn’t able to take an oath in the notary as was required in the letter (that would have required a court order, I was told, and is hugely complicated to get!). I sent a copy of the signed letter to Microsoft representative, but that was declined because of the missing oath. Only after this episode did they tell me that I could achieve my goal by just registering my phone number to my company in Fonecta phone directory, which is what they use to check these things. Duh, why didn’t they tell that in the first place! That took 10 minutes and everything was ok after they called me to verify that it was me answering the phone!

Lesson #2: When registering a company account, make sure you have either a recent phone bill that states the company name OR have your phone number registered on the directory Microsoft uses (Fonecta in Finland).

Do I need another account with Windows Phone marketplace?

I first thought that I would need to create another account for publishing to Windows Phone marketplace. I proceeded to create the account just as I did with Windows 8 Store, but when I reached the point where it asks for official publisher name (company name), I noticed that my company was already reserved “by someone else”. It occurred to me that maybe that someone else is my Windows 8 Store account. And that was it, after I logged on using the account I had already created and validated earlier in Windows 8 Store, I was immediately good to go with all information about my company already in place! Great stuff!

Lesson #3: You can/should use the same publisher account for both Windows 8 Store and Windows Phone Marketplace.

Links

Windows Phone app submission portal

Windows Store app submission portal

Friday, March 22, 2013

Upgrading Azure Storage Client Library from 1.7 to 2.0

I recently needed to update a Windows Azure customer project to use the current version of Azure Storage Client library. Luckily NuGet automates most of the package management activities (adding references, dependencies etc). Apparently there have been some dramatic changes in the structure of the library itself, since I had to do quite a lot of work to bring the code back up to working level.

Some issues I bumped into:

Microsoft.WindowsAzure.StorageClient namespace has been renamed to Microsoft.WindowsAzure.Storage

CloudStorageAccount.SetConfigurationSettingPublisher() is no longer supported, use CloudConfigurationManager.GetSetting() instead. Typically like this:

Account = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(configurationSettingName));

StorageClientException class renamed to StorageException, notably the following code:

catch (StorageClientException ex)
{
    if ((int)ex.StatusCode == 404)
    {
        return false;
    }

    throw;
}

becomes:

catch (StorageException ex)
{
    if ((int)ex.RequestInformation.HttpStatusCode == 404)
    {
        return false;
    }

    throw;
}

Uploading/downloading blobs only support streams instead of the earlier options that included byte array, string etc.

So instead of this code:

public void SaveImage(string containerName, string blobName, string contentType, byte[] data)
{
    CloudBlobContainer container = BlobClient.GetContainerReference(containerName);
    CloudBlob blob = container.GetBlobReference(blobName);
    blob.Properties.ContentType = contentType;
    blob.UploadByteArray(data);
}

you need to do something like this:

public void SaveImage(string containerName, string blobName, string contentType, byte[] data)
{
    CloudBlobContainer container = BlobClient.GetContainerReference(containerName);
    ICloudBlob blob = container.GetBlockBlobReference(blobName);
    blob.Properties.ContentType = contentType;
    var blockBlob = blob as CloudBlockBlob;
    using (var stream = new MemoryStream(data, writable: false))
    {
        blockBlob.UploadFromStream(stream);
    }
}

Note the use of GetBlockBlobReference() method instead of GetBlobReferenceFromServer() in the new code. The latter actually hits the server (thus resulting in performance hit), but what’s more crucial is that it actually fails if the blob does not exist. So if you need to create a new blob, it cannot be used at all, so most likely you will end up using GetBlockBlobReference() instead.

Retry policy structure has changed. Instead of this:

BlobClient.RetryPolicy = RetryPolicies.Retry(4, TimeSpan.Zero);

you need to do something like this:

using Microsoft.WindowsAzure.Storage.RetryPolicies;

BlobClient.RetryPolicy = new LinearRetry(TimeSpan.Zero, 4);

Links

Monday, March 18, 2013

Lenovo IdeaPad Yoga 13 first impressions

General

I picked up Yoga 13 from a local hardware store a few days back. It is the best equipped version with Intel i7, 256GB SSD and 8GB ram. See my post on why I ended up with Yoga instead of Twist or Helix here if you are interested.
I wanted the one with as much as possible storage capacity, since it will be used by everyone in my family and each of us have some stuff in Skydrive etc so 128GB version seemed a bit small. However, it seems to be possible to upgrade the SSD but the price difference seemed to make it worth to begin with the larger option. The drive has a lot of partitions on it, which probably not all are useful. I will probably wipe the drive at some point and do a fresh install of Win8, but let’s see when I have the time to do that.
In general Yoga seems like an impressive piece of hardware. Build quality seems very good and the 1600x900 IPS screen looks marvelous. The kids also love it and one of the first things I did was to configure a suitable maximum amount of time per day for them to reserve at least some slices of time for me as well Smile

Yoga as an ultrabook

Yoga is a pretty slick package for a 13,3” laptop, it I fairly light and thin but yet rather solidly built machine. Having used to traditional ThinkPad line of Lenovos in the past, there are two notable differences you need to be aware of.
First, the keyboard is nowhere near the touch and feel of, say, T420 that is my everyday software development machine. The keys have very small amount of movement and thus they feel a bit numb. Also the keyboard layout is a bit different which takes some getting used to. However, this seems to be the norm in all laptops the size of an ultrabook nowadays so you need to sacrifice something to get that thin outlook.
Second, Yoga does NOT have a TrackPoint mouse (that integrated red stick between GHB keys), only a TouchPad as all other ultrabooks on the planet. Oh well, another compromise…

Yoga as a tablet

Yoga can be used as a tablet as well. The screen turns 360 degrees behind the keyboard (or you can turn it halfway into “tent” or “stand” mode). It feels a bit odd at first that you feel the keyboard on the back of the “tablet”, but you get used to it. No worries, the keyboard is disabled in this mode and there are no accidental key presses.
It has happened a few times that in the tablet mode the screen orientation (portrait/landscape) sensor has not worked correctly and I had to put it in sleep and wake it to recognize orientation changes. 98% of the time it seems to work correctly but there may be some driver issues or some other problem that causes that. Update: I know about the screen orientation lock button, it was not activated.
I have found myself using the tablet almost always in landscape orientation. It feels very tall in portrait orientation due to the 16:9 screen. Reading a long text is the only exception, that seems to be ok in portrait orientation.

Summary

Yoga 13 is a fantastic device! The build quality is very good and the idea of different modes (laptop/tablet/tent/stand) is surprisingly natural. It is our family’s favorite PC from now on!

Wednesday, March 13, 2013

Lenovo Yoga, Twist or Helix?

I have been looking around for a new laptop/tablet/touch machine for a few months now, and finally there are some options that are actually shipping. I am a long-time ThinkPad person so I am primarily looking for Lenovo although I know there are other options as well.

Primary use in my case would be:

  • All-around web surfing at home and on the road (vacations etc) for family use
  • Occasional photo editing with Lightroom (I have a separate machine with calibrated display for the serious stuff)
  • Testing of touch-enabled Windows 8 apps that I have implemented
  • Occasional software development with Visual Studio (again, separate dedicated machine for serious stuff)

Due to my requirement to run traditional desktop software, an RT machine will not do. Therefore I am looking at hardware that runs Windows 8 Pro. The pros and cons listed below reflect my priorities and my personal opinions, of course. YMMV.

The options

All of the options below share similar characteristics: i7, 8GB of RAM, an SSD (size varies), around 1,5kg weight and a touch screen that can also be used as a tablet. I have personally test driven both Yoga and Twist briefly, but Helix is so new that I haven’t been able to get my hands on one yet.

IdeaPad Yoga 13

Yoga is a new design that I haven’t seen before. The screen flips over 360 degrees so that it can be used as a tablet. Drawback is that the keyboard is left exposed in tablet mode.

Pros

  • sturdy hinge, good overall build quality
  • 256GB SSD
  • decent screen resolution (1600x900)

Cons

  • no built-in 3G
  • new type of charger connector (I have a bunch of Lenovo chargers
  • no TrackPoint mouse, only a TouchPad (rare for Lenovos)
  • somewhat closed construction (no user replaceable SSD etc, but makes it sturdier of course)

Yoga 13 tech specs from Lenovo site

ThinkPad Twist

Twist has a familiar design from earlier ThinkPad X…T line of convertible tablets.

Pros

  • 3G
  • traditional round ThinkPad charger connector (matters to me because I have compatible chargers lying around)
  • SSD can be replaced easily
  • TrackPoint mouse

Cons

  • low screen resolution (1366x768)
  • glossy screen & surrounding plastics
  • build quality not high enough for my taste (plastics everywhere)

tech specs from Lenovo site

ThinkPad Helix

Helix is the only one I haven’t been able to try out personally, but based on what I have read from the internet, Helix seems to be by far the best device in the group. However, it is also by far the most expensive one and it remains to be seen how well the detachable screen construction works in practice and how durable the hinge mechanism is. If the build quality is excellent and e.g. fan construction proves to be good, then the higher price might be justified.

Drawback of the detachable screen is that all of the electronics has to be packaged to the screen part. That makes the screen+keyboard combo probably a bit top-heavy, although in Lenovo’s design the weight is almost evenly distributed since the keyboard has additional battery – a nice way to extend the battery life.

Pros

  • detachable screen that makes this a lightweight tablet
  • 3G
  • excellent screen resolution (1920x1080)
  • digitizer, pen for precision touch

Cons

  • expensive (about 1000€ more than Twist & Yoga 13 based on preliminary pricing)
  • new construction, durability

 

Summary

I ended up purchasing the Yoga. The lack of 3G is compensated by sharing my Lumia’s network connection and I will just need to either use external mouse or learn to use the TouchPad mouse.