It’s inevitable, but I have to upgrade from my Lumia 950 running 10.0.15254.527

It drains my battery so it does not last for a day anymore. I believe it is because the Twitter app is deprecated and they moved from a UWP to a PWA type. Since that moment my battery drained faster. I even ordered a new battery. That’s how dedicated I am to UWP apps and the win10 ecosystem.

I thought that I did not care that I missed some apps. But just yesterday I broadcasted my session of Super Lucky Tale’s on Xbox with Mixer and I needed a Mixer app on my mobile which redirected me to the Google/Android store!

During my holiday there was an issue with Azure. So I needed to borrow the iPhone from my wife to use the Azure app… I am on a Microsoft phone and cannot have an Azure app. That is just brutal!

So I have 2 options: the Apple eco-system or the Google eco-system. Option 1 is not an option for me. Because I don’t like the phone’s price. For instance there was an issue in the Netherlands with the new ID cards. You would receive a letter from the government that you need to scan your ID card with an app. This was only possible with Android because of the NFC chip and because of the iOs SDK limitation it was only possible on Android.

Microsoft also launched it’s own Android Launcher. So I am moving to Android. There are then two options (imho) a Samsung or a Nokia. I have been a Nokia fan for ages. (5110, 3210 etc. Lumia 920, 930, “950”)  Samsung has been in the news a lot about staying behind on the updates and not having a vanilla Android. So I will move to Nokia.

Next step: decide what Nokia. Wait for a 6.1 release in Europe? Or go for a 7 or 8 or even the Sirocco? Because of the price, I think that I would go for the 8. I am out the Android eco-system for several years, so I have not a lot of hands on experience with perf and the effect certain hardware can have on the UX.

I had to lookup how long it was ago. My first Android app release in the Google store was in 2010 (8 years ago!) The last person who bought it was in 2014. I took it offline not much after.

I am slowly getting a bit exited about moving to the Nokia+Android eco-system. Would prefer a Surface phone though, but you can’t wait forever! I blogged in 2013 about moving to Windows Phone 8.x and Android custom roms in 2011 http://jphellemons.nl/category/android reading back the app list makes me want to move even faster. An official Sonos app would be great! Miss it on a daily basis. And Android will give me the option to switch my bank to Bunq!

Thanks for reading my 2¢!

Pin on pinterest Plus on Googleplus Post on LinkedIn

I have blogged before about this Excel Nuget package where you don’t need to use interop and have Excel installed on the server. And my journey to start this Azure Function. This is because the most recent Excel format uses xml under the cover in a zipped file stored as a file with an xlsx extension. Since you do not have hard disk access in a serverless environment like Azure Functions you need to generate the Excel in memory (or store stuff in blob storage). I chose the in memory to leave no footprints or take up space in the cloud.

I wanted to use an Azure function to have it run in the cloud. Not being dependent on a Server which needs updates, reboots etc. Since the database already is in the Azure Cloud (Azure SQL) this seems a good/perfect fit.

I got the option to go for Azure function v1 or v2 which is in preview. So this was a nice opportunity to use the v2 and .Net Core/Standard. https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions

The v2 also has support for the Office365 Graph. But that was out of (my) scope.

I took a timer based project because I wanted it to send an overview of invoices on a monthly basis. The Timer based project has a timer as data annotation based on CRON scheduling. There is however a small difference. Instead of 5 “fields” the Azure function has 6. It also let’s you schedule the seconds.

https://en.wikipedia.org/wiki/Cron#CRON_expression

So not just: minutes, hours, day of month, month, day of week, year but seconds, minutes, hours, day of month, month, day of week, year. Of course the order is really important. https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer#cron-expressions

I used this Nuget for the Excel export https://www.nuget.org/packages/EPPlus/

it has .Net Core support and will work perfectly.

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Net;
using System.Net.Mail;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using OfficeOpenXml;

