Azure WebJobs: You need Connection Strings

If you run into any trouble after adding a fresh Azure Webjob to your project and try to run it, my guess will be it has to do with connection strings and a missing storage account. If you don’t have an Azure Storage Account then creating one will be the first step. You then need to define these two connections strings in your web app: Portal (Web App -> Configure):

  • AzureWebJobsDashboard
  • AzureWebJobsStorage

connection-strings

And the format for those connection strings:

Replace STORAGE_ACCOUNT_NAME with the name you give the storage account and get the PRIMARY_ACCESS_KEY from the Portal.

If you’re going to connect to a database, also make sure that the name of the connection string you’re using is present in the Portal as well. Otherwise, if you use something like ‘DefaultConnection’ (in your DB context) which is the default one, the Azure Web App will make sure to make that work, but WebJobs will not. When you look at the connection strings in the portal you will probably not find DefaultConnection, but something along the lines of “prod_db” etc. Either rename the connection string on both ends or make sure that ‘DefaultConnection’ is present so that WebJobs can access it.

Hopefully this little post can be of some help if you run into the same problems as I did.

Running Docker on Hyper-V

It has been clear that the obvious choice when running Linux on Windows has been using VirtualBox or VMWare. It’s easier. VirtualBox and VMWare allows you to configure host-to-guest folder sharing without having to configure something called Samba/CIFS and you could get decent video performance.

Then again, many of us running Windows do however use Hyper-V on a regular basis. At least for me the Windows Phone emulators runs on Hyper-V. You could dual-boot your Windows (If this is something you’d like then check out Scott HanselmansSwitch easily between VirtualBox and Hyper-V”), and I did for while. It got tedious. Why can’t we have it all?

Then this product called Docker came along:

Using Docker on Linux we could package up our apps and distribute them. The apps would run inside containers which is sandbox for running a complete virtualized system inside another system. Basically we’re talking about virtualization. The thing that should strike you is the notion of replacing your README.md file with a Dockerfile that describes how to create a ready-to-use image for running your app.

You can then distribute this Dockerfile and let other people build images off of it, or even better, create images and upload them to Dockerhub for everybody (or privately) to pull and use.

I have begun using it, and even though I’ve hit some problems (mostly due to the fact that I run Windows and Hyper-V) I’m excited to use it and start using it to package our web-apps in particular at work.

This post will be a quick guide on how to get Docker up and running using Boot2Docker or from a plain Ubuntu Server installation.

Windows 10 Continuum for Phones

Ever since I got to play with my dads Nokia 9210i Communicator back in the early 2000s I’ve always been searching for the mobile experience that could evolve upon request. That could be a small phone, but when you needed a little extra it could adapt. The 9210i Communicator was something like that and I’ve been searching for an upgraded experience ever since.

"Nokia 9210" by J-P Kärnä. Licensed under CC BY-SA 3.0 via Wikimedia Commons - http://commons.wikimedia.org/wiki/File:Nokia_9210.jpg#/media/File:Nokia_9210.jpg
“Nokia 9210” by J-P Kärnä. Licensed under CC BY-SA 3.0 via Wikimedia Commons – http://commons.wikimedia.org/wiki/File:Nokia_9210.jpg#/media/File:Nokia_9210.jpg

 

Upon this day I have been through phones running Windows Mobile (or was it PocketPC Phone Edition of some sort?) and the last phone I bought that was anything like the 9210i Communicator: Nokia N900. I loved the device. It had a full keyboard and ran Linux. I could use the package manager and download more hardcore software, and it had pretty much (at that time) every possible way of connecting to people, networks and devices. Eventually I had to switch it with something more modern that allowed me to run the apps I had started developing for Android.

Nokia N900. Look at that task switcher
Nokia N900. Look at that beautiful task switcher

The market had been quiet for quite some time, then Microsoft showed up with their Surface and Surface Pro tablets that ran Windows 8. The Pro being a fully fledged computer running on Intel chipsets, with full USB port and a 10,8″ multi-touch screen and add the Type or Touch Cover and you had a laptop. Finally I thought; now we’re getting somewhere. In fact, I own Surface, Surface Pro, Surface Pro 3 and a Surface 3 to this day. It has really come to be the type of device I’ve wanted for many years. It is a beautiful tablet that can evolve into a laptop (attach the keyboard) or a desktop (dock it) and the experience adapts for its usage.

