import numpy as np
import matplotlib.pyplot as plt
from scipy.special import erf

'''
Review: Precision and Recall
Imagine you are a data scientist working on a language model designed to detect hate speech in tweets.
You have randomly selected 120 tweets from a dataset to test your model.
Your task is to evaluate the performance of the model based on the following results:

               | Predicted: Yes | Predicted: No | Predicted: None
---------------|----------------|---------------|---------------
Actual: Yes    | 30             | 20            | 5
Actual: No     | 10             | 40            | 15

Please calculate the accuracy, precision, recall accuracy of this model for
correctly detecting non-hate speech

'''
true_pos = 40
true_neg = 20
false_pos = 30
false_neg = 10
accuracy = (true_pos + true_neg) / (true_pos + true_neg + false_pos + false_neg)
precision = true_pos / (true_pos + false_pos)
recall = true_pos / (true_pos + false_neg)

print(f"Accuracy: {accuracy}")
print(f"Precision: {precision}")
print(f"Recall: {recall}")

def normal_pdf(x, mu, sigma):
    # mu: the mean
    # sigma: the standard deviation
    # square root: np.sqrt()
    # exponent of e: np.exp()

    # TODO: delete "None", and assign values to the coefficient and exponent
    coefficient = 1 / (sigma * np.sqrt(2 * np.pi))
    exponent = -0.5 * ((x - mu) / sigma) ** 2
    return coefficient * np.exp(exponent)

def normal_cdf(x, mu, sigma):
    return 0.5 * (1 + erf((x - mu) / (sigma * np.sqrt(2))))

# Calculate the probability within 1 sd of the mean
prob_within_one_sd = normal_cdf(1, 0, 1) - normal_cdf(-1, 0, 1)

# TODO: Calculate the probability within 2 sd of the mean
prob_within_two_sd = normal_cdf(2, 0, 1) - normal_cdf(-2, 0, 1)

# TODO: Calculate the probability within 3 sd of the mean
prob_within_three_sd = normal_cdf(3, 0, 1) - normal_cdf(-3, 0, 1)

print(prob_within_one_sd)
print(prob_within_two_sd)
print(prob_within_three_sd)

# Plot out pdf and cdf
x_data = np.linspace(-5, 5, 1000)

# Use the function for pdf defined above to calculate y_data_pdf
y_data_pdf = normal_pdf(x_data, 0, 1)

normal_pdf(x, mu, sigma)

# Use the function for cdf defined above to calculate y_data_cdf
y_data_cdf = normal_cdf(x_data, 0, 1)

# Plot pdf
plt.plot(x_data, y_data_pdf, label='PDF')
# Plot cdf
plt.plot(x_data, y_data_cdf, label='CDF')
plt.legend()
plt.show()


  .g-skip-link.\:focus {
      position: static !important;
      width: auto !important;
      height: auto !important;
      margin: inherit !important;
      overflow: visible !important;
      clip: auto !important;
      -webkit-clip-path: none !important;
      clip-path: none !important;
      white-space: inherit !important;
    }
    @media print {
      .g-skip-link {
        font-family: sans-serif;
      }
    }
    .g-skip-link:focus,
    .g-skip-link.\:focus {
      outline: 3px solid #ffbf47;
      outline-offset: 0;
      background-color: #ffbf47;
    }
    .g-skip-link:link,
    .g-skip-link:visited,
    .g-skip-link:hover,
    .g-skip-link:active,
    .g-skip-link:focus,
    .g-skip-link.\:link,
    .g-skip-link.\:visited,
    .g-skip-link.\:hover,
    .g-skip-link.\:active,
    .g-skip-link.\:focus {
      color: #0b0c0c;
    }
    @media print {
      .g-skip-link:link,
      .g-skip-link:visited,
      .g-skip-link:hover,
      .g-skip-link:active,
      .g-skip-link:focus,
      .g-skip-link.\:link,
      .g-skip-link.\:visited,
      .g-skip-link.\:hover,
      .g-skip-link.\:active,
      .g-skip-link.\:focus {
        color: #000000;
      }
    }
    @media (min-width: 40.0625em) {
      .g-skip-link {
        font-size: 16px;
        font-size: 1rem;
        line-height: 1.25;
      }
    }
    @media print {
      .g-skip-link {
        font-size: 14pt;
        line-height: 1.2;
      }
    }
    @supports (padding: max(calc(0px))) {
      .g-skip-link {
        padding-right: max(15px, calc(15px + env(safe-area-inset-right)));
        padding-left: max(15px, calc(15px + env(safe-area-inset-left)));
      }
    }
    .g-table {
      font-family: Arial, sans-serif;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      font-weight: 400;
      font-size: 16px;
      font-size: 1rem;
      line-height: 1.25;
      color: #0b0c0c;
      width: 100%;
      margin-bottom: 20px;
      border-spacing: 0;
      border-collapse: collapse;
    }
    @media print {
      .g-table {
        font-family: sans-serif;
      }
    }
    @media (min-width: 40.0625em) {
      .g-table {
        font-size: 19px;
        font-size: 1.1875rem;
        line-height: 1.31579;
      }
    }
    @media print {
      .g-table {
        font-size: 14pt;
        line-height: 1.15;
      }
    }
    @media print {
      .g-table {
        color: #000000;
      }
    }
    @media (min-width: 40.0625em) {
      .g-table {
        margin-bottom: 30px;
      }
    }
    .g


