Function, simply speaking, is a code block with a name.
In the first reading, we introduced main, which is a function.
Little is known about the basic components of functions:
Return value type, function name, function parameter list, function body
When we call a function, we call it by calling the operator ().
// valfactorial
int fact(int val)
{
int ret = 1; // Local variables are used to save computation results.
while(val > 1)
ret *= val--; // Assign the product of RET and val to RET, then Val minus 1.
return ret; // Return to the result
}
int mai...
> easy to think of its own value minus the subscript.
Bubble sort
if(!is_array($arr)) return false;
$len = count($arr);
if($len <= 1) return $arr;
for($k = 0; $k < $len; $k++){
for($j = $len-1; $j > $k; $j--){
if($arr[$j] < $arr[$j-1]){
$temp = $arr[$j];
$arr[$j] = $arr[$j-1];
$arr[$j-1] = $temp;
}
// var_dump($arr);
}
}
Fast sorting
/**
* @param Fast sorting*/
function quick_sort($arr)
{
if(!is_array($arr)) return false;
$length = count($arr);
i...
nginx magic” in reverse proxy
When configuring the nginx reverse proxy, the slash in location and proxy_pass causes all sorts of problems. Sometimes one more slash or one less slash causes completely different results, so specially after location and proxy_passIn the case of no diagonal line, the arrangement and combination are made, and a complete test is carried out to find out the principle, so as to improve the posture level.
> test method.
Configure different rules in nginx A, then request nginx A:http://192.168.1.48/foo/api
Observe the request received by nginx B. The specific o...
precondition
Every time you manually create HTML files to import packaged JS, it is obvious that this way of processing is not desirable. The ideal approach would be to generate HTML through plug-ins that automatically import the packaged JS files.
The plug-in used at this time is html-webpack-plugin.
The following are just some common usage. If you want to know more about it, you should check the official website.
> configure html-webpack-plugin
Here are some simple configurations to use html-webpack-plugin in Webpack files only:
const HtmlWebpackPlugin = require('html-webpack-plugin');
c...
After we have installed MySQL (mariadb is installed on cnetos 7), we have the following problem, which we can usenetstat -lntupView the port of the following server, and the port of MySQL is generally defaults to
3306,Check to see if the service is started, not started, start it, centos6: service start mysql, centos7: system CTL start MySQL
:
The problem with typing the mysql_secure_install command appears as shown in the following figure. It is also possible that the MySQL service was not turned on, just follow the above method
Entering this command requires setting the password. The fir...
First create a new filter ExceptionHandleErrorAttribute.cs.
The contents are as follows:
1 using System;
2 using System.Net;
3 using System.Web;
4 using System.Web.Mvc;
5 using ABBPMP.Utility.NLogHelper.Static;
6
7 namespace ABBPMP.Filter
8 {
9 /// <summary>
10 /// Exception capture (business logic layer, UI layer)11 /// </summary>
12 public class ExceptionHandleErrorAttribute : HandleErrorAttribute
13 {
14 /// <summary>
15 /// Erroneous interception16 /// </summary>
17 /// <param name="filterContext"&g...
Learn Embedded 4412 Development Board, Add Android 5.1.1 Porting Course, Mobus Porting Course, Python Porting Course
1: 4412 development board fifth comprehensive upgrading
1.New Python transplant tutorial, MODBUS transplant tutorial, Android5.1.1 migration tutorial
2.Linux-QTStart with the latest version 5.7
3.AndroidThe application development environment is updated to Studio and provided simultaneously with eclipse.
4.iTOP-4412The development board gets the official support of the open source software Linux, which will greatly facilitate the technological upgrading of user products.
Two: n...