Welcome to Mobile Tech Tracker. Our mission is to help technically-minded people to become better versions of themselves and to help ordinary people to use modern smart technologies to their own advantage. If you want to support us, please consider visiting the pages of our advertisers.
Building .NET Core audio application - part 1
As great as .NET Core is for writing software for multiple platforms, it lacks some basic capabilities. This applies to those functionalities that would work radically differently on different platforms under the hood, especially the ones that weren't the priority for the authors of .NET Core. One of these is the ability to play sound.
With it's predecessor, .NET Framework, you could play sound easily by using classes like SoundPlayer from the standard class library of the framework itself. Likewise, NuGet packages such as NAudio added many extra audio-processing capabilities.
Unfortunately, NAudio is not fully compatible with .NET Framework yet. Although there is a pre-release version that is available in .NET Standard and is compatible with .NET Core, the bulk of its functionality is still only available on Windows.
There is, of course, a reliable way to play sound on .NET Core on any platform, but it requires quite a few additional dependencies. You will have to load ASP.NET Core components, Node.js and use NodeServices to get this solution to work.
Therefore, if you would want to be able to play audio on .NET Core in the most efficient way without loading too many additional components, you can write your own library to do so. Fortunately, the process is not prohibitively difficult.
Building .NET Core desktop application
.NET Core is great for cross-platform app development. Unfortunately, the compatibility with multiple platforms was achieved primarily by excluding any components that are specific to Windows OS that it's predecessor, .NET Framework was built for. This is why, out of the box, .NET Core can only be used to build command line applications with no GUI and, with addition of ASP.NET packages, web application with nothing more than a standard functionality.
So, how can one build a .NET Core desktop application with GUI? Fortunately, the framework is extendable and the extendability goes above and beyond simply relying on NuGet packages.
Any common software functionality that isn't yet available in .NET Core is available via a more mature cross-platform software-building technology: Node.js. And the good news is that two frameworks can inter-operate easily.
In my previous article, I talked about how to play audio in .NET Core by using one of its standard libraries, NodeServices. In this article, I will talk about utilising Node.js from within a .NET Core app to build a desktop application with GUI. However, this time, the methodology is somewhat different.
How to play sound on .NET Core
How do you play sound in .NET Core apps? Is there a version of NAudio NuGet package for .NET Core or it's equivalent? Sadly, playing sound is nowhere near as straight forward on .NET Core as it is on .NET Framework. And there isn't a simple NuGet-based solution either. However, there is a way.
.NET Core certainly came a long way since Visual Studio 2017 was first released. It is now at the stage where the framework itself and the technologies that support it are mature enough to be used in production. However, although .NET Core can be deployed on any of the most widely-used operating systems and any CPU architecture that supports those, the framework is still pretty bare-bone compared to it's predecessor, .NET Framework.
Many things that .NET Framework can do are very Windows-specific with no platform-independent equivalent, therefore .NET Core does not natively support those. One of such functionalities is the ability to play sound from the code. With .NET Framework, you have native classes that support it, such as SoundPlayer from System.Media namespace and third-party NuGet packages, such as NAudio. Neither of these are available in .NET Core and, if you browse NuGet repository for sound libraries compatible with .NET Core, you'll soon realise that there is nothing that will enable you to play sound from the code in a straight-forward manner. At best, you can download some library that acts as a wrapper around some other assembly that needs to be compiled specifically for a particular operating system or a specific CPU architecture. As well as potentially not being available for a particular type of a machine, most of such libraries have a strictly enforced paid-for license.
Despite all this, there is a reliable and simple way of playing sound in .NET Core without having to splash out for an expensive software license. But first, let's see why NAudio, one of the most popular NuGet packages for audio processing, cannot live up to this task.
How to protect your website from spammers
If you own a website and have given its users the ability to post content, such as comments or articles, you are bound to clash with malicious spammers at some point. They will come when you least expect them.
So, imagine that you woke up one day after posting an amazing article that you've put a lot of effort into. And you see that people are obviously interested in what you had to say, as it attracted over hundred comments. At first, it makes you happy. However, your happiness doesn't last, as you discover that all of the comments are about Viagra.
The bad news is that this kind of thing is extremely common. The good news is, however, that it is extremely easy to protect your website against spammers. This is why you rarely, if ever, see these kind of comments on reputable websites.
Proven way to make programming fun
Software development can be a very interesting and financially rewarding career. With abundance of free online tutorials, learning how to program today is easier than ever. However, there is one major hurdle that everyone who has ever tried coding is familiar with: the process of writing software can, sometimes, be tedious and boring.
This is especially true for online tutorials. Getting to know a new programming language can be tremendously useful for one's career. However, most of the tutorials available online are extremely dry. Nothing saps motivation for learning new technology as much as seeing the code for yet another "Hello world!" app.
However, the good news is that learning how to code doesn't have to be boring. Perhaps, for learning the very basics of a given language, going through some of the boring tutorial steps is unavoidable. However, once you know the basics, there is a great and exciting way of practicing your programming skills. This is how you can do it.
Why you should care about functional programming
While releasing version 15.7 update to Visual Studio IDE, Microsoft has announced that its main functional language, F#, has been given a whole new set of cutting edge features and tooling, far better than anything available in any other of its popular languages. This has got the software development community excited and the official Visual Studio Magazine article where the announcement was made soon became one of the most visited pages on the magazine's website. This is yet another proof that there is an interest in functional programming.
However, there are some very good and pragmatic reasons why functional languages are worth learning. Let's dive into them.
What the heck is WebAssembly
Desktop apps are not dead. Here is why
Many people entering a software development career are often told to focus on web applications over desktop ones. Apparently, many believe that desktop apps are a dying technology. While it is true that certain business functionality that was, in the past, performed by desktop apps is now commonly performed by hosted browser-based web apps, there are still many use cases for desktop apps and none of them are going away any time soon.
It is extremely difficult to imagine your life without desktop apps. Anything that is actually installed on a full-sized computer is one of them. Yes, web apps can do many things, but the browser that is needed to access them is, itself, a desktop app. Any integrated development environment (IDE) that programmers use to build software is a desktop app, even when it's only ever used to write code for the web. There are countless of other examples that you can find if you'll think about it.
Of course, web apps do have distinct advantages over desktop apps in some areas. However, it is the other way round in some other areas. So, if you are undecided which way to take your programming career, let's have a look at the pros and cons of both technologies.
Popular misconceptions about Node.js
As a server-side technology, Node.js has it's advantages and disadvantages. However, many developers who are accustomed to working with other server-side technologies will never even consider Node.js. Sometimes, there are objective reasons for that. Other server-side technologies can, sometimes, achieve what Node.js cannot. However, there are also some popular misconceptions about Node.js that stop people from taking full advantage of it.
To make it easier for you to decide whether Node.js is something that you would ever consider, I have listed some of the most popular misconceptions about the technology. Some of these believes have a grain of truth in them, so I have also specified what to watch out for.
Becoming a software developer is easier than you think
Everyone knows that software developers is one of the best paid professions. However, the most prevalent assumptions are that entering this career is a long and complicated process and that most people are just not cut out for this type of job. Many people believe that you will need to have a degree in computer science and be really good at maths just to get your foot through the door. But what if I told you that you don't necessarily need any of these to start your career in software?
I have been a software developer for a number of years and I neither have a degree in computer science nor I am particularly good with maths. I have learned how to code on a job and I still use calculator to solve relatively simple multiplication and division problems. Over the years, I have met enough software developers whose career progression was similar to mine, so my experience is certainly not unique.
While it is true that software development may not be for everyone (mainly for the reason of preference rather than the ability), it is one of the least bureaucratic career options out there. Therefore, if computational technology is something that excites you, read on. I will tell you how I entered the career and how you can do it too.
More from Tech Thoughts
Biggest misconceptions about full stack developers
It's not Capitalism that's the problem
The most important skill for 21st century
How to think like a hacker
One human trait that slows down humanity's progress
See everything that Facebook and Google know about you
How society conditions you for mediocrity
Why you shouldn't always trust scientists
Dark side of software development
I cannot wait for AI to take over
© Mobile Tech Tracker. All rights reserved. Unauthorised copying of any of this website's content is prohibited under international law.
For any queries, comments or suggestions, please write to firstname.lastname@example.org.