Published in Level Up Coding·1 day agoMulti-String Replace in Golang with ReplacerString replacements in Golang are very easy using the strings package. From their docs: “Package strings implements simple functions to manipulate UTF-8 encoded strings”. Take the following sentence: "Hello World!" Now let’s say my product owner thinks saying “Hello World” with an exclamation mark is just too much, and if…Golang3 min read
Published in Level Up Coding·Dec 29, 2021Training an ML.NET Image Classification Model on GPUs using Google ColabIf you’re an ML.NET user and looking to train your models on GPUs, you may find you have limited options that are easy to consume. If you happen to be on a desktop that can support Nvidia GPU graphics cards you're in luck! If you happen to be on a…Mlnet16 min read
Published in Level Up Coding·Oct 11, 2021Effective Debugging with .NET Core & Docker Compose (Launch Compose Stack on Debug Start in VS Code)Most of the projects I work with today have external dependencies of some sort. This could be a database, a cloud provider, or just another API that I need to talk to. It’s rare that I don’t have to communicate with something over a network in order to develop my…Docker Compose7 min read
Published in Level Up Coding·Sep 14, 2021Sharing Docker Images Without Docker HubRecently I was working on a side project and needed to switch over to another laptop to work. My project called for a Docker image that laptop #2, unfortunately, did not already have. I went to do a simple Docker pull and got the dreaded: Error response from daemon: Get…Docker4 min read
Published in Level Up Coding·Jan 2, 2021Calling Multiple APIs Concurrently in Go (Goroutine and WaitGroup)With so many REST APIs floating around today, you’ll at some point find yourself in a situation where you need to call multiple endpoints to build a proper representation of your business object. This is not a difficult task, just create a new object, call the various APIs for data…Go5 min read
Published in Level Up Coding·Dec 31, 2020Unit Test SQL in Golang, Without Mocking, Using TestContainers (Go, Postgres, Docker, TestContainers)I wrote another article about this same topic which utilized a pure Docker solution to test database code without mocking. It was a cool solution, and worked really well, however it was a bit heavy-handed. It required special scripts, a certain folder structure, and could be hard to follow at…Testing11 min read
Published in Level Up Coding·Dec 14, 2020Mocking Outbound HTTP Calls in GolangEngineers these days have so many cool APIs to work with. You can literally find an API for a particular need with only a Google search. We have Twilio for sending emails/faxes/text messages, The Rundown for real-time sports scores and odds, or Airbnb to manage your listings. …Golang10 min read
Published in Level Up Coding·Dec 7, 2020Unit Test SQL in Golang, Without Mocking, Using Docker (Go, Postgres, Docker)UPDATE: I’ve written a companion article using TestContainers, based on a comment that I should look into that package. It accomplishes the same goal, testing database code without mocks. You can read it here: https://atkinsonbg.medium.com/unit-test-sql-in-golang-without-mocking-using-testcontainers-go-postgres-docker-4f61574b1989 Recently while working on an API that interfaced with a database, I mistakenly updated our…Docker16 min read
Published in Level Up Coding·Nov 16, 2020Debugging Go Inside Docker, Using Visual Studio Code and Remote ContainersThere have been many times in my career or when working on personal projects, that I have needed some open-source executables to help me complete my task. I have used things like Weasyprint, WKHTMLTOPDF, Exiftool, Ghostscript, the list goes on and on (these are just some of the more recent…Docker8 min read
Published in Level Up Coding·Aug 24, 2020Go Testing Essential Learning PathUsually, when I start out to learn something for the first time, I hit up the usual suspects: Pluralsight, Udemy, Linkedin Learning, etc. I really love learning programming topics via video training. For me, I find the instructors usually drop little tidbits of knowledge throughout the course, which is often…Golang5 min read