3652. Best Time to Buy and Sell Stock using Strategy

You are given two integer arrays prices and strategy, where: prices[i] is the price of a given stock on the ith day. strategy[i] represents a trading action on the ith day, where: -1 indicates buying one unit of the stock. 0 indicates holding the stock. 1 indicates selling one unit of the stock. You are also given an even integer k, and may perform at most one modification to strategy. A modification consists of: Selecting exactly k consecutive elements in strategy. Set the first k / 2 elements to 0 (hold). Set the last k / 2 elements to 1 (sell). The profit is defined as the sum of strategy[i] * prices[i] across all days. Return the maximum possible profit you can achieve. Note: There are no constraints on budget or stock ownership, so all buy and sell operations are feasible regardless of past actions.
/**
 * Calculates the maximum profit achievable by applying a strategy
 * and replacing a window of size `k` with a new profit calculation.
 *
 * @param {number[]} prices - Array of prices over time.
 * @param {number[]} strategy - Strategy multipliers applied to each price.
 * @param {number} k - Size of the window to adjust.
 * @returns {number} Maximum profit achievable.
 */
var maxProfit = function(prices, strategy, k) {
    const n = prices.length;
    let maxProfit = 0;

    // Prefix sums

WordPress debugging with XDebug and Visual Studio Code on Windows

WordPress debugging with XDebug and Visual Studio Code on Windows
# Xdebug Setup for WordPress and VS Code on Windows

## Step 1: Install Xdebug

1. Copy `phpinfo()` output and paste it into [Xdebug Wizard](https://xdebug.org/wizard).
2. Download `xdebug.dll`.
3. Copy the DLL to your PHP `ext` folder.
4. Add the following configuration to your `php.ini`:

```ini
[xdebug]
zend_extension = xdebug
xdebug.mode = develop,debug
xdebug.start_with_request = yes
xdebug.client_host = 127.0.0.1
xdebug.client_port = 9003
xdebug.var_display_max_depth = 5
xdebug.var_display

Kafka - Deep Dive - Partitioning & Consumer Groups

  # Deep Dive : Partitioning & Consumer Groups (Kafka)

> **Prérequis** : Guide principal Kafka  
> **Objectif** : Maîtriser le scaling et les garanties de livraison  
> **Contexte** : Pipelines IoT haute disponibilité

---

## Table des matières

1. [Partitioning en profondeur](#1-partitioning-en-profondeur)
2. [Stratégies de partitionnement](#2-stratégies-de-partitionnement)
3. [Consumer Groups en détail](#3-consumer-groups-en-détail)
4. [Rebalancing](#4-rebalancing)
5. [Offset Management](#5-

smol agent code-first one from tutorial

from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
import datetime
import requests
import pytz
import yaml
from tools.final_answer import FinalAnswerTool

from Gradio_UI import GradioUI

# Below is an example of a tool that does nothing. Amaze us with your creativity !
@tool
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
    #Keep this format for the description / args / args description but feel free to modify the tool
    """

Kafka - Deep Dive - Schema Registry & Avro

# Deep Dive : Schema Registry & Avro (Kafka)

> **Prérequis** : Guide principal Kafka  
> **Objectif** : Maîtriser la gestion des schémas en production  
> **Contexte** : Pipelines IoT avec schémas évolutifs

---

## Table des matières

1. [Pourquoi la gestion des schémas est critique](#1-pourquoi-la-gestion-des-schémas-est-critique)
2. [Apache Avro en profondeur](#2-apache-avro-en-profondeur)
3. [Architecture Schema Registry](#3-architecture-schema-registry)
4. [API et opérations](#4-api-et-opé

Kafka - Overview

# Apache Kafka : Guide Complet pour Data Engineers

> **Contexte** : Formation Data Engineer  
> **Objectif** : Maîtriser Kafka pour pipelines de données temps réel  
> **Cas d'usage** : Pipelines IoT  
> **Compléments** : Voir docs Spark Structured Streaming pour intégration détaillée

---

## Table des matières

1. [Qu'est-ce que Kafka ?](#1-quest-ce-que-kafka)
2. [Architecture](#2-architecture)
3. [Concepts fondamentaux](#3-concepts-fondamentaux)
4. [Producers](#4-producers)
5. [Consumers](#5

Delta Lake - Focus - Unity Catalogue et Gouvernance

# Deep Dive : Unity Catalog et Gouvernance (Delta Lake - Databricks)

> **Prérequis** : Guide principal Delta Lake  
> **Objectif** : Maîtriser la gouvernance des données dans Databricks  
> **Contexte** : Pipelines IoT en production, multi-équipes

---

## Table des matières

1. [Qu'est-ce que Unity Catalog ?](#1-quest-ce-que-unity-catalog)
2. [Architecture et hiérarchie](#2-architecture-et-hiérarchie)
3. [Configuration initiale](#3-configuration-initiale)
4. [Gestion des objets](#4-gestion-des

Delta Lake - Focus - CDC

# Deep Dive : Change Data Feed - CDC (Delta Lake - Databricks)

> **Prérequis** : Guide principal Delta Lake, Deep Dive MERGE  
> **Objectif** : Capturer et propager les changements efficacement  
> **Contexte** : Pipelines IoT, propagation Médaillon

---

## Table des matières

1. [Qu'est-ce que le Change Data Feed ?](#1-quest-ce-que-le-change-data-feed)
2. [Activer et configurer CDF](#2-activer-et-configurer-cdf)
3. [Structure des données CDF](#3-structure-des-données-cdf)
4. [Lire le CDF en b

Delta Lake - Focus - Optimisation & Tuning

# Deep Dive : Optimisation & Tuning (Delta Lake - Databricks)

> **Prérequis** : Guide principal Delta Lake, Deep Dive MERGE  
> **Objectif** : Maximiser les performances de lecture et écriture  
> **Contexte** : Pipelines IoT à haut débit

---

## Table des matières

1. [Le problème des petits fichiers](#1-le-problème-des-petits-fichiers)
2. [OPTIMIZE : compaction](#2-optimize--compaction)
3. [Z-ORDER : clustering des données](#3-z-order--clustering-des-données)
4. [Liquid Clustering (Databrick

Delta Lake - Focus - Merge Patterns

# Deep Dive : MERGE Patterns (Delta Lake - Databricks)

> **Prérequis** : Guide principal Delta Lake  
> **Objectif** : Maîtriser MERGE pour tous les cas d'usage  
> **Contexte** : Pipelines IoT, CDC, dimensions

---

## Table des matières

1. [Anatomie du MERGE](#1-anatomie-du-merge)
2. [Pattern : Upsert simple](#2-pattern--upsert-simple)
3. [Pattern : Déduplication](#3-pattern--déduplication)
4. [Pattern : SCD Type 1](#4-pattern--scd-type-1)
5. [Pattern : SCD Type 2](#5-pattern--scd-type-2)
6.

Delta Lake - Overview

# Delta Lake : Guide Complet (Databricks)

> **Contexte** : Formation Data Engineer  
> **Environnement** : Databricks (fonctionnalités spécifiques signalées)  
> **Cas d'usage** : Pipelines IoT  
> **Prérequis** : Bases Spark SQL, notions de Structured Streaming

---

## Table des matières

1. [Qu'est-ce que Delta Lake ?](#1-quest-ce-que-delta-lake)
2. [Architecture et concepts fondamentaux](#2-architecture-et-concepts-fondamentaux)
3. [Opérations de base](#3-opérations-de-base)
4. [MERGE : l'o

Spark Streaming - Focus - Triggers

# Focus : Triggers (ProcessingTime, Once, AvailableNow, Continuous)

> **Prérequis** : Guide principal  
> **Objectif** : Choisir le trigger adapté à ton SLA  
> **Format** : Focus pratique (~250 lignes)

---

## 1. Les triggers en une image

```
┌─────────────────────────────────────────────────────────────┐
│                    TYPES DE TRIGGERS                        │
├─────────────────────────────────────────────────────────────┤
│                                                            

main v1

# =========================
# main.py
# =========================

import sys
import subprocess
import importlib
import importlib.util

# ------------------------------------------------------------
# Automatisches pip-Upgrade (falls veraltet)
# ------------------------------------------------------------
try:
    print("🔄 Prüfe auf pip-Update ...")
    subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "pip"])
    print("✅ pip erfolgreich aktualisiert.")

