494. Target Sum

You are given an integer array nums and an integer target. You want to build an expression out of nums by adding one of the symbols '+' and '-' before each integer in nums and then concatenate all the integers. For example, if nums = [2, 1], you can add a '+' before 2 and a '-' before 1 and concatenate them to build the expression "+2-1". Return the number of different expressions that you can build, which evaluates to target.
/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number}
 */
var findTargetSumWays = function(nums, target) {
    const memo = {};

    function helper(i, currentSum) {
        // Base case: If we've considered all numbers
        if (i === nums.length) {
            // Check if the current sum equals the target
            return currentSum === target ? 1 : 0;
        }

        // Create a unique key for memoization
        const key = `${i}, ${currentSum}`;

        // Chec

python: psutil结束进程树

```
def kill_proc_tree(
    pid, sig=signal.SIGTERM, include_parent=True, timeout=None, on_terminate=None
):
    """Kill a process tree (including grandchildren) with signal
    "sig" and return a (gone, still_alive) tuple.
    "on_terminate", if specified, is a callback function which is
    called as soon as a child terminates.
    """
    assert pid != os.getpid(), "won't kill myself"
    parent = psutil.Process(pid)
    children = parent.children(recursive=True)
    if include_parent:
      

python: psutil结束进程树

```
def kill_proc_tree(
    pid, sig=signal.SIGTERM, include_parent=True, timeout=None, on_terminate=None
):
    """Kill a process tree (including grandchildren) with signal
    "sig" and return a (gone, still_alive) tuple.
    "on_terminate", if specified, is a callback function which is
    called as soon as a child terminates.
    """
    assert pid != os.getpid(), "won't kill myself"
    parent = psutil.Process(pid)
    children = parent.children(recursive=True)
    if include_parent:
      

フォームテンプレート

<?php
/*
Template Name: お問い合わせ
*/

// 日本語メールの設定(mbstring)
mb_language("ja");
mb_internal_encoding("UTF-8");

// セッション開始
session_start();

// -----------------------------------
// 変数・配列初期化
// -----------------------------------
$mode   = 'input';   // input / confirm / send
$errors = array();   // 項目ごとのエラーメッセージを管理する連想配列

// -----------------------------------
// 1) 「戻る」ボタンが押された場合
// -----------------------------------
if (isset($_POST['back']) && $_POST['back']) {
    // 何もしない → $mode = 'input' 

515. Find Largest Value in Each Tree Row

Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed).
# Definition for a binary tree node.
# class TreeNode(object):
#     def __init__(self, val=0, left=None, right=None):
#         self.val = val
#         self.left = left
#         self.right = right
class Solution(object):
    def largestValues(self, root):
        """
        :type root: Optional[TreeNode]
        :rtype: List[int]
        """
        if not root:  # If the root is None (empty tree), return an empty list
            return []
        
        result = [] # Initialize an empty 

[测试] 哈哈哈哈测试 #检查 #检查2 # 检查3

[测试] 哈哈哈哈测试 #检查 #检查2 # 检查3
    /**
     * 检查商品信息完整度
     * @param $barcode
     * @return false
     * @throws \Exception
     */
    public function checkInfo($spuId = [])
    {
        try {
            $query = SpuModel::query();
            if (!empty($spuId)) {
                $query->whereIn('id', $spuId);
            }
            $spuList = $query->get()->toArray();
            if (empty($spuList)) {
                return false;
            }
            $config = ConfigService::instance()->getConfigValue(ConfigK

# Notes# Notes# Notes# Notes

    /**
     * 检查商品信息完整度
     * @param $barcode
     * @return false
     * @throws \Exception
     */
    public function checkInfo($spuId = [])
    {
        try {
            $query = SpuModel::query();
            if (!empty($spuId)) {
                $query->whereIn('id', $spuId);
            }
            $spuList = $query->get()->toArray();
            if (empty($spuList)) {
                return false;
            }
            $config = ConfigService::instance()->getConfigValue(ConfigK

测试

测试测试测试测试测试测试测试
    /**
     * 批量更新(限制5000条一次)
     *
     * @param array $attributes
     * @param string $conditionKey
     *
     * @return int
     * @throws \yii\db\Exception
     */
    public static function batchUpdate(array $attributes, string $conditionKey): int
    {
        if (count($attributes) > 5000) {
            throw new InfoException('批量更新单次最多支持5000条数据,请进行分批更新!');
        }

        $batchUpdate = [];
        foreach ($attributes as $attribute) {
            $columns = array_keys($attribute)

安装 gcc g++

# install gcc g++

```
sudo apt-get install aptitude

sudo aptitude install build-essential
```

行数制御

			display: -webkit-box;
			text-overflow: ellipsis;
			contain: content;
			-webkit-box-orient: block-axis;
			-webkit-line-clamp: 1;
			max-block-size: 1lh;

3203. Find Minimum Diameter After Merging Two Trees

There exist two undirected trees with n and m nodes, numbered from 0 to n - 1 and from 0 to m - 1, respectively. You are given two 2D integer arrays edges1 and edges2 of lengths n - 1 and m - 1, respectively, where edges1[i] = [ai, bi] indicates that there is an edge between nodes ai and bi in the first tree and edges2[i] = [ui, vi] indicates that there is an edge between nodes ui and vi in the second tree. You must connect one node from the first tree with another node from the second tree with an edge. Return the minimum possible diameter of the resulting tree. The diameter of a tree is the length of the longest path between any two nodes in the tree.
/**
 * @param {number[][]} edges1 - Edges of the first tree
 * @param {number[][]} edges2 - Edges of the second tree
 * @return {number} - Minimum possible diameter after merging the trees
 */
var minimumDiameterAfterMerge = function(edges1, edges2) {
    // Initialize adjacency lists for both trees
    const tree1 = new Map();
    const tree2 = new Map();
    
    // Build the adjacency list for the first tree
    for(let [u, v] of edges1) {
        tree1.set(u, [...(tree1.get(u) || []), v]);
 

Glow Effect Button


<style>
@keyframes pulse-glow {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(52, 152, 219, 0);
  }
}

.pulse-glow {
  animation: pulse-glow 2s infinite;
}
</style>











Download GDRIVE File

import requests
import io

FILE_ID = '1e8hAGdDC2hAbEnosh1Odo9tAj_Wlzl8H'
LOCAL_FILE_NAME = 'TA_Lib-0.4.26-cp310-cp310-linux_x86_64.whl'

def download_public_file(file_id, local_file_name):
    url = f'https://drive.google.com/uc?id={file_id}'
    try:
        response = requests.get(url, stream=True)
        response.raise_for_status() # Raise an exception for bad status codes
        with open(local_file_name, 'wb') as file:
            for chunk in response.iter_content(chunk_size=8192):
     

DUNS NUMBER

https://www.dnb.com/de-de/upik-en.html

Display magenta classnames for Sections

![demo](https://p61.f2.n0.cdn.zight.com/items/8LuWJdYX/d65a0bde-c5d3-4750-994e-4fb10f184bdc.jpg?source=viewer&v=df137aa6b717ae3cef33840418eb897f)
/**
 * Display Class Names
 */

document.addEventListener('DOMContentLoaded', function () {
  var divs = document.querySelectorAll('#tm-main > div');

  divs.forEach(function (div) {
    var classNames = div.className.split(' ');
    var index = classNames.indexOf('uk-section-default');
    if (index !== -1) {
      classNames = classNames.slice(0, index);
    }

    if (classNames.length > 0) {
      classNames[classNames.length - 1] =
        '<strong style="color: white;">' +

Linux shell多行文本

Linux shell多行文本
# 多行文本写入文件,解析变量
```sh
line="一"
cat > myfile.txt <<EOF
第${line}行
第二行
第三行
EOF
cat myfile.txt
```
输出:
```
第一行
第二行
第三行
```

# 多行文本写入文件,不解析变量(EOF带引号)
```sh
line="一"
cat > myfile.txt <<"EOF"
第${line}行
第二行
第三行
EOF
cat myfile.txt
```
输出:
```
第${line}行
第二行
第三行
```


# 多行文本保存到变量
```sh
line="1"
var=$(cat <<EOF
第${line}行
第2行
第3行
EOF
)
echo "$var"
```
输出:
```
第1行
第2行
第3行
```

# 多行文本保存到变量,不解析变量(EOF带引号)
```sh
line="1"
var=$(cat <<"EOF"
第${line}行
第2行
第3行
EOF
)
echo "$var"
```
输出:
```
第${line}行
第2行
第3行
```