Useful Developer Tools #8: Colormind

A while ago, I wrote about the Adobe Color Wheel here, which helps design noobies to create a color scheme for their product using colors that fit together. The challenge with Color Wheel is, that you still need a “feeling” for colors to create a good looking scheme.

Colormind goes one step further and literally generates you a complete color scheme without having the user know anything about colors. It also offers pre-defined schemes for Christmas, Spring and more. When you are struggling with color schemes, colormind.io might be something for you!

 

Replace your old cronjobs with free Azure Functions within 5 minutes

For some of my older projects, I had some repetitive tasks where a simple job triggers a script to run and load some data from the web. For this, I used good old cronjobs like the ones cronjob.de offers. As this was expensive und quite unsatisfying in terms of flexibility, I decided to move them over to Azure, which just took me five minutes and cost me nothing.

My old cronjobs just did a super simple thing: They called a PHP script every 15 minutes, which was hosted at a hosting provider and did some work for me. So the cronjobs were simple HTTP calls and I had no feedback about results, success or failure. So it was time to move the over to Azure Functions.

Create an Azure Function App

Azure Functions are the Serverless solution that Microsoft offer in their cloud. In a Serverless context, you even go one step further than PaaS does and only provide some code to the cloud that should run, when  you want it to. You don’t care about the architecture beneath it and just want your code to run. Perfect for recurring jobs.

To create a new Azure Function, log into the Azure Portal, select Add > Compute > Function App and follow the wizard to create a service for your functions.

Add your first function

Once Azure has finished creating your Function App, you can create your first function in it. The quickstart guides you through the creation of your first one. As we want to create a cronjob equivalent, the Timer scenario looks like the best one for us. As a .NET guy, I choose C# as my language, but you can also pick JavaScript is you like.

As soon as the function got created, we can start coding. To replace my existing cronjobs, I wrote the following lines.

Define the trigger

Now that the logic is created, we have to define a trigger for the function. At the side menu, we can find several settings. At the Integrate tab, we can define triggers. Because we chose the Timer template earlier, a timer trigger has already been created for us. In the Schedule box, we can define the trigger time formatted as a Cron expression. The predefined 0 */5 * * * * will trigger the function every 5 minutes, so let’s increase it to 15 minutes: 0 */15 * * * *.

Test your function

To test what we created, get back to the Develop tab and open the Logs by clicking at the according button at the top. Now we can Run the function and follow its process in the Logs window. For more details, you can visit the Monitor tab in the menu.

What does it cost?

Nothing. For the moment, at least. As we chose the Consumption Plan as the Hosting plan for our function when creating them, we will be billed on a pay-per-use mode.

The price for execution time is $0.000016/GB-s and $0.20 per Million executions. For us it is still free, as the first 400,000 GB-s or the first 1 Million executions come for free every month. If your function got 1 GB of RAM attached and runs for one second, Microsoft counts this as a GB-s.

Does it scale?

It does and this is one of the coolest things about Azure Functions. Up to a specific (very large) size, these functions scale automatically and provision the best possible compute base automatically to keep them performant. But please keep in mind that the programming model for Azure Functions is stateless and there are VMs running below, that are not visible for you. So state-inconsistency and VM startup time is something you might have to consider.

What’s next?

If you liked the concept of Azure Functions, why don’t you create more? There are many more triggers beside the timer like WebHooks, EventHubs, or Blob Storage changes. Of yourse, you can alos trigger a function manually, with the REST API. You can also define outputs for the results of your functions to use them for processing data.

So give it a try and fall in love with Serverless Computing!

Useful Developer Tools #7: Spotify playlist “Ambience While Coding”

The new year has just started and many of us still have some holiday to spend time on our beloved coding projects. I personally love listening to some music while coding but especially when it comes to concentration, I find songs with lyrics distracting.

Good thing, that Spotify user Emiliy Cheng created a beautiful playlist full of orchestral and movie songs, perfectly for coding: Ambience While Coding (Orchestral, Epic, Movie Scores). If you are in love with code and music, you should check it out!

Interested in more Useful Developer Tools? Take a look at the whole series.

Wallpaper of the month (December 2016): Blurry Corn

New month, new wallpaper. As it is getting really cold outside, I decided to use a summer wallpaper, that is also compatible with 21:9 ulta-wide screens!

You can find all wallpapers of this series inside this OneDrive folder.

Blurry Corn

Free self-guided Xamarin workshop

Two days ago, I gave a Xamarin workshop at the Microsoft Technical Summit 2016 conference in Darmstadt (Germany). This was a full-day workshop with a Xamarin introduction at the beginning and a guided workshop experience, where the participants learned how to

  • Setup a Xamarin development environment
  • Create native cross-platform apps with Xamarin
  • Share as much business logic as possible between iOS, Android and Windows
  • Share layouts with Xamarin.Forms
  • Create a clean architecture
  • Spin up an Azure Cloud backend and connect the app to it easily

I decided to make this workshop open and available for free, so that anyone can take it as a self-guided tour through the world of Xamarin development. So feel free to use it in whichever form you like. If you get stuck or have questions, don’t hesitate to ask them here in the comments.

Screen Shot 2016-12-10 at 22.30.58

Beside, as this is an open-source project, contributions are very welcome! If you know something better, have a good idea, want to correct something or know a better teaching style please feel free to create a pull request. This workshop is getting better with every single contribution!

Have fun with it. You can find the workshop on GitHub.

 

Useful Developer Tools #6: App Icons and Resizers

Finding the right icons for your applications can be a tough task. Especially resizing them for the different platforms is super annoying. That is why I would like to share my favorite icon sources and resizing tools with you.

Finding icons

There are many different icon sources in the web with different quality and range. These are my favorites.

