Monthly Archives: April 2016

Azure Portal Tips &Tricks – 04. Keyboard Shortcuts

Azure Portal Tips & Tricks is a series of short videos where I am showing various features of the Azure Portal and how you can take advantage of them to be more productive.

In this video I am showing how you can be more productive by using keyboard shortcuts on the new Azure Portal.

You can follow the series by subscribing to my channel or going directly to Azure Portal Tips & Tricks playlist:

If you have any suggestions or questions about the Azure Portal, or there is something in particular that you would like to see in this series, tweet me at @JakubJedryszek or leave a comment.


How to save money on Azure with WebJobs

This blog is hosted on Azure. It is using WordPress, which stores its data in MySQL database hosted by ClearDb. I blogged about the issues with WordPress database size over a year ago. The issue is inserting transient entries into database that are growing its size and exceeding free 20MB ClearDB limit. As I mentioned in this blog post – you can use plugins that clear database for you, or…you can use web jobs. Azure WebJobs is very neat way to perform custom tasks, such as database maintenance, periodically.

I created a web job that is performing database maintenance for me. Everyday it removes ‘transient’ entries from wp_options table to keep my MySQL database under 20MB ClearDB limit.

One problem was: how to do MySQL backup without mysqldump? As you know, there is a Virtual Machine underneath every Azure website. And this VM has MySQL, along with mysqldump installed:

Azure Console: mysqldump

Based on this article I created a small Console App called DbMaintenance that performs 3 mentioned tasks:

  1. Backup database
  2. Remove transient entries from wp_options table.
  3. Backup database

Two backups gives me more confidence that I have my database backed up correctly. Especially because I am performing them before and after the operation that potentially can broke things.

You can customize my app by editing Initialize method. Current paths (for mysqldump and database backup directory) are set for Azure Website. Additionally you have to create directory for backups (D:\home\db-backups). You can do it from the web app console available on the Azure Portal:

mkdir D:\home\db-backup

Once this is done, you need to zip DbMaintenance.exe and MySql.Data.dll file, and create a WebJob. On the Azure Portal go to your web app -> Settings -> WebJobs, and add a new WebJob:

Azure Portal: add WebJob

You can see the status in Settings -> WebJobs -> YOUR_JOB_NAME:

azure webjobs

By clicking on logs column, you can get details about web job:

Azure WebJob: details

And console output from each execution:

Azure WebJob: console output

I configured my WebJob to run everyday. You can also run it on demand, or continuously.

You can find more about Azure WebJobs in this article.


Azure Portal Tips & Tricks – 03. Customizing Side Bar

Azure Portal Tips & Tricks is a series of short videos where I am showing various features of the Azure Portal and how you can take advantage of them to be more productive.

In this video I am showing how you can customize side bar by adding your favorite resources to it.

You can follow the series by subscribing to my channel or going directly to Azure Portal Tips & Tricks playlist:

If you have any suggestions or questions about the Azure Portal, or there is something in particular that you would like to see in this series, tweet me at @JakubJedryszek or leave a comment.


Azure Portal Tips & Tricks – 02. Customizing Dashboard

Azure Portal Tips & Tricks is a series of short videos where I am showing various features of the Azure Portal and how you can take advantage of them to be more productive.

In this video I am showing how you can customize your dashboard, but adding new tiles and organizing them.

You can follow the series by subscribing to my channel or going directly to Azure Portal Tips & Tricks playlist:

If you have any suggestions or questions about the Azure Portal, or there is something in particular that you would like to see in this series, tweet me at @JakubJedryszek or leave a comment.


Getting started with F#

F#

tl;dr This post is a list of resources for learning F# and overview of my mini-project: Stock Estimator.

I couldn’t resist anymore, and I finally tried F#. For the first two days it was painful. Some elements of F# syntax are weird. However after getting use to that, F# became a joy, and instead of a week (as I planned) I spent with F# almost two months.

Getting Started

Deep Dive

There is also a book written by Jon Skeet and Tomas Petricek: Real World Functional Programming: With Examples in F# and C#.

Testing

Web Development

The most popular F# Web Framework is Suave. There is great SuaveMusicStore tutorial (code), which is inspired by ASP.NET MVC Music Store tutorial. If you want to build Web API with F#, check Building REST Api in Fsharp Using Suave.

It is also worth to check End-to-end Functional Web Development by Tomas Petricek where he showcases building web app with Suave.

For more, check Web Programming with F# Guide.

Stock Estimator

I created F# based app for predicting future stock prices ($1,000,000 idea!). The back-end is written in F#, and communicates with stock data API (Yahoo Finance) through F# type provider. There is also Suave Web API (microservice), and ASP.NET Core web app that communicates with it. Front-end is powered by Aurelia Framework, and D3 library. In other words: I built F# microservice, consumed it from non-F# app, and have reusable logic in separated project. All communication with microservice happens through the client (with Aurelia Framework). So, there is no usage of F# from C#, but…I also created simple Console app (with C#) that uses mentioned F# logic. There is also Windows Forms app for displaying estimates, written in F#, that also use reusable logic.

Entire source code is available on github. Check it out!

Summary

Programming in F# is pure joy! It’s a great language for working with data. Moreover, F# fits perfectly into today’s World of microservices. You don’t have to rewrite your already existing app, or create entire app with F#. You can just create one microservice with F#, and see how it works for you!