chromedp is a faster and simpler Go library that supports the Chrome DevTools Protocol, it is one of the most popular headless browser libraries, you can use it to do a lot of tasks that can only be performed through the browser, such as web screenshots, web rendering tests, downloading videos, simulating login, etc. Today Today I’m going to introduce a useful and simple feature: generating a pdf screenshot of
Installing Redis Object Cache for Litespeed Server
Redis is an efficient object caching application. If you have a Wordpress site based on Litespeed (OpenLitespeed) server and you have LSCache installed, you can further speed up your site with an object cache.
However, you can only choose to install one of the object cache programs, Redis and Memcached. For Litespeed/Wordpress systems, there is not much difference in performance between the two as object cache programs. Today we will cover how to install a Redis server.
Building a Docker Private Registry
Registry Classification Sponsor Registry: a third-party registry for customers and communities Mirror Registry: third-party registry, only available to users Vendor Registry: The registry provided by the vendor that published the image Private Registry: Private registry with fire period and extra security layer (ssl) Why you need a private registry Generally deployed locally self-built (using intranet), if you use aliyun directly use the registry of ali can be.
Hosted Mirror Low bandwidth consumption Fast download speed Rapid Deployment Install docker-registry To install registry in ubuntu 16.
Zabbix5.0 Detailed Installation Steps
zabbix Version 5.0 seems to have recently updated not long ago, we deployed to see what changes have not, then again. From 2.0 to 3.0 does look a lot better, today to see what 5.0 looks like, without further ado, start the installation!
5.0 new features reference https://www.zabbix.com/cn/whats_new_5_0
Prepare the environment Centos 7.8 PHP 7.2 + Apache 1.3.12 + Mysql or MariaDB 5.7+ Refer to the link https://www.zabbix.com/documentation/current/manual/installation/requirements for specific requirements
Use of the Go Empty Struct
1 Does an empty structure take up space? In Go, we can use unsafe.Sizeof to calculate the number of bytes an instance of a data type needs to occupy.
1 2 3 4 5 6 7 8 9 10 package main import ( "fmt" "unsafe" ) func main() { fmt.Println(unsafe.Sizeof(struct{}{})) } Running the above example will output:
1 2 $ go run main.go 0 That is, an instance of the empty struct struct{} does not occupy any memory space.
Memory Leak Monitoring on Flutter
The dart language used by Flutter has a garbage collection mechanism, and with garbage collection, memory leaks are inevitable. There is a memory leak detection tool LeakCanary on the Android platform that can easily detect if the current page is leaking in a debug environment. This article will take you through the implementation of a flutter-ready LeakCanary and tell you how I used it to detect two leaks on the 1.
How to Import Local Packages Using Go Module
go module is the official version management tool introduced after Go 1.11, and since Go 1.13, go module has been the default dependency management tool for the Go language. Since Go 1.14, the go modules feature has been officially recommended for use in production environments.
Here is a detailed description of how to use the go module to import local packages.
Prerequisites Suppose we now have two packages, moduledemo and mypackage, where the moduledemo package will import the mypackage package and use its New method.
Go Embed Brief Tutorial
Go compiles programs that are perfect for deployment, and if no other libraries are referenced through CGO, we generally compile executable binaries that are single files, perfect for copying and deployment. In practice, in addition to binaries, you may also need some configuration files, or static files, such as html templates, static images, CSS, javascript, etc. How these files can also be typed into the binary would be fantastic, and we could just copy and follow the single executable.
Android Simulation Positioning Implementation Details
In navigation test scenarios often need location simulation and route playback, recorded through the LocationManager.setTestProviderLocation() method to achieve simulated status, if the application to be tested does not support TestProviderLocation simulation location input, you can consider starting with the HAL layer, the hook the system’s default GPS implementation.
1, Android simulation permission open configuration In the version of Android 6.0 or below, you need to check the switch of simulated positioning in the settings, in 6.
Opencv4 C++ Compilation
1. Download https://github.com/opencv/opencv/releases https://github.com/opencv/opencv_contrib/releases Download the two zip packages and unzip them.
2. Cmake 1 2 cd opencv-4.2.0 mkdir build && cd build If you are simply using the C++ version of opencv for cpu, you can use the following cmake command
1 2 3 4 5 6 7 8 9 10 11 12 13 cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/home/test/opt/opencv \ -D WITH_CUDA=OFF \ -D WITH_IPP=OFF \ -D OPENCV_EXTRA_MODULES_PATH=/home/test/opencv/opencv_contrib-4.2.0/modules \ -D OPENCV_GENERATE_PKGCONFIG=ON \ -D BUILD_opencv_python3=OFF \ -D BUILD_opencv_python2=OFF \ -D BUILD_opencv_hdf=OFF \ -D BUILD_EXAMPLES=ON .
How to Implement Two Way Binding With Vuejs Prop
I recently encountered a problem, that is, how to implement two-way binding prop in Vue.js is better.
Previously I was passing the prop to the child component, and then the child component directly changed the prop directly, this can reflect the result to the parent component, but it is not a good solution.
For example, I often encounter this Warning.
Avoid mutating a prop directly since the value will be overwritten…
Tcp Network Programming Best Practices
This article is based on years of TCP network programming experience of youzan middleware team. The purpose of this article is to avoid various unintended behaviors of applications due to various network anomalies, which can cause unintended effects and affect system stability and reliability. This document does not cover the basics of TCP, but mainly summarizes some of the problems that may be encountered in TCP network programming practice, as
Several Cases of Goroutine Leaks in Golang
Goroutine 1 2 3 for { go func() {}() } The threshold for using Goroutine is really low, and there are a lot of abuses.
Goroutine Leak The causes of Goroutine leaks are usually:
Read/write operations such as channel/mutex are being performed inside Goroutine, but due to logic problems, they are blocked all the time in some cases. The business logic within the Goroutine enters a dead loop and resources are never released.
Const in Golang
Constants are arguably present in every code file, and there are many benefits to using them.
Avoid magic literals, i.e. numbers, strings, etc. that appear directly in the code. It is not possible to read the code and see what it means at a glance. It also avoids the inconsistencies that can occur when using literals. When their values need to be modified, constants only need to be modified in one place, while literals need to be modified in multiple places, making it easy to miss inconsistencies.
Jdbc Batch Insert Mybatis Postgresql
When inserting a lot of data at once, using bulk inserts can significantly improve performance.
JDBC batch execute When using JDBC, you can use Statement#addBatch(String sql) or PreparedStatement#addBatch method to add SQL statements to the batch list, and then execute them in batch with the executeBatch method. When inserting a lot of data at once, using bulk inserts can significantly improve performance.
reWriteBatchedInserts=true The PostgreSQL JDBC driver supports the reWriteBatchedInserts=true join parameter to modify multiple insert/update statements into a single statement, for example: insert into test(name) values ('n'); insert into test(name) values ('m'); is modified to insert into test(name) values ('n'), ('m'); .
Angular or Ionic Exception Handling ErrorHandler
Exception handling is very important in front-end, including client-side and server-side exceptions. Previously, exception handling was to add err handling for each asynchronous function, which not only increased the workload, but also easily missed some exceptions. Fortunately, Angular6 provides ErrorHandler to handle exceptions (Ionic4 for IonicErrorHandler), the default ErrorHandler handling exceptions is to output it on the console, which obviously can not meet the demand, so you need to implement
Exploring the React Native Startup Version Checking Mechanism
Colleague’s feedback React Native project startup reported an error indicating version mismatch, the error screenshot is as follows.
After some troubleshooting, we finally found that the old version of js file was packed locally, and the project itself depends on a different version, so we can delete the old version of the local file.
We can find out that RN has a version check at startup through this error, how is the specific mechanism, let’s follow the source code together.
Clipboard Operations Clipboard Api Tutorial
1, Introduction Browsers allow JavaScript scripts to read and write to the clipboard to automatically copy or paste content.
In general, scripts should not alter the user’s clipboard in a way that does not meet the user’s expectations. However, there are times when this is convenient, such as the “one-click copy” feature, where the user clicks a button and the specified content automatically goes to the clipboard.
Currently, there are three ways to implement clipboard operations.
Redis Expired Key Removal Policy
Redis stores key-value pairs, where the keys are strings and the values are of various types, such as string, list, hash, set, sorted set, and so on. When setting a key-value pair, we should also set the expiration time for it, which can be set by expire and pexpire commands, or by setnx command. So, after setting the expiration time, how exactly do you delete the expired key-value pairs? To find out, let’s take a look at Redis’ expired key deletion policy.
Implementing Unlimited Cached Channels in Golang
There are two types of channels in Go language, a channel without cache and a buffer with cache, both of which we are familiar with.
Why am I suddenly talking about this infinite cache channel? The main reason is that I was recently reviewing a colleague’s code and I had a problem with a certain design idea that would have been solved by using an infinite cache channel.
A dispatcher contains a channel, which holds the URLs to be processed A bunch of workers read tasks from the channel, download and parse the page, extract the links, and put the links into the dispatcher.