The Noun Project
Pros: Icons for literally everything, CC and paid licenses
Cons: Account required, CC icons come with attribution inside the image

Flaticon
Pros: iOS Style mainly, dimensions and color can be modified online, no account
Cons: iOS Style mainly

Resizing icons

Finding icons is only the first step. In most cases (especially when developing for mobile) icons have to be resized for different screen resolutions and densities. Here are my favorite tools for doing this:

App Icon Resizer
Pros: Resizes for iOS and Android, web-tool
Cons: No Windows, only for toolbar and application icons

Final Android Resizer
Pros: Resizes everything for Android
Cons: No iOS or Windows, Java tool (has to be downloaded)

I hope that helps to find a smarter and faster way through the icon jungle. If you know some other cool icon sources or tools, please reveal them in the comments!

Move your Xamarin.Forms Toolbar to the bottom on Windows

While iOS and Android typically have their toolbars and menus at the top of the page, on Windows you will find it at the bottom in most cases. Unfortunately, Xamarin.Forms renders all toolbar to the top of the page per default, even on Windows. So if you define a toolbar like this, it will appear at the top of the page, when running the Winows application, which is very uncommon there and might look strange to a Windows user.

Previously, you had to write a custom renderer, to modify the toolbar. Xamarin.Froms 2.3.3, which has faced its stable release a couple of days ago, introduces Platform-Specifics, that can modify some UI elements for specific platforms. The toolbar is one of them and we can attach a ToolbarPlacement to it with a single line of code.

However, these Platform-Specifics are still very limited, so we have to keep in mind that

  • Toolbar Placement can only be set application wide, not per page
  • Toolbar Placement can only be set on a NavigationPage

xamFormsBottomToolbar

But it works and it is only one single line, that gives a Xamarin.Forms app on Windows a way more natural look!

Wallpaper of the month (November 2016): Purple Wolf

I love minimalism and clean desktops and a strong wallpaper without any overlapping icons makes me happy every time I start my computer. That is why I started this series of beautiful wallpapers that I find on my travels through the world wide web. This beauty here makes the start!

You can find all wallpapers of this series inside this OneDrive folder.

wallhaven-409338

Source: Wallheaven

Different ways to register devices to the Azure IoT Hub

The Azure IoT Hub is Microsoft’s Internet of Things solution in the cloud. Beside the common event message endpoints, it contains a device management system, which allows to register and manage devices that may send data to the IoT Hub. This increases security by generating a unique access key for every single device that ensures, that devices can only do what they are supposed to allows to disable single devices when they get corrupted. Due to different scenarios, there are several ways to register devices at the IoT Hub.

Windows IoT Core Dashboard

If you are running Windows, the easiest way to register a new device might be the Windows 10 IoT Core Dashboard. It contains a section called Connect to Azure, that allows you to log in with your Microsoft Azure credentials and select an IoT Hub in your subscription, that you want to connect your device to. Once you created a new device, you can get its Security Key inside the Azure Portal or directly write it to a Windows 10 IoT core device’s TPM storage.

iotdashboardnewdevice

Hint: The connection from the IoT Dashboard to Microsoft Azure currently only works with the public datacenters. If your IoT Hub lives in restricted datacenters like the German ones, you currently need to choose one of the other options below.

Device Explorer for IoT Hub

The easiest and at the same time most flexible way to register a device when running on Windows might be the Device Explorer which is an open source tool that manages IoT Hub connected devices simply with the respective connection string. This also works with restricted datacenters like the German ones.

Once you entered the connection string for your IoT Hub, that can be found inside the Azure Portal at your IoT Hub’s Shared access policies section at you iothubowner policy, hit the Update button and switch to the tool’s Management tab. Here you can manage all of your devices and their security tokens.

deviceexplorernewdevice

Command Line Tool

To manage an IoT Hub platform independent and automate things, command line interfaces based on Node.js are always a good choice. Beside, typing commands in a terminal window looks a lot cooler than clicking things on a UI. The iothub-explorer cli is exactly this. It can be installed easily as a Node module and works on every platform.

If you just want to add and delete devices, you could also take a look at a small command line interface, I created. It is much more lightweight than the official one and maybe exactly what you need.

Using code (C# or JavaScript)

Beside all that, Microsoft also offers libraries for several development frameworks to register a device. Especially when you want to automate device registration or you are not working on a Windows machine, this might be an interesting way for you to go.

Hint: Due to security reasons, devices should never register themselves at the IoT Hub. For the device registration, are registry write permissions (typically the iothubowner policy) required, that should not be given to a single device. Especially in case of a stolen or corrupted device, it is important, to exclude the device without giving it the chance to re-register.

.NET

When using .NET, you simply need to add the Azure.Devices NuGet Package to your project. Unfortunately, when writing this article, the package is not compatible with .NET core yet, so it only works on Windows at the moment. Register your device with these simple lines of code:

Start the console application and the device’s primary key will be printed out at the console and can also be seen inside the Azure Portal, of course.

Node.js

To register devices on other platforms than Windows, Microsoft also offers a Node.js package to work with the Azure IoT Hub. For this, simply add the azure-iothub package to your project and register a new device with the following code:

Same as above, the device’s primary key will be printed out at the console and can also be seen inside the Azure Portal, when running the application. Of course, both libraries also offer methods to delete or update devices.

Useful Developer Tools #5: Facebook’s Device Sketches

When creating mockup images for your product presentations, finding cool device images to put your screenshots in can be challenging. Especially, when you are looking for license free images that can be used commercially. Good thing, that Facebook now opened their device mockups to be downloaded for free.

While Facebook has redrawn and shares these assets for the benefit of the design community, Facebook does not own any of the underlying product or user interface designs. Please do not repackage and redistribute these as your own.

devices_header