A step by step guide for beginners to get started with Puppeteer

Image for post
Image for post
The whole point of the puppeteer is lost if you keep doing things manually!

What’s Puppeteer?

With Puppeteer, automate routine jobs that you occasionally do in the web browsers. In Puppeteer, you can control everything in the browser, from simple navigation to use Lighthouse for auditing your website.

Before starting everything, take a look at the following example of a Puppeteer script:


A step by step guide with a full working example of decimal data type in .NET gRPC

Image for post
Image for post
Image by Gerd Altmann from Pixabay

If you check the Protocol Buffers (protobuf) language guide, you’ll see it only supports float and double for real numbers. In most cases, they are good to go. But if part of your data includes currency values, they are not the ideal choices because they are not precise.

> 3.99d * 5
19.950000000000003

Why don’t my numbers, like 0.1 + 0.2 add up to a nice round 0.3, and instead I get a weird result like 0.30000000000000004?


GitHub Actions are great, and you can easily automate your workflows (from simple CI/CD to more complex workflows) with them. I use GitHub Actions for my Project AzureAutoNumber as my CI/CD pipeline. During the last update, I encountered a problem that I couldn’t run my tests (xUnit based).

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.101
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.1.101


With .NET, it’s always easy to generate self-signed certificates for your web applications. You can issue them in Visual Studio or dotnet SDK command-line. If you create a new web application in Visual Studio, at first, you’ll see the following message:

Image for post
Image for post

Or you can quickly issue your self-signed certificate for localhost with the command below:

dotnet dev-certs https# the possible result after succesful execution would b:
# The HTTPS developer certificate was generated successfully.


Nobody likes advertisements and Web trackers, and I’m not an exception. I started using Brave Browser, or I used a different kind of browser plugins to To get rid of those.

Although browser adds blockers block trackers/ads they are not perfect; for example, they are only useful inside the browser not in applications or games or devices like TVs. There is a simple open-source yet powerful solution for this problem: Pi-Hole.

Image for post
Image for post

Pi-Hole is a network-wide Ad Blocking software functions similarly to a network firewall. …


The Windows Subsystem for Linux (WSL) is an ultimate feature from Microsoft that enables developers to run a GNU/Linux environment directly on Windows, unmodified, without the overhead of a traditional virtual machine or the dual-boot setup.

In WSL2, they made lots of performance improvement alongside adding new features such as Managed VM, Full Linux Kernel and Full system call compatibility.

If you enable and install WSL-2 on your Windows, in Docker-desktop can use WSL-2 based engine for better performance.

Image for post
Image for post


One of the main difference from .NET Framework and .NET Core is that .NET Core supports self-contained deployment; everything is bundled together, including runtime and app. That brings easy deployment, but there is draw-back: Increasing application size because the runtime is included too.

Imagine you have a small desktop or web application, but the deployment size is like 200MB, that doesn’t sound good, right?

In .NET Core 3, to resolve this issue, the .NET team introduced a tool that finds unused assemblies to remove them from final deployment. In .NET 5 they went one step forward; not only can it…


More than a year ago, I answered a question on StackOverflow about choosing between Node or Dart-Sass for Vue CLI. It got lots of up-votes, and I thought maybe it is worth diving deeper into this topic.

Introduction

This article is mainly about Sass, and it’s preprocessor implementations: Dart-sass and Node-Sass.

So, what’s a CSS preprocessor?

A CSS preprocessor is a program that lets you generate CSS from the preprocessor’s unique syntax. There are many CSS preprocessors to choose from; however, most CSS preprocessors will add some features that don’t exist in pure CSS, such as mixin, nesting selector, inheritance selector…


Image for post
Image for post
Sample query tagging!

What is query tags in EF Core?

It’s introduced in EF Core 2.2. This feature helps correlate LINQ queries in code with generated SQL queries captured in logs. You annotate a LINQ query using the new TagWith() method.

var publishedBlogPosts = dbContext.BlogPosts
.Where(b => b.PublishedAt != null)
.TagWith("Getting published blog posts")
.ToList();
-- Getting published blog postsSELECT [b].[BlogPostId], [b].[Content], [b].[PublishedAt], [b].[Title]
FROM [BlogPosts] AS [b]
WHERE [b].[PublishedAt] IS NOT NULL

How to make it more practical?


Use perl module to read environment variables

Image for post
Image for post

If you google for Nginx docker and environment variables you’ll end up with the envsubst workaround to pass environment variables to the docker container. Although that workaround works, it’s not that flexible and easy to operate.

The docker image:

I like alpine-based images because they are light-weight and secure. You might wonder why I’m using Perl enabled image, the answer is short: To be able to read environment variables in Nginx, the nginx-mod-http-perl module is needed and that runs on Perl!

FROM nginx:1.18.0-alpine-perlRUN apk add --no-cache nginx-mod-http-perlCOPY nginx.conf /etc/nginx/nginx.conf
COPY default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80/tcp
EXPOSE 443/tcp
CMD ["/bin/sh", "-c", "exec nginx…

Ali Bahraminezhad

I’m a geek, a software engineer who likes to build amazing stuff 😉Here on Medium I write about different things but mostly focused on programming and .NET!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store