3068. Find the Maximum Sum of Node Values

There exists an undirected tree with n nodes numbered 0 to n - 1. You are given a 0-indexed 2D integer array edges of length n - 1, where edges[i] = [ui, vi] indicates that there is an edge between nodes ui and vi in the tree. You are also given a positive integer k, and a 0-indexed array of non-negative integers nums of length n, where nums[i] represents the value of the node numbered i. Alice wants the sum of values of tree nodes to be maximum, for which Alice can perform the following operation any number of times (including zero) on the tree: Choose any edge [u, v] connecting the nodes u and v, and update their values as follows: nums[u] = nums[u] XOR k nums[v] = nums[v] XOR k Return the maximum possible sum of the values Alice can achieve by performing the operation any number of times.
/**
 * @param {number[]} nums
 * @param {number} k
 * @param {number[][]} edges
 * @return {number}
 */
// Function to calculate the maximum value sum
var maximumValueSum = function(nums, k, edges) {
    // Initialize variables
    let totalSum = 0; // Total sum of node values
    let count = 0; // Count of nodes where operation increases the value
    let positiveMin = Infinity; // Minimum positive change in node value
    let negativeMax = -Infinity; // Maximum negative change in node value

 

Move large folders

robocopy C:\src D:\dst /E /COPYALL

system des


![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/49QLBhIlMWNRp_UGE2q1h80TR7Aj6tOU/sy71bi8gl.png)

![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/Rpmw0U5nUfxuG7NMSvUvefuDuLqlDJfr/bbuse1rj3.png)


![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/vGTcijes6_1uLKZWJQ60c22VzTibCN9J/x49m92u3t.png)

![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/ogGm1iosWR4iCuT1Ot6lZyZD6Y9h0Zuw/f9mjrtlj0.png)

![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/QnECT9hSbg6W5eBrI3PgyKWzYRBLEOSY

Thanks for the help at https://www.alfredforum.com/topic/10059-comma-separated-build-and-open-multiple-urls/

Thanks for the help at https://www.alfredforum.com/topic/10059-comma-separated-build-and-open-multiple-urls/
<?php
//
// Do NOT USE OPENING <?php TAG IN ALFRED APP
//

/**
 * Open 1 or more (comma or new line separated) issue number URLs from selection.
 *
 * @link https://github.com/cliffordp/alfred-app-workflows Download this Alfred App Workflow's code (and more).
 * @link https://gist.github.com/cliffordp/8bfc4fee7161ceff3ac9191062a866af This Alfred App Workflow's code snippet.
 *
 * Example selections (without quotes):
 *   "12345,281928" // comma without space
 *   "12345, 281928" // comma with sp

sliding window

1. https://leetcode.com/problems/minimum-window-substring/description/


![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/viqGYj3F1Rl7ewEzUIM6WSasbENHLMse/knzowmkgj.png)

```python

class Solution:
    def minWindow(self, s, t):
        # Importing defaultdict for more efficient counting
        from collections import defaultdict
        # Creating a defaultdict to store the frequency of characters in string t
        char_map = defaultdict(int)
        for c in t:
            char_map[c] 

Automating Android on Bash

#!/bin/bash

emulator -avd Nexus_7_API_27 &

# Wait for the emulator to fully start
echo "Waiting for emulator to start..."
boot_completed=false
while [ "$boot_completed" != "1" ]; do
  sleep 5
  boot_completed=$(adb -e shell getprop sys.boot_completed 2>/dev/null)
done

echo "Emulator is fully started."

# run activity on app
adb shell am start -n package/activity 

PERM RECOVERY ISO BOOT

Saved from https://forum.manjaro.org/t/usb-flash-disk-wont-format-read-only/142823/16
 Make some space on sdc and create a 10GB vfat partition and flag it with boot,esp and name the partition and file system “RECOVERY”.
 Mount it and install grub on it:

sudo mount --mkdir --label RECOVERY /mnt/recovery
sudo grub-install --target=x86_64-efi --recheck --removable --efi-directory=/mnt/recovery --boot-directory=/mnt/recovery/boot --verbose --force

Create an efi entry in your UEFI/BIOS:
sudo efibootmgr --create --disk /dev/sda --part 7 --label "Recovery" --loader '\EFI\BOOT\BOOTX64.

DataExpert.io Copy & Paste

`SHOW CREATE TABLE bootcamp.nba_game_details`

Display a statement that creates the table

Code to search JSON file and return the record if found

import json

# Specify the filename
filename = 'contacts.json'

# Function to search for a contact by name
def search_contact_by_name(contacts, name):
    for contact in contacts:
        if contact['name'].lower() == name.lower():
            return contact
    return None

# Read the JSON data from the file
try:
    with open(filename, 'r') as json_file:
        data = json.load(json_file)
except FileNotFoundError:
    print(f"The file {filename} does not exist.")
except json

JPA-Spring-Data

## JPA-Spring Tips and Tricks

### Rollback programatically
`TransactionAspectSupport.currentTransactionStatus().setRollbackOnly()`

Read JSON data from file

import json

# Specify the filename
filename = 'contact.json'

# Try to read the JSON data from the file
try:
    with open(filename, 'r') as json_file:
        data = json.load(json_file)
    print(data)
except FileNotFoundError:
    print(f"The file {filename} does not exist.")
except json.JSONDecodeError:
    print(f"Error decoding JSON from the file {filename}.")

Write data to file in JSON format

import json

# Define the data as a list of dictionaries
data = [
    {
        'name': 'John',
        'surname': 'Doe',
        'phone': '123-456-7890',
        'birthday': '1990-01-01',
        'notes': 'This is a sample note.'
    },
    {
        'name': 'Jane',
        'surname': 'Smith',
        'phone': '987-654-3210',
        'birthday': '1985-05-15',
        'notes': 'Another sample note.'
    }
]

# Specify the filename
filename = 'contacts.json'

# Write the li

MS Access DB SQL access

import pyodbc

# Define the path to your Access database
database_path = r'C:\path\to\your\database.accdb'

# Define the connection string
conn_str = (
    r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};'
    r'DBQ=' + database_path + ';'
)

# Connect to the database
conn = pyodbc.connect(conn_str)

# Create a cursor from the connection
cursor = conn.cursor()

# Example query
query = 'SELECT * FROM YourTableName'

# Execute the query
cursor.execute(query)

# Fetch all

979. Distribute Coins in Binary Tree

You are given the root of a binary tree with n nodes where each node in the tree has node.val coins. There are n coins in total throughout the whole tree. In one move, we may choose two adjacent nodes and move one coin from one node to another. A move may be from parent to child, or from child to parent. Return the minimum number of moves required to make every node have exactly one coin.
/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @return {number}
 */
var distributeCoins = function(root) {
    let res = 0;

    // Define the DFS function
    const dfs = (node) => {
        if (node === null) return 0;
        let left = dfs(node.left);
        let r

IIS SQL Injection Request Filtering

IIS SQL Injection Request Filtering
<filteringRules>
    <filteringRule name="SQLInjection" scanQueryString="true">
        <appliesTo>
            <clear />
            <add fileExtension=".asp" />
            <add fileExtension=".aspx" />
        </appliesTo>
        <denyStrings>
            <clear />
            <add string="@@version" />
            <add string="sqlmap" />
            <add string="Connect()" />
            <add string="cast(" />
            <add string="char(" />
            <add string="bchar(" />