A step by step guide for beginners to get started with Puppeteer
Puppeteer is a Node library that provides a high-level API to control Chrome or Chromium over the DevTools Protocol. Puppeteer runs headless by default but can be configured to run full (non-headless) Chrome or Chromium.
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:
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
We expected 19.95 but after calculation it’s 19.950000000000003 and that’s why they are not good for currency values.
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).
- uses: actions/checkout@v2
- name: Setup .NET Core
To have .NET 5 SDK in my build process, I changed
- uses: actions/checkout@v2
- name: Setup .NET Core
The build process went fine, but during the test phase…
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:
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.
But sometimes, like my case, it won’t help, and you’ll see this annoying exception:
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.
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.
Docker Desktop uses the dynamic memory allocation feature in WSL 2 to greatly improve the resource consumption. This means, Docker Desktop…
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.
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…
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
var publishedBlogPosts = dbContext.BlogPosts
.Where(b => b.PublishedAt != null)
.TagWith("Getting published blog posts")
When EF generates the SQL with
TagWith method, it also includes the tag as a comment in the query; as a result, debugging and profiling queries might be easier.
-- Getting published blog postsSELECT [b].[BlogPostId], [b].[Content], [b].[PublishedAt], [b].[Title]
FROM [BlogPosts] AS [b]
WHERE [b].[PublishedAt] IS NOT NULL
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.
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.confEXPOSE 80/tcp
EXPOSE 443/tcpCMD ["/bin/sh", "-c", "exec nginx…
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!