3459. Length of Longest V-Shaped Diagonal Segment

You are given a 2D integer matrix grid of size n x m, where each element is either 0, 1, or 2. A V-shaped diagonal segment is defined as: The segment starts with 1. The subsequent elements follow this infinite sequence: 2, 0, 2, 0, .... The segment: Starts along a diagonal direction (top-left to bottom-right, bottom-right to top-left, top-right to bottom-left, or bottom-left to top-right). Continues the sequence in the same diagonal direction. Makes at most one clockwise 90-degree turn to another diagonal direction while maintaining the sequence. Return the length of the longest V-shaped diagonal segment. If no valid segment exists, return 0.
/**
 * @param {number[][]} grid
 * @return {number}
 */
var lenOfVDiagonal = function(grid) {
    const n = grid.length;
    const m = grid[0].length;

    // Diagonal directions: ↘, ↙, ↖, ↗
    const DIRS = [
        [1, 1],   // down-right
        [1, -1],  // down-left
        [-1, -1], // up-left
        [-1, 1]   // up-right
    ];

    // Memoization: memo[i][j][mask] stores longest segment from (i,j) with direction+turn state
    const memo = Array.from({ length: n }, () =>
        Array.

mysqldubp таблицы

mysqldump -u имя_пользователя_БД -p название_БД название_таблицы > academy_curses_appointment.sql

Разворачиваем
1)mysql -u имя_пользователя -p - заходим
2)USE имя_базы;
3)mysql -u имя_пользователя -p имя_базы < /tmp/academy_curses_appointment.sql

extract et calcule Z TN et Profondeur

Profondeur:
to_real(
  replace(
    substr(
      "Text",
      strpos("Text",'(') + 1,
      strpos("Text",')') - strpos("Text",'(') - 1
    ),
    ',', '.'
  )
)


