Skip to main content

How to fix “MySQL server has gone away”, “Packets out of order” and similar MySQL connection errors

If you’re a fond MySQL and/or MariaDB user you most certainly experienced at least one of these common errors:

MySQL server has gone away

Error reading result set’s header

Error executing query

MySQL server has gone away for query

2006, MySQL server has gone away

Packets out of order. Expected X received Y. Packet size=Z

… and so on. You can find these warnings basically anywhere, as they are usually written in the log files of the applications, tools and services that try to connect to your database and fail: however, in most scenarios, they are firstly noticed by the zealous System Administrator inspecting the PHP error log file (or the Joomla or WordPress counterpart) while trying to understand why his beloved web site or service isn’t working like it should.

That said, let’s try to understand the underlying cause and see what we can do to overcome them.

Read More

WordPress – How to redirect all posts in one or more Categories, having one or more Tags or other custom conditions

Being able to redirect a post to another URL is a common need of any WordPress-based Web Master: there are a number of good reasons for doing that, such as: splitting your blog, moving a post from a website to another or to a sub-domain, and so on. Luckily enough, there are a lot of good plugins that can help you to do that, such as:

… and so on.

Unfortunately, most of them are either working with an SourceURL > RedirectURL static list or by adding a widget in the Edit Post page where you can insert the target redirect URL and some additional parameters, such as the redirect type (301 or 302).

What if we need to redirect all posts matching a certain condition? Here are some examples:

Read More

ASP.NET Core: Cloud-ready, Enterprise Web Application Development – The Book

After some weeks of delay due to technical reasons the Learning Path edition of my ASP.NET Core and Angular book is finally out throughout the Amazon (and non-Amazon) marketplaces all over the world. The name is ASP.NET Core: Cloud-ready, Enterprise Web Application Development and it comes as part of the Packt Book’s Learning Path series: each of these paths features a different course for readers to give them a one-stop learning experience with different technologies. Needless to say, the course is about a full-stack programming experience with ASP.NET Core, using modern client-side frameworks (such as Angular) for the GUI part.

Here’s the updated cover:

Read More

How to fix the “No executable found matching command dotnet-ef” error in Visual Studio with .NET Core

If you’ve stumbled upon this post it probably means that you’re trying to use Entity Framework Core in a .NET Core Visual Studio project with the dotnet ef CLI or Powershell command, which gives you the following error:

No executable found matching command “dotnet-ef”

This can be a nasty issue due to the fact that the framework gives little or no info, thus it’s not easy to understand what it actually lies under the hood. Luckily enough, there are a few things you can try that will most likely help you to fix that for good.

Read More

How to stop (or prevent) massive login attempts to Remote Desktop RDP on Windows Server

A couple days ago I published a post regarding how to protect CentOS server from unwanted SSH login attempts by changing the default port and/or using File2ban. Today I will talk about a very similar issue that affects Windows Server, which is often only accessible from the administrator by using a Remote Desktop (RDP) connection: that’s a very common case for any VPS or dedicated server hosted through an ISP.

The issue is the same of CentOS: your system is receiving an insane amount of (failed) login attempts in terms of thousands per day by random attackers who are trying to get in using standard brute-force techniques. Depending on given scenario they can be bots, zombies or hackers running BFA scripts. Luckily enough, there are some rather trivial countermeasures that can be adopted to shielding your system even if you can’t afford to purchase and install a Firewall with Intrusion-Prevention System (IPS) – which is something you should really do anyway, expecially if you’re hosting some valuable and/or sensitive data. The methods below will work on any Windows Server release: Windows Server 2003, Windows Server 2008,  Windows Server 2012, Windows Server 2012 R2 and the new Windows Server 2016.

Read More