Obtener el primer producto por marcar.

SELECT 
	marcaProducto,
	cveProducto,
	cveProductoProveedor,
	stock
FROM (
	SELECT 
		MP.marcaProducto,
		UP.cveProducto,
		ALT.cveProductoProveedor,
		SS.stock,
		ROW_NUMBER() OVER (
			PARTITION BY MP.marcaProducto 
			ORDER BY ALT.cveProductoProveedor DESC
		) AS rn
	FROM MARCA_PRODUCTO MP
		INNER JOIN U_PRODUCTO UP
			ON MP.cveMarcaProducto = UP.cveMarcaProducto
		LEFT JOIN (
			SELECT * 
			FROM (
				SELECT 
					* 
				FROM ALTERNA 
				WHERE LEN(cveProductoProveedor) = 12 
					OR LEN(cv

3129. Find All Possible Stable Binary Arrays I

You are given 3 positive integers zero, one, and limit. A binary array arr is called stable if: The number of occurrences of 0 in arr is exactly zero. The number of occurrences of 1 in arr is exactly one. Each subarray of arr with a size greater than limit must contain both 0 and 1. Return the total number of stable binary arrays. Since the answer may be very large, return it modulo 109 + 7.
/**
 * @param {number} zero
 * @param {number} one
 * @param {number} limit 
 * @return {number}
 */
var numberOfStableArrays = function (zero, one, limit) {
    const MOD = 1_000_000_007;

    // ------------------------------------------------------------
    // dp[a][b][c][d] means:
    //   a = number of 0s used so far
    //   b = number of 1s used so far
    //   c = last bit placed (0 or 1)
    //   d = length of the current run of c
    //
    // Example:
    //   dp[3][2][1][2] = number

Modal module

/**
 * @class BaseModal
 * @extends HTMLElement
 *
 * Base popup element.
 */

export class BaseModal extends HTMLElement {
  #originalParent = null;
  #nextSibling = null;
  #previouslyFocused = null;
  #triggerElement = null;

  /**
   * When true, the modal is appended to `<body>` on open to ensure
   * correct stacking context.
   *
   * @returns {boolean}
   */
  get shouldAppendToBody() {
    return this.hasAttribute('should-append-to-body');
  }

  /**
   * When true, the modal remains at

SQL Server Management Studio (SSMS) AutoRecover Locations

# PowerShell

- $env:LOCALAPPDATA\Microsoft\SSMS\BackupFiles\Solution1
- $env:USERPROFILE\Documents\Visual Studio 2017\Backup Files\Solution1

# Batch

- %LOCALAPPDATA%\Microsoft\SSMS\BackupFiles\Solution1
- %USERPROFILE%\Documents\Visual Studio 2017\Backup Files\Solution1

## Reference

- [Set AutoRecover options](https://learn.microsoft.com/en-us/visualstudio/ide/autorecover-environment-options-dialog-box?view=visualstudio) - This article contains highly inaccurate information.

CSV × スプレッドシート × Shift_JIS で発生する文字変換

# CSV × スプレッドシート × Shift_JIS で発生する文字変換

Shift_JIS の CSV をスプレッドシート (Google Sheets, Excel, Numbers) で開いて保存し直すと、以下の文字変換が発生する。

## 1. 波ダッシュ (U+FF5E ↔ U+301C)

Shift_JIS の `0x8160` を Unicode のどの文字にマッピングするかは実装依存。

| コードポイント | 名称 | 採用元 |
|---------------|------|--------|
| U+FF5E | FULLWIDTH TILDE | Microsoft CP932 (iconv-lite 等) |
| U+301C | WAVE DASH | JIS X 0208 (スプレッドシート、Java、macOS 等) |

iconv-lite で U+FF5E → 0x8160 にエンコードした CSV を、スプレッドシートが 0x8160 → U+301C としてデコードする。UTF-8 で再保存されると U+301C になり、元の U+F

webフォント適用前が一瞬見える現象の原因と対策

# Webフォント読み込みの最適化

## `rel="preload"` と `rel="preconnect"` の違い

### `rel="preconnect"`

DNS解決・TCP接続・TLSハンドシェイクを事前に行う。リソース自体のダウンロードは行わない。

```html
<link rel="preconnect" href="https://fonts.googleapis.com" />
```

用途: リソースのURLが確定しないが、接続先オリジンがわかっている場合(例: Typekitのように動的にリソースURLが決まるケース)。

### `rel="preload"`

リソース自体をダウンロードし、ブラウザキャッシュに保存する。preconnect(接続の事前確立)とは別の機能であり、上位互換ではない。

```html
<link rel="preload" href="https://fonts.googleapis.com/css2?family=..." as="style" crossorigin />
```

用途: リソースのURLが

List ansible playbook contents for AIs

find . -maxdepth 4 -not -path '*/.*' -type f -exec echo "--- FICHIER: {} ---" \; -exec cat {} \; -exec printf "\n\n" \;

C1 U17

get sorted out
large

Compare sample rows between 2 tables

-- Taking a sample of `batiment_groupe_id`
WITH sample_ids AS (
    SELECT batiment_groupe_id
    FROM fr_marts.agg_compilation_building_groupe TABLESAMPLE SYSTEM (0.01)
),
prod_rows AS (
    SELECT 
        batiment_groupe_id,
        -- Sort the array for order-independent comparison for `l_cle_interop_adr` column
        (SELECT ARRAY_AGG(x ORDER BY x) FROM unnest(l_cle_interop_adr) x) AS l_cle_interop_adr_sorted,
        street_number, postal_code, city, address_line_1,
        s_geom_groupe

multi-agency-with-mastra.ai

Build Mastra.ai Digital Agency with Multi-Agent System
Repository Setup
Create a new repository digital-agency (or similar name) with the following stack:

Next.js 15 (App Router)
Mastra.ai (@mastra/core, @mastra/rag)
MongoDB via Mongoose
Tailwind CSS v4
shadcn/ui
TypeScript
Step 1: Initialize the Project

npx create-next-app@latest digital-agency --typescript --tailwind --eslint --app --src-dir  
cd digital-agency  
npx shadcn@latest init  
npm install @mastra/core @mastra/rag mongoose @ai-sdk/

WinActivatorScript.cmd

@::Please stop false-flagging this script over and over. This is the 3rd time I've had to update the script to deal with the false positives.
@::Nothing in this script is malicious and it is used by thousands of people *daily*.
@::Is a real person even the one deciding to flag this or is it Copilot told to flag anything it decides not to like?
@::If a campaign is using this script as a cover, please flag parts of the campaign instead of the script. This isn't the first time we experienced col

border-shapeとclip-pathで吹き出しマークつきバルーンをつくる

<div class="balloon">
  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</div>

intersectionRatioで画面に写っている比率を判定する

<div class="layout">
  <aside class="sidebar">
    <nav class="sidebar__nav">
      <ul class="sidebar__list">
        <li class="sidebar__item"><a href="#section-1" class="sidebar__link" data-target="section-1">Section 1</a></li>
        <li class="sidebar__item"><a href="#section-2" class="sidebar__link" data-target="section-2">Section 2</a></li>
        <li class="sidebar__item"><a href="#section-3" class="sidebar__link" data-target="section-3">Section 3</a></li>
        <li class="sidebar__i

1888. Minimum Number of Flips to Make the Binary String Alternating

You are given a binary string s. You are allowed to perform two types of operations on the string in any sequence: Type-1: Remove the character at the start of the string s and append it to the end of the string. Type-2: Pick any character in s and flip its value, i.e., if its value is '0' it becomes '1' and vice-versa. Return the minimum number of type-2 operations you need to perform such that s becomes alternating. The string is called alternating if no two adjacent characters are equal. For example, the strings "010" and "1010" are alternating, while the string "0100" is not.
/**
 * @param {string} s
 * @return {number}
 */
var minFlips = function(s) {
    const n = s.length;
    const s2 = s + s;

    // Build alternating patterns of length 2n
    let alt0 = "", alt1 = "";
    for (let i = 0; i < 2 * n; i++) {
        alt0 += i % 2 === 0 ? "0" : "1";
        alt1 += i % 2 === 0 ? "1" : "0";
    }

    let diff0 = 0, diff1 = 0;
    let res = Infinity;

    let left = 0;
    for (let right = 0; right < 2 * n; right++) {
        if (s2[right] !== alt0[right]) diff0++;

PHP Backend to Store Contact Form Submissions in Mysql Database

<?php

class Database
{
    private static $instance = null;

    private $host = "localhost";
    private $db   = "website";
    private $user = "dbuser";
    private $pass = "dbpass";
    private $charset = "utf8mb4";

    private function __construct(){}

    public static function getConnection()
    {
        if (self::$instance === null) {

            $db = new self();

            $dsn = "mysql:host={$db->host};dbname={$db->db};charset={$db->charset}";

            $options = [
         

Get Client IP Address Behind Proxy

<?php
function getClientIpAddress() {
    $ipAddress = '';
    // Check for the most common proxy header X-Forwarded-For
    if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $ipAddressList = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
        // The first IP in the list is the most likely client IP
        foreach ($ipAddressList as $ip) {
            if (!empty($ip)) {
                // Trim any whitespace
                $ipAddress = trim($ip);
                break;
            }