WP_20150510_14_16_15_Pro

 

The Surface is a great step on the way for the experience that I’ve sought for all these years. It’s still not quite there, but Microsoft seems to be heading in that direction. At the Xamarin party the night before the Build 2015 conference started I talked with a Microsoft employee, and I got to talk about this concept with him. After I told him my story, he smiled and said “It’s not quite ready, but it will come”. I was intrigued.

The next day at the keynote Joe Belfiore showed us Continuum for Phones. Continuum is already known in Windows 10 as the feature that switches the Windows experience from PC mode to tablet mode and vice versa. Continuum for Phones will allow you to dock your phone or connect to a wired or wireless screen and it will adapt to become a desktop. The only downside with these phones today is that they run on ARM architecture and that means the only software you can run must be built for ARM.

Continuum-Windows-Phone
microsoft-windows-10-continuum-for-phones

 

Down the road Microsoft hopes that the majority of mainstream apps will be Universal Apps that run across the Windows 10 device family, but until that time there’s still a bunch of classic Win32 apps that one would want to run. At least that I would want to run. Until phones come with an Atom chip or some other x86/x64 chip there’s always Remote Desktop to the rescue.

With Windows 10 the phones have access to the same HID support so mice, keyboards and all the other USB peripherals will be able to work with it. Marvelous. When you connect your phone to a dock or a screen, you can still use your phone normally, so it will be like having dual-monitors where one screen is really tiny.

I am genuinely excited about this feature, and is a major step towards the experience I’ve been seeking. It’s still not quite there.

My hopes going forward is take the same concept and introduce a Surface Phone and bundle it with empty Surface tablet shells and other formfactors. Why empty? When we get there, it will no longer be necessary to bring your laptop or tablet with you. The phone is your PC, and you can dock your phone in to the Surface shell. The phone can adapt to become a touchpad if you want (imagine docking it where the touchpad would normally be) as we all know that the only ones that have great touchpads for laptops is Apple. The shell can contain extra batteries instead to increase the longevity of your session. There’s many possibilities, and I would love to one day just carry a phone with me. That’s at least the first step, then we can talk about more complex interfaces as we’re getting closer to realizing them.

The other company that has been making the same kind of progress is Ubuntu with their Ubuntu Phone, so if you’re a Linux user (as I once heavily was) then you should totally check that out. It’s exciting times that’s for sure!

0212_ubuntu_android_660

One last thing: Microsoft should drop the Continuum for Phones name and just go with Continuum. Please.

Surface 3 initial impressions (interrupted)

Surface 3 was released to the public here in Norway on Thursday (7/5/2015). I was lucky enough to get my hands on one for free the very day.

The largest online retailer of computer equipment Komplett.no held a contest in association with Microsoft Norway. Having been situated at home the last couple of days (under the weather), I told my girlfriend about this contest. Komplett.no would announce at the strike of 12, 15 and 18 three locations where the first person to see one holding the Surface 3 and “shouting” “I want a Surface 3” would get to take that Surface 3 along with a Type Cover home. Eagerly we sat around 12:00 and waited for the announcement, and one of the locations announced was pretty close, so my girlfriend put on her shoes and ran to try get a hold of one. When she was almost at the location I texted her that it had already been given away.

After that first attempt I thought the next announcements would be in different cities or in a galaxy far far away. When my girlfriend got home she handed me a large white shopping bag: “Here, I got something for you”. Turns out that she followed the 15:00 announcement and the location? Right outside where she works, so she immediately ran over and got it. So thank you darling for the effort, it was really nice of you!

Here's my girlfriend holding the Surface 3 and the new Type Cover
Here’s my girlfriend holding the Surface 3 and the new Type Cover

Enough with the mushy backstory already, let’s take a look at what we got here.

VS2013: An exception has been encountered. This may be caused by an extension.

Hey peeps,

