10052024

inicio{
"host":"F464DC5BED64C0A9B28DE3252E",
"porta":"0E0276FE51C1"
}fim

シングルトン とは。。

使用したいそれぞれのファイルで、 CustomScriptEditor2 の新しいインスタンスを作成する代わりに、 これらのインスタンスを一度だけ、ここで作成し、 これを、他のすべてのファイルの場所で再利用することをお勧めします。 これは一つの方法であり、 当ファイルのように、別の Pythonファイル(例えば singleton.py )を作成し、 その中で、CustomScriptEditor2 のインスタンスを作成することです。 これにより、CustomScriptEditor2 のインスタンスは一度だけ作成され、 例えば、 SampleA_cmdsUI.py と SampleB_pymelUI.py の両方で共有されるようになります。 これがシングルトンパターンの一般的な実装方法です。
# -*- coding: utf-8 -*-

u"""
singleton.py

:Author:
    oki yoshihiro
    okiyoshihiro.job@gmail.com
:Version: -1.0-
:Date: 2024/05/10

.. note:: 当コード記述時の環境

    - Maya2022 python3系
    - Python version: 3.7.7
    - PySide2 version: 5.15.2

概要(overview):
    シングルトンパターンを実装するためのモジュールです
詳細(details):
    使用したいそれぞれのファイルで、
        CustomScriptEditor2 の新しいインスタンスを作成する代わりに、
            これらのインスタンスを一度だけ、ここで作成し、
                これを、他のすべてのファイルの場所で再利用することをお勧めします。
    これは一つの方法であり、
   

Dynamic Vue.js component in runtime

<template>
  <h1>test</h1>
  <component :is="dynamicComponent" />
</template>


<script setup>
import { computed} from 'vue'

const dynamicComponent = computed(() => {

  let template = `
    <h3>Toto je dynamic component</h3>
    <p>Nejaky text</p>
  `

  return { template }

})
</script>

<!--/* musi to byt jako bundle vue .. build, ne runtime vue   */-->

Django model relations

class User(models.Model):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4)
    email = models.CharField(unique=True, null=False, blank=False)
    password_hash = models.CharField(max_length=255, null=True, blank=False)

    @property
    def pending_articles_count(self):
        return self.articles.filter(state__in=['pending_content', 'pending_translation']).count()

    class Meta:
        db_table = "users"

class Article(models.Model):
    id = models.UUIDField(primary_key=Tru

Git checkout

Switching Branches: To switch to an existing branch, you can use:
git checkout <branch-name>

For example, to switch to a branch named "feature-branch", you would use:
git checkout feature-branch

Creating and Switching to a New Branch: If you want to create a new branch and switch to it immediately, you can combine git checkout with the -b option:
arduino
git checkout -b <new-branch-name>

For example, to create and switch to a new branch named "my-new-feature", you would use:
arduino
git check

Vincent Comments - Loan Id = 624630

select l.loan_payoff_date, lse.closed_date, fi.loan_closed, fi.loan_closed_cumulative, fi.loan_id, fi.installment_number, fi.period_start, fi.period_end, fi.amount, fi.amount_owed_to_period, fi.amount_paid_to_period,
	 fi.initial_default, fi.initial_default_cumulative, fi.current_default, fi.default_7_days, fi.default_15_days, fi.default_30_days, fi.default_35_days,
	 fi.default_60_days, fi.default_65_days, fi.prev_initial_default_or_payoff, fi.prev_current_default_at_period_end, fi.interest_sus

PayTrace

# PayTrace
* Get set up with sandbox, faster support reach out to developer (developersupport@paytrace.com)

---
### Terms 
* **Authorize** - hold _$x_ amount from customer, does not charge the card
* **Capture** - charge the card for _$x_ amount
* **Settle** - Completion of the capture, usually takes a day to finalize

---
### Issue
* When placing an order through the phone, agent uses credit card information
in PayTrace portal to create the transaction. But the card isn't charged at this point

11111

a:=1
fmt.Println(a)

Proxy object guide

// 1)  get + set
const target = {
    name: 'John Smith',
    age: 30,
};
const handler = {
    get: function (target, prop) {
        console.log(`Getting the property ${prop}`);
        return target[prop];
    },
    set: function (target, prop, value) {
        console.log(`Setting the property ${prop} to ${value}`);
        target[prop] = value;
    },
};
const proxy = new Proxy(target, handler);



// 2) with validator fn aka encapsulation
const withValidators = person 

3075. Maximize Happiness of Selected Children

/**
 * @param {number[]} happiness
 * @param {number} k
 * @return {number}
 */
var maximumHappinessSum = function(happiness, k) {
    // Sort the happiness array in descending order.
    // This ensures that the children with higher happiness are selected first.
    happiness.sort((a, b) => b - a);

    // Select the first k children from the sorted array.
    // These are the k children with the highest initial happiness.
    let selectedChildren = happiness.slice(0, k);

    // Calculate the 

Proxy - nested

const user = {
  a: 'A',
  b: {
    c: "C",
    d: "D"
  },
  x: {
    y: {
      z: {
        first: "first nested",
        second: "second nested"
      }
    }
  }
}


const createNestedProxy = (obj) => {
  return new Proxy(obj, {
    get(target, prop) {
      const props = prop.split('.');
      let value = target;
      for (const p of props) {
        value = value[p];
        if (value === undefined) return undefined;
      }
      return value;
    }
  });
}

Cache caché setCache getCache

# Caché
La caché sirve para evitar consultas innecesarias a la BD, que seguramente no cambian frecuentemente. Se le asigna una key, y se comprueba si existe el objeto. Si no existe se calcula y se guarda, poniéndole una caducidad **en segundos**

```php
$keyCache='credencialesAlumno-'.$id;
$cacheCredenciales = $this->quid->db->getCache( $keyCache );
if($cacheCredenciales){
   //operación costosa
}else{
  $this->quid->db->setCache($keyCache, "lo que quieras guardar aquí, puede ser un array", 1000

List



void main() {
  
  // List.filled(int length, E fill, {bool growable = false})
  var fixed_list = List.filled(5, 0); // [0, 0, 0, 0, 0]
  print("List filled: $fixed_list");
  
  // List.generate(int length, E generator(int index), {bool growable = true})
  var generated_list = List.generate(5, (i) => i + 1);
  print("List generated: $generated_list");
  
  // List.empty({bool growable = false})
  // List.from(Iterable elements, {bool growable = true})
  // List.of(Iterable<E> elements, {bool g

Filtro news per categoria Ajax

https://rudrastyh.com/wordpress/ajax-post-filters.html

GX: Demo Notebook


{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "application/vnd.databricks.v1+cell": {
     "cellMetadata": {},
     "inputWidgets": {},
     "nuid": "6a0bfa07-68b4-48d0-82b6-d155622200c5",
     "showTitle": false,
     "title": ""
    }
   },
   "source": [
    "## How-To: Great Expectations\n",
    "\n",
    "Resources:\n",
    "- [Get started with Great Expectations & Databricks](https://docs.greatexpectations.io/docs/oss/get_started/get_started_with_gx_and_databricks/)\n

Classes

// Generative constructors
// To instantiate a class, use a generative constructor.
class Point {
  // Initializer list of variables and values
  double x = 2.0;
  double y = 2.0;

  // Generative constructor with initializing formal parameters:
  Point(this.x, this.y);
  
  double distanceTo(Point other) {
    var dx = x - other.x;
    var dy = y - other.y;
    return sqrt(dx * dx + dy * dy);
  }
}