How to Create a Dev Container for PostgreSQL
PostgreSQL is a free and open-source relational database that I use for most of my private database projects. Today we explore the steps to put PostgreSQL into a dev container.
PostgreSQL is a free and open-source relational database that I use for most of my private database projects. Today we explore the steps to put PostgreSQL into a dev container.
Having a running dev container is a good start, but only when we can write code is it useful. Let’s look how we can use Visual Studio Code to develop inside our container.
Last week we looked at the reason why we should use dev containers to write code. This week we create a dev container to develop a Ruby application on a machine that has no Ruby installed.
Why would you do that? Tools like rbenv are a great help to manage your Ruby environments. However, getting the right Ruby interpreter is only part of the setup. You need all your Gems and 3rd party tools in the right version, or nothing goes. My machine has no Ruby installed and by the end of this post I will run my Ruby Gem
'ruby' is not recognized as an internal or external command, operable program or batch file.
The more connected our applications are, the more complex their development is. The days when an application talked only to a database seem to be a thing of the past. Today, our applications connect to the cloud, talk to various services, and are often connected to multiple social networks.
I like Sublime Text 4 as a fast and versatile editor. Unfortunately, I always forget the command to format JSON files. This is mainly because it takes more steps than one single key combination:
GemBox.Document is a great help when you need to work with Microsoft Office documents in .Net. It gives you one simple interface to interact with DOCX, DOC, PDF, PDF/A, HTML, XPS, RTF, TXT and XML files – all without the hassle of Office interop objects.
For our light-weight data synchronisation tool we need to disable all triggers and constrains on our tables until the data is consistent again. In SQL Server we can use these commands to disable everything, do our work and then reactivate the checks and triggers:
If you need to copy multiple values from one document to another, you can go and copy & past every value on its own. That works, but there is a better and faster way. Windows 10 comes with a well-hidden clipboard history that you already have on your machine. With this feature you to copy multiple values and then past them to the target document in the order you need to – no 3rd party software required.
In a .Net Full Framework application we could use the property SpecifiedPickupDirectory in our mailSettings and the emails got stored to disk instead of sending them to the recipient. That allowed us to check them manually or in our test code.
For .Net 5 you should no longer use System.Net.Mail.SmtpClient and instead use MailKit. However, testing is a lot harder then MailKit does not offer such a convenient way to dump your emails to disk. Let us explore what we can do to check that our applications send the right emails.
SmtpClient from System.Net.Mail was the way to send emails in .Net 4.x. This old class worked for our use cases well enough to not bother finding an alternative. However, as the time progresses, email protocols improved while SmtpClient stayed the same. If you look at the .Net 5 documentation for SmtpClient, you find this important note from Microsoft:
Important We don't recommend that you use the SmtpClient class for new development because SmtpClient doesn't support many modern protocols. Use MailKit or other libraries instead. For more information, see SmtpClient shouldn't be used on GitHub.