Quantcast
Channel: JPHellemons
Viewing all 132 articles
Browse latest View live

Auto-Publish Xbox recording on YouTube: Tried Microsoft Flow ended up with Zapier

$
0
0

I wanted to try Microsoft Flow for the first time. So I thought of a use-case and came up with a thing that has been bothering me for a while. When I have an epic moment while gaming on my Xbox, I can capture it with a quick double tap on the Xbox icon and the ‘x’ button.

The next step is to get it in the cloud. Because auto-upload is still not a thing yet. (please upvote)

So if the recording is done, you get a notification and keep the xbox icon pressed to put it up on OneDrive.

So it’s in the cloud. But it’s private… I wanted it to be available on YouTube

Auto-Publish Xbox recording on YouTube

This is my use-case! I have seen several options (how ironically) on YouTube about using the YouTube app for Xbox. But I want to auto-upload and have it set to private. So that I only have to occasionally look into my YT account and crop, caption, publish them. But it will be the easiest option, because the files are already at the right destination.

YouTube is limited in FlowAfbeeldingsresultaat voor microsoft flow

The YouTube connector/triggers/actions are limited… So I need to pull in something more externally to get it to work. I hope that they will add more capabilities in the future for flow and YT

flow-youtube-limited

There are no actions, so you can’t upload from Flow to YouTube (yet) I have added it as an idea for flow. Since I decided that using Flow was a requirement (to get to know the product) I made this flow:

flow

Sorry for the Dutch. But it says: when a file is made, make a file on Dropbox.

I have specified the video/xbox dir for onedrive and made a new dir on Dropbox as target.

The final step for automation to YouTube

So Flow lacks some options… I had an old but still active IFTTT account (if this, than that) but that also won’t work. So I searched some more and found Zapier. It appears that I could also leave out flow and just use OneDrive to YouTube there. But I wanted to use Flow, so I kept the Dropbox step. So I configured Zapier to auto upload a new Dropbox file and it’s done.

ZapierAfbeeldingsresultaat voor zapier

I found out that they are hiring, but they use a totally different stack then what I prefer. Winking smile so perhaps it’s something for you dear reader. They have some great docs about creating an Zapier app with the node.js sdk. But as I have said. I like a different stack. So here is a C# approach with webhooks for Zapier. They should/could add (unsupported) C# docs to their official site.


So I finally have a semi auto upload to YouTube. A quick tap-tap on the xbox button on the controller and hit the X to record the last 30 seconds. Send it to Onedrive and from there it’s auto to dropbox and automatically to YouTube (as private) video ready for captioning an publishing it. Maybe someday when I have some spare time, I’d automate it even more or better but for now: good luck and take care!


Review: 3 days with a Nissan Leaf

$
0
0

I got lucky and was picked to test a Nissan Leaf for 3 days. I was already interested in this car due to the 4% tax for private use of a company car. So in 2018 the Dutch rules are rather simple: all cars are 22% unless they are full electric. So a full electric car is attractive due to the low additional tax liability.

For instance, a Ford Focus is about € 28.000,-. Take 22% (€ 6.160,-) and multiply your tax scale. For easy calculation, take half. That’s what it costs you a year. So that’s 3k.

A Leaf is about € 40.000,-. Take 4% (€ 1.600,-) take half and that’s € 800,-. So a car that’s about 10k more, costs you € 2.200,- less a year.

That is what makes the Leaf a good company car.

First impression

I only googled it once, so I had never seen a Leaf in real life, but my first impression was: looks good! The trunk had more space then I expected (coming from a station car). It even seemed that the backseat had more leg space then my current car. The test car came with seat heating, steering wheel heating, climate control etc. It has great features. I really liked the adaptive cruise control on the highway and all the cameras while parking.

Driving

No noise! It’s obvious of course, but at some points while driving, you actually notice that there is no engine sound and it is strange at the beginning. Probably because you are used to the sound for all your life.

This was also the first car that had a DAB radio. While driving, I noticed that the coverage of digital radio is not great yet in the Netherlands. So you notice the switch/fallback between digital and analogue radio. It even has a partial replay of the sound when switching. I don’t know much about the technical details, but perhaps they can fix it with some software? Would be nice.

The handbrake is a pedal… This was new for me. I have seen cars that had a small switch on the place where the normal handbrake was. Like a VW Golf. It’s rather common. The pedal can be confusing when you are not used to automatic gears and you think you need to hit a clutch. This did not happen thankfully.