Ever gotten the nice error dialog when opening your Visual Studio saying something like: “An exception has been encountered. This may be caused by an extension. You can get more information by bexamining the file ~AppDataRoamingMicrosoftVisualStudio12.0ActivityLog.xml”?

Then after reading that, you think “OK, lets check it out. Might be some useful information there”.

Opening up the ActivityLog.xml you’ll probably notice that your assumption might have been slightly off base:

System.IO.IOException: The file exists. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.__Error.WinIOError() at System.IO.Path.InternalGetTempFileName(Boolean checkHost) at Microsoft.VisualStudio.Text.Utilities.WpfHelper.LoadCursorDPIAware(Stream cursorStream) at Microsoft.VisualStudio.Text.Editor.Implementation.LeftSelectionMargin.get_RightArrowCursor() at Microsoft.VisualStudio.Text.Editor.Implementation.LeftSelectionMarginProvider.CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin) at Microsoft.VisualStudio.Text.Utilities.ContainerMargin.<AddMargins>b__2(IWpfTextViewMarginProvider mp) at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InstantiateExtension[TExtension,TMetadata,TExtensionInstance](Object errorSource, Lazy2 provider, Func2 getter)

Boom! Now what to do with that? Turns out this indicates that Visual Studio or some extension has difficulties creating files/folders in your Temp folder, because it is full! Full being it has over 65535 files/folders in it. Cleaning up the temp folder will do the trick, and also save you some space. In my case I had 4 GB of crap laying around. (Where did all that come from and why weren’t it deleted automatically?).

Oh, your Temp folder is probably located here: C:UsersYOURUSERNAMEAppDataLocalTemp.

Have fun!

First Technical Preview of Windows 10 for Phones launched

Today Microsoft launched the first version of Windows 10 for Phones. This is a Technical Preview just like the desktop counterpart, and is only recommended for the hardcore enthusiasts that don’t mind to encounter bugs, crashes, weird behavior and unfinished work. I like to live on the bleeding edge of technology. If there is something new I can test then I want to test it out. Unfortunately, this first release is only intended for a small sub-set of Lumia devices in the low-end part of town. If you got one of these devices then you should be able to test out Windows 10 today:

  • Lumia 630
  • Lumia 635
  • Lumia 636
  • Lumia 638
  • Lumia 730
  • Lumia 830

That means I won’t be able to test it out quite yet, I posess a Lumia 520, 530, 1020 and 930, so you have to rely on other sources for videos, screenshots and “reviews” of the Technical Preview. If you want to see what’s new and what’s coming in the near future, take a look at this video feautring Joe Belfiore:

Why am I not getting this preview right now!?

Apparently our beloved high-end devices have very tight OS-partitions and no possibility at the moment to dynamically adjust the partitions, which as stated by Microsoft makes it hard to update the OS in-place:

“Some context on why we chose these and not higher end phones like the 930/Icon or 1520: We have a feature that will be coming soon called “partition stitching” which will allow us to adjust the OS partition dynamically to create room for the install process to be able to update the OS in-place. Until this comes in, we needed devices which were configured by mobile operators with sufficiently sized OS partitions to allow the in-place upgrade, and many of the bigger phones have very tight OS partitions.”

Check out the blog post announcing the release, and be sure to check out the known issues before you decide to install the Technical Preview on your phone!

Microsoft Blog: Announcing the first build of Windows 10 Technical Preview for Phones

Xamarin Android: You are trying to install this package into a project that targets ‘MonoAndroid,Version=v2.2’

Today I created a new Xamarin Android project, and I wanted to test out Material Design on my phone (still runs 4.4.2) using the revamped AppCompat v4 library. To my disappointment I was unable to install the AppCompat NuGet package:

Turns out this can be a common problem when using Visual Studio and the “Compile using Android version” is not explicitly set. The default in my case is “Use Latest Platform”. What this does is making VS to add the proper TargetFrameworkVersion property in the .csproj file. It seems that sometimes this does not get set at all when creating a project and “Use Latest Platform” is set. Weird. In any case, setting this explicitly fixes things and NuGet understands which version of MonoAndroid to use. The default is 2.2, but we want something newer, preferably Android Version 5.

