Articles under classification technology

Today, just an old friend chatted up the jQuery source code. He didn't understand the source code. I had a learning and communication attitude and explained the core realization to him. (as if he had been pigeon for a long time).

By the way, which CDN service provider is looking for a jQuery file to open? The 1.2.3 version I use here is for example. The latest version is almost the same, with only two or three changes. Https://

Source code analysis

17-20 elements Pass the selector and return the init method of your own new. It is estimated that you haven't used it either. $() The second parameter is omitted here.

 Var jQuery = window.jQuery = function (selector) {
return new jQuery.prototype.init (selector);}

26-27 elements This is why it is always a global variable to mount to a window object because of the beginning of $.

 / / Map the jQuery namespace to the '$' one
window.$= jQuery;

36-547 elements Eliminate the core of retention that we do not need. Init Method, the jQuery instance and the selector are judged internally. Here we ignore and simplify.

 JQuery.fn = jQuery.prototype = {
init: function (selector) {
var nodes = document.querySelectorAll (selector); 
for (VaR, 
for) = =; one hundred thousand;

549 elements In the last paragraph, the jQuery prototype chain is passed to the prototype of the init method under the jQuery prototype. Looking back at the new code, it is clear and clear.

 JQuery.prototype.init.prototype = jQuery.prototype;

Complete implementation

Adding functionality to the jQuery prototype is very close to the first version of jQuery. Here I am a simple implementation. Text () Method

 Var jQuery= function (selector) {
return new jQuery.fn.init (selector); 

jQuery.fn = jQuery.prototype = {
init:; (

jQuery.fn) = = (()); (0); (},}; (},}, "}", "}," "(") ";"


Actually, the core is not complicated. I like it very much. I think most of my functions are implemented by plug-ins. The ingenious design and convenience of the tools themselves.

On the traditional page production, jQuery used a very comfortable shuttle, but the appearance of MVVM changed the way of thinking. We only need to pay attention to business logic, do not need to manually operate DOM, do not need to pay attention to the synchronization of data status, and ease the project management.

If there are simple needs on a single page, jQuery is still useful, MVVM can only be added trouble.

Sort out some of the latest gadgets.

You can see that there are two buttons (get verification code, login) two boxes (enter the phone number, enter the verification code).

So we have the following thing (no concrete function, just look at the structure).

<div class= "login-wrapper" >
<div class= "title-bar" > login </div>
<div class= "wrapper phone-wrapper" >
<span >
<span "wrapper" > mobile phone number, "mobile phone", "mobile phone", "mobile phone", "mobile phone", "mobile phone", "phone", "password", "password", "password", "password", "authentication", "authentication code", "password", "password", "password", "password", "password", "password", "password", "password", "login".

At this time, you can start writing logic. It is also a simple analysis. Login needs to click, get the verification code need to click and countdown seconds, that is, dynamically modify the text, experience a good check can limit the number of mobile phone number, the number of verification code.

That's almost like this.

 "Title-bar" > login </div>
<div class= "wrapper phone-wrapper" >
<span, ">
<span", "mobile", "mobile", "mobile", "mobile". <template>
<div class= "login-wrapper" >
<div class= The number of 
code: '/ / input box verification code 
codeText:' get the verification code ', / / countdown display text 
timingBoard: 60, / countdown 
timer: null / / timer, used for countdown verification code}}, 
methods: {
loginCode () {}, / / get the verification code 
login () {} / / login 
changePhone () {} / / check cell phone number 
changeCode () {} / / check the length of the verification code 

With these, it is enough for you to implement a basic mobile phone login interface. If you need full code, please click below. Gist links

Complete code is read: Https://

To tell you the truth, I haven't seen API for such a long time. Vue rediscovered my blog these days. Vue.directive It looks great.

Always see here. Vue.use (ElementUi) Where to use Vue.use (Axios) It has always been at the level of application, and I find that the consumption of markdown parsing examples is a little too large. It may be a lot easier to process directives directly.

Describe the process briefly.

The components that render the article will query whether there is a corresponding article in the local record during the lifecycle of the installation. If there is no request, the request will be searched online, otherwise 404.
The article is for the content of markdown, considering that front-end processing can be directly resolved (after all, the front-end performance is over 233), so as to reduce the burden of logical processing on the back end and consistency.
The markdown parser is used. Marked The completion logic is as follows


import Vue from'vue'
import App from'./App'
import markdown from'./markdown';} / / injection of markdown resolver, (()) = (=).

Integrated marked makes plug-in form exposure


import marked from'marked'
import ('highlight.js/styles/atom-one-dark.css') 

marked.setOptions ({
renderer: new marked.Renderer ()), 
pedantic: false, 
pedantic:, false, e, R, D, R, D, R, D, R, D, C, C, R, R, R, R, R, R, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, etc.

Use on labels V-markdown instructions

 Interface = function (), {
return new new ({}}) = ({}}) =} {} (}) {}}, {}} {}}, {}}, {}}, {}}, {}}, or finding local articles = {}}, (= {}} (=) > {}; this is an interface for searching for articles; {}); (404); //Test.vue