It’s really a joy to drive one. You only have to get used that you do not put your feet down instant when you want to accelerate. With great power comes great responsibility. So accelerate gently. It’s better for the battery, but more important your co-drivers.

The E-pedal, it’s great, it’s true

This might sound like an expression that could be made by the current president of the USA, but it’s not. Some people can’t get used to the e-pedal so there is a button to opt-out, but I love it! Coming from driving stick, you have 3 pedals. Driving automatic has 2 pedals and this e-pedal makes sure that you don’t even need the brake. You can brake by gently lifting your feet from the gas. This is for real lazy effective people. Like software developers. Like me.

Charging

This is the tricky part. This is the biggest change. Having the car for 3 days gave me the opportunity to charge it. Regular test drives take only 30 minutes so that you can never experience the full electric-car-experience. My first charge was with a normal plug in a power outlet in my garage. It’s not fast, but I just wanted to experience it and it’s the easiest option for me to charge it. There are public locations to charge electric cars within about 100 meters from my house.

I got a special card (NFC?) to charge it. It was a New Motion one. Their website is really nice. You can use this slightly hidden gem https://my.newmotion.com/ to see the locations across Europe. Living in the Netherlands seems perfect for an electric car owner.

newmotion

If you like speed, like me, you want to use a fast charger. So I checked out the fastned website.

fastned

They even have 4 locations in the Netherlands with a 175kW connection at the moment. So I always thought that if an electric car had the fast charging capability that it would charge to 80% of the battery in about 20 minutes. That’s not true. #fakenews The Nissan Leaf can “fast” charge to 80% in between 40 – 60 minutes. imageThere is this news item from about a month ago that there is a fast charging issue with the Leaf.

I fast charged it at the A12 and tried to use the card which failed. It appeared that I needed a FastNed account. Because the card was not linked yet. I have read about sharing a card/account. It comes down to the fact that your card needs to be linked. Several people before me tested the car and card, but apparently I was the first to use the card for FastNed. I needed to install an app from either the Google play or Apple app store. I have a Windows 10 Mobile phone…. So luckily my codriver had an iPhone and was willing to install the app and create an account on my name, on his phone, with the card which came with the car. That’s suboptimal, but it worked. The lady on the FastNed customer service was patience and helped us out great. She explained that this was the only way and told us that the car would charge up to 80% in 20 minutes (because it was not completely empty).

image

It was a nice experience which you would not get when you would try out an electric car at the dealer. In a 30 minutes test-drive you cannot have a full electric driving experience. So I am grateful that I could test it for several days. Because if I would pick this car. I will have to drive it for about 5 years.

A few years back there was this Dutch news about someone who had the previous Nissan Leaf and sued Nissan for having a battery that would degrade in capacity and could not get the mileage that they advertise with. I understand that batteries have less capacity in cold weather. Heating the car drains it faster and driving over 100 km/h drains it even more. The range is important to me because I have family living about an hour away.

A small side note I found on zap-zap.com the regular charging method has a cap at 6.6 kW/h so if your location has 10, 11, 22 or even 43. It’s capped at 6.6 kW.

image

Range

I checked it out after the test drive but there are some differences between the current range tests of electric cars as you can see here:

image

source: https://www.nissan.nl/voertuigen/nieuw/leaf/bereik-opladen.html

I drove a Connecta I think. So you can see that according to some tests it’s range is between 270 and 390 km that has a 120 km gap! I drove on the highway, some parts even 130 km/h and had my family in it. It was hot, so the air-conditioning was on. And on a single trip of 84 km the FastNed app predicted (I had to select the type of car) that it would use over 50% of the battery.

Conclusion

My goal was to check if I could drive it like I would normally drive a petrol car and see if I could make it back home without charging. If I would pull it of and have sufficient battery left, I’d choose this car. But as I said before, batteries degrade over time and have less capacity in cold weather. There is no data yet about the degradation of electric car batteries, only from Tesla. But I can imagine that in 5 years, in a winter with the heating on I would have to charge a lot in order to get back home.

It’s a great car. Loved to drive it! But due to the current range, it’s just not for me (yet). I have heard about a 60kW battery, which makes it more interesting for me. But that version is not yet available. So is the Tesla model 3. So I will have to stick to petrol for at least a year.

I would like to thank Riemersma Leasing and Nissan Nederland for making this possible. They really gave me the possibility to fully experience driving the new and amazing Nissan Leaf! I really recommend the car (if you have relatives living closer).

Passed 70-486 –> MCSA: Web Applications

