Most of the time, when serializing JSON, you already have access to the underlying object that you are serializing.
User Defined Table Types are a very nifty way to pass data to a stored procedure for processing.
Pattern matching is a powerful feature borrowed from functional languages that can make a whole class of problems simpler to solve.
One of the things you get for free when using a
record is that the compiler will write for you a
ToString() method for free.
Programming has been with us for almost a century now but the cycle surprisingly has largely been the same:
The final release of .NET 6 is now available.
You can get the final bits here. Remember that .NET is cross platform so you can select the appropriate sections to download the bits for your operating system
Computing “power” over the past decades has changed from being a speed game “megahertz” to a parallelism game - multi-processor, multi-core.
One of the things to think about when writing LINQ
filter expressions (
Single) is what happens when the thing you are looking for was not found.
A fairly common task in day to day programming is combining strings.
Today we look at what might be a niche feature, but nevertheless in some use cases might actually be quite useful.
Suppose you have the following class that you wish to persist using the Entity Framework Core ORM.
record structs, is a bit more elaborate to explain, but I shall do my best.
.NET 6 Release Candidate 2 was released last week, on the 12th.
As your codebase grows, it becomes important to organize your code. This is done using a concept called namespaces.
If there is one thing that .NET has plenty of it is timers.
The Hypertext Transfer Protocol is the protocol at the heart of the internet.
It is again worth repeating that .NET 6, like 5, 3 and 2 before it are cross platform and can be used to build applications in Linux and OSX.
Occasionally you will need to connect to the internet, or to another network for that matter, through a proxy.
When developing an application, you invariably will need to use logic or functionality encapsulated elsewhere.
One of the cornerstones of modern computing is that there is much less emphasis on raw power and more on distributing work.
One of the most powerful features of LINQ is the ability to select a range of elements from a collection.
Software is always a moving target - adding features, fixing bugs or even removing features. The same challenges fall upon the tools used to develop software.
Another improvement that has been added to the LINQ engine is the DistinctBy method.
When dealing with complex object graphs in memory, it is common to have objects referencing themselves.
The .NET 6 Release Candidate 1 was released last week.
The default template for a web application in .NET 5 and previous versions looks like it was done with seasoned, disciplined developers in mind. This is not a bad thing. The issue, just like with the previous console templates I’ve talked about earlier, is it is not welcoming to those new to the platform.
We are all familiar with the Queue class.
It may surprise you to learn that even the Math API, which generally does not change all that much, has some additions for those who do high performance trigonometric functions.
One of the most powerful features introduced in the .NET Framework, all the way back in 2008 in .NET 3.5 was Language Integrated Query, better known as LINQ
We looked at the new DateOnly Type on Day 1 of this series, and it should come as no surprise that there is a companion TimeOnly type that has been introduced to deal with only the time component of a DateTime.
One of the challenges of developing and maintaining a programming languages and its accompanying tooling is you have to be welcoming to several demographics:
- Experienced developers on your tool-set
- Experienced developers from other tool-sets
- Complete newcomers to programming & hobbyists
In .NET when manipulating dates and times, you generally use the DateTime type for such purposes.
After installing the .NET 6 SDK you can confirm that it was successfully installed and recognized by running the following command:
Occasionally you will hear somebody say, (or you yourself may say) something like:
While upgrading docker you may get the following error:
I have done two posts on automating posting messages to teams.
Frequently in the course of your code, you will need to get the current date.
One of my favourite maxims is “measure twice so you cut once”.
Recent developments (we are in the middle of a massive upgrade of our technology stacks) as well as strategic decisions have forced us to interface with systems and ecosystems not only at code level as we are accustomed to, but additionally at documentation level.
Lionel Messi is, by many accounts, the best football player in the world.
Assume you have a command like so:
More Features Is Good
If you have turned on 2 factor authentication for GitLab, you might be wondering how you can access and manipulate your repository over HTTPS.
Default interface implementations were introduced in C# 8. Essentially these are interface declarations with bodies.
Most developers when requiring a integer type use the
int type and go about their business.
If you’re on Windows and are not using Windows Terminal, you really should.
So I noticed that the Disqus comments that I’ve been had been displaying a range of scammy ads.
Assume you have the following type:
I recently had to delete all the queues in my RabbitMQ instance.
I have some code where I am running a regex and using LINQ to manipulate the matches.
Assume we have the following class:
When you were introduced to object oriented programming (OOP), you probably used the canonical example domain of animals.
Refit is a very brilliant library that allows you to call REST APIs with minimal code.
So today I wanted to see if Excel could natively consume JSON APIs.
So today in a rather large project I began getting the following error when I ran a build:
Regular expressions (
Regexes) are a powerful tool for solving certain types of problems - and in particular looking for a certain pattern of text in a larger string and (optionally) replacing it with another.
Assume you have a controller with this
GET end point
Many of the .NET APIs take time intervals as their parameters, and it usually is in milliseconds.
In your traditional database, there are two ways to enforce the restriction that “the value of this column should be unique”:
- Unique constraints
- Unique indexes
This is the dialog I saw when I launched Oracle VM VirtualBox today.
If you are using Entity Framework Core, and are configuring your models using configuration classes (as you probably should) you might run into a situation where after adding your migrations and updating your database, you find that the resulting schema does not have indexes or unique constraints.
While running the entity framework command to add a migration, I got the following error
Are you attempting to open the pgAdmin web console and it appears to be loading endlessly?
I have been writing software for exactly twenty years now. In the course of this I have learnt very many things, which I hope to journal over time.
This is another improvement to the logic of making a
Http request using the HttpClient.
I ran into an interesting problem the other day.
Today we will setup an environment where we can develop and debug code remotely on a Linux environment.
In a previous post I had mentioned that the
HttpClient does not automatically process HTTP redirects and you would have to write the logic yourself.
I recently had an opportunity to revisit some very old code (to the tune of almost a decade) and saw it as an opportunity to make some improvement and cleanup.
The Microsoft Build Engine, MSBuild, is responsible for controlling the build process that translates source code to object code and its relevant artifacts.
I have recently discovered a glorious online streaming radio station, WXQR - New York’s Classical Music Radio Station. This station streams classical music pretty much 24 hours a day.
If you are invoking a web request from your application, you may get the following error:
YouTrack is a robust web based platform for issue tracking, Sprint and Kanban management.
Here is a site I am visiting on Chrome.
This is Part 4 in the series of Joining stings
This is Part 1 in the series of Joining stings
This is Part 2 in the series of Joining stings
Good news if you have been running on Windows Subsystem For Linux (WSL) and have wanted to upgrade to version 2 but have not been willing to join the Windows Insider Program - WSL2 is now out in the main release.
This is Part 1 in the series of Joining stings
I have been running this blog on WordPress since inception, and using WordPress in general for many years (since 2005).
Kestrel, the web server that powers ASP.NET Core is highly optimized for running ASP.NET Core code, and running it fast.
A useful tool to have in your toolbelt is an ability to make web requests and retrieve responses from the command line.
In Unix / Linux land there is a handy command to create an empty file.
Ever wonder how old your favourite language is? You might be surprised!
The .NET framework has a decimal data type.
Suppose you need to extract the byte values of a string in F#
On the surface a perfectly reasonable question.
A software company is an institution that converts money into software that people pay money for.
When working with collections there are several ways that you can determine if a collection is empty.
Suppose, for whatever reason, you need to know your ISP assigned IP address.
One of the features of C# (and the .NET platform in general) is the support of properties as a first class citizen of the runtime.
One of the interesting things about using an object oriented language (like C#) vs a functional one (like Racket) is you get an opportunity to see first hand how different things are doing in either paradigm.
The FizzBuzz problem is one of those ubiquitous industry problems that has been floating around for decades, intended to separate the sheep from the goats.
The Nuget package management system has been a godsend when it comes to managing libraries and dependencies in your projects.
Many of us create .NET Core projects in the following way:
Tuples, or to use their correct name,
ValueTuples, were introduced in C#.
It is often a good idea to verify the file hashes of downloaded files, whether it is to detect that the file you download was actually the one that the developers intended (see what happened to Handbrake for OSX) or to detect corruption of a download.
You have probably come across the
AsReadOnly() extension method, and have probably made liberal use of it.
The other day I spent the better part of an hour trying to figure out why a particular controller action was not being hit by a request.
Did you know that Windows 10 has a proper SSH client, and has had one for a while?