普通视图

发现新文章,点击刷新页面。
昨天以前Alili丶前端大爆炸

Long Time No See

2024年6月20日 03:02

Hello everyone,

It’s been almost three years since I last updated my blog. So much has changed since then. I want to share some of my recent experiences with you.

First, my whole family and I have moved to a new country. It was a big change for us. We are still getting used to everything.

In my job, I’ve noticed that front-end technology is not as demanding as I thought it would be. Instead, good communication in English has become the most important skill for me. English is now the main barrier in my life. It affects my job, my promotion, and everything in my career.

2020 Year-End Reflections

2021年3月5日 00:41

Finally can write this article at this critical time node, although now it’s already March 2021. But never found a very good opportunity to write this article.

Because of pandemic reasons, I know everyone’s 2020 has too many stories to tell. I’m the same, this year is also a critical year of growth for me.

About Work

Because last year had certain progress in cross-platform aspects, after company organizational structure adjustment, established Light Application Group. Specifically doing cross-platform direction technical research to support company business development.

Recommended Order for Developing Taro Multi-Platform Applications

2020年12月17日 06:17

Developing Taro Multi-Platform Applications with Minimal Cost

All mini-programs, quick apps, React Native apps, etc. in our company are now being developed using Taro.

If you only need to support one platform, developing with Taro is no problem at all.

However, if you want to develop once and have it run normally on all platforms, you need to pay attention to many details.

Each platform has its own challenges.

Development Difficulty Ranking

Huawei Quick App > Quick App > React Native > Swan Mini-Program > WeChat Mini-Program > H5

What is a Tensor in TensorFlow?

2020年9月18日 08:00

Tensor

The term “tensor” was first introduced by William Rowan Hamilton in 1846. Yes, that’s the Hamilton who invented quaternions:

Figure 3

  • A Tensor is actually a multidimensional array

  • The purpose of Tensor is to be able to create higher-dimensional matrices and vectors.

Figure 1

Color Example

Color image files (RGB) are generally processed into 3-d tensors, where each element in the 2d array represents a pixel, R represents Red, G represents Green, B represents Blue

How to Disable Chrome CORS Restrictions on Mac

2020年9月17日 06:30

Disable Chrome Cross-Origin Restrictions

Because debugging often requires Chrome to disable cross-origin restrictions, most methods online are for Windows,

Here’s a note today:

open -n -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--args --user-data-dir="/tmp/chrome_dev_test" --disable-web-security

Math - The Relationship Between Data Structures, Programming Statements, Basic Algorithms and Mathematics (Notes)

2020年9月15日 08:00

Many people say that data structures and algorithms cannot be considered mathematics.

Different data structures are products of applying mathematical thinking in programming. Each data structure has its own characteristics, which help us more conveniently implement specific mathematical models.

Data Structures

Don’t underestimate these data structures. They are actually “models” for solving problems.

Array

Characteristics: Can directly locate required data through subscripts, suitable for random access. Often combined with loop statements to implement iterative methods, such as binary search, Fibonacci sequence, etc.

Math - Naive Bayes Classification Algorithm (Notes)

2020年9月14日 08:00

Naive Bayes

“After updating our initial beliefs about something with objective new information, we get a new, improved belief.” —- Mathematician Thomas Bayes (1702~1761)

When you cannot accurately know the essence of something, you can rely on how many events related to that specific essence appear to judge the probability of its essential attributes.

The more events that support a certain attribute occur, the more likely that attribute is to be true.

Math - Probability, Joint Probability, Conditional Probability, Marginal Probability and Bayes' Theorem (Notes)

2020年9月13日 08:00

Formula symbol explanation: P(A|B) is conditional probability of A given B

Joint Probability

Various explanations and descriptions for understanding:

  • Joint probability refers to probability containing multiple conditions where all conditions hold simultaneously, denoted as P(X=a,Y=b) or P(a,b), some books also habitually denote as P(ab), but I’m not used to this notation, so below uses comma-separated notation. Must note that all conditions hold simultaneously!

  • Probability of intersection of two or more events

Math - Random Variables and Distributions (Notes)

2020年9月12日 08:00

Random Variable

  • Let the sample space of a random experiment be S, X = X(e) is a real-valued single-valued function defined on sample space S. X = X(e) is called a random variable.
  • Essentially a function about basic events, where the independent variable is the basic event and the dependent variable is the function value.

Random Experiment:

Must satisfy:

  • (1) Repeatability: The experiment can be repeated under the same conditions;

Math - Tree Depth-First Search and Breadth-First Search (Notes)

2020年9月11日 08:00

How to Implement Depth-First Search Using Recursion and Stack?

The process of depth-first search is logically consistent with recursive calls.

Write a TreeNode Class Code Supporting Node Insertion

class TreeNode {
    constructor(key){
        this.key = key;
        this.sons = []
    }
    insert(key){
        let node = new TreeNode(key);
        this.sons.push(node)  
        return node
    }
}

Try Creating a Tree

let str = 'hello word'
let str2 = 'abcdefg'

// Root node
let root = new TreeNode("root")

createTree(str,root)

createTree(str2,root)

function createTree(strs,parent){
    if(strs.length !==0){
        let found = parent.sons.find((item)=>item.key === strs[0])
        if(found){
            let newStrs = strs.slice(1)
            createTree(newStrs,parent)
        }else{
            let node = parent.insert(strs[0])
            let newStrs = strs.slice(1)
            createTree(newStrs,node)
        }
      
    }else if(strs.length === 0){
        console.log('Creation complete',root)
        return root
    }
}