ZTN:
-- Z (après "Z=" jusqu'à la fin)
to_real(
  replace(
    trim(
      substr(
        "Text",
        strpos("Text",'Z=') + 2,
        length("Text") - (strpos("Text",'Z=') + 1)
      )
    ),
    ',', '.'
  )
)
+
-- Profondeur (entre parenthèses)
to_real(
  replace(
    substr(
      "Text",
      strpos("Text",'(') + 1,
      

Thema kleur voor selecteer acf field wordt automtish ingeladen

function theme_color_selection($field_name) {
    add_filter("acf/load_field/name={$field_name}", function($field) {
        $field['choices'] = [
            'white'  => 'Wit',
            'dark-grey'  => 'Donker grijs',
            'primary'   => 'Groen',
            'secondary' => 'Blauw',
            'tertiary'  => 'Roze',
            'quaternary'  => 'Geel',
            'quinary'  => 'Rood',
        ];
        return $field;
    });
}

theme_color_selection('button_color');
theme_color_sele

Centering in CSS

Great article about all of the ways to center using CSS: grid, flex, https://piccalil.li/blog/another-article-about-centering-in-css/
/* --- center text --- */
p {
  text-align: center;
}

/* --- text that is visually centered, but I maintain my left text align still. --- */
.parent {
  display: flex;
  flex-direction: column;
  align-items: center;
}

p {
  max-width: 50ch;
}

/* --- I am a box that is centered in both directions with grid. --- */
.parent {
  display: grid;
  place-items: center;
}


/* --- child element to center itself in a grid parent. --- */

aside {
  display: grid;
}

.my-element {
  place-self: center;

NeuroLesionLab

# NeuroLesionLab — A Minimal yet Solid Baseline for Brain Lesion Detection & Segmentation > A PyTorch-based template repo for training, evaluating, and deploying neural networks on neuroimaging > datasets (stroke lesions & brain tumors). It includes a clean project layout, dataloaders with real dataset > links, training utilities, metrics, logging, and an inference entry-point. ## ✨ Key Features - Clean, modular code structure with **train/inference** entry points - Pluggable **Model** (UNet-like / simple CNN backbone) and **losses/metrics** - Datasets with **real links** and loader templates: - ISLES 2022 (Ischemic Stroke Lesion Segmentation) - BraTS 2021 (Brain Tumor Segmentation) - ATLAS v2.0 (Anatomical Tracings of Lesions After Stroke) - Kaggle Brain Tumor MRI Dataset - Reproducible training (seed control), mixed precision, gradient clipping, checkpoints - Clear logging / progress bars, learning rate scheduling ## 📦 Repository Layout my-project/ ├── README.md ├── train.py # training entry point ├── model.py # neural network models ├── dataset.py # datasets & dataloaders (includes real links) ├── utils.py # helpers, metrics, logging, checkpointing ├── inference.py # load checkpoint and run predictions ## 📚 Datasets (with links) - ISLES 2022: <https://zenodo.org/records/7153326> - BraTS 2021 (Official/TCIA page): <https://www.cancerimagingarchive.net/analysis-result/rsna-asnr-miccai-brats-2021/> - ATLAS v2.0 (NITRC): <https://fcon_1000.projects.nitrc.org/indi/retro/atlas_download.html> - Kaggle Brain Tumor MRI Dataset: <https://www.kaggle.com/datasets/masoudnickparvar/brain-tumor-mri-dataset> ## 🛠 Installation ```bash git clone https://github.com/<your-username>/my-project.git cd my-project python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate pip install -r requirements.txt
#!/usr/bin/env python3
"""
Training entry point.

Features:
- Argparse for hyperparams
- YAML config dump
- Mixed precision + grad clipping
- Checkpointing (best & last)
- Simple 2D training loop with Dice/IoU metrics
"""

import os
import math
import time
import argparse
import yaml
from pathlib import Path

import torch
from torch.utils.data import DataLoader
from torch.cuda.amp import autocast, GradScaler
from tqdm import tqdm

from dataset import build_dataset
from m

DeepVisionLab

## Overview This project demonstrates the implementation of a deep learning pipeline using PyTorch for image classification. It includes all necessary components to train, evaluate, and use a model for making predictions on unseen data. The project is designed to be modular, enabling easy extensions and modifications. The architecture is based on Convolutional Neural Networks (CNNs) for feature extraction, with a fully connected layer for classification. The project also emphasizes clean and reusable code, providing helper scripts, a custom dataset loader, and model evaluation utilities. ## Features - **Modular Design**: Each component of the deep learning pipeline (model, data loading, training, etc.) is separated into different files for clarity and ease of maintenance. - **Extensibility**: You can easily extend the model to include more layers, change the architecture, or integrate other preprocessing methods. - **Reproducibility**: The project includes training scripts that are well-documented and can be easily reproduced for any dataset. - **Inference**: Once the model is trained, you can use the trained model to make predictions on new images. ## Project Structure - **`README.md`**: Project overview and instructions for use. - **`train.py`**: The script that handles the model's training loop, including loading data, defining loss functions, and saving the model. - **`model.py`**: Defines the CNN architecture used in the project. - **`dataset.py`**: Contains the custom dataset loader and data preprocessing pipeline, including links to the dataset. - **`utils.py`**: Helper functions and evaluation metrics like accuracy calculation. - **`inference.py`**: Script for making predictions with a trained model. ## Requirements - Python 3.x - PyTorch 1.8+ - torchvision - numpy - PIL - requests (for downloading datasets) Install the required dependencies using pip: ```bash pip install -r requirements.txt
import torch
import torch.nn as nn
import torch.nn.functional as F

class MyModel(nn.Module):
    def __init__(self):
        super(MyModel, self).__init__()
        
        # Define layers for the model
        # Convolutional Layer 1
        self.conv1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1)
        # Convolutional Layer 2
        self.conv2 = nn.Conv2d(64, 128, kernel_size=3, stride=1, padding=1)
        # Convolutional Layer 3
        self.conv3 = nn.Conv2d(128,

3000. Maximum Area of Longest Diagonal Rectangle

You are given a 2D 0-indexed integer array dimensions. For all indices i, 0 <= i < dimensions.length, dimensions[i][0] represents the length and dimensions[i][1] represents the width of the rectangle i. Return the area of the rectangle having the longest diagonal. If there are multiple rectangles with the longest diagonal, return the area of the rectangle having the maximum area.
/**
 * Returns the area of the rectangle with the longest diagonal.
 * If multiple rectangles share the longest diagonal, returns the one with the largest area.
 *
 * @param {number[][]} dimensions - Array of [length, width] pairs for each rectangle.
 * @return {number} - Area of the rectangle with the longest diagonal.
 */
var areaOfMaxDiagonal = function(dimensions) {
    let maxDiagonalSq = 0; // Stores the longest diagonal squared (avoids using Math.sqrt)
    let maxArea = 0;       // Stores

Convert a taxonomy ACF field ID to name in a repeater

$data = get_field('programma_speeldata');
if ($data) {
    foreach ($data as &$date) {
        if (!empty($date['programma_location_city'])) {
            $term = get_term($date['programma_location_city']);
            if ($term && !is_wp_error($term)) {
                $date['programma_location_city'] = $term->name;
            }
        }
    }
}
$context['speeldata'] = $data;

Scroll to Bookzo Results (Zook en boek)

Plaats deze code binnen een scripttag in het CustomCode-veld van YooTheme. Als de divs correct zijn benoemd, wordt er na het klikken op de zoekknop naar de resultaten gescrold. (Tom)
jQuery(function($) {
  $('body').on('click', '#searchButton', function(e) {
    e.preventDefault(); 

   
    const observer = new MutationObserver(() => {
      const $target = $('.bookzo.resultaat');
      if ($target.length) {
        $('html, body').animate(
          { scrollTop: $target.offset().top },
          800 
        );
        observer.disconnect(); 
      }
    });

    observer.observe(document.body, { childList: true, subtree: true });
  });
});

Create a new Login, User and Give read access to selected view or table in SQL Server

CREATE LOGIN aurix_ro_login WITH PASSWORD = 'aurixpass@1';
USE SSRMS_Production; GO;
CREATE USER aurix_ro_user FOR LOGIN aurix_ro_login;
GRANT SELECT ON dbo.vw_Request TO aurix_ro_user;

498. Diagonal Traverse

Given an m x n matrix mat, return an array of all the elements of the array in a diagonal order.
/**
 * @param {number[][]} mat
 * @return {number[]}
 */
var findDiagonalOrder = function(mat) {
    // Edge case: empty matrix
    if (!mat || mat.length === 0 || mat[0].length === 0) return [];

    const m = mat.length;       // number of rows
    const n = mat[0].length;    // number of columns
    const result = [];

    let row = 0, col = 0;
    let directionUp = true;     // true = moving up-right, false = down-left

    // We need to collect m * n elements
    while (result.length < m * 

Animation timelines

https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timeline/scroll

> The scroll() CSS function can be used with animation-timeline to indicate a scrollable element (scroller) and scrollbar axis that will provide an anonymous scroll progress timeline for animating the current element. The scroll progress timeline is progressed through by scrolling the scroller between top and bottom (or left and right). The position in the scroll range is converted into a percentage of progress — 0% at t

Theme editor scripts

document.addEventListener('shopify:section:load', (evt) => {
  const { target } = evt;

  // Load and evaluate section specific scripts immediately
  target.querySelectorAll('script[src]').forEach((script) => {
    const s = document.createElement('script');
    s.src = script.src;
    document.body.appendChild(s);
  });
});

BioFusionNet

# Biomedical Multi-Modal Learning This repository implements the core ideas from the paper *Fusion-driven Multi-Modal Learning for Biomedical Time Series in Surgical Care*. It provides a clean, modular PyTorch implementation of the **Adaptive Multi-Modal Fusion Network (AMFN)** and the **Dynamic Cross-Modal Learning Strategy (DCMLS)**. --- ## 🚀 Features - **Adaptive Multi-Modal Fusion Network (AMFN)** - Cross-modal attention to dynamically capture inter-modality dependencies. - Graph Convolutional Networks to model structural relationships among modalities. - **Dynamic Cross-Modal Learning Strategy (DCMLS)** - Adaptive feature selection for context-aware importance weighting. - Contrastive alignment and context-aware fusion for robust integration. - **Datasets Supported (examples in paper)** - PhysioNet, MIMIC-III (time series & clinical records) - OCT (optical coherence tomography images) - LIDC-IDRI (lung CT scans) - **Training & Evaluation** - Example scripts for training, evaluation, and ablation experiments. - Modular encoders (CNN, Transformer) for easy swapping. --- ## 📂 Repository Structure biomedical-multimodal-learning/ │ ├── setup.py # Installation config ├── requirements.txt # Dependencies │ ├── data/ │ ├── raw/ # Raw datasets (not included) │ ├── processed/ # Preprocessed datasets │ └── data_preprocessing.py # Preprocessing utilities │ ├── models/ │ ├── init.py │ ├── amfn.py # Adaptive Multi-Modal Fusion Network │ ├── dcmls.py # Dynamic Cross-Modal Learning Strategy │ ├── encoders.py # Modality-specific encoders │ ├── attention.py # Cross-modal attention │ ├── gcn.py # Graph Convolutional Networks │ └── utils.py # Losses & helpers │ ├── experiments/ │ ├── train.py # Training script │ ├── evaluate.py # Evaluation script │ └── ablation.py # Ablation experiments │ └── results/ # Logs, checkpoints, figures (user generated) 📊 Results AMFN outperforms state-of-the-art methods (LSTM, GRU, Transformers, TFT, N-BEATS, TCN) across multiple biomedical datasets. Improvements in RMSE, MAE, R², and MAPE confirm robustness. Ablation shows attention, GCN, and adaptive feature selection are all critical for best performance. 📖 References If you use this repository, please cite the original paper: Che, J., Sun, M., Wang, Y. Fusion-driven Multi-Modal Learning for Biomedical Time Series in Surgical Care. Department of Anesthesiology and Perioperative Medicine, Xinxiang Medical College. 📌 Notes Datasets are not included in this repo. Please download them (e.g., PhysioNet, MIMIC-III) separately. This implementation provides research scaffolding: components can be extended for custom datasets or tasks. For clinical deployment, additional validation and optimizations are required.

torch>=1.10.0
torchvision>=0.11.0
torchaudio>=0.10.0
numpy>=1.21.0
pandas>=1.3.0
scikit-learn>=0.24.0
scipy>=1.7.0
matplotlib>=3.4.0
seaborn>=0.11.0
tqdm>=4.62.0
pyyaml>=5.4.0
networkx>=2.6.0

Real-time Chat System

-- Database Schema
CREATE TABLE messages (
  id SERIAL PRIMARY KEY,
  user_id INTEGER REFERENCES users(id),
  channel_id INTEGER REFERENCES channels(id),
  content TEXT NOT NULL,
  created_at TIMESTAMP DEFAULT NOW()
);

-- Trigger for real-time notifications
CREATE OR REPLACE FUNCTION notify_new_message()
RETURNS TRIGGER AS $$
BEGIN
  PERFORM pg_notify('new_message', 
    json_build_object(
      'id', NEW.id,
      'user_id', NEW.user_id,
      'channel_id', NEW.channel_id,
      'content', NEW