namespace MonthlyMailInvoices
{
    public static class Function1
    {
        [FunctionName("Function1")]
        public static void Run([TimerTrigger("10 0 0 1 * *")]TimerInfo myTimer, TraceWriter log)
        {
            log.Info($"C# Timer trigger function executed at: {DateTime.Now}");

            var com = new SqlCommand("SELECT * FROM [dbo].[INVOICES] where invoicedate > @startdt and invoicedate < @enddt");

            com.Parameters.AddWithValue("startdt", DateTime.Now.AddMonths(-1));
            com.Parameters.AddWithValue("enddt", DateTime.Now.AddDays(-1));

            var dt = new DataTable();

            using (var con = new SqlConnection("connectionstring goes here"))
            {
                con.Open();
                com.Connection = con;
                var da = new SqlDataAdapter(com);
                da.Fill(dt);

                log.Info($"start: {DateTime.Now.AddMonths(-1)} and end { DateTime.Now.AddDays(-1) } gave {dt.Rows.Count}");
            }

            using (var wb = new ExcelPackage())
            {
                wb.Workbook.Worksheets.Add("Our company");
                var ws = wb.Workbook.Worksheets[0];

                FillData(ws, dt, "Our company B.V.");

                var msg = new MailMessage();
                msg.To.Add("mymail@companydomain.com");
                msg.Subject = "Montly invoices";
                msg.From = new MailAddress("the@cloud.com");
                msg.Body = $"Invoices from {DateTime.Now.AddMonths(-1)} to { DateTime.Now.AddDays(-1) } in the Excel attachment.";
                var ms = new MemoryStream(wb.GetAsByteArray());
                ms.Position = 0;

                //msg.Attachments.Add(new Attachment(ms, "Invoices.xlsx", "application/vnd.ms-excel"));
                msg.Attachments.Add(new Attachment(ms, "Invoices.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));
                var smtp = new SmtpClient
                {
                    Host = "smtp.gmail.com",
                    Port = 587,
                    EnableSsl = true,
                    Credentials = new NetworkCredential("my@gmailaccount.com", "incorrectpassword")
                };
                smtp.Send(msg);
            }
        }

        private static void FillData(ExcelWorksheet ws, DataTable dt, string title)
        {
            ws.Cells[1, 1].Value = title;

            ws.Cells[2, 1].Value = "Invoice nr";
            ws.Cells[2, 2].Value = "Invoice date";
            ws.Cells[2, 3].Value = "Amount inc. VAT";
            ws.Cells[2, 4].Value = "VAT";
            ws.Cells[2, 5].Value = "Amount exc. VAT";

            int row = 3;

            foreach (DataRow dr in dt.Rows)
            {
                ws.Cells[row, 1].Value = dr[0].ToString();
                ws.Cells[row, 2].Value = dr[1].ToString();
                ws.Cells[row, 3].Value = dr[2].ToString();
                ws.Cells[row, 4].Value = dr[3].ToString();
                ws.Cells[row++, 5].Value = dr[4].ToString();
            }
        }
    }
}

I could not test it locally because I had some issues with logins for my localdb. So I hit publish to deploy it on Azure. However republishing failed. I found the answer (as always) on StackOverflow. I had to add “MSDEPLOY_RENAME_LOCKED_FILES” and set it to 1 (true).

app-settings

Tony gave the correct solution.

I also had issues with the Excel generating in memory and having the Memorystream to a byte array and providing the right Mime type. Found that too on SO.

The last bit was to automate deployment. I had my code in VSTS (git) and configured a CI/CD pipeline (build + release) But had issues to grant myself (personal account) global admin rights from our company account in order to be able to access Azure resources to deploy. It was a matter of time before the Azure rights/roles changes are active. It’s a nice small serverless function which you can (should) add to source control and ci/cd to automate the latest builds to a test or production environment in the cloud.


Good luck!

Pin on pinterest Plus on Googleplus Post on LinkedIn
0 Comments

I have written powershell scripts in Azure runbooks in Azure Automation. It’s not a new concept. It’s even from back in 2014

https://azure.microsoft.com/en-us/blog/azure-automation-your-sql-agent-in-the-cloud/

I started to use it because there is no SQL Agent in Azure SQL databases. I relied on SQL Agent to perform Ola’s database maintenance scripts. I use the Azure automation with Runbooks now for a long time to build reports from Azure SQL and have them send to people by SMTP.

The problem is that I string concatenate HTML in the powershell script and just put the results in an HTML enabled Email message. It is still a good option… Until a coworker requests an Excel attached to the mail…

Excel in Azure Runbook (Powershell)

I did build the powershell locally first.

image

When using the Azure Automation ISE add-on for Windows PowerShell ISE it hit me. The cloud probably has no Excel com/interop…

So I found this module to work with Excel in Powershell without Excel on GitHub. It uses Epplus. Which I mentioned in my post from 6 years ago.

But I realised that I could also just use Azure Functions and code in C# and have a time trigger. This enables me to write my beloved C# rather then scripting Powershell. I can also just use the Epplus nuget package.

The Azure functions v2 are now in preview and have .Net Standard support (which is great!)

The Visual Studio dialog can be unclear if you visit it for the first time and have no clue that the schedule uses CRON notation. Maybe they will change it, but now you know.


Good luck!

Pin on pinterest Plus on Googleplus Post on LinkedIn
0 Comments

The current CEO of Microsoft (which caused a huge rise on the stock market) wrote a book called Hit Refresh. This post is a nice summer holiday post with linked resources for you to re-think your productivity and hit refresh yourself!

Let’s start with a 42 minute video from Scott Hanselman back in 2012 at WebStock. He is blogging for years and has more about productivity.

Webstock '12: Scott Hanselman - It's not what you read, it's what you ignore from Webstock on Vimeo.


Here are the books that I have read and recommend:

Pomodoro technique – schedule tasks in small blocks of x uninterrupted minutes

Hit Refresh – The book written by the CEO of Microsoft about their transition of the company

Deep work – A book guiding you to concentrate more

Getting things done – Title says it all. Prioritize tasks and create a system

4 Hour Workweek – Work smarter with these tips and life hacks


And the blogs that I have read:

http://sourcesofinsight.com/the-rule-of-3/ – pick 3 things to focus on. A bit like Warren Buffets advice

https://www.hanselman.com/blog/ScottHanselmansCompleteListOfProductivityTips.aspx – summary of the video from the start of this post.


With these sources I came up with my own subset of productivity tools/habits:

