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

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);
  }
}

node version

$ node --version
v10.15.3
$ node --version > .node-version

Variables

var name = 'Bob'; // Type inference to String
Object name = 'Bob'; // 모든 타입은 Object
String? name = 'Bob'; // Nullable type

// final: 런타임 중에 한번 대입 가능, 그 이후에 변경 불가능
final name = 'Bob'; // t
final String name = 'Bob';

// const 컴파일 타임에 결정되는 값
const name = 'Bob';
const String name = 'Bob';

// Assign value to b if b is null; otherwise, b stays the same
b ??= value;

// 삼항 연산자
var visibility = isPublic ? 'public' : 'private';

// name이 null이면 Guest를 반환하는 함수
String playerName(String? name) => name ??

Hello world

void main() {
  print('Hello, World!');
}

Diffuse weighted image

Diffusion Brain MRI
Sequence: DWI, ADC map.

No demonstrable high signal spot indicating diffusion restricion was observed. 
(For other details, please refer to routine brain MRI.)
--> Conclusion: No evidence of acute infarction.

Recommendation; clinical and neurologic examination correlation.

REST API Requirements

## What makes an API RESTful?
* Follow 6 architectural constraints
  * Client - Server 
  * Uniform interface
  * Stateless (server should not manage the state of the application)
  * Caching - server should use HTTP caching headers to cache response
  * Layered
  * Code on demand (optional constraint)
* Richardson Maturity Model
  * measure of RESTfulness based on a score from 0 - 3, 0 is lowest level of REST compliance
  and 3 is the highest level of REST compliance

---
## Client Server Const

CTGY PageBuilder

<mvt:comment>Ability to have a page with the same code as the current category code and use that page via page builder for specific category landing pages/layouts</mvt:comment>
<mvt:do file="g.Module_Feature_TUI_DB" name="l.settings:Page_Load_CodeOK" value="Page_Load_Code( g.Category_Code, l.settings:category:pagebuilder_cat_page )" />
<mvt:if expr="l.settings:Page_Load_CodeOK">
	<mvt:capture variable="l.settings:category:pagebuilder_design"><mvt:do name="l.settings:foundPageOK" file="g.Modul

Spring Data JPA Testing

### Testing Spring Data JPA

#### Disable rollback in tests
`@Rollback(false)` or `@Commit` at method or class level. See https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/test/annotation/Rollback.html

This can be done programatically with help of `TestTransaction` like:

see https://www.baeldung.com/spring-test-programmatic-transactions.

```
TestTransaction.flagForCommit();
TestTransaction.flagForRollback();

TestTransaction.start();
......
TestTransaction.e

Revision History

kube -n [namespace] rollout history deploy [service]--revision=[x] -o yaml

Find Relative Ranks

/**
 * @param {number[]} score
 * @return {string[]}
 */
var findRelativeRanks = function(score) {
    // Create a copy of the original scores array and sort it in descending order
    var sorted = Array.from(score).sort((a, b) => b - a);

    // Iterate over the sorted scores array
    for (let i = 0; i < sorted.length; i++) {
        // Find the index of the score in the original scores array
        let index = score.indexOf(sorted[i]);

        // Assign the athlete's rank based on their pos