from qgis.core import QgsGeometry, QgsPoint, QgsProject
layer = QgsProject.instance().mapLayersByName('test')[0]
layer.startEditing()
for f in layer.getFeatures():
geom = f.geometry()
# sécurité : seulement LineString
if geom.isMultipart():
continue
pts = geom.constGet().points()
dist = 0.0
new_pts = []
for i, p in enumerate(pts):
if i > 0:
dist += pts[i-1].distance(p)
new_pts.append(QgsPoint(p.x(), p.y(), /**
* @param {number[]} arr
* @return {number[][]}
*/
var minimumAbsDifference = function(arr) {
// Step 1: Sort the array so that minimum absolute difference
// must occur between adjacent elements.
arr.sort((a, b) => a - b);
let minDiff = Infinity; // Track the smallest difference found
const result = []; // Store all pairs that match minDiff
// Step 2: First pass - find the minimum adjacent difference
for (let i = 0; i < arr.length - 1; i++) {
// maps.Equal(map1, map2) bool
myMap2 := map[string]string{
"name": "Alice",
"country": "Wonderland",
}
fmt.Println("Second map:", myMap2)
myMap3 := map[string]string{
"name": "Alice",
"country": "Wonderland",
}
if maps.Equal(myMap2, myMap3) {
fmt.Println("Maps are equal")
} else {
fmt.Println("Maps are not equal")
}// syntax: mapLiteral := map[keyType]valueType{ key1: value1, key2: value2, }
myMap2 := map[string]string{
"name": "Alice",
"country": "Wonderland",
}
fmt.Println("Second map:", myMap2) myMap := make(map[string]int)
myMap["key1"] = 15
myMap["key2"] = 100
myMap["key3"] = 7
myMap["key4"] = 23
value, exists := myMap["key1"]
fmt.Println("Value for key1:", value, "Exists:", exists) //Value for key1: 15 Exists: true
valueOfKey10, existsKey10 := myMap["key10"]
fmt.Println("Value for key10:", valueOfKey10, "Exists:", existsKey10) // Value for key10: 0 Exists: false
myMap := make(map[string]int)
myMap["key1"] = 15
myMap["key2"] = 100
myMap["key3"] = 7
myMap["key4"] = 23
// clear syntax: clear(mapVariable)
clear(myMap)
fmt.Println("Map after clearing:", myMap) // delete syntax: delete(mapVariable, key)
myMap := make(map[string]int)
myMap["key1"] = 9
delete(myMap, "key1")/**
* @param {number[]} nums
* @param {number} k
* @return {number}
*/
var minimumDifference = function(nums, k) {
// If k is 1, picking a single student always gives difference = 0
if (k === 1) return 0;
// Sort scores so close values sit next to each other
nums.sort((a, b) => a - b);
// We'll track the smallest range found
let minDiff = Infinity;
// Slide a window of size k across the sorted array
// Window goes from index i to i + k - 1
for (let i = /**
* @param {number[]} nums
* @return {number}
*/
var minPairSum = function(nums) {
// Step 1: Sort the array so we can pair smallest with largest
nums.sort((a, b) => a - b);
let left = 0; // pointer to smallest element
let right = nums.length - 1; // pointer largest element
let maxPairSum = 0; // track the maximum pair sum we create
// Step 2: Pair elements from both end moving inward
while (left < right) {
const pairSumReview the current changes staged to be commit by running `git diff HEAD` and then write an appropriate git message for these changes and be sure to adhere to the guidlines in `CONTRIBUTING.md`.<div class="container">
<div class="ornament-container">
<svg
class="ornament-svg"
preserveAspectRatio="none"
width="1440"
height="80"
viewBox="0 0 1440 80"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path class="ornament-path" fill="#E60019" />
</svg>
</div>
</div><div class="gradient-border">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec id ultrices arcu.
</div>/**
* Simulates the "minimum adjacent sum merge" process efficiently using:
* - A doubly linked list (prev/next) to track alive indices
* - Versioning (ver[]) to invalidate stale heap entries
* - A custom typed min‑heap for fast pair selection
* - An inversion counter to detect when the array becomes non‑decreasing
*
* @param {number[]} nums
* @return {number}
*/
var minimumPairRemoval = function(nums) {
const n = nums.length;
if (n <= 1) return 0;
// Current values after merges
"The Craft endures not in shadow, but in the gleam of righteous labor. Let us stand revealed—not for vanity, but for virtue. For only the visible flame warms the world." — Ron C Nischwitz Sr. (Masonic Enlightenment)import boto3
# Assuming org_client is already initialized
org_client = boto3.client('organizations')
# Collect all accounts using paginator
accounts = []
paginator = org_client.get_paginator('list_accounts')
for page in paginator.paginate():
accounts.extend(page['Accounts'])
# Update the alternate contact details for each account in the organization
for account in accounts:
account_id = account['Id']
# Initialize a session using the AWS account
account_session = boto3.Session- If you put a colspan in the first row of a table, it can mess up the widths of the subsequent rows. Noticed in Gmail and Outlook. Fix is to add an empty row width pre-defined widths at the top to enforce specified width in subsequent rows.