  1. Use Microsoft OneNote to collect data
  2. Use Microsoft To-Do on mobile and desktop to create your daily to-do
  3. Sync to paper to schedule Pomodoro’s
    • I have added the rule of 3 there but divided for personal and work goals

image

Here is my personal offline weekly sheet. You can download the Excel from my OneDrive account with this link:

https://1drv.ms/x/s!AlYkDgDuTE1LlWKQvwPc82KjU-7N

Let me know if you have suggestions and what works for you.


Good luck!

Pin on pinterest Plus on Googleplus Post on LinkedIn
0 Comments

Yeah! I am exited! Passed the MVC 70-486 this morning.

You can see it instantly on my Acclaim page or just view the screenshot below:

image

I want to earn an MCSD cert. So I am following the app builder path:

image

According to my learning dashboard I have just passed 1 of 2 requirements for the app builder cert. But when I click details, it shows I have both… that’s strange, but I have asked @MSLearning so I will have an answer soon.

I am already looking forward to the next exam and next cert.

If I would pass 70-532 Developing Microsoft Azure Solutions and after that, will study for 70-535 Architecting Microsoft Azure Solutions, then I’d get the:

MCSA: Cloud Platform Microsoft Certified Solutions Associate

What is your certification path for 2018?

Good luck!

Pin on pinterest Plus on Googleplus Post on LinkedIn