About Anthony Mattson

If you want to know more, read my About section.

Never Just Copy Code

When I’m learning something new that involves coding, I’m always grateful when working code examples are provided. Whether I’m working on training modules, looking up how to accomplish a specific task, or troubleshooting code. While I try to learn what I can from reading, I’m much more of a hands-on person and learn best getting my hands dirty, so to speak.

However, I very much understand there are pitfalls for using these code examples. Namely, it is very easy to simply just copy/paste the code and that’s it. If it works, all good. But do you actually know what the code does? If it breaks or doesn’t perform as expected, can you troubleshoot it? If you wanted to alter it to behaving differently, can you? This is why I press on myself to never just copy code.

Whenever I copy code, I make a habit of breaking it down. I make sure I understand every part of the code, what the code does, and how it does it. I want to make sure I know what I’m doing and learning from the code example so I can further improve my own knowledge.

For example, I’ve never worked with asynchronous programming prior to writing my project Discord bot. I was fortunate that the Discord .NET community has really great documentation on how to get started. with all the necessary code. When I was following the documentation and using their code, I made sure to break down each line to make sure I knew what I was writing. This even lead me down a rabbit hole of reading the Microsoft documentation for understand what asynchronous programming is.

I’ll be honest, I’d have no idea how to troubleshoot my bot if I ran into any issues. Not going to say I’m an expert, but I definitely learned a lot about asynchronous coding.

It’s always good to keep learning.

Getting Started with Containers

For a while now, I’ve been wanting to know and learn more about containers. Nothing like a new job that specializes in containers to jump start that process.

If anyone is wondering where a good starting point is for learning what containers are, might I recommend the Docker tutorial container getting-started.

$ docker run -d -p 80:80 docker/getting-started

This is a simple image that includes a tutorial website that takes you through the basics of using Docker. Goes through how to pull an image, build an image with code, update an image, and deploy all with using the CLI. Doesn’t really get into orchestration but does bring it up near the end. However, an added benefit in my book, it’s a fully functioning image that includes a multi-page website. Perfect for running quick container tests.

It may not be what you intend to do with a container, but it is very nice baseline. So much so, I’ve started using it to play around with the container services in AWS. Started off by deploying a copy of it to an ECR repo. From there, I’ve used it to test out different scenarios in ECS and EKS. Testing out EC2 vs Fargate instance types; testing out multiple deployments behind a load balancer; and testing a multi-container task. Perfect for helping me know I’m deploying my containers correctly and they work. I know I can build my own container and test it locally, but I haven’t gotten to that point yet.

I do have a couple of my own ideas to try testing out as well. Just need to build the images. Current plans include my Discord bot, a V Rising game server, and some of my own website builds. The bot will be interesting as I haven’t yet tested .NET Core in Linux and want to give that a try. The V Rising server is Windows only, so that will be nice experience with a Windows container. The websites will likely be Blazor/.NET Core, so Windows is a given; but Linux is an unknown. Similar to my Discord bot currently. Either way, I’ll be learning along the way.

Ever Evolving

Something I try my best to embrace and keeping looking towards is to constantly evolve. While have loose ideas about what I want to document, I’ve been constantly changing my mind and making tweaks to this sight.

Well, it’s time to evolve once again. While I have been continuing to try and define myself as a programmer/developer, I’ve been finalizing what elements I want to focus on. Technology is ever expanding, but if I can’t find some amount of focus, I’ll have a much more difficult time finding my place.

On that note, I am planning to focus my attention towards C#, .NET, HTML5/CSS, SQL, and GIT. While quite a nice spread of tech, all of these work hand-in-hand. Not required, but all things I’m already familiar with, but lacking expertise. With this, I plan on updating this blog once again to help track my individual projects.

Just a quick teaser, one of these projects is I’m working on my own Discord bot written in C#. Also mulling the idea of my own site I build from scratch using ASP.NET Core Bazor.

VS Code, the Ultimate Open Source Editor

Between work and school at the moment, my progress through the HTML5/CSS3 learning course in YouTube has been slow, but I’m making progress. While most of what I’ve learned is what I already know, there have been some new concepts I have not touched yet such as HTML Forms. However, one item I’ve been learning a lot more about has nothing to do with HTML5 or CSS3. It is Visual Studio Code.

Now, I’ve been technically using Visual Studio Code for a few years now, just never to the extent of how I’m now using to write my web code for the HTML5/CSS3 course. I’ve used it somewhat for helping write SQL queries and saving a local copy of a C# class/method I’m working on. However, this is the first time I’ve really started using it with extensions beyond the language support. A few great extensions that I’m using for web design, but I’ve started using for my C#, are Bracket Pair Colorizer 2 and indent-rainbow. I can’t say how often I’ve spent more time trying to match brackets and fix mismatch indents then actually writing code. For web design, I’m also using Highlight Matching Tag, Live Server, and Prettier – Code formatter. Live Server is honestly extremely simple, but a heck of a time saver when making page edits and not having to constantly reload pages. Prettier isn’t exactly necessary as I do feel getting into a better formatting habit is more ideal, I’m not perfect and overlook indents from time to time. Just nice to make sure I have a more consistent format without to much fuss. Although none of these are necessary, they make coding so much nicer.

My latest fun with VS Code has to do with Microsoft finally bringing it to Raspberry Pi. I’ve been sitting on a Raspberry Pi 3 for a while now not really knowing what to do with it. With my decision to start focusing on web development, I figured why not use as a lightweight web server. Now, I can use VS Code on my Raspberry Pi to help work on site code. Set it up with SSH, VNC, VS Code, and Apache2. Not sure what kind of site I’ll try to build first, but now I’ve got a perfect lightweight Linux testing environment to play around with. If I don’t want to VNC into the Pi, I just found out that I can use VS Code on my desktop to remote into my Pi’s file system to also edit files over SSH with the Remote Development extension. Granted, I don’t think you need the entire Remote Development extension as you can get the individual components, but I figured why not. Just need to play around with it more, but I’ve already setup a connection and it really nice. Side note, I kept getting this error when trying to connect initially: Resolver error: The process tried to write to a nonexistent pipe. Found a nice fix on Stack Overflow that worked perfect for me.

In all, I really feel that Visual Studio Code really is the ultimate open source editor. It’s free and has one heck of an extension library. Also, you can get it across Windows, OSX, and Linux. If you are looking for a good editor that you can also use for code development, I strongly recommend giving Visual Studio Code a shot.