Posts

Showing posts from October, 2023

Creating boundary: How software developers can disconnect from work

Image
Picture this: You've just wrapped up a marathon day of coding, bugs, and Zoom meetings that seem to multiply like rabbits. You're finally done, and you close that laptop with a triumphant sigh. But wait, you're not quite done – work's lingering like a virtual ghost, haunting your every move. For software developers and those glued to their screens all day, the struggle to disconnect from work is as real as debugging that cryptic error message. So, welcome to the not-so-technical guide on how to take back your life from the code-monster's clutches – it's time to create some space between your work-life and your home-life. The need for disconnection So, you're a software developer, and your typical day reads like a mix between binary code and a suspense novel. Meetings, code, meetings about code – and suddenly, your 9 to 5 feels more like a 24/7. You close your laptop, but it's like trying to close Pandora's box; work thoughts keep popping up like thos

Using Dependency Injection in .NET Console Apps

Image
Are you tired of hearing the words "Dependency Injection" and instantly picturing complex web applications with fancy UIs? Well, my fellow developers, you're in for a treat, because in this article you'll see how to use Dependency Injection in console apps! You might be thinking, "Console apps? Isn't that reserved for simple command-line utilities?" But, hold on. With Dependecy Injection, your humble console app can tap into the same power and flexibility that  ASP.NET  Core developers wield for their web applications. Sounds good, right? Let's dive in and see how we can turn even the most mundane console apps into flexibile and testable applications. In this article, I'll guide you through the process of setting up a basic console app with a  ServiceCollection  that'll make any  ASP.NET  Core developer feel right at home. Installing NuGet packages You'll need to install the Microsoft.Extensions.DependencyInjection package in your console

Stop writing code during interviews and do this instead!

Image
With generative AI, writing code during an interview just doesn't make sense anymore The reality is we expect that you can code. It’s implied, it's taught in schools to children, it’s integrated into video games like Roblox. Asking a professional software developer to write trivial coding problems like the Fibonacci sequence during an interview is no longer good enough. We can do better and here’s how. Introduction Technical interviews for software engineers are at a crossroads. The traditional practice of having candidates write code is facing new challenges in the age of generative AI. Writing code is becoming easier to automate, raising questions about its relevance in evaluating real-world skills. In this article, we propose a shift towards code reviews as a better assessment method. Code reviews offer a window into how candidates reason, think, and communicate in a typical workday. They also provide a robust defense against cheating. Join us as we explore the changing land

An introduction to Particle Swarm Optimization (PSO) using C#

Image
In the realm of optimization algorithms, Particle Swarm Optimization (PSO) stands out as an efficient and intuitive technique inspired by social behaviour. Developed in the 1990s by Eberhart and Kennedy, PSO has gained popularity in various fields, including engineering, computer science, and economics. By simulating the movement of a swarm of particles, PSO searches for optimal solutions in complex problem spaces. In this post, we will delve into the essence of PSO, employing a relatable metaphor to facilitate understanding, and present a basic implementation in C#. Understanding PSO through the flock of birds metaphor To grasp the concept of PSO, let's imagine a flock of birds searching for the most favourable location to roost for the night. Each bird represents a potential solution to the optimization problem. The goal is to find the optimal location, analogous to the solution we seek. Initially, the birds scatter randomly across the sky. However, they are not entirely clueless

Create a Discord bot in C# and .NET - Part 3

Image
This is part 3 in the series of articles about creating a Discord bot in C# and .NET. In part 1 of the series, we completed our project setup in Visual Studio and created all the necessary information in the Discord developer portal. In part 2 , we created a bot using the Discord.NET library and added some basic functionality. 🧑🏻‍💻 Source code: https://github.com/adamstirtan/DiscordBotTutorial 🧠 Part 1: https://blog.adamstirtan.net/2023/10/create-discord-bot-in-c-and-net-part-1.html 🧠 Part 2:  https://blog.adamstirtan.net/2023/10/create-discord-bot-in-c-and-net-part-2.html Implementing Logging using the ILogger interface As we build out new features debugging will become more involving. By implementing logging we'll be able to print to the terminal when something happens and we'll have a much better idea of what the is doing. Add NuGet package Microsoft.Extensions.Logging.Console dotnet add package Microsoft.Extensions.Logging.Console Update the ServiceCollection in Progr

Create a Discord bot in C# and .NET - Part 2

Image
This is part 2 in the series of articles about creating a Discord bot in C# and .NET. In part 1 of the series, we completed our project setup in Visual Studio and created all the necessary information in the Discord developer portal . This article assumes you have a working console application and our bot's Discord token is stored in user secrets. This article will focus on the fundamentals of using the Discord.NET library to create a Discord bot from a console application. Then we'll finish off by creating a simple command called !echo which will repeat back what was said. 🧑🏻‍💻 Source code:  https://github.com/adamstirtan/DiscordBotTutorial 🧠 Part 1: https://blog.adamstirtan.net/2023/10/create-discord-bot-in-c-and-net-part-1.html 🧠 Part 3:  https://blog.adamstirtan.net/2023/10/create-discord-bot-in-c-and-net-part-3.html Install the Discord.NET NuGet package We're going to use Discord.NET, an unofficial .NET wrapper for the Discord API . It's a comprehensive lib

Create a Discord bot in C# and .NET - Part 1

Image
Creating a Discord bot is a fun way to add new functionality to your Discord server. The Discord API is very comprehensive and beginners may find it too complex to know where to get started. In this series of articles, I'm going to show you have to create a Discord bot using C# and .NET from scratch. The articles will demonstrate fundamentals such as new project setup, starting the bot and adding useful bot commands like: simple responses, embeds and remote API calls. 🧑🏻‍💻 Source code: https://github.com/adamstirtan/DiscordBotTutorial 🧠 Part 2: https://blog.adamstirtan.net/2023/10/create-discord-bot-in-c-and-net-part-2.html 🧠 Part 3:  https://blog.adamstirtan.net/2023/10/create-discord-bot-in-c-and-net-part-3.html Project setup in Visual Studio Open Visual Studio 2022 and create a new project. Choose Console App as the project type. Give your project a name and choose where to save the source code. For simplicity, check "Place solution and project in the same directory&qu

Remote .NET development with tunnels using Visual Studio Code and Synology NAS

Image
  Visual Studio Code allows you setup a remote development environment that using secure tunnels. In this article I'm going to show you how to use a Synology NAS running DSM 7.2 as the remote environment. We'll install some development tools on the NAS and the .NET SDK and configure the environment properly using our $PATH variable and run the Code CLI as a service so after your Synology reboots, the secure tunnel will be started. Remote Tunnels official documentation Installing .NET on Linux SynoCommunity 1. Install git and nano on Synology The first thing we need to do is install some new packages on the Synology NAS. These packages come from the community contributors at SynoCommunity.com . These packages will allow us to install git and nano, the terminal file editor. Open the Synology DSM web interface Open the main menu Select Package Center Select Settings Select the Package Sources tab Select Add Use SynoCommunity as the name and https://packages.synocommunity.com as th