<div v-if= "isNotFound" >404</div>
<div v-else v-markdown= "article" ></div>

const, this is a search article. }

return res; {}}, 
mounted () {/ / ID to find articles 
let a = this.handlerArticle (123); 

if (a = = = 404) {/ / jump to error page}} / / processing loading
this.isNotFound = false; = =}; / / save content directly to variable

Complete code is read: Https://

Rubbed the student discount, bought a Ali cloud server, 5M bandwidth to foreign lines to reduce the probability of packet loss is not bad, NS online beauty, but it is said that the port service online service is out, I do not know how online quality will be.

Firewall relay chestnut

 Open the IP camouflage 
firewall-cmd --add-masquerade --permanent

# add the port protocol 
firewall-cmd --add-forward-port=port= transfer port: proto=tcp:toport= acid milk port: toaddr= acid yogurt address --permanent
firewall-cmd --add-forward-port=port= transit port: proto=udp:toport= sour milk port: the address of the sour yogurt.

Recently, in the golang, which used all the online data in redis, the configuration that used to be written dead is not very suitable, and thermal loading is the kingly way.

As the saying goes, programmers who can't search are not good programmers.

I saw the other chiefs writing, mostly using. Timer +goroutine Achieved. It's not very difficult, starting code.

Configuration file structure

Let's assume that our configuration files are JSON files, which should be the following.

 / / conf.json
 "host": "", "port": 6379, "passwd": "," "DB": 0

First of all, it must be to write a structure that is exactly the same as it.

 //json configuration file structure 
