数据库建表

CREATE TABLE `t_box_code_award_20200102` LIKE `t_box_code_award_20200101`;

Model not found in laravel

Model not found in laravel

/* I try both path but still not found model */
use App\Model\immigration_form;
use App\immigration_form;


/* Go to terminal - Solution */
composer dump-autoload




/* Working for me */

cpp code

# windows 版本

#include <iostream>
#include <io.h>
#include <fstream>
#include <string>
#include <sstream>
using namespace std;

void getAllFiles(string path, vector<string>& files)
{
    //文件句柄  
    long   hFile = 0;
    //文件信息  
    struct _finddata_t fileinfo;  //很少用的文件信息读取结构
    string p;  //string类很有意思的一个赋值函数:assign(),有很多重载版本
    if ((hFile = _findfirst(p.assign(path).append("\\*").c_str(), &fileinfo)) != -1)
    {
        do
        {
            if ((fileinfo.attrib &  _A_SUBDIR))  //比较文件类型是否是文件夹
            {
                if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0)
                {
                    files.push_back(p.assign(path).append("/").append(fileinfo.name));
                    getAllFiles(p.assign(path).append("/").append(fileinfo.name), files);
                }
            }
            else
            {
                files.push_back(p.assign(path).append("/").append(fileinfo.name));
            }
        } while (_findnext(hFile,

Checking ios lifecycle

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    //    if #available(iOS 10.0, *) {
    //      UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
    //    }

        UIApplication.shared.setStatusBarHidden(false, with: UIStatusBarAnimation.none)
        // Register the plugins with the AppDelegate
        registerPlugins(self)

        // Set registerPlugins as a callback within GeofencingPlugin. This allows
        // for the Geofencing plugin to register the plugins with the background
        // FlutterEngine instance created to handle events. If this step is skipped,
        // other plugins will not work in the geofencing callbacks!
        SwiftGpsServicePlugin.setPluginRegistrantCallback(registerPlugins)


        // Sut Google Maps api key
        GMSServices

C++

Rc资源文件乱码
LANGUAGE 9, 1==>地方改为4,2;
codepage(1252)==>codepage(936);
#include "afxres.rc" ==> #include "l.chs\afxres.rc"

xmllint


检查格式
```
xmllint --noout xxx.xml
```

clear method in Map

`clear`方法清除所有成员,没有返回值。

```javascript
let map = new Map();
map.set('foo', true);
map.set('bar', false);

map.size // 2
map.clear()
map.size // 0
```

http://es6.ruanyifeng.com/#docs/set-map

Object and Map

- 一个`Object`的键只能是字符串或者 `Symbols`,但一个 `Map` 的键可以是任意值,包括函数、对象、基本类型。
- `Map` 中的键值是有序的,而添加到对象中的键则不是。因此,当对它进行遍历时,`Map` 对象是按插入的顺序返回键值。
- 你可以通过 `size` 属性直接获取一个 `Map` 的键值对个数,而 `Object` 的键值对个数只能手动计算。
- `Map` 可直接进行迭代,而 `Object` 的迭代需要先获取它的键数组,然后再进行迭代。

```javascript
let myMap = new Map();
myMap.set(0, "zero");
myMap.set(1, "one");
for (let [key, value] of myMap) {
  console.log(key + " = " + value);
}
// 将会显示两个log。一个是"0 = zero"另一个是"1 = one"

for (let key of myMap.keys()) {
  console.log(key);
}
// 将会显示两个log。 一个是 "0" 另一个是 "1"

for (let value of myMap.values()) {
  console.log(value);
}
// 将会显示两个log。 一个是 "zero" 另一个是 "one"

for (let [key, value] of myMap.entries()) {
  console.log(key + " = " + value);
}
// 将会显示两个log。 一个是 "0 = zero" 另一个是 "1 = one"           
```

```javascript
myMap.forEach(function(value, key) {
  console.log(key + " = " + value);
})
// 将会显示两个logs。 一个是 "0 = zero" 另一个是 "1 = one"
```

## 复制或合并 `Map`s
Map 能像数组一样被复制:

```javascript
let original 

エンコーディング問題について

# UTF-8 と Shift-JIS の変換

## UTF-8 <-> Shift-JIS 変換出来ない文字

|文字|SJIS|Unicode(Unix)|Unicode(Windows)|
|---|---|---|---|
|~(波ダッシュ)|8160|U+301C|U+FF5E|
|-(全角マイナス)|817C|U+2212|U+FF0D|
|¢(セント)|8191|U+00A2|U+FFE0|
|£(ポンド)|8192|U+00A3|U+FFE1|
|¬(ノット)|81CA|U+00AC|U+FFE2|
|―(全角マイナスより少し幅のある文字)|815D|U+2014|U+2015|
|∥(半角パイプが2つ並んだような文字)|816B|U+2016|U+2225|

## UTF-8 -> Shift-JIS するときは

特に含まれていることが多い文字は、「~(波ダッシュ)」「-(全角マイナス)」と「/0xa」の3つ。  
これは変換する前に事前に変換しておくほうがいい。

```python
data = data.replace('\uff0d', '\u2212').replace('\uff5e', '\u301c').replace('\xa0', '')
```

# 参考情報

[文字コード嫌いだ](https://qiita.com/motoki1990/items/fd7473f4d1e28c6a3ed6)

Semver Symbols

- `^ 1.1.1`: [1.1.1, 2.0.0)

- `~ 1.1.1`: [1.1.1, 1.2.0)

- `^ 0.2.0`: [0.2.0, 0.3.0)

JS manipulation of DOM

```javascript
document.getElementById("AppFrameNav").remove();
// Remove the element with id equal to AppFrameNav

document.getElementById("AppFrameMain").style.paddingLeft = "0px";
// Make the element with id equal to AppFrameMain left padding to 0
```

An exercise of using Map

## Question

Given an array of integers, return **indices** of the two numbers such that they add up to a specific target.

You may assume that each input would have **_exactly_** one solution, and you may not use the _same_ element twice.

### Example:

Given nums = [2, 7, 11, 15], target = 9,

Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].

https://leetcode.com/problems/two-sum/

## Solution

```javascript
var twoSum = function(nums, target) {
    let map = new Map;

    for (var i = 0; i < nums.length; i++) {
      let complement = target - nums[i];
      if (map.has(complement)) {
          return [map.get(complement), i]
      }
      map.set(nums[i], i);
    }
};
```

Windows队列Queue

public partial class Form1 : Form
{
Thread thread1;
Queue<string> strTest = new Queue<string>();
public Form1()
{
    InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
    Random rad = new Random();//实例化随机数产生
    for (int i = 0; i < 1000;i++ )
    {
        strTest.Enqueue(rad.Next(100,10000).ToString());
    }
}
delegate void SetTextCallback(string text);
private void setLog(string text)
{
    if (this.txtLog.InvokeRequired)
    {
        SetTextCallback d = new SetTextCallback(setLog);
        this.Invoke(d, new object[] { text });
    }
    else
    {
        this.txtLog.AppendText(text + " --- " + DateTime.Now.ToString() + "\r\n");
    }
}
private void button2_Click(object sender, EventArgs e)
{
    for (int i = 0; i < Convert.ToInt32(textBox1.Text); i++)//队列输出
    {
        thread1 = new Thread(new ThreadStart(ThreadWork));//线程
        thread1.IsBackground = true;
        thread1.Start();
    }
}

/// <summar

If not using theme to override globally on MUI components, such as ListItem, how to implement it independently? Give one solution.

If not using `theme` to override globally on MUI components, such as `ListItem`, how to implement it independently? Give one solution.
## One Solution

In the component

```javascript
<ListItem
  classes={{
    root: classes.root,
    selected: classes.selected,
    button: classes.button
  }}
>
```

Here need to use `classes` property of the component. The psudo class `selected` must be defined along with its attached class.

In CSS
```javascript
root: {
  marginTop: 4,
  marginBottom: 4,
  border: '1px solid transparent',
  borderRadius: 4,
  
  '&$selected': {
    border: '1px solid #3f51b5',
    backgroundColor: 'transparent',
    '&:hover': {
      backgroundColor: 'transparent'
    }
  },
},

button: {
  '&$selected': {
    '&:hover': {
      backgroundColor: 'rgba(0, 0, 0, 0.08)',
    }
  }
},

selected: {}
```

The psudo class must be declared in the CSS although you don't need to add any rule inside. Other part will be the same as the way to override in `theme` globally.

https://material-ui.com/customization/components/#use-rulename-to-reference-a-local-rule-within-the-same-style-sheet

## Others

This metho

LRU

https://github.com/mohaps/lrucache

https://github.com/lamerman/cpp-lru-cache

https://stackoverflow.com/questions/2504178/lru-cache-design

https://github.com/goldsborough/lru-cache

Describe how npm check update package works

- `ncu`

  Check outdated packages. The same as `npm outdated`.
  
- `ncu --upgrade [the specific package name]`

  Update `package.json` to the latest version of the specific package or all outdated

- `npm install`

  This is npm native command. Install the project by following the updated `package.json`.
  
https://www.hostingadvice.com/how-to/update-npm-packages/