So change this:

01-compile-using-latest

To this:

02-compile-with-21

Reload the project when asked by Visual Studio and install the package again!

Thanks to the awesome community over at the Xamarin Forums for being on top of this already — check out the post here.

UPDATE: Haha, never mind the blurred out assembly name in the first image. Don’t know why I did that 😉

Why I pirate movies and feel good about it

I’ve been trying to write this post for a while now, and you have no idea how many times I’ve redone it, so here it goes:

Ever since the introduction of public (high-speed) internet there has been piracy: movies, games, tv shows, music, whatever, you name it. Nothing new here. I’ve been a “pirate” since we got cable internet since my early teens. Back then I had no money, no way of obtaining this material, and the good thing piracy has always brought with it, is exposure. There’s no way I would have had the same exposure to movies, games, tv and music if the concept of downloading it free off the internet didn’t exist. No way.

If we fast forward to today, I’ve solved my money issue, and Norway has and is becoming increasingly international. I’m guessing in a few years we won’t speak Norwegian anymore. We’ll speak in memes, abbrevations, and English. Ok, it’s not that bad, but it’s not a far fetched idea. To get back on track; Norway is following USA tightly in what media gets released, so the exposure problem is in some areas like movies and tv shows not an issue anymore.

Then why do I still download stuff off the internet for free? And how can I speak so freely about it?

To begin I’m not downloading as much today as I did back then. Just the other day I rented two movies from Xbox Video, which almost worked perfectly (small issues with the stream), so I am definitely moving in the right direction.

Wait up. It’s not really me who’s moving in the right direction. There are some in the industry that has slowly begun to realize how consumers want to consume their media. Today we have services like Spotify, Netflix, Xbox Video, Xbox Music, HBO, Viaplay, the list goes on, that provides unlimited access to content in exchange for a small amount withdrawn from your wallet each month. The only problem here is that they all vary in how much content they provide, so a small amount can quickly escalate to A LOT withdrawn each month.

Take me as an example. I use these services regularly and pay for it:

  • Spotify
  • Netflix
  • Xbox Video
  • Xbox Music

And I’m quite happy with giving my money; they are good services that provide plenty of content with a good user experience. That’s where the industry should put their focus and their money at. Thinking new, thinking ahead, think different!

The criterias I put forward for a service that suits me (and I’m guessing a lot of other people):

  • Needs to have a lot of content (good content is always preferable)
  • Needs to be able to deliver it to me instantly (streaming right?)
  • Needs to be ad-free (there’s nothing more disturbing than buying a movie and having to watch 10 trailers and the “YO fool, don’t steal shit”-movie before the menu appear)
  • Needs to be fairly priced
  • High quality

Based on that, I download stuff illegally when:

  • I can’t find what I’m looking for in the services I pay for
  • It’s not good enough quality
  • The only legal way is buying a hard copy. Ugh.
  • There’s no way I’ll be able to afford it in one years worth of salary

There’s probably a lot of other smaller reasons that will influence my decision to pirate or not. Like when the industry goes bat shit crazy and snuggles up with the government to try to impose a tax on our internet access due to lost income. Or when the government replies that they’re actually considering it. Come on guys, wake up.

In the end I feel good about it. I’ve set up rules and guidelines, and if the industry can’t please me as a consumer then I know the pirates will be able to.

(no calling the cops or lawyers, please 😉

Project of the Week #3 – Day 7

Welcome to the last day of Project of the Week for the third week in 2015. I started off great the first days, but due to other activities I haven’t been able to do anything the last couple of days. Since it’s already afternoon this will be quite interesting to see if I can:

  • Test the mobile service
  • Create a login page in the app
  • Display schedule for current day
  • Create the detail page for a session
  • Post comment
  • Attend/Not attend session

Let’s not give up before we’ve started, but this seems like a great amount of work to do in one day, but let’s just begin. Continue reading to see how it all fares.

Project of the Week #3 – Day 6

Unfortunately, what (usually) happens after going out the night before, the motivation for doing any work is reduced considerably, so day six has been a total still when it comes to the continued development of the app.