type Content struct {
Host string `json: "host" `
Port int `json: "`
Port", "" "," "" "

If it is not very safe to write operation functions on this structure, serialization of JSON is also a pointer to direct operation. The trial and error of breaking them up before, and finally let them stay together 233

Optimized structure

Integrate file name, synchronization lock, last modification time, and configuration file structure together.

 / / configuration structure 
type Config struct {
Filename string
LastModifyTime int64
Lock *sync.RWMutex
Data interface{}

Write the factory function of instance configuration (this is a conventional rule, the specific source is your own textual research, it has many advantages).

 Func NewConfig (filename string, data interface{}) *Config {
conf: = &Config{
Filename: filename, 
Data:, &Config{
Filename:, and (())

The default parameters are configured in the configuration structure, and the external parameter is File name of configuration file and Configuration file structure The type of data is interface type. The advantage is that Config Can be independent, code Multiple reuse We also used it. Conf.parse () Method, the first analytical file, Go conf.reload () Method to run a goroutine run alone (see the specific effect), and of course return to the ontology.

- reading the remainder part -


Why should we develop integral mall?

Because we used to use the bar service, not bad.

But this year's (2018) closure of the free version of the service in the second half of the year requires paying for professional or ultimate use.

Of course, the staff have also contacted us, can give preferential prices, commercial mutual blow must say, "OK, we will discuss and consider".

If we use it, you won't see this article 23333.

- reading the remainder part -

There is no problem in setting up agents in general settings, but today we have to operate websockt.

 Server {
location / {
proxy_set_header Host $host; 
proxy_set_header X-Real-IP $remote_addr; 
proxy_set_header; 1.1;

Nginx -t Once

The following errors will occur:
Nginx: [emerg] unknown "connection_upgrade" variable

This is where there is a pit.

It involves a design problem of nginx. End-to-end and Hop-by-hop Headers
I am still talking about it here, so as not to mislead my children.

Map sets up mapping tables for one or more variables in nginx.

Here are a few configurations to add:

 Http {
map $http_upgrade $connection_upgrade {
default upgrade; '' 'close; 

server {
location / { 
proxy_set_header Upgrade $http_upgrade; 
proxy_set_header Connection $connection_upgrade;}}}}

Error in compiling PHP version, oh, incidentally, there may be discrepancy in php7 below, pure system.
For a long time, there is no written word. The document does not want to tidy up (3[____]

 The compilation parameters are basically 
'./configure''--cache-file=/opt/temp/cache/config.cache''--prefix=/opt/temp/php/php-7.2.6''--with-config-file-path=/opt/temp/php/php-7.2.6/etc''--with-config-file-scan-dir=/opt/temp/php/php-7.2.6/var/db''--disable-all''--enable-short-tags''--enable-opcache''--enable-dba''--enable-ipv6''--enable-calendar''--enable-ipv6'. E-dtrace''--with-pcre-regex''--with-pcre-dir=/usr''--with-mhash''--with-mcrypt=/usr''--with-zlib=/usr''--with-curl=/usr''--with-readline=/usr''--with-libedit=/usr/local''--with-gd=shared''--enable-gd-native-ttf''--with-gd=shared', the first, the second, the third, the second and the third.

Error: Configure: error: Please reinstall the libcurl distribution easy.h should be in/include/curl/
Resolvent: Yum install curl-devel

Error: Configure: error: jpeglib.h not found.
Resolvent: Yum install libjpeg-devel

Error: Configure: error: png.h not found.
Resolvent: Yum install libpng-devel

Error: Configure: error: To enable code coverage reporting you must have LTP have
Resolvent: Yum install -y lcov

Error: Configure: error: Cannot find sys/sdt.h which is required for DTrace support
Resolvent: Yum install -y systemtap-sdt-devel , Apt install -y systemtap-sdt-dev

Error: Configure: error: Cannot find OpenSSL's Libraries
Resolvent: Yum install OpenSSL openssl-devel openssl-libs
Note: the 64 bit system is added at compile time. --with-libdir=/usr/lib64 Or put /usr/lib64/ Copy to /usr/lib/

Error: Configure: error: Unable to locate gmp.h
Resolvent: Yum install -y GMP gmp-devel

Error: Configure: error: Unable to detect ICU prefix or no failed. Please failed.
Resolvent: Yum install -y ICU libicu libicu-devel

Error: Configure: error: Please reinstall libedit I cannot find readline.h
Resolvent: Yum install -y readLine readline-devel
Note: the 64 bit system is added at compile time. --with-readline You may also need to download and compile the latest version separately. Libedit

Error: Configure: error: Cannot find libtidy
Resolvent: Yum install -y readLine readline-devel , Apt install libtidy-dev libtidy5

Error: Configure: error: Cannot find OpenSSL's <evp.h>
Resolvent: Yum install -y OpenSSL openssl-devel libssl-dev

Error: Configure: error: Please reinstall the BZip2 distribution
Resolvent: Yum install -y libbz2-dev

Error: Configure: error: Please reinstall the libcurl distribution
Resolvent: Yum install -y curl-devel , Apt install libcurl4-gnutls-dev

Error: Configure: error: mcrypt.h not found.
Resolvent: Apt install libmcrypt4-dev

Error: Configure: error: Cannot find libpq-fe.h.
Resolvent: Apt install libpq-dev

Error: Configure: error: Please reinstall readLine I cannot find readline.h
Resolvent: Apt install libreadline-dev

Error: Configure: error: xslt-config not found.
Resolvent: Apt install libxslt1-dev

Error: Configure: error: cURL version 7.10.5 or later is required to compile to
Resolvent: Apt install libcurl4-openssl-dev , Apt install libcurl4-gnutls-dev

Error: Configure: error: xslt-config not found. Please reinstall the libxslt > = 1.1.0 distribution
Resolvent: Apt install libxslt1-dev

Error: Configure: error: Unable to locate gmp.h
Resolvent: Apt install libgmp-dev

Error: Configure: error: utf8_mime2text () has new signature, but U8T_CANONICAL is missing. This, is
Resolvent: Apt install libc-client2007e-dev , Apt install libc-client-dev

Error: Configure: error: This c-client library is built with Kerberos support.
Resolvent: Apt install libkrb5-dev Consider adding --with-kerberos and --with-imap-ssl parameter

Error: Configure: error: libfbclient, libgds or libib_util not found! Check config.log for Check
Resolvent: Apt install firebird-dev It might be Apt install firebird2-dev

Error: Configure: error: Cannot find ldap.h
Resolvent: Apt install libldap2-dev

Error: Configure: error: Please reinstall the libzip distribution
Resolvent: Apt install libzip-dev

The new year is very busy now, and there are games waiting for me, van. This article dragged on for a long time.

Last time, I didn't tell my family that raspberry pie was hanging up. They used FRP to wear the outer net, and they could stay at home and make movies at home everywhere.

But the problem is coming. The resources in my hard disk are used by the company. I usually do not have the habit of copying the U disk. After I finish writing, I usually shut it down and save it on the hard disk. Recently, the notebook has not been taken home by the company, which limits my operation.

Is too laggy to write out a catalogue program. Of course, before I wrote, I also went to the Internet to find the next one. Most of them were not the kind of (simple) cold (clean) style. The foreigner's big round looked too cartoonish, and it was not suitable for my dear father's identity. The only one on the top was the one who looked at it. DirectoryLister/DirectoryLister But I need to put programs and files in a directory, and I have refused to use them.
Most of the things that can be found on the Internet are basically DirectoryLister/DirectoryLister Operations are similar and are placed in the same directory. Think about it or write it yourself??

 Directory program interface

Project address: Https://
Demo web site: Http://

This program is applicable to developers who have certain PHP knowledge reserves. Please understand the use of composer first.

Make sure that you have installed PHP and do the following operations.

Class UNIX

Such systems as MacOSX, Ubuntu, CentOS, archlinux and Debian.

 PHP -i grep grep "/php.ini"

 Quasi UNIX system


If no environment variables are added, add the PHP directory to the environment variable!!!

 PHP -i findstr findstr "php.ini"

 Windows system


Create a PHP file and write the following contents into it

  1.  < php
    echo phpinfo ();

    Browser access


  2.  Echo (str_replace (")," / ", str_replace (" ext "," php.ini ", ini_get (" extension_dir ")));

    Mu Yue Xi Dalao comment area gives out a kind of, understand the use.