Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Block Ads at a Network Level with Pi-Hole and an Ubiquiti EdgeRouter

Advertisements are incredibly annoying, and I’m saying this as someone who relies on them for income on The Polyglot Developer. Even with ad providers such as Google saying that they’re working to provide a better experience, things seem to be getting worse. You could use tools like Adblock Plus in the browser, but what about mobile devices? Better yet, what about all the websites out there that detect when an ad blocker is being used and make the browsing experience even worse by denying access?

To get beyond these advertisement related problems, you’re going to need to handle things from a network level, not a per device level.

In this tutorial we’re going to see how to configure Pi-Hole, a popular network level ad blocking solution. For this example we’re going to use it with a Raspberry Pi and an Ubiquiti EdgeRouter, even though other networking hardware can be substituted.

Read More

Test ETag Browser Caching with cURL Requests

Recently I’ve been playing around with Netlify and as a result I’m becoming more familiar with caching strategies commonly found with content delivery networks (CDN). One such strategy makes use of ETag identifiers for web resources.

In short, an ETag identifier is a value, typically a hash, that represents the version of a particular web resource. The resource is cached within the browser along with the ETag value and that value is used when determining if the particular cached resource has changed remotely.

We’re going to explore how to simulate the requests that the browser makes when working with ETag identifiers, but using simple cURL requests instead.

Read More

Continuously Deploy a Hugo Site with GitLab CI

In case you hadn’t heard it on social media, The Polyglot Developer is part of a continuous integration (CI) and continuous deployment (CD) pipeline. Rather than using Hugo to manually build the site and then manually copying the files to a DigitalOcean VPS or similar, the Hugo changes are pushed to GitLab and GitLab takes care of the building and pushing.

Now you might be wondering why this is important because the process of manually building and pushing wasn’t so strenuous.

Having your web application as part of a CI / CD pipeline can streamline things that you would have otherwise needed to take into consideration. Here are some examples of where a pipeline would be of benefit, at least in the world of static website generation through tools like Hugo:

  • Multiple authors and developers can work on the project without knowing sensitive information like SSH keys.
  • Scheduled builds and deployments can be configured for content that is scheduled with a future date.
  • Docker images can be automatically created and uploaded to a Docker registry.

Those are just some of the examples, more specifically how things are done on The Polyglot Developer. In this tutorial, we’re going to explore how The Polyglot Developer is doing things and how you can adopt them into your static website generation workflow.

Read More

Getting Started with Visual Testing

There are tons of tools out there that help you make sure your app is functioning correctly. But how do test software from a purely visual standpoint?

Chances are you’re writing functional tests to check visual elements, or manually checking your UI whenever you push a change. If you are doing either of those things, then you know that they’re incredibly time-consuming and bugs still end up slipping through the cracks.

That’s where visual testing comes in.

Read More

Fix GLIBCXX Errors From Serverless Framework And AWS Lambda

While I haven’t done too much with Serverless Framework and Functions as a Service (Faas) recently, I did in the past and it isn’t something that I’ve forgotten. In the past I demonstrated how to deploy Node.js functions to Amazon Web Services (AWS) Lambda that contain native dependencies. While not a necessity for all Lambda functions, it is for functions that use libraries for specific operating systems and architectures. For example, my previous article titled, Use AWS Lambda and API Gateway with Node.js and Couchbase NoSQL, fell into this situation. Making use of an EC2 instance or a Docker container with Amazon Linux will help most of the time, but there are scenarios where a little bit extra must be done to accomplish the task.

In certain circumstances everything may package and deploy correctly, but still throw errors. For example, a common error is around libstdc++ and a version of GLIBCXX not being found.

In this tutorial we’re going to see how to resolve library errors that might not be caught in a typical packaging and deployment scenario with Serverless Framework and AWS Lambda.

Read More

Don't Be Afraid Of Grep

One of the most powerful commands that you could learn, grep is essentially a robust search tool. It gets its name from the acronym it stands for which is global regular expression print. This is just a fancy way of saying “to search for specific strings or patterns (using regular expressions) within a specific file or directory and print the matching results”.

Read More

Getting Started With MongoDB As A Docker Container Deployment

MongoDB is one of the most popular NoSQL databases on the market right now and is used heavily with Node.js development in particular. So what if you wanted to give MongoDB a spin and see what it’s all about?

There are plenty of deployment options when it comes to using MongoDB. For example, I had recently written a tutorial titled, Developing a RESTful API with Node.js and MongoDB Atlas which focused on the MongoDB cloud solution called Atlas. However, you can also install MongoDB on premise using multiple options.

In this tutorial we’re going to focus on using Docker to deploy MongoDB as a container and interact with it with the shell client.

Read More