1.000000
/* 185618 801D75C8 44818000 */  mtc1  $at, $f16
/* 18561C 801D75CC 8CB80000 */  lw    $t8, ($a1)
/* 185620 801D75D0 3C01800E */ lui $at, 0x800e
/* 185624 801D75D4 02002025 */  move  $a0, $s0
/* 185628 801D75D8 0018C880 */  sll   $t9, $t8, 2
/* 18562C 801D75DC 00390821 */  addu  $at, $at, $t9
/* 185630 801D75E0 E4306A10 */ swc1 $f16, 0x6a10($at)
/* 185634 801D75E4 8CA80000 */  lw    $t0, ($a1)
/* 185638 801D75E8 3C018022 */ lui $at, 0x8022
/* 18563C 801D75EC C432CEDC */ lwc1 $f18, -0x3124($at)
/* 185640 801D75F0 3C01800E */ lui $at, 0x800e
/* 185644 801D75F4 00084880 */  sll   $t1, $t0, 2
/* 185648 801D75F8 00290821 */  addu  $at, $at, $t1
/* 18564C 801D75FC 0C03E39B */  jal   func_800F8E6C
/* 185650 801D7600 E43264D0 */ swc1 $f18, 0x64d0($at)
/* 185654 801D7604 0C02CCFD */  jal   func_800B33F4
/* 185658 801D7608 00000000 */   nop
/* 18565C 801D760C 8E450000 */  lw    $a1, ($s2)
/* 185660 801D7610 3C04800E */ lui $a0, 0x800e
/* 185664 801D7614 248417D0 */ addiu $a0, 0x17d0
/* 185668 801D7618 8CA30000 */  lw    $v1, ($a1)
/* 18566C 801D761C 3C018022 */ lui $at, 0x8022
/* 185670 801D7620 C422CEE0 */ lwc1 $f2, -0x3120($at)
/* 185674 801D7624 00031880 */  sll   $v1, $v1, 2
/* 185678 801D7628 00831021 */  addu  $v0, $a0, $v1
/* 18567C 801D762C C4400000 */  lwc1  $f0, ($v0)
/* 185680 801D7630 44806000 */  mtc1  $zero, $f12
/* 185684 801D7634 3C018022 */ lui $at, 0x8022
/* 185688 801D7638 4600103E */  c.le.s $f2, $f0
/* 18568C 801D763C 00000000 */  nop
/* 185690 801D7640 4502000C */  bc1fl .L801D7674_ovl9
/* 185694 801D7644 460C003C */   c.lt.s $f0, $f12
/* 185698 801D7648 46020101 */  sub.s $f4, $f0, $f2
.L801D764C_ovl9:
/* 18569C 801D764C E4440000 */  swc1  $f4, ($v0)
/* 1856A0 801D7650 8CA30000 */  lw    $v1, ($a1)
/* 1856A4 801D7654 00031880 */  sll   $v1, $v1, 2
/* 1856A8 801D7658 00831021 */  addu  $v0, $a0, $v1
/* 1856AC 801D765C C440000


 DispatchParticleEffect( const char *pszParticleName, Vector vecOrigin, QAngle vecAngles, CBaseEntity *pEntity )
{
	int iIndex = GetParticleSystemIndex( pszParticleName );
	DispatchParticleEffect( iIndex, vecOrigin, vecOrigin, vecAngles, pEntity );
}

//-----------------------------------------------------------------------------
// Purpose: Yet another overload, lets us supply vecStart
//-----------------------------------------------------------------------------
void DispatchParticleEffect( const char *pszParticleName, Vector vecOrigin, Vector vecStart, QAngle vecAngles, CBaseEntity *pEntity )
{
	int iIndex = GetParticleSystemIndex( pszParticleName );
	DispatchParticleEffect( iIndex, vecOrigin, vecStart, vecAngles, pEntity );
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void StopParticleEffects( CBaseEntity *pEntity )
{
	CEffectData	data;

	if ( pEntity )
	{
#ifdef CLIENT_DLL
		data.m_hEntity = pEntity;
#else
		data.m_nEntIndex = pEntity->entindex();
#endif
	}

#ifdef GAME_DLL
	CReliableBroadcastRecipientFilter filter;
	DispatchEffect( "ParticleEffectStop", data, filter );
#else
	DispatchEffect( "ParticleEffectStop", data );
#endif
}

#ifndef CLIENT_DLL

	extern CBaseEntity *GetNextCommandEntity( CBasePlayer *pPlayer, const char *name, CBaseEntity *ent );

	ConVar particle_test_file( "particle_test_file", "", FCVAR_CHEAT, "Name of the particle system to dynamically spawn" );
	ConVar particle_test_attach_mode( "particle_test_attach_mode", "follow_attachment", FCVAR_CHEAT, "Possible Values: 'start_at_attachment', 'follow_attachment', 'start_at_origin', 'follow_origin'" );
	ConVar particle_test_attach_attachment( "particle_test_attach_attachment", "0", FCVAR_CHEAT, "Attachment index for attachment mode" );

	void Particle_Test_Start( CBasePlayer* pPlayer, const char *name, bool bStart )
	{
		if ( !pPlayer )
			return;

		int iAttachType = GetAttachTypeFromString( particle_test_attach_mode.GetString() );

		if ( iAttachType < 0 )
		{
			Warning( "Invalid attach type specified for particle_test in cvar 'particle_test_attach_mode.\n" );
			return;
		}

		int iAttachmentIndex = particle_test_attach_attachment.GetInt();

		const char *pszParticleFile = particle_test_file.GetString();

		CBaseEntity *pEntity = NULL;
		while ( (pEntity = GetNextCommandEntity( pPlayer, name, pEntity )) != NULL )
		{
			/*
			Fire the test particle system on this entity
			*/

			DispatchParticleEffect(
				pszParticleFile,
				(ParticleAttachment_t)iAttachType,
				pEntity,
				iAttachmentIndex,
				true );				// stops existing particle systems
		}
	}

	void CC_Particle_Test_Start( const CCommand& args )
	{
		Particle_Test_Start( UTIL_GetCommandClient(), args[1], true );
	}
	static ConCommand particle_test_start("particle_test_start", CC_Particle_Test_Start, "Dispatches the test particle system with the parameters specified in particle_test_file,\n particle_test_attach_mode and particle_test_attach_param on the entity the player is looking at.\n\tArguments:   	{entity_name} / {class_name} / no argument


MapVirtualObject) geometry.getDirectFeature(GeometryPackage.eINSTANCE.getGeometryInfo_Data());
						int saveableTriangles = (int)geometryData.get("saveableTriangles");
						int reused = (int)geometryData.get("reused");
						int triangles = (int)geometryData.get("nrIndices") / 3;

						org.bimserver.database.queries.Bounds objectBounds = new org.bimserver.database.queries.Bounds((double) min.get("x"), (double) min.get("y"), (double) min.get("z"), (double) max.get("x"), (double) max.get("y"),
								(double) max.get("z"));
						GeometryObject geometryObject = new GeometryObject(next.getOid(), next.eClass(), next.getCroid(), saveableTriangles, reused, triangles, density, objectBounds);
						Node node = octree.add(geometryObject);
						geometryObject.setTileId(node.getId());
						geometryObject.setTileLevel(node.getLevel());
						geometryObject.setGeometryDataObject(geometryDataObject);
					}
				}
				next = queryObjectProvider.next();
			}

			AtomicLong totalTriangles = new AtomicLong();

			octree.traverseBreathFirst(new Traverser() {
				@Override
				public void traverse(Node node) {
					for (GeometryObject geometryObject : node.getValues()) {
						totalTriangles.addAndGet(geometryObject.getTriangles());
					}
				}
			});

			LOGGER.info("Total triangles: " + totalTriangles);

			octree.moveGeometryDown(new MoveGeometryDownDecider() {
				@Override
				public boolean shouldMoveDown(GeometryObject geometryObject) {
					GeometryDataObject geometryDataObject = geometryObject.getGeometryDataObject();
					if (geometryDataObject == null) {
						// It's not reused at all
						return false;
					}

					// Maybe we should reason the other way around. Each tile can at max be X triangles big. If the amount of triangles is too large, we start moving reusable objects down by splitting them.
					// If that in turn means that reuse in those tiles makes no sense anymore, stop applying reuse altogether.W

					// So we have already decided that reuse is going to be useful, but if moving the geometry down a level would result

					return false;
				}});

			octree.moveUp(new MoveUpDecider() {
				@Override
				public boolean moveUp(Node node) {
					// TODO use more heuristics
					int totalTriangles = 0;
					for (GeometryObject geometryObject : node.getValues()) {
						totalTriangles += geometryObject.getTriangles();
					}
					if (totalTriangles < 1200) {
						return true;
					}

					return false;
				}
			});

			long end = System.nanoTime();
			LOGGER.info("Octree generated in " + ((end - start) / 1000000) + " ms");

			return octree;
		} catch (BimserverDatabaseException e) {
			LOGGER.error("", e);
		} catch (IOException e) {
			LOGGER.error("", e);
		} catch (QueryException e) {
			LOGGER.error("", e);
		}
		return null;
	}

	private DensityThreshold generateDensityThreshold(DensityThresholdKey key) {
		long start = System.nanoTime();
		DensityThreshold densityThreshold = new DensityThreshold();
		try (DatabaseSession session = bimServer.getDatabase().createSession(OperationType.READ_ONLY)) {
			Set<Long> roids = key.getRoid();
			List<Density> allDensities = new ArrayList<>();
			for (long roid : roids) {
				Revision revision = session.get(roid, OldQuery.getDefault());
				List<Density> densities = revision.getDensityCollection().getDensities();
				allDensities.addAll(densities);
			}
			if (key.getRoid().size() > 1) {


i - ri ) * ( wi x t )

    Note the use of the chain rule. Now we identify the jacobian

        G*W = [ -t      -ri x t + t x gg     t    rj x t ] * [vi wi vj wj]

    The rotational part is just a rotation lock.

     */

    var maxForce = this.maxForce = typeof(options.maxForce)!=="undefined" ? options.maxForce : Number.MAX_VALUE;

    // Translational part
    var trans = new Equation(bodyA,bodyB,-maxForce,maxForce);
    var ri = new vec2.create(),
        rj = new vec2.create(),
        gg = new vec2.create(),
        t =  new vec2.create();
    trans.computeGq = function(){
        // g = ( xj + rj - xi - ri ) * t
        return vec2.dot(gg,t);
    };
    trans.updateJacobian = function(){
        var G = this.G,
            xi = bodyA.position,
            xj = bodyB.position;
        vec2.rotate(ri,localAnchorA,bodyA.angle);
        vec2.rotate(rj,localAnchorB,bodyB.angle);
        vec2.add(gg,xj,rj);
        vec2.sub(gg,gg,xi);
        vec2.sub(gg,gg,ri);
        vec2.rotate(t,localAxisA,bodyA.angle+Math.PI/2);

        G[0] = -t[0];
        G[1] = -t[1];
        G[2] = -vec2.crossLength(ri,t) + vec2.crossLength(t,gg);
        G[3] = t[0];
        G[4] = t[1];
        G[5] = vec2.crossLength(rj,t);
    };
    this.equations.push(trans);

    // Rotational part
    if(!options.disableRotationalLock){
        var rot = new RotationalLockEquation(bodyA,bodyB,-maxForce,maxForce);
        this.equations.push(rot);
    }

    /**
     * The position of anchor A relative to anchor B, along the constraint axis.
     * @property position
     * @type {Number}
     */
    this.position = 0;

    // Is this one used at all?
    this.velocity = 0;

    /**
     * Set to true to enable lower limit.
     * @property lowerLimitEnabled
     * @type {Boolean}
     */
    this.lowerLimitEnabled = typeof(options.lowerLimit)!=="undefined" ? true : false;

    /**
     * Set to true to enable upper limit.
     * @property upperLimitEnabled
     * @type {Boolean}
     */
    this.upperLimitEnabled = typeof(options.upperLimit)!=="undefined" ? true : false;

    /**
     * Lower constraint limit. The constraint position is forced to be larger than this value.
     * @property lowerLimit
     * @type {Number}
     */
    this.lowerLimit = typeof(options.lowerLimit)!=="undefined" ? options.lowerLimit : 0;

    /**
     * Upper constraint limit. The constraint position is forced to be smaller than this value.
     * @property upperLimit
     * @type {Number}
     */
    this.upperLimit = typeof(options.upperLimit)!=="undefined" ? options.upperLimit : 1;

    // Equations used for limits
    this.upperLimitEquation = new ContactEquation(bodyA,bodyB);
    this.lowerLimitEquation = new ContactEquation(bodyA,bodyB);

    // Set max/min forces
    this.upperLimitEquation.minForce = this.lowerLimitEquation.minForce = 0;
    this.upperLimitEquation.maxForce = this.lowerLimitEquation.maxForce = maxForce;

    /**
     * Equation used for the motor.
     * @property motorEquation
     * @type {Equation}
     */
    this.motorEquation = new Equation(bodyA,bodyB);

    /**
     * The current motor state. Enable or disable the motor using .enableMotor
     * @property motorEnabled
     * @type {Boolean}
     */
    this.motorEnabled = false;

    /**
     * Set the ta


px}.contentBox .upLoadBox .btnBox[data-v-49dbf792]{display:flex;align-items:center;justify-content:center;width:128px;height:34px;line-height:34px;border-radius:8px;color:#fff;background-color:#10a37f;margin-top:8px;cursor:pointer}.model-line{margin-bottom:11px;display:flex;justify-content:flex-start;align-items:center}.model-line .img{width:20px;height:20px}.model-line .name{margin-left:8px;font-size:14px;color:#0256ff}.markdown-body-text .code-block-header{width:100%;display:flex;justify-content:space-between;background-color:#23a559}.markdown-body-text .code-block-header .code-block-header__lang{color:#fff}.markdown-body-text .code-block-header .code-block-header__copy{cursor:pointer;color:#fff}.markdown-body-text p{line-height:25px!important}.markdown-body-text ol{padding-left:40px}.markdown-body-text ol>li{list-style:disc;line-height:25px}.markdown-body-text ul{padding-left:2em}.markdown-body-text h1{font-size:22px}.markdown-body-text h2{font-size:20px}.markdown-body-text h3{font-size:18px}.markdown-body-text h4{font-size:16px}.markdown-body-text h1,.markdown-body-text h2,.markdown-body-text h3,.markdown-body-text h4,.markdown-body-text h5,.markdown-body-text h6{margin-top:20px;font-weight:700;margin-bottom:20px}.markdown-body-text hr{margin-bottom:10px}.markdown-body-text ul li{line-height:25px}.markdown-body-text table thead tr th{border:1px solid #aaa;font-weight:700;font-size:15px}.markdown-body-text table tbody tr td{border:1px solid #aaa;font-weight:700;font-size:14px}pre code.hljs[data-v-6359a07c]{display:block;overflow-x:auto;padding:1em}code.hljs[data-v-6359a07c]{padding:3px 5px}/*!
  Theme: GitHub
  Description: Light theme as seen on github.com
  Author: github.com
  Maintainer: @Hirse
  Updated: 2021-05-15

  Outdated base version: https://github.com/primer/github-syntax-light
  Current colors taken from GitHub's CSS
*/.hljs[data-v-6359a07c]{color:#24292e;background:#ffffff}.hljs-doctag[data-v-6359a07c],.hljs-keyword[data-v-6359a07c],.hljs-meta .hljs-keyword[data-v-6359a07c],.hljs-template-tag[data-v-6359a07c],.hljs-template-variable[data-v-6359a07c],.hljs-type[data-v-6359a07c],.hljs-variable.language_[data-v-6359a07c]{color:#d73a49}.hljs-title[data-v-6359a07c],.hljs-title.class_[data-v-6359a07c],.hljs-title.class_.inherited__[data-v-6359a07c],.hljs-title.function_[data-v-6359a07c]{color:#6f42c1}.hljs-attr[data-v-6359a07c],.hljs-attribute[data-v-6359a07c],.hljs-literal[data-v-6359a07c],.hljs-meta[data-v-6359a07c],.hljs-number[data-v-6359a07c]


/// </summary>
		WoodenChair_826 = 171686,
		/// <summary>
		/// Type: Chair
		/// </summary>
		WoodenChair_827 = 171687,
		/// <summary>
		/// Type: Chair
		/// </summary>
		WoodenChair_828 = 171688,
		/// <summary>
		/// Type: Chair
		/// </summary>
		WoodenChair_829 = 171689,
		/// <summary>
		/// Type: Chair
		/// </summary>
		WoodenChair_830 = 171690,
		/// <summary>
		/// Type: Chair
		/// </summary>
		WoodenChair_831 = 171691,
		/// <summary>
		/// Type: SpellFocus
		/// Trap: Campfire (ID: 2061, 2061)
		/// </summary>
		DwarvenBrazier_105 = 171692,
		/// <summary>
		/// Type: SpellFocus
		/// Trap: Campfire (ID: 2061, 2061)
		/// </summary>
		DwarvenBrazier_106 = 171693,
		/// <summary>
		/// Type: SpellFocus
		/// Trap: Campfire (ID: 2061, 2061)
		/// </summary>
		DwarvenBrazier_107 = 171694,
		/// <summary>
		/// Type: SpellFocus
		/// Trap: Campfire (ID: 2061, 2061)
		/// </summary>
		DwarvenBrazier_108 = 171695,
		/// <summary>
		/// Type: SpellFocus
		/// </summary>
		DwarvenBrazier_109 = 171696,
		/// <summary>
		/// Type: SpellFocus
		/// </summary>
		DwarvenBrazier_110 = 171697,
		/// <summary>
		/// Type: SpellFocus
		/// </summary>
		DwarvenBrazier_111 = 171698,
		/// <summary>
		/// Type: Mailbox
		/// </summary>
		Mailbox_41 = 171699,
		/// <summary>
		/// Type: SpellFocus
		/// Trap: Campfire (ID: 2061, 2061)
		/// </summary>
		DwarvenBrazier_112 = 171700,
		/// <summary>
		/// Type: SpellFocus
		/// Trap: Campfire (ID: 2061, 2061)
		/// </summary>
		DwarvenBrazier_113 = 171701,
		/// <summary>
		/// Type: SpellFocus
		/// Trap: Campfire (ID: 2061, 2061)
		/// </summary>
		DwarvenBrazier_114 = 171702,
		/// <summary>
		/// Type: SpellFocus
		/// Trap: Campfire (ID: 2061, 2061)
		/// </summary>
		DwarvenBrazier_115 = 171703,
		/// <summary>
		/// Type: Generic
		/// </summary>
		IronforgeArmory = 171704,
		/// <summary>
		/// Type: SpellFocus
		/// Trap: Campfire (ID: 2061, 2061)
		/// </summary>
		DwarvenBrazier_116 = 171705,
		/// <summary>
		/// Type: SpellFocus
		/// Trap: Campfire (ID: 2061, 2061)
		/// </summary>
		DwarvenBrazier_117 = 171706,
		/// <summary>
		/// Type: SpellFocus
		/// Trap: Campfire (ID: 2061, 2061)
		/// </summary>
		DwarvenBrazier_118 = 171707,
		/// <summary>
		/// Type: Generic
		/// </summary>
		TheMilitaryWard_5 = 171708,
		/// <summary>
		/// Type: Generic
		/// </summary>
		TheHighSeat = 171709,
		/// <summary>
		/// Type: Generic
		/// </summary>
		HallOfExplorers_3 = 171710,
		/// <


10.521000000">
    <meta name="changed" content="2020-01-31T06:18:42.262000000">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta http-equiv="Content-Language" content="de">
    <title>
      Bearbeiten der Wahrheitstabelle
    </title>
    <link rel="stylesheet" type="text/css" href="../../style.css">

        Bearbeiten der Wahrheitstabelle

        Wenn Sie das Kombinatorikfenster öffnen, werden Sie sehen, daß es vier Registerkarten enthält.

	    Diese Seite wird die ersten tzwei Registerkarten beschreiben: Eingänge und Ausgänge und Tabelle. Die nächste Seite des Leitfadens beschreibt die letzten zwei Registerkarten:  Ausdruck und  Minimierung.

        Die Registerkarten Eingänge und Ausgänge

	    Die Registerkarte Input & Output ermöglicht es Ihnen, die Listen der Ein- und/oder Ausgänge anzuzeigen und zu editieren und die Breite ihrer Daten zu präzisieren.

	  Um Elemente zur Liste hinzuzufügen, wählen Sie einfach die Zeile mit Auf-Pfeiltasten oder Ab-Pfeiltasten aus oder klicken Sie auf "Klicken sie..." und geben Sie den gewünschten Namen ein. Sie können über der Zeile "c_out" sehen, die in die Liste der Ausgangs eingefügt wurde. Dann können Sie die Datenbreite dieser Linie (rechts) mit der Maus definieren. Mit der Eingabe- oder Tabulatortaste wird die Eingabe beendet.

	  Wenn Sie eine der bestehenden Zeilen umbenennen wollen, können Sie mit einem doppelten Klick den Text ändern

       Um eine Linie zu unterdrücken, wählen Sie sie wie zuvor aus, mit der Maus oder den Tasten Auf-Pfeiltasten oder Ab-Pfeiltasten, und verwenden Sie dann die Delete-Taste.

	    Um die Reihenfolge der Zeilen neu anzuordnen, wählen Sie sie wie oben beschrieben aus und verwenden Sie dann die Kombination Strg-Auf-Pfeil oder Strg-Ab-Pfeil, um sie in der Liste nach oben oder unten zu verschieben.

        Alle Aktionen wirken sich unmittelbar auf die Wahrheitstabelle aus.

        Die Registerkarte "Tabelle"

        In der Registerkarte Tabelle finden Sie eine Reihe von Schaltflächen und die aktuelle Wahrheitstabelle. Diese wird a


のです。
*   **Audio:** Exactly. It's like he's trying to become the embodiment of justice, but it's all built on this foundation of guilt and deception.
*   **Gloss:** "embodiment" は「体現」「具現」。「foundation」は「土台」「基礎」。「deception」は「欺瞞」「騙し」。

**05:48 - 05:54**
*   **Visual:** Window with raindrops, blurred city lights outside. Text overlay: And the setting of the excerpt kind of adds to that whole feeling, you know, this dimly lit bar, the rain outside. そして、抜粋の舞台設定も、その全体の雰囲気に拍車をかけていますね。薄暗がりのバー、外では雨が降っています。
*   **Audio:** And the setting of the excerpt kind of adds to that whole feeling, you know, this dimly lit bar, the rain outside.
*   **Gloss:** "adds to" は「〜に拍車をかける」「〜を増す」。

**05:54 - 05:56**
*   **Visual:** Same rainy window. Text overlay: It's like we're trapped in there with him. まるで、私たちも彼と一緒にそこに閉じ込められているようです。
*   **Audio:** It's like we're trapped in there with him.
*   **Gloss:** "trapped" は「閉じ込められた」「逃れられない」。

**05:56 - 06:01**
*   **Visual:** Same rainy window. Text overlay: Exactly. It's claustrophobic, secretive, like we're in on this confession, but it's also kind of suffocating. その通りです。閉塞的で、秘密めいていて、まるで私たちは彼の告白に同席しているのですが、同時に息苦しい感じもします。
*   **Audio:** Exactly. It's claustrophobic, secretive, like we're in on this confession, but it's also kind of suffocating.
*   **Gloss:** "claustrophobic" は「閉塞感のある」「息苦しい」。「secretive」は「秘密めいた」「隠蔽的な」。「suffocating」は「息苦しい」「窒息させるような」。

**06:01 - 06:12**
*   **Visual:** Same rainy window. Text overlay: Totally. And that's Camus's genius. He creates this atmosphere that mirrors Clamence's internal state, this feeling of being trapped by his own guilt and his need to confess. 全くその通り。それがカミュの天才性なんです。彼はクラマンスの内面の状態を反映するような雰囲気を作り出しているんです。自らの罪悪感に囚われ、告白する必要性に駆られているという気持ち。
*   **Audio:** Totally. And that's Camus's genius. He creates this atmosphere that mirrors Clamence's internal state, this feeling of being trapped by his own guilt and his need to confess.
*   **Gloss:** "genius" は「天才性」「才能」。「mirrors」は「反映する」「映し出す」。「internal state」は「内面の状態」。

**06:12 - 06:25**
*   **Visual:** Silhouette of a person at a bar counter, another figure in the background. Text overlay: And it makes me think about us as readers. We're drawn into this confession, we're listening to Clamence's story, but are we part of the problem? そして、それは読者である私たちについて考えさせられます。私たちは彼の告白に引き込まれ、クラマンスの物語に耳を傾けていますが、私たちも問題の一部になっているのでしょうか？
*   **Audio:** And it makes me think


		return PathFormat.getFullYear();
		} else if ( pattern.indexOf( PathFormat.YEAR ) != -1 ) {
			return PathFormat.getYear();
		} else if ( pattern.indexOf( PathFormat.MONTH ) != -1 ) {
			return PathFormat.getMonth();
		} else if ( pattern.indexOf( PathFormat.DAY ) != -1 ) {
			return PathFormat.getDay();
		} else if ( pattern.indexOf( PathFormat.HOUR ) != -1 ) {
			return PathFormat.getHour();
		} else if ( pattern.indexOf( PathFormat.MINUTE ) != -1 ) {
			return PathFormat.getMinute();
		} else if ( pattern.indexOf( PathFormat.SECOND ) != -1 ) {
			return PathFormat.getSecond();
		} else if ( pattern.indexOf( PathFormat.RAND ) != -1 ) {
			return PathFormat.getRandom( pattern );
		}

		return pattern;

	}

	private static String getTimestamp () {
		return System.currentTimeMillis() + "";
	}

	private static String getFullYear () {
		return new SimpleDateFormat( "yyyy" ).format( PathFormat.currentDate );
	}

	private static String getYear () {
		return new SimpleDateFormat( "yy" ).format( PathFormat.currentDate );
	}

	private static String getMonth () {
		return new SimpleDateFormat( "MM" ).format( PathFormat.currentDate );
	}

	private static String getDay () {
		return new SimpleDateFormat( "dd" ).format( PathFormat.currentDate );
	}

	private static String getHour () {
		return new SimpleDateFormat( "HH" ).format( PathFormat.currentDate );
	}

	private static String getMinute () {
		return new SimpleDateFormat( "mm" ).format( PathFormat.currentDate );
	}

	private static String getSecond () {
		return new SimpleDateFormat( "ss" ).format( PathFormat.currentDate );
	}

	private static String getRandom ( String pattern ) {

		int length = 0;
		pattern = pattern.split( ":" )[ 1 ].trim();

		length = Integer.parseInt( pattern );

		return ( Math.random() + "" ).replace( ".", "" ).substring( 0, length );

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
package top.tangyh.lamp.msg.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import top.tangyh.basic.base.entity.Entity;

import java.time.LocalDateTime;

import static com.baomidou.mybatisplus.annotation.SqlCondition.EQUAL;
import static top.tangyh.lamp.model.constant.Condition.LIKE;

/**
 * <p>
 * 实体类
 * 接口执行日志
 * </p>
 *
 * @author zuihou
 * @date 2022-07-09 23:58:59
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString(callSuper = true)
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@Builder
@TableName("extend_interface_log")
public class ExtendInterfaceLog extends Entity<Long> {
    private static final long serialVersionUID = 1L;

    /**
     * 接口ID;
     * #extend_interface
     */
    @TableField(value = "interface_id", condition = EQUAL)
    private Long interfaceId;
    /**
     * 接口名称
     */
    @TableField(value = "name", condition = LIKE)
    private String name;
    /**
     * 成功次数


lize IPv6 support and register with socket layer.  */
int sctp_v6_protosw_init(void)
{
	int rc;

	rc = proto_register(&sctpv6_prot, 1);
	if (rc)
		return rc;

	/* Add SCTPv6(UDP and TCP style) to inetsw6 linked list. */
	inet6_register_protosw(&sctpv6_seqpacket_protosw);
	inet6_register_protosw(&sctpv6_stream_protosw);

	return 0;
}

void sctp_v6_protosw_exit(void)
{
	inet6_unregister_protosw(&sctpv6_seqpacket_protosw);
	inet6_unregister_protosw(&sctpv6_stream_protosw);
	proto_unregister(&sctpv6_prot);
}

/* Register with inet6 layer. */
int sctp_v6_add_protocol(void)
{
	/* Register notifier for inet6 address additions/deletions. */
	register_inet6addr_notifier(&sctp_inet6addr_notifier);

	if (inet6_add_protocol(&sctpv6_protocol, IPPROTO_SCTP) < 0)
		return -EAGAIN;

	return 0;
}

/* Unregister with inet6 layer. */
void sctp_v6_del_protocol(void)
{
	inet6_del_protocol(&sctpv6_protocol, IPPROTO_SCTP);
	unregister_inet6addr_notifier(&sctp_inet6addr_notifier);
}


; List of bad guy sprites
		section	data
DKnightSprs	dc.l	S_DKNIGHT_ATK1
		dc.l	S_DKNIGHT_ATK2
		dc.l	S_DKNIGHT_ATK3
		dc.l	S_DKNIGHT_ATK4
		dc.l	S_DKNIGHT_WLK1
		dc.l	S_DKNIGHT_WLK2
		dc.l	S_DKNIGHT_WLK3
		dc.l	S_DKNIGHT_WLK4
		dc.l	S_DKNIGHT_DTH1
		dc.l	S_DKNIGHT_DTH2
		dc.l	S_DKNIGHT_DTH3
		dc.l	S_G_KEY,0

DogSprs		dc.l	S_DOG_ATK1
		dc.l	S_DOG_ATK2
		dc.l	S_DOG_ATK3
		dc.l	S_DOG_WLK1
		dc.l	S_DOG_WLK2
		dc.l	S_DOG_WLK3
		dc.l	S_DOG_WLK4
		dc.l	S_DOG_DTH1
		dc.l	S_DOG_DTH2
		dc.l	S_DOG_DTH3,0

NaziSprs	dc.l	S_GUARD_ATK1
		dc.l	S_GUARD_ATK2
		dc.l	S_GUARD_ATK3
		dc.l	S_GUARD_WLK1
		dc.l	S_GUARD_WLK2
		dc.l	S_GUARD_WLK3
		dc.l	S_GUARD_WLK4
		dc.l	S_GUARD_PAIN
		dc.l	S_GUARD_DTH1
		dc.l	S_GUARD_DTH2
		dc.l	S_GUARD_DTH3
		dc.l	S_AMMO,0

HansSprs	dc.l	S_HANS_ATK1
		dc.l	S_HANS_ATK2
		dc.l	S_HANS_ATK3
		dc.l	S_HANS_WLK1
		dc.l	S_HANS_WLK2
		dc.l	S_HANS_WLK3
		dc.l	S_HANS_WLK4
		dc.l	S_HANS_DTH1
		dc.l	S_HANS_DTH2
		dc.l	S_HANS_DTH3
		dc.l	S_G_KEY,0

HitlerSprs	dc.l	S_HITLER_ATK1
		dc.l	S_HITLER_ATK2
		dc.l	S_HITLER_ATK3
		dc.l	S_HITLER_WLK1
		dc.l	S_HITLER_WLK2
		dc.l	S_HITLER_WLK3
		dc.l	S_HITLER_WLK4
		dc.l	S_HITLER_DTH1
		dc.l	S_HITLER_DTH2
		dc.l	S_HITLER_DTH3
		dc.l	S_MHITLER_ATK1
		dc.l	S_MHITLER_ATK2
		dc.l	S_MHITLER_ATK3
		dc.l	S_MHITLER_DIE1
		dc.l	S_MHITLER_DIE2
		dc.l	S_MHITLER_DIE3
		dc.l	S_MHITLER_DIE4
		dc.l	S_MHITLER_WLK1
		dc.l	S_MHITLER_WLK2
		dc.l	S_MHITLER_WLK3
		dc.l	S_MHI


u1eddi",currentmarker:"B\u1ed9 t\u1ea1o hi\u1ec7n th\u1eddi",captioningid:"id \u0111\u1ea7u \u0111\u1ec1",baseurl:"Base URL",balance:"C\u00e2n b\u1eb1ng",windowlessvideo:"Video kh\u00f4ng c\u1eeda s\u1ed5",stretchtofit:"D\u00e3n \u0111\u1ec3 ph\u00f9 h\u1ee3p",mute:"T\u1eaft \u00e2m thanh",invokeurls:"URL tri\u1ec7u g\u1ecdi",fullscreen:"To\u00e0n m\u00e0n h\u00ecnh",enabled:"Cho ph\u00e9p",autostart:"T\u1ef1 \u0111\u1ed9ng b\u1eaft \u0111\u1ea7u",volume:"\u00c2m l\u01b0\u1ee3ng",target:"\u0110\u00edch",qtsrcchokespeed:"T\u1ed1c \u0111\u1ed9 Choke",href:"Href",endtime:"Th\u1eddi gian k\u1ebft th\u00fac",starttime:"Th\u1eddi gian b\u1eaft \u0111\u1ea7u",enablejavascript:"Cho ph\u00e9p JavaScript",correction:"Kh\u00f4ng ch\u1ec9nh",targetcache:"B\u1ed9 nh\u1edb \u0111\u1ec7m \u0111\u00edch",playeveryframe:"Ph\u00e1t t\u1ea5t c\u1ea3 khung",kioskmode:"Ch\u1ebf \u0111\u1ed9 Kiosk",controller:"Tr\u00ecnh \u0111i\u1ec1u khi\u1ec3n",menu:"Hi\u1ec3n th\u1ecb menu",loop:"L\u1eb7p",play:"T\u1ef1 \u0111\u1ed9ng ph\u00e1t",hspace:"H-Space",vspace:"V-Space","class_name":"L\u1edbp",name:"T\u00ean",id:"Id",type:"Ki\u1ec3u",size:"K\u00edch th\u01b0\u1edbc",preview:"Xem tr\u01b0\u1edbc","constrain_proportions":"R\u00e0ng bu\u1ed9c t\u1ec9 l\u1ec7",controls:"\u0110i\u1ec1u khi\u1ec3n",numloop:"S\u1ed1 l\u1eb7p",console:"B\u00e0n \u0111i\u1ec1u khi\u1ec3n",cache:"B\u1ed9 nh\u1edb \u0111\u1ec7m",autohref:"AutoHREF",liveconnect:"SWLiveConnect",flashvars:"Flashvars",base:"C\u01a1 s\u1edf",bgcolor:"N\u1ec1n",wmode:"WMode",salign:"SAlign",align:"Canh l\u1ec1",scale:"T\u1ec9 l\u1ec7",quality:"Ch\u1ea5t l\u01b0\u1ee3ng",shuffle:"Kh\u00f4ng theo tr\u1eadt t\u1ef1",prefetch:"T\u00ecm n\u1ea1p tr\u01b0\u1edbc",nojava:"Kh\u00f4ng c\u00f3 java",maintainaspect:"Duy tr\u00ec c\u1ea1nh",imagestatus:"Tr\u1ea1ng th\u00e1i \u1ea3nh",center:"Gi\u1eefa",autogotourl:"T\u1ef1 \u0111\u1ed9ng nh\u1ea3y t\u1edbi URL","shockwave_options":"T\u00f9y ch\u1ecdn Shockwave","rmp_options":"T\u00f9y ch\u1ecdn tr\u00ecnh ch\u01a1i media Real","wmp_options":"T\u00f9y ch\u1ecdn tr\u00ecnh ch\u01a1i media Windows","qt_options":"T\u00f9y ch\u1ecdn Quicktime","flash_options":"T\u00f9y ch\u1ecdn Flash",hidden:"\u1ea8n","align_bottom_left":"D\u01b0\u1edbi c\u00f9ng tr\u00e1i","align_bottom_right":"D\u01b0\u1edbi c\u00f9ng ph\u1ea3i",flash:"",quicktime:"","embedded_audio_options":"Embedded Audio Options",windowsmedia:"",realmedia:"",shockwave:"",audio:"",video:"","html5_video_options":"HTML5 Video Options",altsource1:"


searchbar-outer">
                        <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
                    </form>

My solution

My solution is in src/main.rs.

#![no_main]
#![no_std]

use core::str;

use cortex_m_rt::entry;
use embedded_hal::delay::DelayNs;
use panic_rtt_target as _;
use rtt_target::rtt_init_print;

use microbit::{
    hal::uarte::{self, Baudrate, Parity},
    hal::{twim, Timer},
    pac::twim0::frequency::FREQUENCY_A,
};

use core::fmt::Write;
use heapless::Vec;
use lsm303agr::{AccelMode, AccelOutputDataRate, Lsm303agr, MagMode, MagOutputDataRate};

use serial_setup::UartePort;

#[entry]
fn main() -> ! {
    rtt_init_print!();
    let board = microbit::Board::take().unwrap();

    let serial = uarte::Uarte::new(
        board.UARTE0,
        board.uart.into(),
        Parity::EXCLUDED,
        Baudrate::BAUD115200,
    );
    let mut serial = UartePort::new(serial);

    let i2c = { twim::Twim::new(board.TWIM0, board.i2c_internal.into(), FREQUENCY_A::K100) };
    let mut timer0 = Timer::new(board.TIMER0);

    let mut sensor = Lsm303agr::new_with_i2c(i2c);
    sensor.init().unwrap();
    sensor
        .set_accel_mode_and_odr(
            &mut timer0,
            AccelMode::HighResolution,
            AccelOutputDataRate::Hz50,
        )
        .unwrap();
    sensor
        .set_mag_mode_and_odr(
            &mut timer0,
            MagMode::HighResolution,
            MagOutputDataRate::Hz50,
        )
        .unwrap();
    let mut sensor = sensor.into_mag_continuous().ok().unwrap();
    let mut buffer: Vec<u8, 32> = Vec::new();

    loop {
        buffer.clear();

        loop {
            let byte = serial.read().unwrap();

            if byte == b'\r' {
                break;
            }

            if buffer.push(byte).is_err() {
                write!(serial, "error: buffer full\r\n").unwrap();
                break;
            }
        }

        if str::from_utf8(&buffer).unwrap().trim() == "accelerometer" {
            while !sensor.accel_status().unwrap().xyz_new_data() {
                timer0.delay_ms(1u32);
            }

            let (x, y, z) = sensor.acceleration().unwrap().xy


      .comment-form .email {
        padding-left: 0px; } }
  .comment-form .form-control {
    padding: 8px 20px;
    background: #fff;
    border: none;
    border-radius: 0px;
    width: 100%;
    font-size: 14px;
    color: #777777;
    border: 1px solid transparent; }
    .comment-form .form-control:focus {
      box-shadow: none;
      border: 1px solid #eee; }
  .comment-form textarea.form-control {
    height: 140px;
    resize: none; }
  .comment-form ::-webkit-input-placeholder {
    /* Chrome/Opera/Safari */
    font-size: 13px;
    color: #777; }
  .comment-form ::-moz-placeholder {
    /* Firefox 19+ */
    font-size: 13px;
    color: #777; }
  .comment-form :-ms-input-placeholder {
    /* IE 10+ */
    font-size: 13px;
    color: #777; }
  .comment-form :-moz-placeholder {
    /* Firefox 18- */
    font-size: 13px;
    color: #777; }

.contributors-list{
  text-align: center;
  list-style-type: none;
  -webkit-column-count: 2;
  -moz-column-count: 2;
  column-count: 2;
}

/*============ End Blog Single Styles  =============*/
/*---------------------------------------------------- */
/*----------------------------------------------------*/
/* Home Map Area css
============================================================================================ */
.home_map_area {
  position: relative; }
  .home_map_area .mapBox2 {
    min-height: 600px; }
  .home_map_area .home_details {
    position: absolute;
    right: 0px;
    width: 100%;
    z-index: 10;
    top: 50%;
    transform: translateY(-50%); }
    .home_map_area .home_details .box_home_details {
      background: #fff;
      max-width: 457px;
      float: right;
      width: 100%;
      padding-left: 92px;
      padding-right: 92px;
      padding-top: 112px;
      padding-bottom: 112px;
      border-radius: 10px; }
      .home_map_area .home_details .box_home_details .media {
        margin-bottom: 26px; }
        .home_map_area .home_details .box_home_details .media:last-child {
          margin-bottom: 0px; }
        .home_map_area .home_details .box_home_details .media .d-flex {
          padding-right: 20px; }
          .home_map_area .home_details .box_home_details .media .d-flex i {
            font-size: 20px;
            background: linear-gradient(to right, #2c28b1 0%, #9b5cf6 70%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent; }
        .home_map_area .home_details .box_home_details .media .media-body h4 {
          font-size: 14px;
          color: #222222;
          text-transform: uppercase; }
        .home_map_area .home_details .box_home_details .media .media-body p {
          margin-bottom: 0px; }

/* End Home Map Form Area css
============================================================================================ */
/* Reservation Form Area css
============================================================================================ */
.reservation_form_area .res_form_inner {
  max-width: 555px;
  margin: auto


t one. If not, show a prompt to the
  /// user.
  Future<Function()?> _checkForUpdates() async {
    try {
      final lastUpdateCheck = context.lastUpdateCheck ?? DateTime.now();
      if (context.updateCheckDisabled) return null;
      final oneDay = lastUpdateCheck.add(const Duration(days: 1));

      if (DateTime.now().isBefore(oneDay)) {
        return null;
      }

      LocalAppConfig.read()
        ..lastUpdateCheck = DateTime.now()
        ..save();

      final isUpToDate = await _pubUpdater.isUpToDate(
        packageName: kPackageName,
        currentVersion: packageVersion,
      );

      if (isUpToDate) return null;

      final latestVersion = await _pubUpdater.getLatestVersion(kPackageName);

      return () {
        final updateAvailableLabel = lightYellow.wrap('Update available!');
        final currentVersionLabel = lightCyan.wrap(packageVersion);
        final latestVersionLabel = lightCyan.wrap(latestVersion);

        logger
          ..info()
          ..info(
            '$updateAvailableLabel $currentVersionLabel \u2192 $latestVersionLabel',
          )
          ..info();
      };
    } catch (_) {
      return () {
        logger.debug("Failed to check for updates.");
      };
    }
  }

  /// Checks for deprecated environment variables and shows warnings
  void _checkDeprecatedEnvironmentVariables() {
    // Check for deprecated variables (no longer supported)
    final deprecatedVars = {'FVM_GIT_CACHE': 'FVM_FLUTTER_URL'};

    // Check for legacy variables (still supported but discouraged)
    final legacyVars = {'FVM_HOME': 'FVM_CACHE_PATH'};

    var hasDeprecated = false;
    for (final entry in deprecatedVars.entries) {
      if (context.environment.containsKey(entry.key)) {
        if (!hasDeprecated) {
          logger.warn('Deprecated environment variables detected:');
          hasDeprecated = true;
        }
        logger.warn('  ${entry.key} → Use ${entry.value} instead');
      }
    }

    var hasLegacy = false;
    for (final entry in legacyVars.entries) {
      if (context.environment.containsKey(entry.key) &&
          !context.environment.containsKey(entry.value)) {
        if (!hasLegacy) {
          logger.info('Legacy environment variables detected:');
          hasLegacy = true;
        }
        logger.info('  ${entry.key} → Consider using ${entry.value}');
      }
    }

    if (hasDeprecated || hasLegacy) logger.info('');
  }

  Logger get logger => context.get();

  @override
  void printUsage() => logger.info(usage);

  @override
  Future<int> run(Iterable<String> args) async {
    try {
      final argResults = parse(args);

      if (argResults['verbose'] == true) {
        logger.level = Level.verbose;
      }

      final exitCode = await runCommand(argResults) ?? ExitCode.success.code;

      return exitCode;
    } on ForceExit catch (e) {
      logger.info(e.message);

      return e.exitCode;
    } on AppDetailedException catch (err, stackTrace) {
      logger
        ..fail(err.message)
        ..err()
        ..err(err.info);
      logger.logTrace(stackTrace);

      return ExitCode.unavailable.code;
    } on FileSystemException catch (err, stackTrace) {
      if (checkIfNeedsPrivilegePermission(err)) {
        logger
          ..info()
          ..fail('Requires administrator privileges to run this command.')
          ..info();

        logger.notice(
          "You don't have the required privileges to run this command.\n"
          "Try running with sudo or administrator privileges.\n"


#ifndef INPUT_DEVICE_H
#define INPUT_DEVICE_H

#include <stdbool.h>

typedef struct fake_wiimote_t fake_wiimote_t;
typedef struct input_device_t input_device_t;
typedef struct egc_input_device_t egc_input_device_t;

typedef struct input_device_ops_t {
    int (*resume)(void *usrdata, fake_wiimote_t *wiimote);
    int (*suspend)(void *usrdata);
    int (*set_leds)(void *usrdata, int leds);
    int (*set_rumble)(void *usrdata, bool rumble_on);
    bool (*report_input)(void *usrdata);
} input_device_ops_t;

void input_devices_init(void);
void input_devices_tick(void);

/** Used by input devices **/

void input_device_handle_added(egc_input_device_t *device, void *userdata);
void input_device_handle_removed(egc_input_device_t *device, void *userdata);
void input_device_handle_updated(egc_input_device_t *device, void *userdata);

/** Used by fake Wiimotes and fake Wiimote manager **/

input_device_t *input_device_get_unassigned(void);

void input_device_assign_wiimote(input_device_t *input_device, fake_wiimote_t *wiimote);
void input_device_release_wiimote(input_device_t *input_device);

int input_device_resume(input_device_t *input_device);
int input_device_suspend(input_device_t *input_device);
int input_device_set_leds(input_device_t *input_device, int leds);
int input_device_set_rumble(input_device_t *input_device, bool rumble_on);
bool input_device_report_input(input_device_t *input_device);

#endif


 equalTo(Success(processed))
        )
    }

    private fun checkPendingRequest(expected: List<Postbox.PendingRequest>) {
        assertThat(transactor.perform { it.pendingRequests(10, timeSource()) }, equalTo(expected))
    }

    private fun store(requestId: RequestId, request: Request) {
        transactor.perform { it.store(requestId, request) }
    }
}

package org.http4k.ai.mcp

import dev.forkhandles.result4k.Failure
import dev.forkhandles.result4k.Success
import org.http4k.ai.llm.LLMError
import org.http4k.ai.llm.LLMError.Custom
import org.http4k.ai.llm.LLMError.Http
import org.http4k.ai.llm.LLMError.Internal
import org.http4k.ai.llm.LLMError.Timeout
import org.http4k.ai.llm.model.Message.ToolResult
import org.http4k.ai.llm.tools.ToolRequest
import org.http4k.ai.llm.tools.ToolResponse
import org.http4k.ai.mcp.McpError.Protocol
import org.http4k.ai.mcp.ToolResponse.Error
import org.http4k.ai.mcp.ToolResponse.Ok
import org.http4k.ai.mcp.model.Content

fun McpError.toLLM(): LLMError = when (this) {
    is McpError.Http -> Http(response)
    is McpError.Internal -> Internal(cause)
    is Protocol -> Custom(error)
    McpError.Timeout -> Timeout
}

fun org.http4k.ai.mcp.ToolResponse.toLLM(request: ToolRequest) = when (this) {
    is Ok -> Success(
        ToolResponse(
            (content ?: emptyList())
                .filterIsInstance<Content.Text>()
                .map { ToolResult(request.id, request.name, it.text) }
                .first())
    )

    is Error -> Failure(Protocol(error).toLLM())
}
package org.http4k.ai.mcp.client.websocket

import dev.forkhandles.result4k.Failure
import dev.forkhandles.result4k.Result
import dev.forkhandles.result4k.Success
import dev.forkhandles.result4k.flatMap
import dev.forkhandles.result4k.flatMapFailure
import dev.forkhandles.result4k.map
import dev.forkhandles.result4k.resultFrom
import org.http4k.ai.mcp.McpError
import org.http4k.ai.mcp.McpError.Internal
import org.http4k.ai.mcp.McpError.Timeout
import org.http4k.ai.mcp.client.AbstractMcpClient
import org.http4k.ai.mcp.model.McpEntity
import org.http4k.ai.mcp.model.McpMessageId
import org.http4k.ai.mcp.protocol.ClientCapabilities
import org.http4k.ai.mcp.protocol.ClientCapabilities.Companion.All
import org.http4k.ai.mcp.protocol.ProtocolVersion
import org.http4k.ai.mcp.protocol.ProtocolVersion.Companion.LATEST_VERSION
import org.http4k.ai.mcp.protocol.Version
import org.http4k.ai.mcp.protocol.VersionedMcpEntity
import org.http4k.ai.mcp.protocol.messages.ClientMessage
import org.http4k.ai.mcp.protocol.messages.McpRpc
import org.http4k.ai.mcp.util.McpJson
import org.http4k.ai.mcp.util.McpNodeType
import org.http4k.core.Request
import org.http4k.core.with
import org.http4k.format.renderRequest
import org.http4k.format.renderResult
import org.http4k.lens.Header
import org.http4k.lens.MCP_PROTOCOL_VERSION
import org.http4k.sse.SseMessage
import org.http4k.sse.SseMessage.Event
import org.http4k.websocket.WebsocketFactory
import org.http4k.websocket.WsMessage
import java.time.Duration
import java.util.concurrent.CountDownLatch
import java.util.concurrent.LinkedBlockingQueue
import java.util.concurrent.TimeUnit.MILLISECONDS
import kotlin.random.Random

/**


enames;

bool hasOutfile;
char *outfilename;

int target;

std::unordered_map<std::string, std::string> var_addr_map;

std::vector<std::string> ipaddr_buffer;
std::vector<std::vector<std::string>> report_dataset_buffer;
std::vector<std::string> controlVariables;
std::vector<std::string> mapvaraddr_buffer;

using namespace pugi;

/*
    Trims leading and trailing whitespaces from string
*/
std::string trimWhitespace(std::string line)
{
    int startIndex = line.find_first_not_of(" \n\r\t");
    int endIndex = line.find_last_not_of(" \n\r\t");
    int count = endIndex - startIndex + 1;

    if (startIndex < 0 || endIndex < 0) {
        return line;
    }

    return line.substr(startIndex, count);
}

/*
    Function to get IP address from SCL file.
    Called only for client target.
*/
void get_IP_address(xml_document &sclfile)
{
    xml_node conap = sclfile.child("SCL").child("Communication").child("SubNetwork").child("ConnectedAP");
    std::string iedName = conap.attribute("iedName").value();
    for (xml_node ip = conap.child("Address").child("P"); ip; ip = ip.next_sibling("P")) {
        std::string iptype = ip.attribute("type").value();
        if (iptype.compare("IP") == 0) {
            ipaddr_buffer.push_back((std::string)ip.first_child().text().as_string());
        }
    }
}

/*
    Called by get_report_dataset()
    Function to get dataset details from SCL file (assume only 1 logical device).
*/

std::string get_dataSet_reference(xml_document &sclfile, std::string given_name)
{
    xml_node phydev = sclfile.child("SCL").child("IED");
    std::string ied_name = phydev.attribute("name").value();

    xml_node logdev = phydev.child("AccessPoint").child("Server").child("LDevice");
    //pdld_name = pdld_name + logdev.attribute("inst").value();

    for (xml_node ld_node = logdev; ld_node; ld_node = ld_node.next_sibling("LDevice")) {
 	xml_node ln_node = ld_node.child("LN0");
        std::string pdld_name = ied_name + ld_node.attribute("inst").value();
	//std::cout << "DATASETNAME: " <<pdld_name << "\n";

    	for (xml_node dataset = ln_node.child("DataSet"); dataset; dataset = dataset.next_sibling("DataSet")) {
        	std::string dataset_name = dataset.attribute("name").value();
		//std::cout << "REPORTNAME: " <<(pdld_name + "/LLN0$" + dataset_name) << "\n";
        	if (dataset_name.compare(given_name) == 0) {

            		return (pdld_name + "/LLN0$" + dataset_name);
        	}

    	}
    }
    return "X";
}

/*
    Function to get report details from SCL file (assume only 1 logical device).
    Called only for client target.
*/

void get_report_dataset(xml_document &sclfile)
{
    std::vector<std::string> reports_datasets;
    xml_node phydev = sclfile.child("SCL").child("IED");
    std::string ied_name = phydev.attribute("name").value();

    xml_node logdev = phydev.child("AccessPoint").child("Server").child("LDevice");
    //pdld_name = pdld_name + logdev.attribute("inst").value();

     for (xml_node ld_node = logdev; ld_node; ld_node = ld_node.next_sibling("LDevice")) {
 	xml_node ln_node = ld_node.child("LN0");
        std::string pdld_name = ied_name + ld_node.attribute("inst").value();

        for (xml_node report = ln_node.child("Repor


rv := objc.Call[float64](b_, objc.Sel("columnContentWidthForColumnWidth:"), columnWidth)
	return rv
}

// Scrolls columns left by the specified number of columns. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/appkit/nsbrowser/1407747-scrollcolumnsleftby?language=objc
func (b_ Browser) ScrollColumnsLeftBy(shiftAmount int) {
	objc.Call[objc.Void](b_, objc.Sel("scrollColumnsLeftBy:"), shiftAmount)
}

// Returns the rectangle containing the specified column, not including borders. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/appkit/nsbrowser/1407617-frameofinsideofcolumn?language=objc
func (b_ Browser) FrameOfInsideOfColumn(column int) foundation.Rect {
	rv := objc.Call[foundation.Rect](b_, objc.Sel("frameOfInsideOfColumn:"), column)
	return rv
}

// Returns the width of the specified column. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/appkit/nsbrowser/1407778-widthofcolumn?language=objc
func (b_ Browser) WidthOfColumn(column int) float64 {
	rv := objc.Call[float64](b_, objc.Sel("widthOfColumn:"), column)
	return rv
}

// Loads column 0; unloads previously loaded columns. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/appkit/nsbrowser/1407745-loadcolumnzero?language=objc
func (b_ Browser) LoadColumnZero() {
	objc.Call[objc.Void](b_, objc.Sel("loadColumnZero"))
}

// Loads, if necessary, and returns the cell at the specified row and column location. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/appkit/nsbrowser/1407581-loadedcellatrow?language=objc
func (b_ Browser) LoadedCellAtRowColumn(row int, col int) objc.Object {
	rv := objc.Call[objc.Object](b_, objc.Sel("loadedCellAtRow:column:"), row, col)
	return rv
}

// Specifies the selected rows in a given column of the browser. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/appkit/nsbrowser/1407618-selectrowindexes?language=objc
func (b_ Browser) SelectRowIndexesInColumn(indexes foundation.IIndexSet, column int) {
	objc.Call[objc.Void](b_, objc.Sel("selectRowIndexes:inColumn:"), indexes, column)
}

// Returns the item that contains the children located in the specified column. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/appkit/nsbrowser/1407570-parentforitemsincolumn?language=objc
func (b_ Browser) ParentForItemsInColumn(column int) objc.Object {
	rv := objc.Call[objc.Object](b_, objc.Sel("parentForItemsInColumn:"), column)
	return rv
}

// Returns whether the specified item is a leaf item. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/appkit/nsbrowser/1407713-isleafitem?language=objc
func (b_ Browser) IsLeafItem(item objc.IObject) bool {
	rv := objc.Call[bool](b_, objc.Sel("isLeafItem:"), item)
	return rv
}

// Returns the column width for the width of the given column’s content. [Full Topic]
//
// [Full Topic]: https://developer.apple.com/documentation/appkit/nsbrowser/1407648-columnwidthforcolumncontentwidth?language=objc
func (b_ Browser) ColumnWidthForColumnContentWid


    public Gradient gradient = new Gradient();
        public int size = 16;
        public bool up = false;
        public bool overwriteExisting = true;
    }


right:0}.video_sub_sidebar .scroll_card .style_card .style_img[data-v-d27b9c11]{width:100%;height:100%;border-radius:10px}.video_sub_sidebar .scroll_card .style_card .style_name[data-v-d27b9c11]{width:100%;height:26px;color:#fff;font-size:12px;position:absolute;bottom:0;border-bottom-left-radius:5px;border-bottom-right-radius:5px;text-align:center;line-height:26px}.video_sub_sidebar .scroll_card .style_card .def_style_name[data-v-d27b9c11]{width:100%;text-align:center;color:#fff;font-size:12px;position:absolute;bottom:6px}.video_sub_sidebar .scroll_card .size_card[data-v-d27b9c11]{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap}.video_sub_sidebar .scroll_card .size_card .size_item[data-v-d27b9c11]{width:80px;height:80px;margin-bottom:10px;border-radius:10px;display:flex;flex-direction:column;align-items:center;justify-content:center;cursor:pointer}.video_sub_sidebar .scroll_card .size_card .size_item.selected[data-v-d27b9c11]{border:2px solid #0066ff}.video_sub_sidebar .scroll_card .camera_controller_card[data-v-d27b9c11]{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap}.video_sub_sidebar .scroll_card .camera_controller_card .camera_controller_item[data-v-d27b9c11]{display:flex;align-items:center;margin-bottom:10px;cursor:pointer}.video_sub_sidebar .scroll_card .camera_controller_card .camera_controller_item .camera_controller_img[data-v-d27b9c11]{width:20px;height:20px;margin:4px 12px}.setParameterBox[data-v-d27b9c11]{width:99%;border-radius:12px 12px 0 0;padding-bottom:20px}.uploadPic[data-v-d27b9c11]{margin-top:16px}.uploadPic .upload[data-v-d27b9c11]{display:fle;margin-top:6px;width:100%;height:175px;border-radius:8px;overflow:hidden}.uploadPic .upload .title[data-v-d27b9c11]{text-align:center;cursor:pointer}.uploadPic .upload .uploadOther[data-v-d27b9c11]{padding:3px 8px;display:flex;justify-content:space-between}.sizeMain[data-v-d27b9c11]{display:flex;flex-wrap:wrap;gap:6px}.sizeMain .sizeItem[data-v-d27b9c11]{padding:10px 18px;border-radius:var(--8, 8px);font-size:10px;width:86px;height:90px;display:flex;flex-direction:column;align-items:center;justify-content:space-between;cursor:pointer}.sizeMain .sizeItem .size[data-v-d27b9c11]{border-radius:2px}.noText[data-v-d27b9c11]{margin-top:16px}.noText .inpBox[data-v-d27b9c11]{max-width:50%;height:100px;padding:8px;border-radius:12px;margin-top:6px}.noText .inpBox .inp[data-v-d27b9c11]{width:100%;height:50px;resize:none;background-color:transparent}.advancedBox[data-v-d27b9c11]{margin-top:16px}


                   }
                }
                _ => {}
            }
        }
    }

    Ok(())
}

/// Check that some impure function producing a side effect is called or return an error
pub fn check_side_effects(tables: &mut GenerationTables) -> Result<()> {
    for function in &tables.functions {
        if function.is_impure() {
            return Ok(());
        }
    }

    bail!("Flow has no side-effects")
}

fn connection_to(tables: &GenerationTables, input: &Route) -> bool {
    for connection in &tables.collapsed_connections {
        if connection.to_io().route() == input {
            return true;
        }
    }
    false
}
<reponame>Shipica/Shipica.github.io
//! Mathematical point on the 2D (x, y) plane.

use super::vec2::Vec2;

use std::ops::{Add, AddAssign, Sub};

/// Mathematical point on the 2D (x, y) plane.
#[derive(Copy, Clone, Debug, Default, PartialEq)]
#[repr(C)]
pub struct Point {
    /// Horizontal component
    pub x: f64,
    /// Vertical component
    pub y: f64,
}

/// Mathematical origin point on the real number plane.
pub const ORIGIN: Point = Point::ORIGIN;

impl Point {
    /// Mathematical origin point on the real number plane.
    pub const ORIGIN: Point = Point { x: 0.0, y: 0.0 };

    /// Construct a point from the components
    #[inline]
    pub fn new(x: f64, y: f64) -> Self {
        Point { x, y }
    }

    #[inline]
    pub fn to_vector(self) -> Vec2 {
        self - ORIGIN
    }

    /// Rounds the values in the point to the nearest integer, rounding away
    /// from zero in the half-way case.
    ///
    /// See [f64::round][1]
    ///
    /// [1]: https://doc.rust-lang.org/std/primitive.f64.html#method.round
    #[inline]
    pub fn rounded(self) -> Point {
        Point {
            x: self.x.round(),
            y: self.y.round(),
        }
    }

    /// Determines if the components of two points are less than `epsilon`
    /// distance from each other. Be wary that this does not check the actual
    /// distance, but a component-wise distance check. If you desire a more
    /// precise distance check, consider subtracting one point from the other
    /// and comparing the length(_sq) of the resulting vector.
    #[inline]
    pub fn is_approx_eq(self, other: impl Into<Point>, epsilon: f64) -> bool {
        let other = other.into();
        (self.x - other.x).abs() <= epsilon && (self.y - other.y).abs() <= epsilon
    }
}

impl<V> Add<V> for Point
where
    V: Into<Vec2>,
{
    type Output = Point;

    #[inline]
    fn add(self, rhs: V) -> Point {
        let rhs = rhs.into();
        Point {
            x: self.x + rhs.x,
            y: self.y + rhs.y,
        }
    }
}

impl<V> AddAssign<V> for Point
where
    V: Into<Vec2>,
{
    fn add_assign(&mut self, rhs: V) {
        let rhs = rhs.into();
        self.x += rhs.x;
        self.y += rhs.y;
    }
}

impl Sub for Point {
    type Output = Vec2;

    #[inline]
    fn sub(self, rhs: Point) -> Vec2 {
        Vec2 {
            x: self.x - rhs.x,
            y: self.y - rhs.y,
        }
    }
}

impl Sub<(f64, f64)> for Point {
    type Output = Vec2;


 40%;
	height: 100%;
	text-align: center;
	font-size: 19px;
	color:#daebff;
}

/* Leaderboard Legend */
.LeaderboardLegend {
	width: 100%;
	height: 40px;
	flow-children: right;
	/* border-bottom: 1px solid white; */
}

/* Leaderboard */
.LeaderboardGames {
	width: 100%;
	height: 45px;
	flow-children: right-wrap;
	border-top: 1px solid #3f464ecc;
}

.LeaderboardRank {
	width: 10%;
	text-align: center;
	font-size: 19px;
	color:#daebff;
	align:  center center;
}

.LeaderboardAvatar {
	width: 15%;
	height: 90%;
	border: 0;
	align:  center top;
}

.LeaderboardXP {
	width: 50%;
	align:  center center;
}

.LeaderboardIMR {
	width: 25%;
	align:  center center;
}

#PlayerContent
{
	width: 100%;
	height: fit-children;
	flow-children: right;
}

#RadiantPlayers
{
	width: 50%;
	height: fit-children;
	background-color: #005000da;
	flow-children: down;
}

#DirePlayers
{
	width: 50%;
	height: fit-children;
	background-color: #500000da;
	flow-children: down;
}

.TeamTitle {
	width: 100%;
	height: 40px;
	text-align: center;
	font-size: 24px;
	font-weight: bolder;
	color:#fff;
}

#TabsButtonWrapper {
	border-top:  1px solid #29353b;
	padding-top:  10px;
	padding-bottom:  10px;
	width: 100%;
	flow-children: down;
	background-color:  gradient( linear, 0% 0, 0 100%, from( #414f6245 ), color-stop( 0.9, #13161a00 ), to( #13161a00 ) );
	/* background-color: #414f62; */
}

.MiniTabButtonContainer {
	flow-children: right;
	width: 100%;
	align:  center top;
	background-color: #04050780;
	margin: 10px 5px 0;
	padding: 4px 10px 0px;
	visibility: collapse;
}
.sub_nav_tab {
	padding:  9px 10px;
	flow-children: right;
}
.sub_nav_tab Label {
	transition-property: color, text-shadow;
	transition-duration: 0.2s;
	text-transform: uppercase;
//	letter-spacing: 0.5px;
	color: #606366;
}
.sub_nav_tab.active Label,
.sub_nav_tab:hover Label {
	color: #e9ebed;
	text-shadow: 1px 1px 8px 2.0 #6ab5ff12;
}
.tab_separator {
	align: center center;
	margin: 0 20px;
}
.tab_separator Label {
	color: #606366;
}
#TabButtonContainer {
	flow-children: right;
	margin-left:  10px;
	margin-right:  10px;
	align:  center top;
}
#CloseButton {
	width: 90px;
	height: 37px;
	align: left center;
}
#CloseButtonImage {
	width: 37px;
	height: 37px;
	align: left center;
	background-image: url("file://panorama/images/custom_game/battlepass/assets/close.png");
	opacity: 0.5;
}
#CloseButton:hover #CloseButtonImage {
	opacity: 1;
}
#SettingsButton {
	width: 37px;
	height: 37px;
	align: right center;
}
#SettingsButtonImage {
	width: 37px;
	height: 37px;


        );
      }
    });

    test('Sorted', () {
      for (final s1xy in [
        series1xy,
        series1xy.packed(),
        series1xy.packed(singlePrecision: true),
        PositionSeries.view(series1xy.values.toList()),
      ]) {
        expect(
          s1xy.sorted((a, b) => ((a.x + a.y) - (b.x + b.y)).round()).values,
          [1.0, 1.0, 1.0, 2.0, 2.0, 2.0],
        );
        expect(
          s1xy.sorted((a, b) => -((a.x + a.y) - (b.x + b.y)).round()).values,
          [2.0, 2.0, 1.0, 2.0, 1.0, 1.0],
        );
      }
    });

    test('Filtered', () {
      for (final s1xy in [
        series1xy,
        series1xy.packed(),
        series1xy.packed(singlePrecision: true),
        PositionSeries.view(series1xy.values.toList()),
      ]) {
        expect(
          s1xy.filtered((count, index, pos) => pos.x + pos.y <= 3.5).values,
          [1.0, 1.0, 1.0, 2.0],
        );
        expect(
          s1xy.filtered((count, index, pos) => index < count - 2).values,
          [1.0, 1.0],
        );
        expect(
          s1xy.reversed().filtered((count, index, pos) => true).values,
          [2.0, 2.0, 1.0, 2.0, 1.0, 1.0],
        );
        expect(
          s1xy.reversed().filtered((count, index, pos) => false).values,
          <double>[],
        );
      }
    });

    test('Length2D', () {
      expect(series1xy.length2D(), 2.0);
      expect(series1xy.reversed().length2D(), 2.0);

      expect(series2xy.length2D(), 2.8284271247461903);
      expect(series2xy.range(1).length2D(), 1.4142135623730951);
    });

    test('Length3D', () {
      expect(series3xyz.length3D(), 3.0);
      expect(series3xyz.reversed().length3D(), 3.0);
    });

    test('Area2D and centroid2D (and partially distance2D)', () {
      final rectangle = [
        [1.0, 1.0].xy,
        [2.0, 1.0].xy,
        [2.0, 2.0].xy,
        [1.0, 2.0].xy,
        [1.0, 1.0].xy,
      ].series();
      final rectangleNC = rectangle.range(0, 4);
      expect(rectangle.signedArea2D(), 1.0);
      expect(rectangle.range(0, 4).signedArea2D(), 1.0);
      expect(rectangle.range(0, 3).signedArea2D(), 0.5);
      expect(rectangle.range(1, 5).signedArea2D(), 1.0);
      expect(rectangle.reversed().signedArea2D(), -1.0);
      expect((rectangle * 2.0).signedArea2D(), 4.0);
      expect((rectangle * -3.0).signedArea2D(), 9.0);
      expect(rectangle.length2D(), 4.0);
      expect(rectangle.range(0, 4).length2D(), 3.0);
      expect(rectangle.centroid2D(), [1.5, 1.5].xy);
      expect((


payload[\"password\"] = password;\n    }\n    if (typeof oldPassword !== \"undefined\") {\n      payload[\"oldPassword\"] = oldPassword;\n    }\n    const uri = new URL(this.client.config.endpoint + apiPath);\n    const apiHeaders = {\n      \"content-type\": \"application/json\"\n    };\n    return await this.client.call(\n      \"patch\",\n      uri,\n      apiHeaders,\n      payload\n    );\n  }\n  /**\n   * Update phone\n   *\n   * Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.\n   *\n   * @param {string} phone\n   * @param {string} password\n   * @throws {AppwriteException}\n   * @returns {Promise<Models.User<Preferences>>}\n   */\n  async updatePhone(phone, password) {\n    if (typeof phone === \"undefined\") {\n      throw new _client_mjs__WEBPACK_IMPORTED_MODULE_0__.AppwriteException('Missing required parameter: \"phone\"');\n    }\n    if (typeof password === \"undefined\") {\n      throw new _client_mjs__WEBPACK_IMPORTED_MODULE_0__.AppwriteException('Missing required parameter: \"password\"');\n    }\n    const apiPath = \"/account/phone\";\n    const payload = {};\n    if (typeof phone !== \"undefined\") {\n      payload[\"phone\"] = phone;\n    }\n    if (typeof password !== \"undefined\") {\n      payload[\"password\"] = password;\n    }\n    const uri = new URL(this.client.config.endpoint + apiPath);\n    const apiHeaders = {\n      \"content-type\": \"application/json\"\n    };\n    return await this.client.call(\n      \"patch\",\n      uri,\n      apiHeaders,\n      payload\n    );\n  }\n  /**\n   * Get account preferences\n   *\n   * Get the preferences as a key-value object for the currently logged in user.\n   *\n   * @throws {AppwriteException}\n   * @returns {Promise<Preferences>}\n   */\n  async getPrefs() {\n    const apiPath = \"/account/prefs\";\n    const payload = {};\n    const uri = new URL(this.client.config.endpoint + apiPath);\n    const apiHeaders = {\n      \"content-type\": \"application/json\"\n    };\n    return await this.client.call(\n      \"get\",\n      uri,\n      apiHeaders,\n      payload\n    );\n  }\n  /**\n   * Update preferences\n   *\n   * Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.\n   *\n   * @param {Partial<Preferences>} prefs\n   * @throws {AppwriteException}\n   * @returns {Promise<Models.User<Preferences>>}\n   */\n  async updatePrefs(prefs) {\n    if (typeof prefs === \"undefined\") {\n      throw new _client_mjs__WEBPACK_IMPORTED_MODULE_0__.AppwriteException('Missing required parameter: \"prefs\"');\n    }\n    const apiPath = \"/account/prefs\";\n    const payload = {};\n    if (typeof prefs !== \"undefined\") {\n      payload[\"prefs\"] = prefs;\n    }\n    const uri = new URL(this.client.config.endpoint + apiPath);\n    const apiHeaders = {\n      \"content-type\": \"application/json\"\n    };\n    return await this.client.call(\n      \"patch\",\n      uri,\n      apiHeaders,\n      payload\n    );\n  }\n  /**\n


0 0 132.9L338.1 378.6l-2.1 2.3 0 3.1 0 112L48 496l0-112 0-32 0-3.3-2.3-2.3L16 316.7zm124.6 20.8l-6.5-4.6-9.3 13 6.5 4.6L178.2 384l-46.9 33.5-6.5 4.6 9.3 13 6.5-4.6L192 393.8l51.4 36.7 6.5 4.6 9.3-13-6.5-4.6L205.8 384l46.9-33.5 6.5-4.6-9.3-13-6.5 4.6L192 374.2l-51.4-36.7z"],"temperature-three-quarters":[320,512,["temperature-3","thermometer-3","thermometer-three-quarters"],"f2c8","M96 256.8l-7.1 4.8C54.6 284.6 32 323.7 32 368c0 70.7 57.3 128 128 128s128-57.3 128-128c0-44.4-22.6-83.5-56.9-106.5l-7.1-4.8 0-8.5L224 16 96 16l0 232.2 0 8.5zM224 0l16 0 0 16 0 232.2c38.6 25.8 64 69.8 64 119.8c0 79.5-64.5 144-144 144S16 447.6 16 368c0-49.9 25.4-93.9 64-119.8L80 16 80 0 96 0 224 0zM160 416a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm0 16c-35.3 0-64-28.7-64-64c0-32.6 24.4-59.6 56-63.5L152 136l0-8 16 0 0 8 0 168.5c31.6 3.9 56 30.9 56 63.5c0 35.3-28.7 64-64 64z"],"bell-school":[512,512,[],"f5d5","M208 400a192 192 0 1 0 0-384 192 192 0 1 0 0 384zm0 16c-48.3 0-92.7-16.4-128-44l0 124 192 0 64 0 0-124c-35.3 27.6-79.7 44-128 44zm64 96L72 512l-8 0 0-8 0-145.9C24.6 320.2 0 267 0 208C0 93.1 93.1 0 208 0S416 93.1 416 208c0 59-24.6 112.2-64 150.1L352 496l104 0 0-48.7c-22.7-3.8-40-23.6-40-47.3c0-26.5 21.5-48 48-48s48 21.5 48 48c0 23.8-17.3 43.5-40 47.3l0 56.7 0 8-8 0-112 0-8 0-72 0zM208 272a64 64 0 1 0 0-128 64 64 0 1 0 0 128zm0-144a80 80 0 1 1 0 160 80 80 0 1 1 0-160zM496 400a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"],"mobile-screen":[384,512,["mobile-android-alt"],"f3cf","M336 16l0 368L48 384 48 16l288 0zm0 384l0 96L48 496l0-96 288 0zM48 0L32 0l0 16 0 480 0 16 16 0 288 0 16 0 0-16 0-480 0-16L336 0 48 0zm88 440l0 16 8 0 96 0 8 0 0-16-8 0-96 0-8 0z"],"plane-up":[512,512,[],"e22d","M212.5 36.1C223 19 239 2.


train line.

```{code-cell} ipython3
con.sql("""
SELECT
  100.0 * Sum(popn_white) / Sum(popn_total) AS white_pct,
  100.0 * Sum(popn_black) / Sum(popn_total) AS black_pct,
  Sum(popn_total) AS popn_total
FROM nyc_census_blocks AS census
JOIN nyc_subway_stations AS subways
ON ST_DWithin(census.geom, subways.geom, 200)
WHERE strpos(subways.routes,'A') > 0;
""")
```

So the racial make-up along the A-train isn’t radically different from the make-up of New York City as a whole.

## Advanced Join

In the last section we saw that the A-train didn’t serve a population that differed much from the racial make-up of the rest of the city. Are there any trains that have a non-average racial make-up?

To answer that question, we’ll add another join to our query, so that we can simultaneously calculate the make-up of many subway lines at once. To do that, we’ll need to create a new table that enumerates all the lines we want to summarize.

```{code-cell} ipython3
con.sql("""
CREATE OR REPLACE TABLE subway_lines ( route char(1) );
INSERT INTO subway_lines (route) VALUES
  ('A'),('B'),('C'),('D'),('E'),('F'),('G'),
  ('J'),('L'),('M'),('N'),('Q'),('R'),('S'),
  ('Z'),('1'),('2'),('3'),('4'),('5'),('6'),
  ('7');
""")
```

Now we can join the table of subway lines onto our original query.

```{code-cell} ipython3
con.sql("""
SELECT
  lines.route,
  100.0 * Sum(popn_white) / Sum(popn_total) AS white_pct,
  100.0 * Sum(popn_black) / Sum(popn_total) AS black_pct,
  Sum(popn_total) AS popn_total
FROM nyc_census_blocks AS census
JOIN nyc_subway_stations AS subways
ON ST_DWithin(census.geom, subways.geom, 200)
JOIN subway_lines AS lines
ON strpos(subways.routes, lines.route) > 0
GROUP BY lines.route
ORDER BY black_pct DESC;
""")
```

As before, the joins create a virtual table of all the possible combinations available within the constraints of the JOIN ON restrictions, and those rows are then fed into a GROUP summary. The spatial magic is in the ST_DWithin function, that ensures only census blocks close to the appropriate subway stations are included in the calculation.

+++

## Projection

+++

DuckDB provides the `ST_Transform` function to transform geometries from one projection to another. The function takes three arguments: the geometry to transform, and the EPSG code of the projection of the input geometry, and the EPSG code of the projection to transform to.

```{code-cell} ipython3
url = 'https://opengeos.org/data/duckdb/cities.parquet'
con.sql(f"SELECT * EXCLUDE geometry, ST_GeomFromWKB(geometry) AS geometry FROM '{url}'")
```

Let's convert the data from EPSG:4326 to [EPSG:5070](https://epsg.io/5070-1252) (NAD83 / Conus Albers).

```{code-cell} ipython3
con.sql(f"""
SELECT * EXCLUDE geometry, ST_Transform(ST_GeomFromWKB(geometry), 'EPSG:4326', 'EPSG:5070', true) AS geometry FROM '{url}'
""")
```

## Function List

https://duckdb.org/docs/archive/0.9.2/extensions/spatial#spatial-relationships

![](https://i.imgur.com/ogJojVX.png)

+++

## References

- [Introduction to PostGIS - Spatial Joins](https://postgis.net/


 = m*m ;
  m = m*m ;

// Gradients: 41 points uniformly over a line, mapped onto a diamond.
// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)

  vec3 x = 2.0 * fract(p * C.www) - 1.0;
  vec3 h = abs(x) - 0.5;
  vec3 ox = floor(x + 0.5);
  vec3 a0 = x - ox;

// Normalise gradients implicitly by scaling m
// Approximation of: m *= inversesqrt( a0*a0 + h*h );
  m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );

// Compute final noise value at P
  vec3 g;
  g.x  = a0.x  * x0.x  + h.x  * x0.y;
  g.yz = a0.yz * x12.xz + h.yz * x12.yw;
  return 130.0 * dot(m, g);
}
""";

const String SimplexNoiseFunction3 = """
float snoise3(vec3 v) {
  const vec2  C = vec2(1.0/6.0, 1.0/3.0) ;
  const vec4  D = vec4(0.0, 0.5, 1.0, 2.0);

// First corner
  vec3 i  = floor(v + dot(v, C.yyy) );
  vec3 x0 =   v - i + dot(i, C.xxx) ;

// Other corners
  vec3 g = step(x0.yzx, x0.xyz);
  vec3 l = 1.0 - g;
  vec3 i1 = min( g.xyz, l.zxy );
  vec3 i2 = max( g.xyz, l.zxy );

  //   x0 = x0 - 0.0 + 0.0 * C.xxx;
  //   x1 = x0 - i1  + 1.0 * C.xxx;
  //   x2 = x0 - i2  + 2.0 * C.xxx;
  //   x3 = x0 - 1.0 + 3.0 * C.xxx;
  vec3 x1 = x0 - i1 + C.xxx;
  vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y
  vec3 x3 = x0 - D.yyy;      // -1.0+3.0*C.x = -0.5 = -D.y

// Permutations
  i = mod289(i);
  vec4 p = permute( permute( permute(
             i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
           + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
           + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));

// Gradients: 7x7 points over a square, mapped onto an octahedron.
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
  float n_ = 0.142857142857; // 1.0/7.0
  vec3  ns = n_ * D.wyz - D.xzx;

  vec4 j = p - 49.0 * floor(p * ns.z * ns.z);  //  mod(p,7*7)

  vec4 x_ = floor(j * ns.z);
  vec4 y_ = floor(j - 7.0 * x_ );    // mod(j,N)

  vec4 x = x_ *ns.x + ns.yyyy;
  vec4 y = y_ *ns.x + ns.yyyy;
  vec4 h = 1.0 - abs(x) - abs(y);

  vec4 b0 = vec4( x.xy, y.xy );
  vec4 b1 = vec4( x.zw, y.zw );

  //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;
  //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;
  vec4 s0 = floor(b0)*2.0 + 1.0;
  vec4 s1 = floor


!   5 MT (latency=0)

	mov	r5, r0		!   5 MT (latency=0)
	tst	#1, r0		!  87 MT

	bf/s	1f		! 111 BR
	 mov	#64, r7		!   6 EX

	! bit 0 clear

	cmp/ge	r7, r6		!  55 MT

	bt/s	2f		! 111 BR
	 tst	#2, r0		!  87 MT

	! small
	bt/s	.Lcase0
	 mov	r3, r0

	bra	.Lcase2
	 nop

	! big
2:	bt/s	.Lcase0b
	 mov	r3, r0

	bra	.Lcase2b
	 nop

	! bit 0 set
1:	tst	#2, r0		! 87 MT

	bt/s	.Lcase1
	 mov	r3, r0

	bra	.Lcase3
	 nop

	!
	!	GHIJ KLMN OPQR -->  GHIJ KLMN OPQR
	!

	! src, dst and size are all long word aligned
	! size is non-zero

	.balign	32
.Lcase00:
	mov	#64, r1		!   6 EX
	mov	r5, r3		!   5 MT (latency=0)

	cmp/gt	r6, r1		!  56 MT
	add	#-4, r5		!  50 EX

	bf	.Lcase00b	! 108 BR		(big loop)
	shlr2	r6		! 105 EX

	shlr	r6		! 104 EX
	mov.l	@(r0, r5), r1	!  21 LS (latency=2)

	bf/s	4f		! 111 BR
	 add	#-8, r3		!  50 EX

	tst	r6, r6		!  86 MT
	bt/s	5f		! 110 BR

	 mov.l	r1,@-r0		!  30 LS

	! 4 cycles, 2 long words per iteration
3:	mov.l	@(r0, r5), r1	!  21 LS (latency=2)

4:	mov.l	@(r0, r3), r2	!  21 LS (latency=2)
	dt	r6		!  67 EX

	mov.l	r1, @-r0	!  30 LS
	bf/s	3b		! 109 BR

	 mov.l	r2, @-r0	!  30 LS

5:	rts
	 nop

	! Size is 16 or greater and less than 64, but may have trailing bytes

	.balign	32
.Lcase0:
	add	#-4, r5		!  50 EX
	mov	r4, r7		!   5 MT (latency=0)

	mov.l	@(r0, r5), r1	!  21 LS (latency=2)
	mov	#4, r2		!   6 EX

	add	#11, r7		!  50 EX
	tst	r2, r6		!  86 MT

	mov	r5, r3		!   5 MT (latency=0)
	bt/s	4f		! 111 BR

	 add	#-4, r3		!  50 EX
	mov.l	r1,@-r0		!  30 LS

	! 4 cycles, 2 long words per iteration
3:	mov.l	@(r0, r5), r1	!  21 LS (latency=2)

4:	mov.l	@(r0, r3), r2	!  21 LS (latency=2)
	cmp/hi	r7, r0

	mov.l	r1, @-r0	!  30 LS
	bt/s	3b		! 109 BR

	 mov.l	r2, @-r0	!  30 LS

	! Copy the final 0-3 bytes

	add	#3,r5		!  50 EX

	cmp/eq	r0, r4		!  54 MT
	add	#-10, r7	!  50 EX

	bt	9f		! 110 BR

	! 3 cycles, 1 byte per iteration
1:	mov.b	@(r0,r5),r


 end, as mustaches go so much better with noses than with beaks!'
    },
    {
      name: 'Dace',
      picture: '../../assets/img/fish/dace.png',
      available_month: [MONTH.January, MONTH.February, MONTH.March, MONTH.April, MONTH.May, MONTH.June, MONTH.July,
      MONTH.August, MONTH.September, MONTH.October, MONTH.November, MONTH.December],
      available_south: [MONTH.January, MONTH.February, MONTH.March, MONTH.April, MONTH.May, MONTH.June, MONTH.July,
      MONTH.August, MONTH.September, MONTH.October, MONTH.November, MONTH.December],
      caught: false,
      in_museum: false,
      price: 240,
      shadow: SHADOW.Medium,
      location: FISH_LOCATION.River,
      time_start: {
        hours: 16,
        minutes: 0
      },
      time_end: {
        hours: 9,
        minutes: 0
      },
      b_fact: 'Dace are shiny little fish that enjoy freshwater streams with gravelly bottoms and plenty of sunlight. '+
      'What a fishy paradise...until the larger fish move in and begin eating the dace! '+
      'Sadly, the shiny Dace are easy for other fish to spot, which makes them a popular snack. '+
      'However, this particular specimen here has no need to worry. '+
      'There\'s a strict "No Eating Your Neighbor" policy at this institution.'
    },
    {
      name: 'Carp',
      picture: '../../assets/img/fish/carp.png',
      available_month: [MONTH.January, MONTH.February, MONTH.March, MONTH.April, MONTH.May, MONTH.June, MONTH.July,
      MONTH.August, MONTH.September, MONTH.October, MONTH.November, MONTH.December],
      available_south: [MONTH.January, MONTH.February, MONTH.March, MONTH.April, MONTH.May, MONTH.June, MONTH.July,
      MONTH.August, MONTH.September, MONTH.October, MONTH.November, MONTH.December],
      caught: false,
      in_museum: false,
      price: 300,
      shadow: SHADOW.Large,
      location: FISH_LOCATION.Pond,
      time_start: {
        hours: 0,
        minutes: 0
      },
      time_end: {
        hours: 24,
        minutes: 0
      },
      b_fact: 'Oh, the Carp... have you ever seen their teeth? For your sake, I hope you have not! '+
      'Carp have teeth in their throat strong enough to crunch on hard things like shells and fingers! '+
      'A good rule of thumb when dealing with other species is to keep your fingers out of their mouths. '+
      'Although, having neither thumbs nor fingers, I am quite safe from this little fellow!'
    },
    {
      name: 'Koi',
      picture: '../../assets/img/fish/koi.png',
      available_month: [MONTH.January, MONTH.February, MONTH.March, MONTH.April, MONTH.May, MONTH.June, MONTH.July,
      MONTH.August, MONTH.September, MONTH.October, MONTH.November, MONTH.December],
      available_south: [MONTH.January, MONTH.February, MONTH.March, MONTH.April, MONTH.May, MONTH.June, MONTH.July,
      MONTH.August, MONTH.September, MONTH.October, MONTH.November, MONTH.December],
      caught: false,
      in_museum: false,
      price: 4000,
      shadow: SHADOW.Large,
      location: FISH_LOCATION.Pond,
      time_start: {
        hours: 16,
        minutes: 0
      },
      time_end: {
        hours: 9,
        minutes: 0
      },
      b_fact: 'Koi are a variety of carp bred for their color


': 'selected'},
  ],
};

/// Descriptor for `SelectItem`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List selectItemDescriptor = $convert.base64Decode(
    'CgpTZWxlY3RJdGVtEhsKCWl0ZW1fdHlwZRgBIAEoBVIIaXRlbVR5cGUSEgoEdGV4dBgCIAEoCV'
    'IEdGV4dBIaCghzZWxlY3RlZBgDIAEoCFIIc2VsZWN0ZWQ=');

@$core.Deprecated('Use sessionDescriptor instead')
const Session$json = {
  '1': 'Session',
  '2': [
    {
      '1': 'id',
      '3': 1,
      '4': 1,
      '5': 11,
      '6': '.bilibili.app.im.v1.SessionId',
      '10': 'id'
    },
    {
      '1': 'session_info',
      '3': 2,
      '4': 1,
      '5': 11,
      '6': '.bilibili.app.im.v1.SessionInfo',
      '10': 'sessionInfo'
    },
    {
      '1': 'unread',
      '3': 3,
      '4': 1,
      '5': 11,
      '6': '.bilibili.app.im.v1.Unread',
      '10': 'unread'
    },
    {
      '1': 'msg_summary',
      '3': 4,
      '4': 1,
      '5': 11,
      '6': '.bilibili.app.im.v1.MsgSummary',
      '10': 'msgSummary'
    },
    {'1': 'timestamp', '3': 5, '4': 1, '5': 3, '10': 'timestamp'},
    {'1': 'is_pinned', '3': 6, '4': 1, '5': 8, '10': 'isPinned'},
    {'1': 'sequence_number', '3': 7, '4': 1, '5': 3, '10': 'sequenceNumber'},
    {'1': 'is_muted', '3': 8, '4': 1, '5': 8, '10': 'isMuted'},
    {'1': 'chat_url', '3': 9, '4': 1, '5': 9, '10': 'chatUrl'},
    {
      '1': 'operation',
      '3': 10,
      '4': 1,
      '5': 11,
      '6': '.bilibili.app.im.v1.SessionOperation',
      '10': 'operation'
    },
    {
      '1': 'trace_params',
      '3': 11,
      '4': 3,
      '5': 11,
      '6': '.bilibili.app.im.v1.Session.TraceParamsEntry',
      '10': 'traceParams'
    },
  ],
  '3': [Session_TraceParamsEntry$json],
};

@$core.Deprecated('Use sessionDescriptor instead')
const Session_TraceParamsEntry$json = {
  '1': 'TraceParamsEntry',
  '2': [
    {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
    {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'},
  ],
  '7': {'7': true},
};

/// Descriptor for `Session`. Decode as a `google.protob


ox-width: 13px;
  --radio-label-spacing: 6px;
  --range-track-height: 4px;
  --range-spacing: 10px;

  /* Some detailed computations for radio buttons and checkboxes */
  --radio-total-width-precalc: var(--radio-width) + var(--radio-label-spacing);
  --radio-total-width: calc(var(--radio-total-width-precalc));
  --radio-left: calc(-1 * var(--radio-total-width-precalc));
  --radio-dot-width: 4px;
  --radio-dot-top: calc(var(--radio-width) / 2 - var(--radio-dot-width) / 2);
  --radio-dot-left: calc(
    -1 * (var(--radio-total-width-precalc)) + var(--radio-width) / 2 - var(
        --radio-dot-width
      ) / 2
  );

  --checkbox-total-width-precalc: var(--checkbox-width) +
    var(--radio-label-spacing);
  --checkbox-total-width: calc(var(--checkbox-total-width-precalc));
  --checkbox-left: calc(-1 * var(--checkbox-total-width-precalc));
  --checkmark-width: 7px;
  --checkmark-top: 3px;
  --checkmark-left: 3px;

  /* Borders */
  --border-width: 1px;
  /* rtl:ignore */
  --border-raised-outer: inset -1px -1px var(--window-frame),
    inset 1px 1px var(--button-highlight);
  /* rtl:ignore */
    --border-raised-inner: inset -2px -2px var(--button-shadow),
    inset 2px 2px var(--button-face);
  /* rtl:ignore */
    --border-sunken-outer: inset -1px -1px var(--button-highlight),
    inset 1px 1px var(--window-frame);
  /* rtl:ignore */
    --border-sunken-inner: inset -2px -2px var(--button-face),
    inset 2px 2px var(--button-shadow);

  /* Window borders flip button-face and button-highlight */
  /* rtl:ignore */
  --border-window-outer: inset -1px -1px var(--window-frame),
    inset 1px 1px var(--button-face);
  /* rtl:ignore */
    --border-window-inner: inset -2px -2px var(--button-shadow),
    inset 2px 2px var(--button-highlight);

  /* Field borders (checkbox, input, etc) flip window-frame and button-shadow */
  /* rtl:ignore */
  --border-field: inset -1px -1px var(--button-highlight),
    inset 1px 1px var(--button-shadow), inset -2px -2px var(--button-face),
    inset 2px 2px var(--window-frame);
}

fieldset {
  border-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='5' height='5' viewBox='0 0 5 5' fill='grey' xmlns='http://www.w3.org/2000/svg'%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M0 0H5V5H0V2H2V3H3V2H0' fill='white'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M0 0H4V4H0V1H1V3H3V1H0' fill='%23808080'/%3E %3C/svg%3E") 2;
  padding: calc(


 ":" ~ version ~ "/" ~ identifier }

// Namespaced identifier like my.module/my-function or just my-function
// Allowing multiple '.' for ns parts before the '/'
namespaced_identifier = @{ identifier ~ ("." ~ identifier)* ~ "/" ~ identifier }

// A symbol is typically represented by an identifier or namespaced identifier in code
symbol = { versioned_namespace | namespaced_identifier | identifier }

// --- Keywords ---
// Simple keyword like :foo or qualified like :my.ns/foo or versioned like :com.acme:v1.0/foo
keyword = @{ ":" ~ (versioned_namespace | namespaced_identifier | identifier) }

// Add this after the existing symbol rule and before collections
// Task context access using @ prefix
task_context_access = { "@" ~ (identifier | keyword) }

// Atom deref sugar: @atom-name desugars to (deref atom-name)
atom_deref = { "@" ~ symbol }

vector_match_pattern    = { "[" ~ match_pattern* ~ ("&" ~ symbol)? ~ "]" }
map_match_pattern_entry = { map_key ~ match_pattern }
map_match_pattern       = { "{" ~ map_match_pattern_entry* ~ ("&" ~ symbol)? ~ "}" }

as_match_pattern = { "(" ~ ":as" ~ symbol ~ match_pattern ~ ")" } // Specific rule for :as

match_pattern = _{
    literal
  | keyword // Keyword before symbol if keywords can look like symbols
  | wildcard // Wildcard before symbol
  | symbol
  | type_expr // Matching on type might be complex, placeholder
  | as_match_pattern // Use the specific :as pattern rule
  | vector_match_pattern
  | map_match_pattern
}

// --- Collections ---
// These now explicitly contain 'expression'
list      = { "(" ~ expression* ~ ")" }
vector    = { "[" ~ expression* ~ "]" }
map       = { "{" ~ map_entry* ~ "}" }
map_entry = { map_key ~ expression }
// Allowing keywords, strings, or integers as map keys for now (as per grammar_spec)
map_key = { keyword | string | integer }

// Shorthand anonymous function using Clojure-style reader macro: #( ... ) with % %1 %2 ...
// Parses as its own rule; later transformed into a normal fn expression in parser.
shorthand_fn = { "#" ~ "(" ~ expression* ~ ")" }

// Anonymous function shorthand: #(...)
anon_fn = { "#" ~ "(" ~ expression* ~ ")" }

// Method call interop: (.method target arg*) desugared in parser to (method target arg*)
method_call_expr = { "(" ~ "." ~ identifier ~ expression+ ~ ")" }

// --- Type Expressions (Based on grammar_spec.md) ---
primitive_type = { symbol | keyword }
// Accept both bare symbols (int) and keyword forms (:int) for primitive types for backward compatibility

// Complex Type Rules (assuming list-based syntax like [:vector T], [:map ...], etc.)
optional_marker = { "?" }
vector_type    = { "[" ~ ":vector" ~ WHITESPACE* ~ type_expr ~ WHITESPACE* ~ "]" }
// Map type entry supports two styles used in tests:
//  - Bracketed single-entry: [ :key Type ]
//  - Braced compact form: { :key Type :key2 Type2 }
map_type_entry = { "[" ~ keyword ~ WHITESPACE* ~ type_expr ~ (WHITESPACE* ~ optional_marker)? ~ WHITESPACE* ~ "]" }
map_type_entry_braced = { "{" ~ (WHITESPACE* ~ keyword ~ WHITESPACE* ~ type_expr ~ (WHITESPACE* ~ optional_marker)? )+ ~ WHITESPACE* ~ "}" }
// [Key Type Optional?]
map_type_wildcard = { "[" ~ ":*" ~ WHITESPACE*


 either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <set>

#include "dawn/common/BitSetIterator.h"
#include "dawn/common/ityp_bitset.h"
#include "gtest/gtest.h"

namespace dawn {
namespace {

// This is ANGLE's BitSetIterator_unittests.cpp file.

class BitSetIteratorTest : public testing::Test {
  protected:
    std::bitset<40> mStateBits;
};

// Simple iterator test.
TEST_F(BitSetIteratorTest, Iterator) {
    std::set<uint32_t> originalValues;
    originalValues.insert(2);
    originalValues.insert(6);
    originalValues.insert(8);
    originalValues.insert(35);

    for (uint32_t value : originalValues) {
        mStateBits.set(value);
    }

    std::set<uint32_t> readValues;
    for (uint32_t bit : IterateBitSet(mStateBits)) {
        EXPECT_EQ(1u, originalValues.count(bit));
        EXPECT_EQ(0u, readValues.count(bit));
        readValues.insert(bit);
    }

    EXPECT_EQ(originalValues.size(), readValues.size());
}

// Test an empty iterator.
TEST_F(BitSetIteratorTest, EmptySet) {
    // We don't use the FAIL gtest macro here since it returns immediately,
    // causing an unreachable code warning in MSVC
    bool sawBit = false;
    for (uint32_t bit : IterateBitSet(mStateBits)) {
        DAWN_UNUSED(bit);
        sawBit = true;
    }
    EXPECT_FALSE(sawBit);
}

// Test iterating a result of combining two bitsets.
TEST_F(BitSetIteratorTest, NonLValueBitset) {
    std::bitset<40> otherBits;

    mStateBits.set(1);
    mStateBits.set(2);
    mStateBits.set(3);
    mStateBits.set(4);

    otherBits.set(0);
    otherBits.set(1);
    otherBits.set(3);
    otherBits.set(5);

    std::set<uint32_t> seenBits;

    for (uint32_t bit : IterateBitSet(mStateBits & otherBits)) {
        EXPECT_EQ(0u, seenBits.count(bit));
        seenBits.insert(bit);
        EXPECT_TRUE(mStateBits[bit]);
        EXPECT_TRUE(otherBits[bit]);
    }

    EXPECT_EQ((mStateBits & otherBits).count(), seenBits.size());
}

class EnumBitSetIteratorTest : public testing::Test {
  protected:
    enum class TestEnum { A, B, C, D, E, F, G, H, I, J, EnumCount };

    static constexpr size_t kEnumCount = static_cast<size_t>(TestEnum::EnumCount);
    ityp::bitset<TestEnum, kEnumCount> mStateBits;
};

// Simple iterator test.
TEST_F(EnumBitSetIteratorTest, Iterator) {
    std::set<TestEnum> originalValues;
    originalValues.insert(TestEnum::B);
    originalValues.insert(TestEnum::F);
    originalValues.insert(TestEnum::C);
    originalValues.insert(TestEnum::I);

    for (TestEnum value : originalValues) {
        mStateBits.set(value);
    }

    std::set<TestEnum> readValues;
    for (TestEnum bit : IterateBitSet(mStateBits)) {
        EXPECT_EQ(1u, originalValues.count(bit));
        EXPECT_EQ(0u,


px;
  color: inherit;
  text-rendering: optimizelegibility;
}
h1 small {
  font-weight: normal;
  line-height: 1;
  color: #999;
}
h1 {
  line-height: 40px;
}
h1 {
  font-size: 38.5px;
}
h1 small {
  font-size: 24.5px;
}
body {
  margin-top: 90px;
}
.header {
  position: fixed;
  top: 0;
  left: 50%;
  margin-left: -480px;
  background-color: #fff;
  border-bottom: 1px solid #ddd;
  padding-top: 10px;
  z-index: 10;
}
.footer {
  color: #ddd;
  font-size: 12px;
  text-align: center;
  margin-top: 20px;
}
.footer a {
  color: #ccc;
  text-decoration: underline;
}
.the-icons {
  font-size: 14px;
  line-height: 24px;
}
.switch {
  position: absolute;
  right: 0;
  bottom: 10px;
  color: #666;
}
.switch input {
  margin-right: 0.3em;
}
.codesOn .i-name {
  display: none;
}
.codesOn .i-code {
  display: inline;
}
.i-code {
  display: none;
}
@font-face {
      font-family: 'fontello';
      src: url('./font/fontello.eot?65519511');
      src: url('./font/fontello.eot?65519511#iefix') format('embedded-opentype'),
           url('./font/fontello.woff?65519511') format('woff'),
           url('./font/fontello.ttf?65519511') format('truetype'),
           url('./font/fontello.svg?65519511#fontello') format('svg');
      font-weight: normal;
      font-style: normal;
    }

    .demo-icon
    {
      font-family: "fontello";
      font-style: normal;
      font-weight: normal;
      speak: none;

      display: inline-block;
      text-decoration: inherit;
      width: 1em;
      margin-right: .2em;
      text-align: center;
      /* opacity: .8; */

      /* For safety - reset parent styles, that can break glyph codes*/
      font-variant: normal;
      text-transform: none;

      /* fix buttons height, for twitter bootstrap */
      line-height: 1em;

      /* Animation center compensation - margins should be symmetric */
      /* remove if not needed */
      margin-left: .2em;

      /* You can be more comfortable with increased icons size */
      /* font-size: 120%; */

      /* Font smoothing. That was taken from TWBS */
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;

      /* Uncomment for 3D effect */
      /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
    }
     </style>
    <link rel="stylesheet" href="css/animation.css">

        fontello
         font demo

        <i


SpriteBatch GetSpriteBatch(GraphicsDevice graphics)
        {
            if (spriteBatchMemory == null)
                spriteBatchMemory = new SpriteBatch(graphics);

            return spriteBatchMemory;
        }

        private static Effect GetEffectStroke(GraphicsDevice graphics)
        {
            if (strokeEffectCache == null)
            {

                var assembly = Assembly.GetExecutingAssembly();
                var resourceName = $"TeamJRPG.Content.{CurrentShaderExtension}.StrokeEffect.xnb";

                using (Stream stream = assembly.GetManifestResourceStream(resourceName))
                {
                    using (MemoryStream ms = new MemoryStream())
                    {
                        stream.CopyTo(ms);
                        var content = new XnbContentManager(ms, graphics);
                        strokeEffectCache = content.Load<Effect>("MyMemoryStreamAsset");
                    }
                }
            }

            return strokeEffectCache;
        }

        private static GraphicsApi GetShaderExtension()
        {
            // Use reflection to figure out if Shader.Profile is OpenGL (0) or DirectX (1).
            // May need to be changed / fixed for future shader profiles.
            const string SHADER_TYPE = "Microsoft.Xna.Framework.Graphics.Shader";
            const string PROFILE = "Profile";

            var assembly = typeof(Game).GetTypeInfo().Assembly;
            if (assembly == null)
                throw new Exception(
                    "Error determining shader profile. Couldn't find assembly. Falling back to OpenGL.");

            var shaderType = assembly.GetType(SHADER_TYPE);
            if (shaderType == null)
                throw new Exception(
                    $"Error determining shader profile. Couldn't find shader type of '{SHADER_TYPE}'. Falling back to OpenGL.");

            var shaderTypeInfo = shaderType.GetTypeInfo();
            if (shaderTypeInfo == null)
                throw new Exception(
                    "Error determining shader profile. Couldn't get TypeInfo of shadertype. Falling back to OpenGL.");

            // https://github.com/MonoGame/MonoGame/blob/develop/MonoGame.Framework/Graphics/Shader/Shader.cs#L47
            var profileProperty = shaderTypeInfo.GetDeclaredProperty(PROFILE);
            var value = (int)profileProperty.GetValue(null);

            switch (value)
            {
                case 0:
                    return GraphicsApi.OPEN_GL;
                case 1:
                    return GraphicsApi.DIRECT_X;
                default:
                    throw new Exception("Unknown shader profile.");
            }
        }
    }
}


  &[00,  60,   20,   60,   20,   20,   00]
    )
}

#[test]
#[ignore = "next glyph layout is not yet implemented"]
fn context3_next_glyph_t1_gpos() {
    gpos_test(
        "gpos_context3_next_glyph_f1.otf",
        "latn", "UNKN", "test",
        &[00,  20,   20,   20,   20,   20,   00],
        &[0,   20,    0,   20,    0,    0,    0],
        &[0,    0,    0,    0,    0,    0,    0],
        None,None
    )
}

#[test]
fn context3_boundary_t1_gsub() {
    gsub_test(
        "gsub_context3_boundary_f1.otf",
        "latn", "UNKN", "test",
        &[00,  20,   20,   20,   20,   20,   00],
        &[00,  20,   20,   20,   20,   20,   00]
    )
}

#[test]
fn context3_boundary_t1_gpos() {
    gpos_test(
        "gpos_context3_boundary_f1.otf",
        "latn", "UNKN", "test",
        &[00,  20,   20,   20,   20,   20,   00],
        &[0,    0,    0,    0,    0,    0,    0],
        &[0,    0,    0,    0,    0,    0,    0],
        None,None
    )
}

#[test]
fn context3_boundary_t2_gsub() {
    gsub_test(
        "gsub_context3_boundary_f2.otf",
        "latn", "UNKN", "test",
        &[00,  20,   20,   20,   20,   20,   00],
        &[00,  60,   60,   60,   60,   60,   00]
    )
}

#[test]
fn context3_boundary_t2_gpos() {
    gpos_test(
        "gpos_context3_boundary_f2.otf",
        "latn", "UNKN", "test",
        &[00,  20,   20,   20,   20,   20,   00],
        &[0,   20,   20,   20,   20,   20,    0],
        &[0,    0,    0,    0,    0,    0,    0],
        None,None
    )
}

#[test]
fn context3_successive_t1_gsub() {
    gsub_test(
        "gsub_context3_successive_f1.otf",
        "latn", "UNKN", "test",
        &[00,  20,   21,   22,  23,   00],
        &[00,  20,   61,        63,   00]
    )
}

#[test]
fn context3_successive_t1_gpos() {
    gpos_test(
        "gpos_context3_successive_f1.otf",
        "latn", "UNKN", "test",
        &[00,  20,   21,   22,  23,   00],
        &[0,    0,   20,   20,   0,    0],
        &[0,    0,    0,    0,   0,    0],
        None,None
    )
}

#[test]
fn context3_lookupflag_t1_gsub() {
    gsub_test(
        "gsub_context3_lookupflag_f


6. 齐治科技 (Qizhi)   - 代表产品：齐治堡垒机 (ID-Security)       主要功能包括特权账号管理、运维操作审计、访问控制和合规性管理。

7. Jumpserver     - 代表产品：Jumpserver堡垒机       提供操作审计、特权管理、访问控制功能，且基础版本完全开源。

![](https://mmbiz.qpic.cn/mmbiz_png/qqUYEYiclhFKv0NRl1dBYeyTicofdfqzQepo0N6WzmOv8HNbFCcwEsvdicblo2APfibhEAvLBcmzpeCGjTd73mXCdA/640?wx_fmt=png&from=appmsg "")

### 国外品牌

1. CyberArk     - 代表产品：Privileged Access Security (PAS)       全球知名的特权账号安全管理厂商，其产品侧重于特权账号管理和运维操作安全。

2. BeyondTrust     - 代表产品：PowerBroker       提供完整的权限管理和操作审计功能，适用于企业多场景安全管理。

3. Thycotic (现Delinea)     - 代表产品：Secret Server       注重密码管理与特权访问控制，是许多跨国企业的选择。

4. Wallix     - 代表产品：Wallix Bastion       提供简洁高效的操作审计和特权管理功能，注重用户体验和合规性。

# 云堡垒机

云堡垒机是一种基于云计算技术的堡垒机解决方案，它
将传统的堡垒机功能部署在云平台上，通过云服务提供商来提供堡垒机的功能和服务。

云堡垒机具有传统堡垒机的所有功能和特点，包括限制远程访问、审计远程访问、密钥管理和认证授权等。但与传统堡垒机不同的是，云堡垒机利用云计算平台的灵活性和可扩展性，提供更高的可用性、弹性和易管理性。

云堡垒机可以通过云端的虚拟机实例来实现，用户可以根据需要动态创建和删除虚拟机实例，从而根据实际需求调整堡垒机的容量和规模。此外，