Network Tools
Technical Article

Technical implementation of php calling statistical software R to perform complex calculations and obtain results

As the main language for web program development, php is widely used. As a statistical software, R has good operability in the implementation of mathematical algorithms. Recently, due to work needs, I have to perform complex mathematical calculations on some web application data. However, although PHP itself can write some mathematical algorithms, it is still difficult to meet the demand. The efficiency of dozens of lines of code is not comparable to a function in R.

Use .user.ini file to modify open_basedir to enhance PHP system security

.user.ini is an lnmp file, which contains the folder path address of the website. The purpose is to prevent cross-directory access and cross-directory reading of files. In a certain sense, it ensures potential security issues that may be caused by unknown PHP code. .

The configuration is placed in the root directory .user.ini

open_basedir=/project path/:/tmp/:/proc/     

example:

Remember that aliyun host ECS was hacked for mining?

I accidentally discovered that the CPU usage of an ECS host in the backend of Alibaba Cloud has been near 100%. If I look closely, it is used to provide idle services to customers. Few people take care of it. After taking a closer look at the data, I found that the CPU has been at 100% for two weeks. , there is no abnormality in the memory, but the hard disk has sharp peaks every 1 minute. It is estimated that there is a problem with the cron job.

Excel uses pivot tables to count the number of unique values

The sample data source format is as follows. Now we need to count the number of people with uid in each group:

By default when using a pivot table, you can only select "Count" to get the number of rows for each group, and the uid is not deduplicated;

Commonly used statements of screen command under Linux

The screen command can establish an independent connection in the terminal and keep running after closing the terminal. It can be used for file transfer or long-running programs.

Installation: yum install screen

New: screen -S onename

View: screen -ls

Enter: screen -r onename

Complete exit: exit, equivalent to directly closing the terminal window

Keep the session and exit: Press Ctrl+A+D keys on the keyboard at the same time

Web page tag cloud custom format automatic generation program example

A tag cloud is a set of related tags and their corresponding weights. A typical tag cloud has 30 to 150 tags. affect the font size or other visual effects used. Meanwhile, histograms or pie charts are most commonly used to represent about 12 different weights. Therefore, the tag cloud can represent more rights, although it is less accurate. Additionally, tag clouds are often interactive: tags are typically hyperlinks that allow users to drill down to their content.