$
0
0

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!

Hit refresh!

$
0
0

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!

Automate Azure and export reports to Excel

$
0
0

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!

Azure function v2 send mail periodically with Excel attached

$
0
0

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!

Moving away from Windows 10 Mobile

$
0
0

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¢!

Add images to Excel with some VB code

$
0
0

Building reports is a common task for me and I often struggle putting images in Excel so this post is just a small reference for myself to easy find how I have done it before.

I have build SQL before which would build html to display product images.

SQL like:

select '<tr><td>' + productid + '</td></tr>' from products  

And would paste that in a text file which has <table>…</table> and would save it as .html

That’s ugly and hard to work with, but it would/could show images (if you use <img src=’http://www.google.com/’ etc.)

Copying from the SMSS result panel

image

and pasting in Excel is an option to work with the data (apply extra filters or ordering etc.)

The open source SQL Operations Studio even has a community contribution to export directly to Excel! I just found out searching for the download link that the product is renamed to Azure Data Studio

https://docs.microsoft.com/nl-nl/sql/azure-data-studio/download?view=sql-server-2017

But then you only have a filename or uri or (local) path to a file in a sheet

image

I stored the Excel file as one with macro’s enabled and enabled the developer menu on the lint.

  1. Click the File tab.
  2. Click Options.
  3. Click Customize Ribbon.
  4. Under Customize the Ribbon and under Main Tabs, select the Developer check box.

And I used this small VB sub:

Sub PlacePics()

    Dim Path As String, Pics As Range, Pic As Range
    
    Path = "https://www.ourcompany.com/images/"
    Set Pics = ActiveSheet.Range("F2:F2164")
        
    For Each Pic In Pics
        On Error Resume Next
        Pic.RowHeight = 100
        Pic.Offset(0, 0).Select
        ActiveSheet.Pictures.Insert(Path & Pic.Value).Select
    Next Pic
End Sub

It might take a while to process (depending on the amount of rows). But it gets the job done.

Good luck!


Passed 70-532–> MCSD: App Builder 2018

$
0
0

It’s a bit of a follow up from my achievement last June when I passed the 70-486 MVC exam. I thought that I’d get the MCSD because I completed two (old/previous) UWP related exams before. But there was a bug in the cert planner. I had to wait a long time to hear from Microsoft, but unfortunately I had to take another exam to get the MCSD. I choose 70-532 because I wanted to go for MCSA: Cloud platform. So I ordered the v2 of the exam guide and studied every day during my holiday.

I found out (later) that the 70-532 and 70-535 and some more, will be deprecated by the end of the year… and will be replaced.

70-532 →   AZ-200
AZ-201
70-535 →AZ-300
AZ-301

But if you finish 532 or 535 before the 31ste of December you can use a cheaper transition exam to transfer to the same as the new “AZ” style. Since I passed 70-532, I decided to give AZ-202 a go and I hope that I will pass. I have to pass before June 2019 to get the MCAD. After that, I have added the AZ-300 and AZ-301 in my to-do list to get the MCASA (Microsoft Certified Azure Solutions Architect)

azure developer image

But first, let me enjoy my MCSD.

Good luck studying!

Using MariaDB on a Synology Nas

$
0
0

I have just enabled the MariaDB 10.x package and installed the famous Heidi SQL from the Microsoft Store (because of the auto update and roaming settings etc.)

So I tried to connect to it. The MariaDB 5.x uses port 3306, but the 10.x uses 3307 (minor detail) However, I could not connect, because by default only localhost connections are enabled.

So I had to SSH into the nas and fix it. But using SSH did not work how it used to. I used Ubuntu (also from the Microsoft store) to `ssh myadminname@localipofnas` but got a cypher not accepted/available message. It turns out that the Synology has disabled several old insecure ciphers. So I had to provide a –c and an algorithm to use in order to get it to work.

“no matching cipher found. Their offer: aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc”

I used `-c aes128-cbc` because it was the first option in the list

Once logged in, I had to launch MariaDB mysql and give the user access within the lan and create a database:

  • Search mysql (/usr/local/mariadb10/bin/mysql)
  • Enter to mariadb with command line: ./mysql -u root –p
    • Use the password
  • Check user's:
    • SELECT User, Host FROM mysql.user WHERE Host <> 'localhost';
  • Granting User Connections From Remote Hosts:
    • GRANT ALL PRIVILEGES ON . TO 'root'@'192.168.1.%' IDENTIFIED BY 'my-new-password' WITH GRANT OPTION;

Found it on: https://stackoverflow.com/a/51277323/169714

You can also use localhost or % instead of the ip. It depends on what you are trying to do Smile

MariaDB is now ready for some .Net Core

(Only my Synology NAS does not support Docker to run .Net Core…)

I am having doubts if I should try to work around it or just use a Raspberry Pi for my .Net core code.


Good luck, hope it saved someone some time!

Reflections: mobile phones

$
0
0

I’d decided to make a good list of my previous owned mobile phones. I have blogged about it before. And made a list of it back in 2013, so it’s time for an update:

  1. Nokia 5110
    https://upload.wikimedia.org/wikipedia/commons/5/58/Nokia_5110.jpg
  2. Nokia 3210
    Nokia 3210.jpg
  3. Nokia 5210
    https://cf4.s3.souqcdn.com/item/2013/04/28/64/51/46/item_XL_645146_1899588.jpg
  4. Alcatel 511
  5. Motorola T720
    https://www.technopat.net/db/wp-content/uploads/2016/10/Motorola-T720-600x600.png
  6. Sony Ericsson W800
    https://i-cdn.phonearena.com/images/phones/4611-large/Sony-Ericsson-W800-0.jpg
  7. HTC S710 (first Windows Mobile phone for me)
    https://image.coolblue.nl/600x315/products/48538
  8. LG Cookie (worst phone ever!)
  9. HTC Touch Diamond 2 (2nd Windows Mobile)
  10. HTC Desire (Android 2.x never got to 4.x)
    http://jphellemons.nl/posts/files/image1.jpg
  11. HTC Desire C (Android 4.x never got to 4.1 etc.)
  12. Nokia Lumia 920 (Windows Mobile 7, 7.5 and even Phone 8)
  13. Nokia Lumia 930 (Windows Phone 8)
  14. Microsoft Lumia 950 (Windows 10 Mobile)
  15. Nokia 8 (Android 7 or 8, now running 9)
    http://cdn.eglobalcentral.nl/images/detailed/59/nokia-8-dual-sim-4gb-ram-64gb-blue.jpg

There are rumors about the Nokia 9 which seems awesome, but I've also heard good stories about the Xaomi Mix serie. I will stick to my Nokia 8 for a bit longer.

Review: 3 days with a Nissan Leaf

$
0
0

I got lucky and was picked to test a Nissan Leaf for 3 days. I was already interested in this car due to the 4% tax for private use of a company car. So in 2018 the Dutch rules are rather simple: all cars are 22% unless they are full electric. So a full electric car is attractive due to the low additional tax liability.

For instance, a Ford Focus is about € 28.000,-. Take 22% (€ 6.160,-) and multiply your tax scale. For easy calculation, take half. That’s what it costs you a year. So that’s 3k.

A Leaf is about € 40.000,-. Take 4% (€ 1.600,-) take half and that’s € 800,-. So a car that’s about 10k more, costs you € 2.200,- less a year.

That is what makes the Leaf a good company car.

First impression

I only googled it once, so I had never seen a Leaf in real life, but my first impression was: looks good! The trunk had more space then I expected (coming from a station car). It even seemed that the backseat had more leg space then my current car. The test car came with seat heating, steering wheel heating, climate control etc. It has great features. I really liked the adaptive cruise control on the highway and all the cameras while parking.

Driving

No noise! It’s obvious of course, but at some points while driving, you actually notice that there is no engine sound and it is strange at the beginning. Probably because you are used to the sound for all your life.

This was also the first car that had a DAB radio. While driving, I noticed that the coverage of digital radio is not great yet in the Netherlands. So you notice the switch/fallback between digital and analogue radio. It even has a partial replay of the sound when switching. I don’t know much about the technical details, but perhaps they can fix it with some software? Would be nice.

The handbrake is a pedal… This was new for me. I have seen cars that had a small switch on the place where the normal handbrake was. Like a VW Golf. It’s rather common. The pedal can be confusing when you are not used to automatic gears and you think you need to hit a clutch. This did not happen thankfully.

It’s really a joy to drive one. You only have to get used that you do not put your feet down instant when you want to accelerate. With great power comes great responsibility. So accelerate gently. It’s better for the battery, but more important your co-drivers.

The E-pedal, it’s great, it’s true

This might sound like an expression that could be made by the current president of the USA, but it’s not. Some people can’t get used to the e-pedal so there is a button to opt-out, but I love it! Coming from driving stick, you have 3 pedals. Driving automatic has 2 pedals and this e-pedal makes sure that you don’t even need the brake. You can brake by gently lifting your feet from the gas. This is for real lazy effective people. Like software developers. Like me.

Charging

This is the tricky part. This is the biggest change. Having the car for 3 days gave me the opportunity to charge it. Regular test drives take only 30 minutes so that you can never experience the full electric-car-experience. My first charge was with a normal plug in a power outlet in my garage. It’s not fast, but I just wanted to experience it and it’s the easiest option for me to charge it. There are public locations to charge electric cars within about 100 meters from my house.

I got a special card (NFC?) to charge it. It was a New Motion one. Their website is really nice. You can use this slightly hidden gem https://my.newmotion.com/ to see the locations across Europe. Living in the Netherlands seems perfect for an electric car owner.

newmotion

If you like speed, like me, you want to use a fast charger. So I checked out the fastned website.

fastned

They even have 4 locations in the Netherlands with a 175kW connection at the moment. So I always thought that if an electric car had the fast charging capability that it would charge to 80% of the battery in about 20 minutes. That’s not true. #fakenews The Nissan Leaf can “fast” charge to 80% in between 40 – 60 minutes. imageThere is this news item from about a month ago that there is a fast charging issue with the Leaf.

I fast charged it at the A12 and tried to use the card which failed. It appeared that I needed a FastNed account. Because the card was not linked yet. I have read about sharing a card/account. It comes down to the fact that your card needs to be linked. Several people before me tested the car and card, but apparently I was the first to use the card for FastNed. I needed to install an app from either the Google play or Apple app store. I have a Windows 10 Mobile phone…. So luckily my codriver had an iPhone and was willing to install the app and create an account on my name, on his phone, with the card which came with the car. That’s suboptimal, but it worked. The lady on the FastNed customer service was patience and helped us out great. She explained that this was the only way and told us that the car would charge up to 80% in 20 minutes (because it was not completely empty).

image

It was a nice experience which you would not get when you would try out an electric car at the dealer. In a 30 minutes test-drive you cannot have a full electric driving experience. So I am grateful that I could test it for several days. Because if I would pick this car. I will have to drive it for about 5 years.

A few years back there was this Dutch news about someone who had the previous Nissan Leaf and sued Nissan for having a battery that would degrade in capacity and could not get the mileage that they advertise with. I understand that batteries have less capacity in cold weather. Heating the car drains it faster and driving over 100 km/h drains it even more. The range is important to me because I have family living about an hour away.

A small side note I found on zap-zap.com the regular charging method has a cap at 6.6 kW/h so if your location has 10, 11, 22 or even 43. It’s capped at 6.6 kW.

image

Range

I checked it out after the test drive but there are some differences between the current range tests of electric cars as you can see here:

image

source: https://www.nissan.nl/voertuigen/nieuw/leaf/bereik-opladen.html

I drove a Connecta I think. So you can see that according to some tests it’s range is between 270 and 390 km that has a 120 km gap! I drove on the highway, some parts even 130 km/h and had my family in it. It was hot, so the air-conditioning was on. And on a single trip of 84 km the FastNed app predicted (I had to select the type of car) that it would use over 50% of the battery.

Conclusion

My goal was to check if I could drive it like I would normally drive a petrol car and see if I could make it back home without charging. If I would pull it of and have sufficient battery left, I’d choose this car. But as I said before, batteries degrade over time and have less capacity in cold weather. There is no data yet about the degradation of electric car batteries, only from Tesla. But I can imagine that in 5 years, in a winter with the heating on I would have to charge a lot in order to get back home.

It’s a great car. Loved to drive it! But due to the current range, it’s just not for me (yet). I have heard about a 60kW battery, which makes it more interesting for me. But that version is not yet available. So is the Tesla model 3. So I will have to stick to petrol for at least a year.

I would like to thank Riemersma Leasing and Nissan Nederland for making this possible. They really gave me the possibility to fully experience driving the new and amazing Nissan Leaf! I really recommend the car (if you have relatives living closer).

Passed 70-486 –> MCSA: Web Applications

$
0
0

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!

Hit refresh!

$
0
0

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!

Automate Azure and export reports to Excel

$
0
0

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!


Azure function v2 send mail periodically with Excel attached

$
0
0

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!

Moving away from Windows 10 Mobile

$
0
0

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¢!

Add images to Excel with some VB code

$
0
0

Building reports is a common task for me and I often struggle putting images in Excel so this post is just a small reference for myself to easy find how I have done it before.

I have build SQL before which would build html to display product images.

SQL like:

select '<tr><td>' + productid + '</td></tr>' from products  

And would paste that in a text file which has <table>…</table> and would save it as .html

That’s ugly and hard to work with, but it would/could show images (if you use <img src=’http://www.google.com/’ etc.)

Copying from the SMSS result panel

image

and pasting in Excel is an option to work with the data (apply extra filters or ordering etc.)

The open source SQL Operations Studio even has a community contribution to export directly to Excel! I just found out searching for the download link that the product is renamed to Azure Data Studio

https://docs.microsoft.com/nl-nl/sql/azure-data-studio/download?view=sql-server-2017

But then you only have a filename or uri or (local) path to a file in a sheet

image

I stored the Excel file as one with macro’s enabled and enabled the developer menu on the lint.

  1. Click the File tab.
  2. Click Options.
  3. Click Customize Ribbon.
  4. Under Customize the Ribbon and under Main Tabs, select the Developer check box.

And I used this small VB sub:

Sub PlacePics()

    Dim Path As String, Pics As Range, Pic As Range
    
    Path = "https://www.ourcompany.com/images/"
    Set Pics = ActiveSheet.Range("F2:F2164")
        
    For Each Pic In Pics
        On Error Resume Next
        Pic.RowHeight = 100
        Pic.Offset(0, 0).Select
        ActiveSheet.Pictures.Insert(Path & Pic.Value).Select
    Next Pic
End Sub

It might take a while to process (depending on the amount of rows). But it gets the job done.

Good luck!

Passed 70-532–> MCSD: App Builder 2018

$
0
0

It’s a bit of a follow up from my achievement last June when I passed the 70-486 MVC exam. I thought that I’d get the MCSD because I completed two (old/previous) UWP related exams before. But there was a bug in the cert planner. I had to wait a long time to hear from Microsoft, but unfortunately I had to take another exam to get the MCSD. I choose 70-532 because I wanted to go for MCSA: Cloud platform. So I ordered the v2 of the exam guide and studied every day during my holiday.

I found out (later) that the 70-532 and 70-535 and some more, will be deprecated by the end of the year… and will be replaced.

70-532 →   AZ-200
AZ-201
70-535 →AZ-300
AZ-301

But if you finish 532 or 535 before the 31ste of December you can use a cheaper transition exam to transfer to the same as the new “AZ” style. Since I passed 70-532, I decided to give AZ-202 a go and I hope that I will pass. I have to pass before June 2019 to get the MCAD. After that, I have added the AZ-300 and AZ-301 in my to-do list to get the MCASA (Microsoft Certified Azure Solutions Architect)

azure developer image

But first, let me enjoy my MCSD.

Good luck studying!

Using MariaDB on a Synology Nas

$
0
0

I have just enabled the MariaDB 10.x package and installed the famous Heidi SQL from the Microsoft Store (because of the auto update and roaming settings etc.)

So I tried to connect to it. The MariaDB 5.x uses port 3306, but the 10.x uses 3307 (minor detail) However, I could not connect, because by default only localhost connections are enabled.

So I had to SSH into the nas and fix it. But using SSH did not work how it used to. I used Ubuntu (also from the Microsoft store) to `ssh myadminname@localipofnas` but got a cypher not accepted/available message. It turns out that the Synology has disabled several old insecure ciphers. So I had to provide a –c and an algorithm to use in order to get it to work.

“no matching cipher found. Their offer: aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc”

I used `-c aes128-cbc` because it was the first option in the list

Once logged in, I had to launch MariaDB mysql and give the user access within the lan and create a database:

  • Search mysql (/usr/local/mariadb10/bin/mysql)
  • Enter to mariadb with command line: ./mysql -u root –p
    • Use the password
  • Check user's:
    • SELECT User, Host FROM mysql.user WHERE Host <> 'localhost';
  • Granting User Connections From Remote Hosts:
    • GRANT ALL PRIVILEGES ON . TO 'root'@'192.168.1.%' IDENTIFIED BY 'my-new-password' WITH GRANT OPTION;

Found it on: https://stackoverflow.com/a/51277323/169714

You can also use localhost or % instead of the ip. It depends on what you are trying to do Smile

MariaDB is now ready for some .Net Core

(Only my Synology NAS does not support Docker to run .Net Core…)

I am having doubts if I should try to work around it or just use a Raspberry Pi for my .Net core code.


Good luck, hope it saved someone some time!

Viewing all 132 articles
Browse latest View live