erkennung v2

# erkennung.py
import os
import re
import json
import requests
from typing import Optional
from ics import Calendar
from fuzzywuzzy import process, fuzz
from openai import OpenAI
from dotenv import load_dotenv
from datetime import datetime
import csv


# ---------------------------
# 🔐 ENV-Dateien laden & prüfen (mit Fallbacks)
# ---------------------------
benutzer_fallbacks = ["bernh", "Bernhard Holl", "XeisWorks"]

# --- OpenAI ---
openai_env_path = ""
for benutzer in ben

termingenerator v1

# =========================
# termingenerator.py
# =========================

import os
import random
import re
from typing import Optional
from datetime import datetime, date, timedelta

from icalendar import Calendar
from dateutil import tz
from tqdm import tqdm
import holidays

from erkennung import (
    ort_erkennen,
    FALLBACK_ORTE,
    google_geocode_ort,
    speichere_fallback_ort
)

# ------------------------------------------------------------
# ICS-Einträge ei

ics-import v1

# erkennung.py
import os
import re
import json
import requests
from typing import Optional
from ics import Calendar
from fuzzywuzzy import process, fuzz
from openai import OpenAI
from dotenv import load_dotenv
from datetime import datetime
import csv


# ---------------------------
# 🔐 ENV-Dateien laden & prüfen (mit Fallbacks)
# ---------------------------
benutzer_fallbacks = ["bernh", "Bernhard Holl", "XeisWorks"]

# --- OpenAI ---
openai_env_path = ""
for benutzer in ben