Start Depth-First Search

// Use stack to implement depth-first search
// General idea is to push all nodes into an array, then take the last one to process, delete while processing.
// Continue until none remain
function dfsByStack(root) {
    let stack = []; 
      // Create stack object, js uses array instead of stack, where each element is TreeNode type
    stack.push(root);    // During initialization, push the root node
    while (stack.length) {  // As long as there are nodes in the stack, continue
    // Get the node just pushed in
    let node = stack.pop();  // Pop the top node of the stack, get the first node that went in
    if (node.sons.length == 0) {
      // Already reached a leaf node, output
        console.log('Reached leaf node',node.key)
    } else {
      // Non-leaf node, traverse each of its child nodes
      // Note, a temporary stack stackTemp is used here
      // This is to maintain traversal order, consistent with recursive traversal order
      // If consistency is not required, can directly push to stack
      let stackTemp = []
      for (let index = 0; index < node.sons.length; index++) {
          const son = node.sons[index];
          console.log(son.key)
          stackTemp.push(son)
      }
      //   Sort the nodes and put them in the stack
      //   Reverse the order
      while (stackTemp.length) {
        stack.push(stackTemp.pop());
      }
    }
    }
  }  

Breadth-First Search (BFS)

Breadth-First Search BFS (Breadth First Search) is also called width-first search. It is a strategy that expands nodes in the order they are generated.

Math - Tree Concepts (Notes)

2020年9月10日 08:00

Basic Concepts of Trees

A tree is a data structure composed of nodes or vertices and edges (possibly nonlinear) that does not contain any cycles. A tree without nodes is called an empty (null or empty) tree. A non-empty tree includes a root node and (likely) multiple additional nodes, all nodes forming a multi-level hierarchical structure.

A tree is a special type of graph (graphs will be mentioned in subsequent articles).

Math - Dynamic Programming, Edit Distance Calculation (Notes)

2020年9月9日 08:00

Dynamic Programming (DP)

Many people abbreviate it as DP. Dynamic programming needs to derive the optimal solution of the final problem through optimal solutions of subproblems. Therefore, this method particularly emphasizes the transfer relationships between subproblems. We usually call these transfer relationships between subproblems state transfer, and call the expressions used to describe these state transfers state transfer equations.

Edit Distance (Levenshtein Distance)

Proposed by Russian scientist Vladimir Levenshtein (graduated from Moscow State University’s Department of Mathematics and Mechanics) in 1965. He won the IEEE Richard W. Hamming Medal in 2006 for his contributions to error-correcting code theory and information theory.

Math - Combinations, Solving Schedule Planning and Natural Language Processing (Notes)

2020年9月8日 08:00

Combinations

Combination is a mathematical term. Generally, selecting m (m≤n) elements as a group from n different elements is called a combination of m elements taken from n different elements. We call problems related to finding the number of combinations combination problems.

For the complete set of combinations for all m values, we can call it All Combination. For example, for the set {1, 2, 3}, the all combination is {empty set, {1}, {2}, {3}, {1, 2}, {1,3} {2, 3}, {1, 2, 3}}.

Math - Permutations, Solving Tianji Horse Racing and Password Brute Force Problems (Notes)

2020年9月7日 08:00

The Story of Tianji Horse Racing

Tianji was a famous general of the State of Qi. He often raced horses with the King of Qi, but always lost, which made him very unhappy. Sun Bin wanted to help Tianji. He divided these horses into upper, middle, and lower classes. He had Tianji use his lower-class horse to compete against the King’s upper-class horse, use his upper-class horse to compete against the King’s middle-class horse, and use his middle-class horse to compete against the King’s lower-class horse. After three races, Tianji only lost the first race and won the next two, ultimately winning the entire match against the King.

Math - Recursion, Divide and Conquer, From Merge Sort to MapReduce (Notes)

2020年9月6日 08:00

Teacher Huang Shen’s title is really too good, can’t find better title to describe today’s learning content. Haha~

Divide and Conquer Thinking in Merge Sort

Problem: Sort a pile of messy unordered numbers according to rules from small to large or large to small

Ordered Case

Try merging ordered arrays {1, 2, 5, 8} and {3, 4, 6} process. Figure 1

Unordered Case

Try to continuously simplify problem, i.e., continuously simplify sequence, until only 1 number remains. 1 number itself is ordered,

Math - Recursion, Decompose Complex Problems (Notes)

2020年9月5日 08:00

Recursion and Loops

Theoretically all recursion can do, loops can achieve.

Recursion and loops are actually implementations of iterative method, and in certain situations, their implementations can be converted to each other.

Why Use Recursion

Since recursive function value return process is consistent with loop-based iterative method, why not just use iterative method directly, why still use recursive mathematical thinking and programming methods?

How to Find All Possible Summation Methods Under Limited Total?

Assume there are four denominations of currency, 1 yuan, 2 yuan, 5 yuan and 10 yuan, want to reward someone 10 yuan, can reward 1 ten yuan note, or 10 one yuan notes, or 5 one yuan notes plus 1 five yuan note, etc. How many schemes total?

Math - Mathematical Induction, Injecting Soul into Computers (Notes)

2020年9月4日 08:00

What is Mathematical Induction?

The rule for placing wheat grains on a chessboard is: place 1 grain in the first square, 2 grains in the second square, and so on. Each small square has twice as many wheat grains as the previous small square, until all 64 squares are filled. You find that the wheat grains in squares 1 to 8 are: 1, 2, 4, 8, 16, 32, 64, 128.

❌
❌