-
Testing Blazor with Playwright
How do you test Blazor applications with Playwright, both locally and in GitHub actions?
-
Adding build information with a source generator
This is the easy way to add build information, such as build time, branch, commit ID, etc., into your application!
-
Adding build information with GitHub Actions
How can you add build information, such as build time, branch, commit ID, etc., into your application?
-
Batch upgrade to .NET 6
.NET 6 preview has been out for a while, and I decided to give it a go. New compiler warnings have been introduced and I wanted to find and fix this early. But I also wanted to easily go back to .NET 5.
-
Redirect with Azure CDN
A while ago I needed to make a redirect from www.oldcomain.com to www.newdomain.com. This needed to be done with the HTTP status 301 – moved permanently. I could not do this with the service that was hosting the new address. But I found a cheap solution in Azure CDN.
-
Date time picker for Blazor
In my previous post I showed how you could do a time picker component in Blazor. This time I will extend this so you could select date and time with a single component.
-
Time picker for Blazor
There are existing components in Blazor that makes it to get different types of user input, like strings, numbers, and date. But what about time?
-
Get time zone for a user in Graph
With the current SDK for .NET you cannot directly get the time zone for a user. But you could work around this.
-
Invite to a meeting
How to invite someone to a Teams meeting with the Microsoft Graph in .NET.
-
Caching configuration from Azure KeyVault
Azure KeyVault is a great service. With this you store secrets on a share location and could use on several services. But it is not fun to use during development.
-
Be careful with references in Power Query
References in Power Query are incredibly useful. I often use it to organize my queries. But when you are using them you could trigger extra calls against your data sources.
-
Creating unique Excel sheet names
Here is a solution that gives you unique and valid sheet names in Excel files that you are generating.
-
Calling an API multiple times with Power Query
Making a single call to a web API is quite straightforward. But sometimes you need to make multiple calls to get the data you want.
-
Creating accruals with Power Query
Let say you have expenses that you want to split into several dates. How do you solve this with Power Query?
-
Finding objects that are not disposed
Making sure objects are properly disposed could be tricky. Here are some ways I deal with this.
-
Avoid connecting to resources by mistake
Being able to connect to any resource at any time is both convenient and scary – especially if you are a developer. Here is a little trick that reduces the risk a bit.
-
Finding redundant project references
When you are working with a nontrivial .NET solution you will eventually have a lot of references between projects and NuGet-packages. Here is a little script that finds references that are no longer needed in .NET Core projects.
-
Preparing for 2038
When I am writing this, it is 17 years until the 19:th of January 2038. This is the date when systems will run out of seconds.
-
PolicyScope
I recently decided to use Polly in a project. Polly is a solution to make it ease to implement retry logic in an application. It is a really nice framework. But when using in with dependency injection I thought that something was missing. This ended up me creating my first public NuGet packet.
-
Manually creating a DbContext and enable logging
In an application I have working with a needed to manually create a
DbContext
. But doing so, disabled all logging from theDbContext
. -
Add .NET 5 extension to App Service from the command line
I have started to migrate some of my .NET Core 3.1 applications to .NET 5. But to be able to run these in Azure App Service an extension needs to be installed.
-
Graphemes
Since 1998 I have been developing an application to make it easier and fun to learn languages, Vokabel. For about a year ago I got some complains that the application in some scenarios did not work properly with some languages.
-
WithPartitionKey and in-memory database
With EF Core 5, WithPartitionKey has been added that will make your queries executes faster on a Cosmos database. But it does not work with in in-memory database.
-
.NET 5 and Azure Functions
.NET 5 have been out for a few weeks when writing then. Upgrading from .NET Core 3.1 has been easy, I think. Except when it comes to Azure Functions.
-
How to use JWT token from query string
Normally you authenticate via a HTTP header when you are accessing an API. But how do you configure your server to allow authenticating via the query string too?
-
Power Query and Web API with HTTP authentication
With Power Query you could easily get data from different data sources, like Excel-files, CSV-files, and Web API. But if you need to connect to a Web API that requires authentication things are not that easy.
-
Power Query and JSON arrays
When you are working with JSON arrays in Power Query it is not always obvious how to convert the data into a table.
-
What characters are whitespace?
What characters are considered to be whitespace? Space obviously, also tab and line break characters are easy. But what about U+00A0, the no-break space character? Or U+180E, the Mongolian vowel separator? It turns out that the computer languages we are using are not agreeing on this.
-
Trimming whitespace in objects
How to trim strings in all properties in objects with C#.
-
Trimming whitespace in input controls
A simple solution to automatically remove whitespaces on input textboxes and text area controls in HTML.
-
Prettifying JSON with PowerShell
A quick and dirty way to quickly prettifying JSON-files with PowerShell.
-
Multiple find and replace with PowerShell
If you need to find and replace a string in multiple files there are several tools that could do this. But recently I was in a situation where multiple URL:s needed to be updated in multiple files. So, I decided to do this in PowerShell instead.
-
Autoscroll
Very recently I developed a basic chat function in an application. Users could enter and send message to each other. And the messages were shown in a list that automatically scrolled down when a new message was received.
-
Detect and warn multiple editors
How to show a warning when two, or more, users are editing the same object at the same time.
-
Modifying query strings
Recently I needed modify a query string that was somewhere in a URI string. It seems to be a trivial problem, but it took me some hours to get this right.
-
Format tables in Excel with macros
If you copy a table from a browser, or some other application, and then paste it into Excel it most certainly looks bad. You may have cells with content that spans over several rows, and texts that are badly formatted. Luckily, with a simple macro in Excel, that works in all your documents, this is easily solved.
-
Submitting forms when a select list changes
On a page I created recently, there as a simple select list. When the select value was changed it was supposed to submit a form.
-
How to make InputSelect support more types
If you have used
InputSelect
in Blazor in ASP.NET Core 3.1 you may have noticedbind-Value
only works on a limited set of types. That is strings and enum to be precise. In .NET 5 this will be improved. And it is easy to backport this to 3.1. -
Creating Excel-files in Azure Functions
Last week I looked on how you could create an Excel file in Logic Apps and then e-mail that file to someone. This week I solved the same problem in Azure Functions. In retrospect, I think this was a better solution.
-
Creating Excel-files in Logic Apps
Imagine that you day week has to get data from some databases, add this in an Excel file that is then e-mailed to someone. How could you automate this in Logic Apps? Also, is it worth it? Maybe.
-
Extracting URL:s from files with PowerShell
Recently I needed to extract all URL:s from several files. I thought this was a fun little challenge where I could improve my limited skills in PowerShell and regular expressions.
-
Power Query - Grouping and filtering data
When you are working with data you often want to do some kind of summarizing. With Power Query you do this with grouping. Just like join, this is similar how it works in SQL.
-
Power Query - Joining data
Sometime useful to combine data from two tables when you are working with Excel. You could do this with functions like VLOOKUP. It works, but it is a pain to use. If you instead are using Power Query, you could easily join data from two tables. If you know SQL, you will find this familiar.
-
Power Query - Working with columns
When you are working with Power Query you often add, remove and modifying columns in your queries. There are tons of ways to do that, in this part we look on the most common cases.
-
Power Query - Get started in Excel
There is a feature in Excel called Power Query. Personally, I think this is one if the best feature in Excel. Despite this, I find that very few people are aware of it. It is a wonderful when you are analyzing data.
-
Lessons learned from rendering video in Azure Functions
Recently I have been working with creating time lapse videos in Azure Functions. It was challenging and fun, and I share what I learned from this here.
-
Create a time lapse video
Let’s create a time lapse video! We take some images, add some title screen background audio and a time stamp on each frame and combine all that to a video file. All this in C# and some help from ffmpeg.
-
Setup a NuGet feed in Azure DevOps
With Artifacts in Azure DevOps you could easily setup a private NuGet feed. Here is a summary of the steps required for different scenarios from a .NET Core developer perspective.
-
Change language version on multiple projects
If you have several .NET Core projects where you want to change the C# language version to 8.0, how you do this the fastest way?
-
Change database SKU with Logic apps
If you have a database that you are using less during night time, you could change SKU (Stock Keeping Unit) with some schedule to save some money. With Logic apps and the connector
Azure Resource Manager
it is quite straightforward to do. -
Change encoding on your source files
How do you make sure that all your source files are using the same encoding? With PowerShell of course!
-
Build time
Waiting on the compiler could be a large part of the developer’s life. What can you do to make this process faster? I have tried different way to organize code and projects and measure the build time.
-
Compiling with a RAM-drive
When you are compiling your latest application that will take over the world, it will make a lot a reading and writing against your hard drive. Wouldn’t it be a lot faster if you instead compile against a RAM-drive, and just having your source code on your physical storage devices? To be honest, not much. Despite this disappointment, let us geek out and try it.
-
Prevent enter to submit forms
Recently I was working with a web form for submitting some data. But one of the input fields was used for searching instead, so I wanted to prevent the form from being submitted when the user pressed enter in that field. If you have a few forms this is possible to solve with JavaScript on every page. But I wanted something else so I created a solution where you only need to add a CSS-class on the fields what should have this behavior. I think this turned out to be an elegant and reusable solution.
-
Use Teams as a Terminal
Here is a crazy idea. Teams is a popular application for communication, especially the chat is widely used between persons on companies. What if we also could use the chat as terminal, so people could it to start and stop virtual machines, start a synchronizing of a PowerBI report and other things. You could do a simple little bot with Logic apps.
-
Cache NuGet packages for .NET Core builds
Restoring NuGet packages often takes significant amount of time if build large .NET application. To solve this you could use a cache in your build. But if you follow the documentation you should create an
packages.lock.json
file for every project. I do not want to that, so I created a slightly different solution. -
Test migrations on production data
Running database migrations on a SQL server could be scary. Even if your migrations scripts work perfectly fine on test server, there might be data on your production servers that could cause problems. Wouldn’t it be nice if you could copy data from your production servers and then test the migrations on that? Of course, this should be fully automated, and you can do this with Azure DevOps.
-
Change SQL Server firewall settings with Logic apps
Recently I needed a way to change firewall settings in SQL Server in a Logic app. I wanted to add and remove which IP-addresses that were allowed. I was able to solve this with the connector
Azure Resource Manager
. -
Start and stop virtual machines with Logic apps
A highly voted feature request is to start and stop virtual machines with Logic apps. This is quite easy and possible already today if you just know the right steps.
-
Escape sequences in Logic apps
If you are working with Logic apps in Azure you might have run into problems if you want to use an escape sequence - they are simply not supported. I had problems with this when I wanted to replace all line breaks in a string with spaces. This is annoying, but there is a workaround.