{
							Name: "gardener-admission-controller-cert",
							VolumeSource: corev1.VolumeSource{
								Secret: &corev1.SecretVolumeSource{
									SecretName:  serverCertSecretName,
									DefaultMode: ptr.To[int32](0640),
								},
							},
						},
						{
							Name: "gardener-admission-controller-config",
							VolumeSource: corev1.VolumeSource{
								ConfigMap: &corev1.ConfigMapVolumeSource{
									LocalObjectReference: corev1.LocalObjectReference{Name: configSecretName},
								},
							},
						},
						{
							Name: "kubeconfig",
							VolumeSource: corev1.VolumeSource{
								Projected: &corev1.ProjectedVolumeSource{
									DefaultMode: ptr.To[int32](420),
									Sources: []corev1.VolumeProjection{
										{
											Secret: &corev1.SecretProjection{
												LocalObjectReference: corev1.LocalObjectReference{
													Name: "generic-token-kubeconfig",
												},
												Items: []corev1.KeyToPath{{
													Key:  "kubeconfig",
													Path: "kubeconfig",
												}},
												Optional: ptr.To(false),
											},
										},
										{
											Secret: &corev1.SecretProjection{
												LocalObjectReference: corev1.LocalObjectReference{
													Name: "shoot-access-gardener-admission-controller",
												},
												Items: []corev1.KeyToPath{{
													Key:  "token",
													Path: "token",
												}},
												Optional: ptr.To(false),
											},
										},
									},
								},
							},
						},
					},
				},
			},
		},
	}

	utilruntime.Must(references.InjectAnnotations(deployment))

	return deployment
}

func service(namespace string, testValues Values) *corev1.Service {
	svc := &corev1.Service{
		ObjectMeta: metav1.ObjectMeta{
			Name:      "gardener-admission-controller",
			Namespace: namespace,
			Labels: map[string]string{
				"app":  "gardener",
				"role": "admission-controller",
			},
			Annotations: map[string]string{
				"networking.resources.gardener.cloud/from-all-webhook-targets-allowed-ports":       `[{"protocol":"TCP","port":2719}]`,
				"networking.resources.gardener.cloud/from-all-garden-scrape-targets-allowed-ports": `[{"protocol":"TCP","port":2723}]`,
			},
		},
		Spec: corev1.ServiceSpec{
			Type: corev1.ServiceTypeClusterIP,
			Selector: map[string]string{
				"app":  "gardener",
				"role": "admission-controller",
			},
			Ports: []corev1.ServicePort{
				{
					Name:       "https",
					Protocol:   corev1.ProtocolTCP,
					Port:       443,
					TargetPort: intstr.FromInt32(2719),
				},
				{
					Name:       "metrics",
					Protocol:   corev1.ProtocolTCP,
					Port:       2723,
					TargetPort: intstr.FromInt32(2723),
				},
			},
		},
	}

	if testValues.TopologyAwareRoutingEnabled {
		if versionutils.ConstraintK8sGreaterEqual132.Check(testValues.RuntimeVersion) {
			svc.Spec.TrafficDistribution = ptr.To(corev1.ServiceTrafficDistributionPreferClose)
		} else if versionutils.ConstraintK8sEqual131.Check(testValues.RuntimeVersion) {
			svc.Spec.TrafficDistribution = ptr.To(corev1.ServiceTrafficDistributionPreferClose)
			metav1.SetMetaDataLabel(&svc.ObjectMeta, "endpoint-slice-hints.resources.gardener.cloud/consider",


}

/**
* Build the lookup tree for a given item and all of its children.
* @param item The item to start from
*/
void MaterialTreeView::BuildLookupTrees(HTREEITEM item) {

	//Add my quicktree item
	idStr qt = GetQuicktreePath(item);
	quickTree.Set(qt, item);

	CTreeCtrl& tree = GetTreeCtrl();
	if(tree.ItemHasChildren(item)) {
		HTREEITEM childItem = tree.GetChildItem(item);
		while(childItem != NULL) {
			DWORD childType = tree.GetItemData(childItem);
			if(childType == TYPE_MATERIAL_FOLDER) {
				//Recursively call this method for all my child folders
				BuildLookupTrees(childItem);
			}
			childItem = tree.GetNextSiblingItem(childItem);
		}
	}
}

/**
* Returns the quicktree path for a given item.
* @param item The item for which to generate the quicktree path
*/
idStr MaterialTreeView::GetQuicktreePath(HTREEITEM item) {
	CTreeCtrl& tree = GetTreeCtrl();

	idStr qt = "";
	HTREEITEM pathItem = item;
	while(pathItem != NULL) {
		qt = "/" + idStr(tree.GetItemText(pathItem)) + qt;
		pathItem = tree.GetParentItem(pathItem);
	}
	return qt;
}

/*
===========================================================================

Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.

This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).

Doom 3 Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Doom 3 Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Doom 3 Source Code.  If not, see <http://www.gnu.org/licenses/>.

In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code.  If not, please request a copy in writing from id Software at the address below.

If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.

===========================================================================
*/

#include "../../idlib/precompiled.h"
#pragma hdrstop

#include "qe3.h"
#include "Radiant.h"
#include "EditViewDlg.h"

// CEditViewDlg dialog

IMPLEMENT_DYNAMIC(CEditViewDlg, CDialog)
CEditViewDlg::CEditViewDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CEditViewDlg::IDD, pParent)
{
	findDlg = NULL;
}

CEditViewDlg::~CEditViewDlg() {
}


n`|-|表单禁用|N|
|readonly|`boolean`|-|表单只读|N|
|maxlength|`number`|-|最大长度，原生属性|N|
|rows|`number`|3|显示行数，原生属性|N|
|placeholder|`string`|-|提示语，原生属性|N|
|show-word-limit|`boolean`|-|是否显示字数统计，需要开启 `maxlength`|N|
|autosize|`boolean`|-|是否输入内容自动撑高|N|## 主题定制

### Events

|事件|说明|回调参数|
|---|----|-------|
|change|内容发生改变时触发|`value: string(当前输入内容)`|

### TS 类型

```typescript
import type { TextareaProps } from '@xuanmo/dl-ui'
```

### CSS 变量

|变量名|默认值|描述|
|-----|-----|----|
|--d-textarea-limit-color|var(--d-secondary-text-color)|字数统计颜色|
# Cascader 级联选择器

用于树形数据选择，常用于地址选择。

最新中国内地行政区域数据下载 [https://github.com/D-xuanmo/china-region](https://github.com/D-xuanmo/china-region)。

## 引入

```typescript
import { createApp } from 'vue';
import { DCascader } from '@xuanmo/dl-ui'

// 注册组件
const app = createApp()
app.use(DCascader)
```

## 代码演示

```vue client=Mobile playground=MCascader previewType=iframe
<template>
  <d-cell-group cell-title-width="100px">
    <d-cell title="基础用法">
      <d-cascader v-model="value" :options="template" placeholder="数据加载中..." />
    </d-cell>
    <d-cell title="绑定对象数组">
      <d-cascader
        v-model="value2"
        :options="template"
        title="请选择地址"
        placeholder="数据加载中..."
      />
    </d-cell>
    <d-cell title="模拟异步场景">
      <d-cascader
        v-model="value3"
        :options="template2"
        title="请选择地址"
        placeholder="请选择"
        lazy
        :lazy-load="handleLazyLoad"
      />
    </d-cell>
    <d-cell title="禁用">
      <d-cascader v-model="value" :options="template" disabled />
    </d-cell>
  </d-cell-group>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import { ICascaderOption } from '../../common'

const template = ref<ICascaderOption[]>([])
const value = ref(['110000000000', '110100000000', '110102000000', '110102007000'])
const value2 = ref([
  { value: '110000000000', label: '北京市' },
  { value: '110100000000', label: '市辖区' },
  { value: '110102000000', label: '西城区' }
])
const template2 = ref<ICascaderOption[]>(


&i.c.i.k==(Xn(),Oc)&&Di(i.c.i,n.a)}function xqn(n){m0(n,new Od(g0(d0(w0(b0(new ed,iP),"ELK Randomizer"),'Distributes the nodes randomly on the plane, leading to very obfuscating layouts. Can be useful to demonstrate the power of "real" layout algorithms.'),new J4n))),Q(n,iP,hb,Fdn),Q(n,iP,Fw,15),Q(n,iP,MS,Y(0)),Q(n,iP,Mp,im)}function xen(){var n,e,t,i,r,c;for(xen=N,n7=K(Ku,E2,28,255,15,1),XO=K(ds,jh,28,16,15,1),e=0;e<255;e++)n7[e]=-1;for(t=57;t>=48;t--)n7[t]=t-48<<24>>24;for(i=70;i>=65;i--)n7[i]=i-65+10<<24>>24;for(r=102;r>=97;r--)n7[r]=r-97+10<<24>>24;for(c=0;c<10;c++)XO[c]=48+c&ri;for(n=10;n<=15;n++)XO[n]=65+n-10&ri}function Gx(n){var e,t,i,r,s;if(!n.c){if(s=new jmn,null==(e=J9).a.zc(n,e)){for(i=new ne(Lc(n));i.e!=i.i.gc();)L(r=iS(t=u(ue(i),89)),90)&&Bt(s,Gx(u(r,29))),me(s,t);e.a.Bc(n),e.a.gc()}(function w8e(n){var e,t,i,r;for(t=u(n.g,689),i=n.i-1;i>=0;--i)for(e=t[i],r=0;r<i;++r)if($Un(n,e,t[r])){hp(n,i);break}})(s),gw(s),n.c=new Lg((u(D(H((ra(),_n).o),15),19),s.i),s.g),no(n).b&=-33}return n.c}function Ben(n){var e;if(10!=n.c)throw M(new De($e((Ie(),sP))));switch(e=n.a){case 110:e=10;break;case 114:e=13;break;case 116:e=9;break;case 92:case 124:case 46:case 94:case 45:case 63:case 42:case 43:case 123:case 125:case 40:case 41:case 91:case 93:break;default:throw M(new De($e((Ie(),os))))}return e}function Bqn(n){var e,t,i,c;if(0==n.l&&0==n.m&&0==n.h)return"0";if(n.h==Hy&&0==n.m&&0==n.l)return"-9223372036854775808";if(n.h>>19)return"-"+Bqn(b4(n));for(t=n,i="";0!=t.l||0!=t.m||0!=t.h;){if(t=


ee_close,
.webix_tree_open,
.webix_tree_none {
  background-position: center center;
}
.webix_cell .webix_tree_close,
.webix_cell .webix_tree_open,
.webix_cell .webix_tree_none {
  background-color: transparent;
}
.webix_tree_folder,
.webix_tree_file,
.webix_tree_folder_open {
  background-position: 0 center ;
}
.webix_tree_file,
.webix_tree_folder,
.webix_tree_folder_open {
  margin: 0px 2px;
}
.webix_tree_leaves .webix_tree_leaves {
  margin-left: 20px;
}
.webixLineTree .webix_tree_leaves {
  margin-left: 0px;
}
.webix_tree_close {
  background-image: url("data:image/gif;base64,R0lGODlhEgASALMJAMrKyt3d3ejp6d7f3+/v75aWlvf39////wAAAP///wAAAAAAAAAAAAAAAAAAAAAAACH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0Nzc3LCAyMDEwLzAyLzEyLTE3OjMyOjAwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IFdpbmRvd3MiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6M0I5RTczQjVDMDdBMTFFMTgxRjc4Mzk4M0Q3MjVFQzAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6M0I5RTczQjZDMDdBMTFFMTgxRjc4Mzk4M0Q3MjVFQzAiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDozQjlFNzNCM0MwN0ExMUUxODFGNzgzOTgzRDcyNUVDMCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDozQjlFNzNCNEMwN0ExMUUxODFGNzgzOTgzRDcyNUVDMCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgH//v38+/r5+Pf29fTz8vHw7+7t7Ovq6ejn5uXk4+Lh4N/e3dzb2tnY19bV1NPS0dDPzs3My8rJyMfGxcTDwsHAv769vLu6ubi3trW0s7KxsK+urayrqqmop6alpKOioaCfnp2cm5qZ


tity<Void> register(User user, @RequestParam("code") String code) {
    Boolean boo = this.userService.register(user, code);
    if (!boo) {
        return ResponseEntity.badRequest().build();
    }
    return ResponseEntity.created(null).build();
}
```

### UserService

```java
@Override
public Boolean register(User user, String code) {
    //校验验证码是否正确
    String realCode = this.redisTemplate.opsForValue().get(KEY_PREFIX + user.getPhone());
    if (!StringUtils.equals(realCode, code)) {
        return false;
    }

    //生成盐
    String salt = CodecUtils.generateSalt();
    //设置盐
    user.setSalt(salt);
    //密码加密
    user.setPassword(CodecUtils.md5Hex(user.getPassword(), salt));

    // 强制设置不能指定的参数为null
    user.setId(null);
    user.setCreated(new Date());

    //保存到数据库
    boolean boo = this.userMapper.insertSelective(user) == 1;

    //注册成功删除redis中的验证码
    if (boo) {
        this.redisTemplate.delete(KEY_PREFIX + user.getPhone());
    }

    return boo;
}
```

此处使用了资料中的CodeUtils：

该工具类需要apache加密工具包：

```xml
<dependency>
    <groupId>commons-codec</groupId>
    <artifactId>commons-codec</artifactId>
</dependency>
```

### 测试

我们通过RestClient测试：

![1533024221725](https://cdn.tencentfs.clboy.cn/images/2021/20210911203308288.png)

查看数据库：

![1533024241233](https://cdn.tencentfs.clboy.cn/images/2021/20210911203308340.png)

查看redis中的信息也被删除

## hibernate-validate

刚才虽然实现了注册，但是服务端并没有进行数据校验，而前端的校验是很容易被有心人绕过的。所以我们必须在后台添加数据校验功能：

我们这里会使用Hibernate-Validator框架完成数据校验：

而SpringBoot的web启动器中已经集成了相关依赖：

 ![1527244265451](https://cdn.tencentfs.clboy.cn/images/2021/20210911203247810.png)

### 什么是Hibernate Validator

Hibernate Validator是Hibernate提供的一个开源框架，使用注解方式非常方便的实现服务端的数据校验。

官网：http://hibernate.org/validator/

![1527244393041](https://cdn.tencentfs.clboy.cn/images/2021/20210911203247862.png)

**hibernate Validator** 是 Bean Validation 的参考实现 。

Hibernate Validator 提供了 JSR 303 规范中所有内置 constraint（约束） 的实现，除此之外还有一些附加的 constraint。

在日常开发中，Hibernate Validator经常用来验证bean的字段，基于注解，方便快捷高效。

### Bean校验的注解

常用注解如下：

| **Constraint**                                     | **详细信息**                                                 |
| -------------------------------------------------- | ------------------------------------------------------------ |
| **@Valid**                                         | 被注释的元素是一个对象，需要检查此对象的所有字段值           |
| **@Null**                                          | 被注释的元素必须为


  }

  /// Return the Cartesian Chart with Bar series.
  SfCartesianChart _buildCartesianChart() {
    return SfCartesianChart(
      plotAreaBorderWidth: 0,
      title: ChartTitle(
        text: isCardView ? '' : 'Population growth rate of countries',
      ),
      primaryXAxis: const CategoryAxis(
        majorGridLines: MajorGridLines(width: 0),
      ),
      primaryYAxis: const NumericAxis(
        minimum: -2,
        maximum: 2,
        majorTickLines: MajorTickLines(size: 0),
      ),
      series: _buildBarSeries(),
      tooltipBehavior: _tooltipBehavior,
    );
  }

  /// Returns the list of Cartesian Bar series.
  List<BarSeries<ChartSampleData, String>> _buildBarSeries() {
    return <BarSeries<ChartSampleData, String>>[
      BarSeries<ChartSampleData, String>(
        dataSource: _chartData,
        xValueMapper: (ChartSampleData sales, int index) => sales.x,
        yValueMapper: (ChartSampleData sales, int index) => sales.y,

        /// If we set the border radius value for Bar series,
        /// then the series will appear as rounder corner.
        borderRadius: const BorderRadius.all(Radius.circular(10)),
      ),
    ];
  }

  @override
  void dispose() {
    _chartData!.clear();
    super.dispose();
  }
}
/// Dart imports.
import 'dart:async';
import 'dart:math';

/// Package import.
import 'package:flutter/material.dart';

/// Chart import.
import 'package:syncfusion_flutter_charts/charts.dart';

/// Local import.
import '../../../../../model/sample_view.dart';

/// Renders the Range Column Chart sample with dynamically updated data points.
class AnimationRangeColumnDefault extends SampleView {
  const AnimationRangeColumnDefault(Key key) : super(key: key);

  @override
  _AnimationRangeColumnDefaultState createState() =>
      _AnimationRangeColumnDefaultState();
}

class _AnimationRangeColumnDefaultState extends SampleViewState {
  _AnimationRangeColumnDefaultState();

  Timer? _timer;
  List<_ChartData>? _chartData;

  @override
  Widget build(BuildContext context) {
    _buildChartData();
    _timer = Timer(const Duration(seconds: 2), () {
      setState(() {
        _buildChartData();
      });
    });
    return _buildCartesianChart();
  }

  /// Return the Cartesian Chart with Range Column series.
  SfCartesianChart _buildCartesianChart() {
    return SfCartesianChart(
      plotAreaBorderWidth: 0,
      primaryXAxis: const CategoryAxis(
        majorGridLines: MajorGridLines(width: 0),
      ),
      primaryYAxis: const NumericAxis(
        majorTickLines: MajorTickLines(color: Colors.transparent),
        axisLine: AxisLine(width: 0),
        minimum: 0,
        maximum: 100,
      ),
      series: _buildRangeColumnSeries(),
    );
  }

  /// Returns the list of Cartesian Range Column series.
  List<RangeColumnSeries<_ChartData, num>> _buildRangeColumnSeries() {
    return <RangeColumnSeries<_ChartData, num>>[
      RangeColumnSeries<_ChartData, num>(
        dataSource: _chartData,
        xValueMapper: (_ChartData sales, int index) => sales.x,
        lowValueMapper: (_ChartData sales, int index) => sales.y,
        highValueMapper: (_ChartData sales, int index) => sales.z,
      ),
    ];
  }

  int _buildRandomInt(int min, int max) {
    final Random random = Random();
    return min + random.nextInt(max - min);
  }

  void _buildChartData() {
    _ch


using System.IO;
using System.Linq;
using NUnit.Framework;
using OpenTap.Plugins.BasicSteps;
namespace OpenTap.UnitTests;

[TestFixture]
public class TestPlanReferenceTest
{
    [Test]
    public void RemovingParameterFromReferencedPlan()
    {
        // this unit test checks that a parameterization is automatically removed if
        // the parameter comes from a test plan reference which initially has the parameter
        // but later the referenced plan removes the parameter after which
        // the test plan is reloaded.

        var planWithoutParam = nameof(RemovingParameterFromReferencedPlan) + ".no-parameter.TapPlan";
        var planWithParam = nameof(RemovingParameterFromReferencedPlan) + ".parameter.TapPlan";
        try
        {
            {
                // create two test plans, one with the external parameter 'A' and one without.
                var plan = new TestPlan();
                var step = new DelayStep();
                plan.ChildTestSteps.Add(step);
                plan.Save(planWithoutParam);
                TypeData.GetTypeData(step).GetMember(nameof(step.DelaySecs)).Parameterize(plan, step, "A");
                plan.Save(planWithParam);
            }

            {

                var plan = new TestPlan();
                var tpr = new TestPlanReference();

                // first we load the test plan reference containing the parameter A and
                // parameterize that onto the plan.

                tpr.Filepath.Text = planWithParam;
                plan.ChildTestSteps.Add(tpr);
                tpr.LoadTestPlan();
                var aMember = TypeData.GetTypeData(tpr).GetMember("A");
                aMember.Parameterize(plan, tpr, "B");
                var memberBPre = TypeData.GetTypeData(plan).GetMember("B");

                // now we select the test plan _without_ the parameter A
                // and load that with the parameter B still existing on the test plan.

                tpr.Filepath.Text = planWithoutParam;
                tpr.LoadTestPlan();

                var memberBPost = TypeData.GetTypeData(plan).GetMember("B");

                // if everything works, we should no longer be able to access 'B'.
                // it is automatically removed by the parameter sanitation algorithm, ParameterManager.checkParameterSanity.

                Assert.IsNotNull(memberBPre);
                Assert.IsNull(memberBPost);
            }

        }
        finally
        {
            File.Delete(planWithoutParam);
            File.Delete(planWithParam);
        }
    }

    /// <summary>
    /// tests various aspects of converting a test plan reference to a sequence.
    /// </summary>
    [Test]
    public void TestConvertToSequence()
    {
        string targetFile = "TestConvertToSequence.unittest.TapPlan";


            string version)
        {
            AzureApiVersion = azureApiVersion;
            ExpiryTime = expiryTime;
            Id = id;
            IsUpToDate = isUpToDate;
            LastAliveTime = lastAliveTime;
            Name = name;
            State = state;
            SyncDatabaseId = syncDatabaseId;
            Type = type;
            Version = version;
        }
    }
}


->b[oc5];
	if (no == NULL) br->b[oc5] = (Branch *)(no = addnode(oc));

	while (no->next) no = no->next;

	a = 0;
	if (no->v[7]) {     /* node full */
		no->next = addnode(oc);
		no = no->next;
	}
	else {
		while (no->v[a] != NULL) a++;
	}

	no->v[a] = (RayFace *) RE_rayobject_align(face);

	if (quad)
		calc_ocval_face(rtf[0], rtf[1], rtf[2], rtf[3], x >> 2, y >> 1, z, &no->ov[a]);
	else
		calc_ocval_face(rtf[0], rtf[1], rtf[2], NULL, x >> 2, y >> 1, z, &no->ov[a]);
}

static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocface, short rts[4][3], float rtf[4][3])
{
	int ocx1, ocx2, ocy1, ocy2;
	int x, y, dx = 0, dy = 0;
	float ox1, ox2, oy1, oy2;
	float lambda, lambda_o, lambda_x, lambda_y, ldx, ldy;

	ocx1 = rts[b1][c1];
	ocy1 = rts[b1][c2];
	ocx2 = rts[b2][c1];
	ocy2 = rts[b2][c2];

	if (ocx1 == ocx2 && ocy1 == ocy2) {
		ocface[oc->ocres * ocx1 + ocy1] = 1;
		return;
	}

	ox1 = rtf[b1][c1];
	oy1 = rtf[b1][c2];
	ox2 = rtf[b2][c1];
	oy2 = rtf[b2][c2];

	if (ox1 != ox2) {
		if (ox2 - ox1 > 0.0f) {
			lambda_x = (ox1 - ocx1 - 1.0f) / (ox1 - ox2);
			ldx = -1.0f / (ox1 - ox2);
			dx = 1;
		}
		else {
			lambda_x = (ox1 - ocx1) / (ox1 - ox2);
			ldx = 1.0f / (ox1 - ox2);
			dx = -1;
		}
	}
	else {
		lambda_x = 1.0f;
		ldx = 0;
	}

	if (oy1 != oy2) {
		if (oy2 - oy1 > 0.0f) {
			lambda_y = (oy1 - ocy1 - 1.0f) / (oy1 - oy2);
			ldy = -1.0f / (oy1 - oy2);
			dy = 1;
		}
		else {
			lambda_y = (oy1 - ocy1) / (oy1 - oy2);
			ldy = 1.0f / (oy1 - oy2);
			dy = -1;
		}
	}
	else {
		lambda_y = 1.0f;
		ldy = 0;
	}

	x = ocx1; y = ocy1;
	lambda = MIN2(lambda_x, lambda_y);

	while (true) {

		if (x < 0 || y < 0 || x >= oc->ocres || y >= oc->ocres) {
			/* pass*/
		}
		else {
			ocface[oc->ocres * x + y] = 1;
		}

		lambda_o = lambda;
		if (lambda_x == lambda_y) {
			lambda_x += ldx;
			x += dx;
			lambda_y += ldy;
			y += dy;
		}
		else {
			if (lambda_x < lambda_y) {
				lambda_x += ldx;
				x += dx;
			}
			else {
				lambda_y += ldy;
				y += dy;
			}
		}
		lambda = MIN2(lambda_x, lambda_y);
		if (lambda == lambda_o) break;
		if (lambd


доменами. См. [подробнее](https://github.com/mtxadmin/ublock/blob/master/docs/hosts_file_blokada_en.md) на английском

Обратите внимание, что нет смысла добавлять данный файл в uBlock Origin, хотя он и понимает этот формат - используйте лучше [полную версию подписки](../README.md) для этого.
# 内容： 监督学习
## 项目：为CharityML寻找捐献者

## 项目概况
在这个项目中，你将使用监督技术和分析能力对美国人口普查数据进行分析，以帮助CharityML（一个虚拟的慈善机构）识别最有可能向他们捐款的人，你将首先探索数据以了解人口普查数据是如何记录的。接下来，你将使用一系列的转换和预处理技术以将数据整理成能用的形式。然后，你将在这个数据上评价你选择的几个算法，然后考虑哪一个是最合适的。之后，你将优化你现在为CharityML选择的模型。最后，你将探索选择的模型和它的预测能力。

## 项目亮点
这个项目设计成帮助你熟悉在sklearn中能够使用的多个监督学习算法，并提供一个评价模型在某种类型的数据上表现的方法。在机器学习中准确理解在什么时候什么地方应该选择什么算法和不应该选择什么算法是十分重要的。

完成这个项目你将学会以下内容：
- 知道什么时候应该使用预处理以及如何做预处理。
- 如何为问题设置一个基准。
- 判断在一个特定的数据集上几个监督学习算法的表现如何。
- 调查候选的解决方案模型是否足够解决问题。

## 软件要求

这个项目要求使用 Python 2.7 并且需要安装下面这些python包：

- [Python 2.7](https://www.python.org/download/releases/2.7/)
- [NumPy](http://www.numpy.org/)
- [Pandas](http://pandas.pydata.org/)
- [scikit-learn](http://scikit-learn.org/stable/)
- [matplotlib](http://matplotlib.org/)

你同样需要安装好相应软件使之能够运行 [iPython Notebook](http://ipython.org/notebook.html)

优达学城推荐学生安装[Anaconda](https://www.continuum.io/downloads), 这是一个已经打包好的python发行版，它包含了我们这个项目需要的所有的库和软件。请注意你安装的是2.7而不是3.X

## 开始项目

对于这个项目，你能够在**Resources**部分找到一个能下载的`find_donors.zip`。*你也可以访问我们的[机器学习项目GitHub](https://github.com/udacity/machine-learning)获取我们纳米学位中的所有项目*

这个项目包含以下文件：

- `find_donors.ipynb`: 这是你需要工作的主要的文件。
- `census.csv`: 项目使用的数据集，你将需要在notebook中载入这个数据集。
- `visuals.py`: 一个实现了可视化功能的Python代码。不要修改它。

在终端或命令提示符中，导航到包含项目文件的文件夹，使用命令`jupyter notebook finding_donors.ipynb`以在一个浏览器窗口或一个标签页打开notebook文件。或者你也可以使用命令`jupyter notebook`或者`ipython notebook`然后在打开的网页中导航到需要的文件夹。


271	cuelink
5272	pk
5280	xmpp-bosh
5281	undo-lm
5282	transmit-port
5298	presence
5299	nlg-data
5300	hacl-hb
5301	hacl-gs
5302	hacl-cfg
5303	hacl-probe
5304	hacl-local
5305	hacl-test
5306	sun-mc-grp
5307	sco-aip
5308	cfengine
5309	jprinter
5310	outlaws
5312	permabit-cs
5313	rrdp
5314	opalis-rbt-ipc
5315	hacl-poll
5316	hpdevms
5317	hpdevms
5318	pkix-cmc
5320	bsfserver-zn
5321	bsfsvr-zn-ssl
5343	kfserver
5344	xkotodrcp
5349	stuns
5350	nat-pmp-status
5351	nat-pmp
5352	dns-llq
5353	mdns
5354	mdnsresponder
5355	llmnr
5356	ms-smlbiz
5357	wsdapi
5358	wsdapi-s
5359	ms-alerter
5360	ms-sideshow
5361	ms-s-sideshow
5362	serverwsd2
5363	net-projection
5364	kdnet
5397	stresstester
5398	elektron-admin
5399	securitychase
5400	pcduo-old
5401	excerpts
5402	mftp
5403	hpoms-ci-lstn
5404	hpoms-dps-lstn
5405	pcduo
5406	systemics-sox
5407	foresyte-clear
5408	foresyte-sec
5409	salient-dtasrv
5410	salient-usrmgr
5411	actnet
5412	continuus
5413	wwiotalk
5414	statusd
5415	ns-server
5416	sns-gateway
5417	sns-agent
5418	mcntp
5419	dj-ice
5420	cylink-c
5421	netsupport2
5422	salient-mux
5423	virtualuser
5424	beyond-remote
5425	br-channel
5426	devbasic
5427	sco-peer-tta
5428	telaconsole
5429	base
5430	radec-corp
5431	park-agent
5432	postgresql
5433	pyrrho
5434	sgi-arrayd
5435	sceanics
5436	pmip6-cntl
5437	pmip6-data
5443	spss
5445	smbdirect
5450	tiepie
5453	surebox
5454	apc-5454
5455	apc-5455
5456	apc-5456
5461	silkmeter
5462	ttl-publisher
5463	ttlpriceproxy
5464	quailnet
5465	netops-broker
5470	apsolab-col
5471	apsolab-cols
5472	apsolab-tag
5473	apsolab-tags
5474	apsolab-rpc
5475	apsolab-data
5490	connect-proxy
5500	hotline
5501	fcp-addr-srvr2
5502	fcp-srvr-inst1
5503	fcp-srvr-inst2
5504	fcp-cics-gw1
5505	checkoutdb
5506	amc
5507	psl-management
5510	secureidprop
5520	sdlog
5530	sdserv
5540	sdreport
5550	sdadmind
5553	sgi-eventmond
5554	sgi-esphttp
5555	freeciv
5556	freeciv
5557	farenet
5560	isq


$110.w,(a0)+
		move.l	$70.w,(a0)+
		move.b	$fffffa07.w,(a0)+
		move.b	$fffffa09.w,(a0)+
		move.b	$fffffa13.w,(a0)+
		move.b	$fffffa15.w,(a0)+
		move.b	$fffffa17.w,(a0)+
		move.b	$fffffa19.w,(a0)+
		move.b	$fffffa1b.w,(a0)+
		move.b	$fffffa1d.w,(a0)+
		move.b	$fffffa23.w,(a0)+
		move.b	$fffffa25.w,(a0)+

		and.b	#$df,$fffffa09.w
		and.b	#$fe,$fffffa07.w

; Musics done by BIG ALEC of DF
		moveq	#1,d0
		jsr	tune

		move.l	#new_120,$120.w
		move.l	#new_70,$70.w
		bclr	#3,$fffffa17.w
		or.b	#1,$fffffa07.w
		or.b	#1,$fffffa13.w
		move.w	#$2300,sr
		rts

**** Due to the tune using TIMERD I cause TIMERB to interrupt 1 line
**** earlier so I can disable TIMERD. The reason for this is to stop
**** the rasters on TIMERB flickering. Once I've changed the raster
**** colour I re-enable TIMERD so the tune doesn't screw up.
****
**** Note: I turn TIMERD off each time I want a change of colour on
****       the raster. If a different tune is used the TIMERD bit can
****       be removed but the TIMERB DATA REG (fffffa21.b) and routines
****       will need altering accordingly.
****
****       If you haven't got a f**kin' clue what I'm talking about
****       simply bolt a normal tune in 'cos it'll still work!

new_120	bclr	#4,$fffffa15.w		;STOP TIMERD - SID chip emulator
	clr.b	$fffffa1b.w
	move.l	#new_120a,$120.w
	move.b	#1,$fffffa21.w
	move.b	#8,$fffffa1b.w
	rte

new_120a
	not.w	$ffff8240.w
	clr.b	$fffffa1b.w
	move.w	middle_pal+2,$ffff8242.w
	movem.l	d0-d6,-(sp)
	movem.l	middle_pal+4,d0-d6
	movem.l	d0-d6,$ffff8244.w
	movem.l	(sp)+,d0-d6
	move.l	#new_120_part2,$120.w
	move.b	#1,$fffffa21.w
	move.b	#8,$fffffa1b.w
	bset	#4,$fffffa15.w		;start TIMERD - tune!!!!
	rte

new_120_part2
	move.w	#$002,$ffff8240.w
	clr.b	$fffffa1b.w
	move.l	#new_120_part3,$120.w
 	move.b	#133,$fffffa21.w
	move.b	#8,$fffffa1b.w
	rte

new_120_part3
	clr.b	$fffffa1b.w
	move


);

impl<'a,'r> FromRequest<'a,'r> for DbConn{
	type Error=();

	fn from_request(request:&'a Request<'r>)->request::Outcome<Self,Self::Error>{
		let pool=request.guard::<State<mysql::Pool>>()?;
		match pool.get_conn(){
			Ok(conn)=>Outcome::Success(DbConn(conn)),
			Err(_)=>Outcome::Failure((Status::ServiceUnavailable,()))
		}
	}
}

impl Deref for DbConn{
	type Target=mysql::PooledConn;

	fn deref(&self)->&Self::Target{
		&self.0
	}
}
impl DerefMut for DbConn{
	fn deref_mut(&mut self)->&mut mysql::PooledConn{
		&mut self.0
	}
}

pub fn connect()->MysqlPool{
	dotenv().ok();
	let database_url=env::var("DATABASE_URL");
	mysql::Pool::new(database_url.unwrap()).expect("db orz")
}
<filename>src/ast.rs
use semver::Version;

pub trait Feature {
    fn get_str_version(&self) -> String;

    fn get_version(&self) -> Version {
        Version::parse(&self.get_str_version()).unwrap()
    }

    fn has_str_version(&self, str_version: &str) -> bool {
        self.has_version(&Version::parse(str_version).unwrap())
    }

    fn has_version(&self, version: &Version) -> bool {
        *version >= self.get_version()
    }
}

pub type Identifier = String;
pub type FuncName = Identifier;
pub type VarName = Identifier;
pub type DefArgs = Vec<Identifier>;
pub type CallArgs = Vec<Box<Expr>>;
pub type Format = String;
pub type Field = String;

#[derive(Debug)]
pub enum TopLevel {
    WithExpr { module: Module, imports: Vec<Import>, expr: Box<Expr> },
    NoExpr { module: Module, imports: Vec<Import>, func_defs: Vec<FuncDef> },
}

#[derive(Debug)]
pub enum Module {
    None,
    WithMetadata { metadata: Box<Expr> },
}

#[derive(Debug)]
pub enum Import {
    Simple { what: ImportWhat },
    WithMetadata { what: ImportWhat, metadata: Box<Expr> },
}

#[derive(Debug)]
pub enum ImportWhat {
    Json { from: ImportFrom, as_ident: Identifier },
    Jq { from: ImportFrom, as_ident: Identifier },
    Include { from: ImportFrom },
}

#[derive(Debug)]
pub enum ImportFrom {
    ImportFrom { path: LString },
}

#[derive(Debug)]
pub enum Expr {
    Top { func_def: FuncDef, expr: Box<Expr> },
    TermPipe { term_patterns: TermPatterns, expr: Box<Expr> },
    Reduce { term_patterns: TermPatterns, base: Box<Expr>, increment: Box<Expr> },
    ForeachEx { term_patterns: TermPatterns, init: Box<Expr>, update: Box<Expr>, extract: Box<Expr> },
    Foreach { term_patterns: TermPatterns, init: Box<Expr>, update: Box<Expr> },
    Conditional { if_then_cases: Vec<(Box<Expr>, Box<Expr>)>, else_case: Box<Expr> },
    TryCatch { try: Box<Expr>, catch: Box<Expr> },
    Try { try: Box<Expr> },
    LabelPipe { ident: Identifier, expr: Box<Expr> },
    WithOperator { operator_expr: OperatorExpr },
}

#[derive(Debug)]
pub struct TermPatterns { pub term: Box<Term>, pub patterns: Patterns }

#[derive(Debug)]
pub enum OperatorExpr {
    UnaryPrefix { op: UnaryPrefixOp, operand: Bo


 TitlePrefix = titlePrefix ?? "Story: ";
            Type = storyType;

            Narrative1 = narrative1;
            Narrative2 = narrative2;
            Narrative3 = narrative3;

            ImageUri = imageUri;
            StoryUri = storyUri;
        }

        public Type Type { get; private set; }
        public string Title { get; private set; }
        public string TitlePrefix { get; private set; }
        public string Narrative1 { get; private set; }
        public string Narrative2 { get; private set; }
        public string Narrative3 { get; private set; }
        public string ImageUri { get; private set; }
        public string StoryUri { get; private set; }
    }
}


 node = getServer();

        try (ClickHouseClient client = getClient()) {
            ClickHouseRequest<?> request = newRequest(client, node)
                    .format(ClickHouseFormat.RowBinaryWithNamesAndTypes)
                    .set("send_logs_level", "trace")
                    .set("enable_optimize_predicate_expression", 1)
                    .set("log_queries_min_type", "EXCEPTION_WHILE_PROCESSING");
            execute(request, "drop table if exists test_mutation;");
            execute(request, "create table if not exists test_mutation(a String, b UInt32) engine = Memory;");
            execute(request, "insert into test_mutation values('a', 1)('b', 2)");
        }
    }

    @Test(groups = "integration")
    public void testQueryIntervalTypes() throws ExecutionException, InterruptedException {
        ClickHouseNode server = getServer();

        try (ClickHouseClient client = getClient()) {
            for (ClickHouseDataType type : new ClickHouseDataType[] { ClickHouseDataType.IntervalYear,
                    ClickHouseDataType.IntervalQuarter, ClickHouseDataType.IntervalMonth,
                    ClickHouseDataType.IntervalWeek, ClickHouseDataType.IntervalDay, ClickHouseDataType.IntervalHour,
                    ClickHouseDataType.IntervalMinute, ClickHouseDataType.IntervalSecond }) {
                try (ClickHouseResponse resp = newRequest(client, server)
                        .format(ClickHouseFormat.RowBinaryWithNamesAndTypes)
                        .query(ClickHouseUtils.format(
                                "select to%1$s(0), to%1$s(-1), to%1$s(1), to%1$s(%2$d), to%1$s(%3$d)", type.name(),
                                Long.MIN_VALUE, Long.MAX_VALUE))
                        .execute().get()) {
                    List<ClickHouseRecord> records = new ArrayList<>();
                    for (ClickHouseRecord record : resp.records()) {
                        records.add(record);
                    }

                    Assert.assertEquals(records.size(), 1);
                    ClickHouseRecord r = records.get(0);
                    Assert.assertEquals(r.getValue(0).asString(), "0");
                    Assert.assertEquals(r.getValue(1).asString(), "-1");
                    Assert.assertEquals(r.getValue(2).asString(), "1");
                    Assert.assertEquals(r.getValue(3).asString(), String.valueOf(Long.MIN_VALUE));
                    Assert.assertEquals(r.getValue(4).asString(), String.valueOf(Long.MAX_VALUE));
                }
            }
        }
    }

    @Test(groups = "integration")
    public void testReadWriteDateTimeTypes() throws ClickHouseException {
        ClickHouseNode server = getServer();

        sendAndWait(server, "drop table if exists test_datetime_types",
                "create table test_datetime_types(no UInt8, d0 DateTime32, d1 DateTime64(5), d2 DateTime(3), d3 DateTime64(3, 'Asia/Chongqing')) engine=MergeTree ORDER BY no");
        sendAndWait(server, "insert into test_datetime_types values(:no, :d0, :d1, :d2, :d3)",
                new ClickHouseValue[] { ClickHouseIntegerValue.ofNull(),
                        ClickHouseDateTimeValue.ofNull(0, ClickHouseValues.UTC_TIMEZONE),
                        ClickHouseDateTimeValue.ofNull(3, ClickHouseValues.UTC_TIMEZONE),
                        ClickHouseDateTimeValue.ofNull(9, ClickHouseValues.UTC_TIMEZONE),
                        ClickHouseOffsetDateTimeValue.ofNull(3, TimeZone.getTimeZone("Asia/Chongqing")) },
                new Object[] { 0, "1970-01-01 00:00:00", "1970-01-01 00:00:00.123456",
                        "1970-01-01 00:00:00.123456789", "1970-02-01 12:34:56.789" },
                new Object[] { 1, -1, -1, -1, -1 }, new Object[] { 2, 1, 1, 1, 1 },
                new Object[] { 3, 2.1,


filename), metadata);

    // load() waits for the job to finish
    console.log(`Job ${job.id} completed.`);
  }
  // [END bigquery_load_table_gcs_parquet]
  loadTableGCSParquet();
}
main(...process.argv.slice(2));
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

function main(
  datasetId = 'my_dataset', // Existing dataset ID
  tableId = 'my_view', // Existing table ID
) {
  // [START bigquery_get_view]
  // Import the Google Cloud client library
  const {BigQuery} = require('@google-cloud/bigquery');
  const bigquery = new BigQuery();

  async function getView() {
    // Retrieves view properties.

    /**
     * TODO(developer): Uncomment the following lines before running the sample
     */
    // const datasetId = "my_dataset";
    // const tableId = "my_view";

    // Retrieve view
    const dataset = bigquery.dataset(datasetId);
    const [view] = await dataset.table(tableId).get();

    const fullTableId = view.metadata.id;
    const viewQuery = view.metadata.view.query;

    // Display view properties
    console.log(`View at ${fullTableId}`);
    console.log(`View query: ${viewQuery}`);
  }
  getView();
  // [END bigquery_get_view]
}
main(...process.argv.slice(2));
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

function main(datasetId = 'my_dataset', tableId = 'my_table') {
  // [START bigquery_load_table_gcs_csv_autodetect]
  // Import the Google Cloud client libraries
  const {BigQuery} = require('@google-cloud/bigquery');
  const {Storage} = require('@google-cloud/storage');

  // Instantiate clients
  const bigquery = new BigQuery();
  const storage = new Storage();

  /**
   * TODO(developer): Uncomment the following lines before running the sample
   */
  // const datasetId = "my_dataset";
  // const tableId = "my_table";

  /**
   * This sample loads the CSV file at
   * https://storage.googleapis.com/cloud-samples-data/bigquery/us-states/us-states.csv
   *
   * TODO(developer): Replace the following lines with the path to your file
   */
  const bucketName = 'cloud-samples-data';
  const filename = 'bigquery/us-states/us-states.csv';

  async function loadCSVFromGCSAutodetect() {
    // Imports a GCS file into a table with autodetected schema.

    // Configure the load job. For full list of options, see:
    // https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad
    const metadata = {
      sourceFormat: 'CSV',
      skipLeadingRows: 1,
      autode


tiary!.xml,
    );
  }

  loadSpriteSheets(): void {
    const bgImg = GameConfig.bgImg as IGameObjectInfo;
    const shooter = GameConfig.shooter;
    const bullet = GameConfig.bullet;
    const coronaL1 = GameConfig.covidBalls.L1!;
    const coronaL2 = GameConfig.covidBalls.L2!;
    const coronaL3 = GameConfig.covidBalls.L3!;

    this.load.image(bgImg.name, bgImg.path);

    this.load.spritesheet(shooter.name, shooter.path, {
      frameWidth: shooter.width,
      frameHeight: shooter.height,
    });

    this.load.spritesheet(bullet.name, bullet.path, {
      frameWidth: bullet.width,
      frameHeight: bullet.height,
    });

    this.load.spritesheet(coronaL3.name, coronaL3.path, {
      frameWidth: coronaL3.width,
      frameHeight: coronaL3.height,
    });

    this.load.spritesheet(coronaL2.name, coronaL2.path, {
      frameWidth: coronaL2.width,
      frameHeight: coronaL2.height,
    });

    this.load.spritesheet(coronaL1.name, coronaL1.path, {
      frameWidth: coronaL1.width,
      frameHeight: coronaL1.height,
    });
  }

  /**
   * Sets background image for the game scene
   *
   * @param {IBox} midPoint
   * @memberof GameScene
   */
  setBgImage(midPoint: IBox): void {
    this.bgImage = this.add
      .tileSprite(0, midPoint.height, 0, 0, (GameConfig.bgImg as IGameObjectInfo).name)
      .setScale(1.26);
  }

  // #endregion
}
declare let require: any;
type IconBase<TIcon> = {
    id: string;
    icon: TIcon;
    name: string;
    groupName: string;
    size: number;
};
type IconGroup<TIcon> = { [key: string]: IconBase<TIcon>[] };
export type IconList<TIcon> = IconBase<TIcon> & {
    parentId?: string;
};
const groupsLoader: { ctx: any; iPath: string; delimiter: string }[] = [{ ctx: require.context('@epam/assets/icons/loaders', true, /.svg$/), iPath: '@epam/assets/icons/loaders', delimiter: '_' }, { ctx: require.context('@epam/assets/icons/common', true, /.svg$/), iPath: '@epam/assets/icons/common', delimiter: '-' }];
function getAllIconsGrouped<TIcon>(): IconGroup<TIcon> {
    const acc: IconGroup<TIcon> = {};
    groupsLoader.forEach((t) => {
        const { ctx, iPath, delimiter } = t;
        const keys = ctx.keys();
        keys.forEach((file: any) => {
            const { ReactComponent: icon } = ctx(file);
            const name = file.replace('.', iPath);
            const groupName = name.replace(`${iPath}/`, '').split(delimiter).slice(0, -1).join('-');
            const size = getIconSize(name);
            const i = {
                id: name, icon, name, groupName, size,
            };
            const g = acc[groupName] || (acc[groupName] = []);
            g.push(i);
        });
    });
    return acc;
}
function getIconSize(path: string) {
    const info = path.match(/\d{2}/);
    return info ? +info[0] : null;
}

const groupedIcons = getAllIconsGrouped<any>();

export function getGroupedIcons() {
    return groupedIcons;
}

export function getIconList<TIcon>(includeChildren?: boolean) {
    return Object.keys(groupedIcons).reduce<IconList<TI


rty<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<int>("AfterQuantity")
                        .HasColumnType("INTEGER");

                    b.Property<DateTime>("Date")
                        .HasColumnType("TEXT");

                    b.Property<int>("InventoryId")
                        .HasColumnType("INTEGER");

                    b.Property<string>("InventoryItemId")
                        .IsRequired()
                        .HasColumnType("TEXT");

                    b.Property<int>("PreviousQuantity")
                        .HasColumnType("INTEGER");

                    b.HasKey("Id");

                    b.HasIndex("InventoryId");

                    b.ToTable("StockInOut");
                });

            modelBuilder.Entity("SimpleWMS.Database.Entities.InventoryItem", b =>
                {
                    b.HasOne("SimpleWMS.Database.Entities.Product", "Product")
                        .WithMany("InventoryItems")
                        .HasForeignKey("ProductId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Product");
                });

            modelBuilder.Entity("SimpleWMS.Database.Entities.StockInOut", b =>
                {
                    b.HasOne("SimpleWMS.Database.Entities.InventoryItem", "InventoryItem")
                        .WithMany("StockInOuts")
                        .HasForeignKey("InventoryId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("InventoryItem");
                });

            modelBuilder.Entity("SimpleWMS.Database.Entities.InventoryItem", b =>
                {
                    b.Navigation("StockInOuts");
                });

            modelBuilder.Entity("SimpleWMS.Database.Entities.Product", b =>
                {
                    b.Navigation("InventoryItems");
                });
#pragma warning restore 612, 618
        }
    }
}


e);
        }
      } else {
        return this.created(this.res);
      }
    } catch (err) {
      // console.log(err)
      return this.fail(err);
    }
  }
}
// Import config from .env

// eslint-disable-next-line
require("dotenv").config();

import { ConEd } from "./coned";
import { connect } from "trilogy";
import chalk from "chalk";
import fs from "fs";
import moment from "moment";
import fastify from "fastify";
import axios from "axios";

const output_dir = "out";

if (!fs.existsSync(output_dir)) {
	fs.mkdirSync(output_dir);
}

async function main() {
	const db = connect(`./${output_dir}/storage.db`);

	process.on("exit", function () {
		db.close();
		console.log(chalk.green("Successfully closed DB connection!"));
	});

	const energySchema = {
		id: "increments",
		startTime: { type: Date, unique: true },
		endTime: { type: Date, unique: true },
		energy: { type: Number },
	};
	type EnergyEntry = {
		id: number;
		startTime: Date;
		endTime: Date;
		energy: number;
	};
	const energyModel = await db.model<EnergyEntry>("energy", energySchema);

	let latest_read_startTime = new Date(0);
	async function update_sensor(latest_read: any) {
		if (latest_read.startTime < latest_read_startTime) return;
		latest_read_startTime = latest_read.startTime;
		axios.post("http://supervisor/core/api/states/sensor.coned_energy", {
			state: latest_read.value,
			attributes: { unit_of_measurement: "kWh", friendly_name: "ConEd Energy Usage", device_class: "energy", state_class: "measurement", last_reset: latest_read.startTime },
		}, {
			headers: {"Authorization": `Bearer ${process.env.SUPERVISOR_TOKEN}`, "Content-Type": "application/json"}
		});
		console.log(chalk.green(`Sent sensor update: ${latest_read.value} kWh @ ${moment(latest_read.startTime).format("LLL")}`));
	}

	async function db_store(raw_data: any) {
		const filtered_data = raw_data.reads.filter((row: any) => {
			return row.value !== null && row.value !== undefined;
		})
		const latest_read = filtered_data[0];
		update_sensor(latest_read);
		for (const row of filtered_data) {
			await energyModel.updateOrCreate({ startTime: new Date(row.startTime), endTime: new Date(row.endTime) }, { energy: row.value }).catch((e) => {
				console.log(chalk.red(`Err: ${e}`));
			});
		}
		console.log(chalk.green("Database Updated!"));
		console.log(chalk.green("Database Closed!"));
	}

	const c = new ConEd({ db_store });
	c.monitor();

	const server = fastify({
		//logger: true,
	});

	// Declare a route
	server.get<{
		Querystring: { h: number };
	}>("/", (request, reply) => {
		console.log(request.query);
		let hour_lookback = 24;
		if (request.query.h) {
			if (!!Number(request.query.h)) {
				hour_lookback = Number(request.query.h);
			} else {
				reply.code(400).type("text/plain").send("Err 400: Invalid Request");
				return;
			}
		}
		const d = new Date();
		d.setHours(d.getHours() - hour_lookback);
		energyModel.find([["startTime", ">", d]]).then((raw_data) => {
			reply.send({ data: raw_data });
		});
	});

	server.get<{
		Querystring: { n: number };
	}>("/latest", (request, reply) => {
		console.log(request.query);
		let n_results = 64;


 r1 = i = -read
	MOV	r10,#0			@ r10= next = 0
m1_loop:
	MOV	r7, r10			@ r7 = chase=next
	MOVS	r0, r0, LSR #1		@ r0 = lok>>1     C = bottom bit
	ADC	r8, r6, r7		@ r8 = t+chase+bit
	LDRB	r10,[r8], -r6		@ r10= next=t[chase+bit] r8=chase+bit
	ADDS	r1, r1, #1		@ r1 = i++
	@ stall Xscale
	CMPLT	r10,#0x80		@ if (next & 0x80) == 0
	BLT	m1_loop

	ADD	r1, r1, r4		@ r1 = i+read
	MOV	r0, r5			@ r0 = b
	BL	oggpack_adv		@ oggpack_adv(b, i)

	CMP	r10,#0x80
	BLT	duff

	CMP	r8, r7			@ if bit==0 (chase+bit==chase) (sets C)
	LDRNEB	r14,[r6, r7]		@ r14= t[chase]
	MOVEQ	r14,#128
	ADC	r12,r8, r6		@ r12= chase+bit+1+t
	LDRB	r14,[r12,r14,LSR #7]	@ r14= t[chase+bit+1+(!bit || t[chase]&0x80)]
	BIC	r10,r10,#0x80		@ r3 = next &= ~0x80
	@ stall Xscale
	ORR	r0, r14,r10,LSL #8	@ r7 = chase = (next<<8) | r14

	LDMFD	r13!,{r4-r8,r10,PC}

meth2:
	RSB	r1, r4, #0		@ r1 = i-read = 0-read
	MOV	r7, #0			@ r7 = chase
	MOV	r6, r6, LSR #1
m2_loop:
	MOVS	r0, r0, LSR #1		@ r0 = lok>>1   C = bottom bit
	ADC	r2, r6, r7, LSL #1	@ r8 = &t[chase*2+C]
	LDRH	r7, [r2, r2]
	ADDS	r1, r1, #1		@ r1 = i-read++ (i-read<0 => i<read)
	@ stall Xscale
	CMPLT	r7, #0x8000
	BLT	m2_loop
	BIC	r7, r7, #0x8000		@ r7 = chase
	CMP	r1, #0			@ if (i-read >= 0) === (i >= read)
	MVNGT	r7, #0			@ if (i >= read) value to return = -1
	ADD	r1, r1, r4		@ r1 = i-read+read+1 = i +1
	MOV	r0, r5			@ r0 = b
	BL	oggpack_adv		@ oggpack_adv(b, i+1);
	MOV	r0, r7			@ return chase
	LDMFD	r13!,{r4-r8,r10,PC}

meth3:
	@ r0 = lok
	@ r4 = read
	@ r5 = b
	@ r6 = dec_table
	RSB	r1, r4, #0		@ r1 = i = -read
	MOV	r10,#0			@ r10= next = 0
m3_loop:
	MOV	r7, r10			@ r7 = chase=next
	MOVS	r0, r0, LSR #1		@ r0 = lok>>1     C = bottom bit
	ADC	r8, r7, #0		@ r8 = chase+


//////////////////////////////////////////////////////////////////////////
//
//  Copyright (c) 2008-2010, Image Engine Design Inc. All rights reserved.
//
//  Redistribution and use in source and binary forms, with or without
//  modification, are permitted provided that the following conditions are
//  met:
//
//     * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the following disclaimer.
//
//     * Redistributions in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in the
//       documentation and/or other materials provided with the distribution.
//
//     * Neither the name of Image Engine Design nor the names of any
//       other contributors to this software may be used to endorse or
//       promote products derived from this software without specific prior
//       written permission.
//
//  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
//  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
//  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
//  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
//  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
//  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
//  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
//  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
//  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
//  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
//  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////

#ifndef IECOREIMAGEBINDINGS_ENVMAPSAMPLERBINDING_H
#define IECOREIMAGEBINDINGS_ENVMAPSAMPLERBINDING_H

namespace IECoreImageBindings
{

void bindEnvMapSampler();

} // namespace IECoreImageBindings

#endif // IECOREIMAGEBINDINGS_ENVMAPSAMPLERBINDING_H


header-img: img/post-bg-2015.jpg
catalog: true
tags:
- CICD
- Tool
---

![img](https://docs.fastlane.tools/img/fastlane_text.png)

写在文章前的话：有问题就去查文档和issues，错不了的

列举一下 在自己电脑上常用的功能

- fastlane 在 iOS 下可以很容易的管理证书和 p12文件
- 很容易修改项目 version，build，截图等需要j提交审核的资源文件
- xcode command line自动化打包，提交测试

- [CI]在 git 提交到测试分支时候执行 CI，打包上传到 TstFlight。打 tag 时候就会上传审核

[官方文档关于 CI 的介绍](https://docs.fastlane.tools/best-practices/continuous-integration/)

## 官网文档 ：[fastlane](https://docs.fastlane.tools/)

### github 是一个强大的社区 ,[mythkiven/AD_Fastlane](https://github.com/mythkiven/AD_Fastlane)有一个很好的例子，和Demo工程，实现了从零到自动打包上传的详细操作步骤。

### 另外一个文档，包括一些多语言、和 CI等处理。[fastlane 持续集成](https://juejin.im/post/5a7b10bb6fb9a0636263bfd5)，是另一个一个非常好的教学文档。

还有可以 google到很多非常有用的博客资料。但是据自己实践来看，很多文档你只需要返回去看官方文档就可以解决。

## 介绍一下自己用到的一些脚本

如果想学习 Ruby 脚本语言可以到这里：**[Ruby 文档](https://www.kancloud.cn/imxieke/ruby-base/107282)**

### 在管理员电脑/打包机器上一些有用的脚本

- 注册新的设备

```
desc "register device"
lane :new_devices do
    register_devices(devices_file: "./devices.txt")
    match(type: "develop", force_for_new_devices: true)
end

```

- 提交测试、提交审核，这些脚本也可以在分支条件被触发时候调用

```
lane :beta do
    build
    upload_to_testflight(ipa: './build/Zhima_iOS.ipa',
                         changelog: '增加评论功能',
                         groups: ['beta'],
                         demo_account_required: true,
                         skip_waiting_for_build_processing: true)
end

lane :release do
    build
    upload_to_app_store(ipa: './build/Zhima_iOS.ipa',
                        force: true,
                        submit_for_review: false,
                        automatic_release: false)
end

lane :release_from_beta do
    upload_to_app_store(
                        build_number: get_build_number,
                        skip_binary_upload: true,
                        force: true,
                        submit_for_review: true,
                        automatic_release: false)
end
```

### 在开发者电脑上一些有用的脚本

- 同步证书

```
lane :setup do
    match(type: 'development', readonly: true)
    match(type: 'appstore', readonly: true)
    match(type: 'adhoc', readonly: true)
end
```

- 设置项目的 version number、build nu


trol characters and escape sequences into
/// function calls that the terminal can handle.
///
/// Design goals:
///  * Zero object allocation during processing.
///  * No internal state. Same input will always produce same output.
class EscapeParser {
  final EscapeHandler handler;

  EscapeParser(this.handler);

  final _queue = ByteConsumer();

  /// Start of sequence or character being processed. Useful for debugging.
  var tokenBegin = 0;

  /// End of sequence or character being processed. Useful for debugging.
  int get tokenEnd => _queue.totalConsumed;

  void write(String chunk) {
    _queue.unrefConsumedBlocks();
    _queue.add(chunk);
    _process();
  }

  void _process() {
    while (_queue.isNotEmpty) {
      tokenBegin = _queue.totalConsumed;
      final char = _queue.consume();

      if (char == Ascii.ESC) {
        final processed = _processEscape();
        if (!processed) {
          _queue.rollback(tokenEnd - tokenBegin);
          return;
        }
      } else {
        _processChar(char);
      }
    }
  }

  void _processChar(int char) {
    if (char > _sbcHandlers.maxIndex) {
      handler.writeChar(char);
      return;
    }

    final sbcHandler = _sbcHandlers[char];
    if (sbcHandler == null) {
      handler.unkownEscape(char);
      return;
    }

    sbcHandler();
  }

  /// Processes a sequence of characters that starts with an escape character.
  /// Returns [true] if the sequence was processed, [false] if it was not.
  bool _processEscape() {
    if (_queue.isEmpty) return false;

    final escapeChar = _queue.consume();
    final escapeHandler = _escHandlers[escapeChar];

    if (escapeHandler == null) {
      handler.unkownEscape(escapeChar);
      return true;
    }

    return escapeHandler();
  }

  late final _sbcHandlers = FastLookupTable<_SbcHandler>({
    0x07: handler.bell,
    0x08: handler.backspaceReturn,
    0x09: handler.tab,
    0x0a: handler.lineFeed,
    0x0b: handler.lineFeed,
    0x0c: handler.lineFeed,
    0x0d: handler.carriageReturn,
    0x0e: handler.shiftOut,
    0x0f: handler.shiftIn,
  });

  late final _escHandlers = FastLookupTable<_EscHandler>({
    '['.charCode: _escHandleCSI,
    ']'.charCode: _escHandleOSC,
    '7'.charCode: _escHandleSaveCursor,
    '8'.charCode: _escHandleRestoreCursor,
    'D'.charCode: _escHandleIndex,
    'E'.charCode: _escHandleNextLine,
    'H'.charCode: _escHandleTabSet,
    'M'.charCode: _escHandleReverseIndex,
    // 'P'.charCode: _unsupportedHandler, // Sixel
    // 'c'.charCode: _unsupportedHandler,
    // '#'.charCode: _unsupportedHandler,
    '('.charCode: _escHandleDesignateCharset0, //  SCS - G0
    ')'.charCode: _escHandleDesignateCharset1, //  SCS - G1
    // '*'.charCode: _voidHandler(1), // TODO: G2 (vt220)
    // '+'.charCode: _voidHandler(1), // TODO: G3 (vt220)
    '>'.charCode: _escHandleResetAppKeypadMode, // TODO: Normal Keypad
    '='.charCode: _escHandleSetAppKeypadMode, // TODO: Application Keypad
  });

  /// `ESC 7` Save Cursor (DECSC)
  ///
  /// https://terminalguide.namepad.de/seq/a_esc_a7/
  bool _escHandleSaveCursor() {
    handler.saveCursor();
    return true;
  }

  /// `ESC 8` Restore Cursor (DECRC)
  ///
  /// https://terminalguide.namepad.de/seq/a_esc_a8/
  bool _escHandleRestoreCursor() {
    handler.restoreCursor();
    return true;
  }

  /// `ESC D` Index (IND)
  ///
  /// https://terminalguide.namepad.de/seq/a_esc_cd/
  bool _escHandleIndex() {
    handler.index();
    return true;


    5.5,
            6.,
            7.5,
            8.,
            9.5,
            10.,
            11.5,
            12.,
            13.5,
            14.,
            0.00000000000000000000007,
        );
        let b = _mm512_set1_ps(0.1);
        let r = _mm512_maskz_mul_round_ps(0, a, b, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
        assert_eq_m512(r, _mm512_setzero_ps());
        let r = _mm512_maskz_mul_round_ps(
            0b11111111_00000000,
            a,
            b,
            _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC,
        );
        let e = _mm512_setr_ps(
            0.,
            0.,
            0.,
            0.,
            0.,
            0.,
            0.,
            0.,
            0.8,
            0.95,
            1.0,
            1.15,
            1.2,
            1.35,
            1.4,
            0.000000000000000000000007000001,
        );
        assert_eq_m512(r, e);
    }

    #[simd_test(enable = "avx512f")]
    unsafe fn test_mm512_div_round_ps() {
        let a = _mm512_set1_ps(1.);
        let b = _mm512_set1_ps(3.);
        let r = _mm512_div_round_ps(a, b, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
        let e = _mm512_set1_ps(0.33333334);
        assert_eq_m512(r, e);
        let r = _mm512_div_round_ps(a, b, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
        let e = _mm512_set1_ps(0.3333333);
        assert_eq_m512(r, e);
    }

    #[simd_test(enable = "avx512f")]
    unsafe fn test_mm512_mask_div_round_ps() {
        let a = _mm512_set1_ps(1.);
        let b = _mm512_set1_ps(3.);
        let r = _mm512_mask_div_round_ps(a, 0, a, b, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
        assert_eq_m512(r, a);
        let r = _mm512_mask_div_round_ps(
            a,
            0b11111111_00000000,
            a,
            b,
            _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC,
        );
        let e = _mm512_setr_ps(
            1., 1., 1., 1., 1., 1., 1., 1., 0.33333334, 0.33333334, 0.33333334, 0.33333334,
            0.33333334, 0.33333334, 0.33333334, 0.33333334,
        );
        assert_eq_m512(r, e);
    }

    #[simd_test(enable = "avx512f")]
    unsafe fn test_mm512_maskz_div_round_ps() {
        let a = _mm512_set1_ps(1.);
        let b = _mm512_set1_ps(3.);
        let r = _mm512_maskz_div_round_ps(0, a, b, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
        assert_eq_m512(r, _mm512_setzero_ps());
        let r = _mm512_maskz_div_round_ps(
            0b11111111_00000000,
            a,
            b,
            _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC,
        );
        let e = _mm512_setr_ps(
            0., 0., 0


),
      );
    }

    StreamSubscription? streamSub;
    streamSub = receivePort.listen((p) {
      if (PortsProvider.isDisposeMessage(p)) {
        receivePort.close();
        streamSub?.cancel();
        return;
      }
      p as Map<String, dynamic>;
      final text = p['text'] as String;
      final temp = p['temp'] as bool;

      final lctext = textCleanedForSearch(text);
      final lctextNonCleaned = textNonCleanedForSearch == null ? null : textNonCleanedForSearch(text);
      final lctextSplit = splitTextCleanedAndNonCleaned(text);

      bool isMatch(List<String>? propertySplit) {
        if (propertySplit == null) return false;

        final match1 = lctextSplit.every((element) => propertySplit.any((p) => p.contains(element)));
        if (match1) return true;

        if (cleanup) {
          // cleanup means symbols and *spaces* are ignored.
          final propertyJoined = propertySplit.join();

          final match2 = propertyJoined.contains(lctext);
          if (match2) return true;

          if (lctextNonCleaned != null) {
            final match3 = propertyJoined.contains(lctextNonCleaned);
            if (match3) return true;
          }
        }

        return false;
      }

      final result = <Track>[];
      tracksExtended.loop((trExt) {
        if ((stitle && isMatch(trExt.splitTitle)) ||
            (sfilename && isMatch(trExt.splitFilename)) ||
            (salbum && isMatch(trExt.splitAlbum)) ||
            (salbumartist && isMatch(trExt.splitAlbumArtist)) ||
            (sartist && isMatch(trExt.splitArtist)) ||
            (sgenre && isMatch(trExt.splitGenre)) ||
            (scomposer && isMatch(trExt.splitComposer)) ||
            (scomment && isMatch(trExt.splitComment)) ||
            (syear && isMatch(trExt.year))) {
          result.add(Track.decide(trExt.path, trExt.isVideo));
        }
      });

      sendPort.send((result, temp, text));
    });

    sendPort.send(null);
  }

  void _searchMediaType({required MediaType type, required String text, bool temp = false}) async {
    Iterable<String> keys = [];
    switch (type) {
      case MediaType.album:
        keys = Indexer.inst.mainMapAlbums.value.keys;
      case MediaType.artist:
        keys = Indexer.inst.mainMapArtists.value.keys;
      case MediaType.albumArtist:
        keys = Indexer.inst.mainMapAlbumArtists.value.keys;
      case MediaType.composer:
        keys = Indexer.inst.mainMapComposer.value.keys;
      case MediaType.genre:
        keys = Indexer.inst.mainMapGenres.value.keys;
      case MediaType.folder:
        keys = mainMapFolder.keys;
      case MediaType.folderVideo:
        keys = mainMapFolderVideos.keys;
      default:
        null;
    }

    if (text == '') {
      if (temp) {
        _searchMapTemp[type]?.clear();
      } else {
        final typeNomalize = type == MediaType.albumArtist || type == MediaType.composer ? MediaType.artist : type;
        typeNomalize.toLibraryTab().textSearchController?.clear();
        _searchMap[typeNomalize]?.value = keys.toList();
      }
      return;
    }

    final sp = await _prepareMediaPorts(keys, type);
    sp.send({
      'text': text,
      'temp': temp,
    });
  }

  void _searchPlaylists(String text, {bool temp = false}) async {
    if (text == '') {
      if (temp) {
        playli


s(autoIndent, "", System.lineSeparator(), BaseXmlFormattingOptions())

  constructor() : this(false)

  private var indentLevel = 0

  override fun startElement(prefix: String?, name: String?, close: Boolean
  ): XmlBuilder {
    if (autoIndent) {
      lfIndent()
    }
    return super.startElement(prefix, name, close).also {
      if (autoIndent) {
        incrIndent()
      }
    }
  }

  override fun addAttributeContents(name: String?, equalsSign: Boolean,
                                    originalValue: String?,
                                    surroundWithQuotes: Boolean
  ) {
    if (autoIndent) {
      lfIndent()
    }
    super.addAttributeContents(name, equalsSign, originalValue,
      surroundWithQuotes)
  }

  override fun selfCloseElement(): XmlBuilder {
    if (autoIndent) {
      dcrIndent()
    }
    return super.selfCloseElement()
  }

  override fun endElement(prefix: String?, name: String?,
                          isEndTagClosed: Boolean
  ): XmlBuilder {
    if (autoIndent) {
      dcrIndent()
      lfIndent()
    }
    return super.endElement(prefix, name, isEndTagClosed)
  }

  /**
   * Increment the indentation level.
   */
  fun incrIndent() {
    ++indentLevel
  }

  /**
   * Decrement the indentation level.
   */
  fun dcrIndent() {
    --indentLevel
  }

  /**
   * Appends a line feed and indents the next line.
   */
  fun lfIndent() {
    linefeed()
    indent()
  }

  /**
   * Appends indentation to the indent line.
   */
  fun indent() {
    indent(indentLevel)
  }
}/*
 *  This file is part of AndroidIDE.
 *
 *  AndroidIDE is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  AndroidIDE is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *   along with AndroidIDE.  If not, see <https://www.gnu.org/licenses/>.
 */

package com.itsaky.androidide.xml.versions

/**
 * A model class to hold the API version information.
 *
 * **Dev Note**: This class must be immutable as the instances of this class are reused for
 * multiple symbols.
 *
 * @property since The API in which the symbol was added.
 * @property deprecatedIn The API in which the symbol was deprecated.
 * @property removedIn The API in which the symbol was removed.
 * @author Akash Yadav
 */
data class ApiVersion(
  val since: Int,
  val deprecatedIn: Int = NONE,
  val removedIn: Int = NONE
) {

  /**
   * Returns `true` if [since] is 1 and [deprecatedIn] and [removedIn] is [ApiVersion.NONE].
   */
  fun isSinceInception(): Boolean =
    since == 1 && deprecatedIn == NONE && removedIn == NONE

  companion object {
    internal const val NONE = 0
  }
}
package com.android.aaptcompiler

import com.android.aaptcompiler.android.isTruthy

// Placeholder marks
private const val PLACEHOLDER_OPEN = "\u00bb"
private const val PLACEHOLDER_CLOSE = "\u00ab"

// Special unicode characters to override directionality of the words
private const val RLM = "\u200f"
private const val RLO = "\u202e"
private const val PDF = "\u202c"

// Argument markers for text
private const val ARG_START = '{'
private const val ARG_END = '}'

private fun Char.pseudoLocalize() = when (this) {
  'a' -> "\u00e5"


VideoHeaders, _: i32, _: i32)
           -> Result<Box<videodecoder::VideoDecoder + 'static>,()> {
        match VpxCodec::init(&VpxCodecIface::vp8()) {
            Ok(codec) => {
                Ok(Box::new(VideoDecoderImpl {
                    codec: codec,
                }) as Box<videodecoder::VideoDecoder>)
            }
            Err(_) => Err(()),
        }
    }
}

impl videodecoder::VideoDecoder for VideoDecoderImpl {
    fn decode_frame(&mut self, data: &[u8], presentation_time: &Timestamp)
                    -> Result<Box<videodecoder::DecodedVideoFrame + 'static>,()> {
        if self.codec.decode(data, 0).is_err() {
            return Err(())
        }
        let image = match self.codec.frame(&mut None) {
            None => return Err(()),
            Some(image) => image,
        };
        if image.format() != ffi::VPX_IMG_FMT_I420 {
            return Err(())
        }
        Ok(Box::new(DecodedVideoFrameImpl {
            image: image,
            presentation_time: *presentation_time,
        }) as Box<videodecoder::DecodedVideoFrame>)
    }
}

struct DecodedVideoFrameImpl {
    image: VpxImage,
    presentation_time: Timestamp,
}

impl videodecoder::DecodedVideoFrame for DecodedVideoFrameImpl {
    fn width(&self) -> c_uint {
        self.image.width()
    }

    fn height(&self) -> c_uint {
        self.image.height()
    }

    fn stride(&self, index: usize) -> c_int {
        self.image.stride(index as u32)
    }

    fn pixel_format<'a>(&'a self) -> PixelFormat<'a> {
        PixelFormat::I420
    }

    fn presentation_time(&self) -> Timestamp {
        self.presentation_time
    }

    fn lock<'a>(&'a self) -> Box<videodecoder::DecodedVideoFrameLockGuard + 'a> {
        Box::new(DecodedVideoFrameLockGuardImpl {
            image: &self.image,
        }) as Box<videodecoder::DecodedVideoFrameLockGuard + 'a>
    }
}

struct DecodedVideoFrameLockGuardImpl<'a> {
    image: &'a VpxImage,
}

impl<'a> videodecoder::DecodedVideoFrameLockGuard for DecodedVideoFrameLockGuardImpl<'a> {
    fn pixels<'b>(&'b self, plane_index: usize) -> &'b [u8] {
        self.image.plane(plane_index as u32)
    }
}

pub const VIDEO_DECODER: videodecoder::RegisteredVideoDecoder =
    videodecoder::RegisteredVideoDecoder {
        id: [ b'V', b'P', b'8', b'0' ],
        constructor: VideoDecoderImpl::new,
    };

#[allow(non_camel_case_types)]
pub mod ffi {
    use libc::{c_char, c_int, c_long, c_uchar, c_uint, c_void};

    pub type vpx_codec_flags_t = c_long;
    pub type vpx_codec_err_t = c_int;
    pub type vpx_codec_iter_t = *mut vpx_codec_iter;
    pub type vpx_color_space_t = c_int;
    pub type vpx_img_fmt_t = c_int;

    #[repr(C)]
    pub struct vpx_codec_ctx_t {
        pub name: *const c_char,
        pub iface: *mut vpx_codec_iface_t,
        pub err: vpx_codec_err_t,
        pub err_detail: *const c_char,
        pub init_flags: vpx_codec_flags_t,
        pub config: *const c_void,
        pub private: *mut vpx_codec_priv_t,
    }

    #


nc == EnKarebaba_Dying) {
            stemSections = 2;
        } else {
            stemSections = 3;
        }

        for (i = 0; i < stemSections; i++) {
            Matrix_Translate(0.0f, 0.0f, -2000.0f, MTXMODE_APPLY);
            gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
            gSPDisplayList(POLY_OPA_DISP++, stemDLists[i]);

            if (i == 0 && this->actionFunc == EnKarebaba_Dying) {
                Matrix_MultVec3f(&zeroVec, &this->actor.focus.pos);
            }
        }

        func_80026608(play);
    }

    func_80026230(play, &black, 1, 2);
    Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, MTXMODE_NEW);

    if (this->actionFunc != EnKarebaba_Grow) {
        scale = 0.01f;
    }

    Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
    Matrix_RotateY(this->actor.home.rot.y * (M_PI / 0x8000), MTXMODE_APPLY);
    gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
    gSPDisplayList(POLY_OPA_DISP++, gDekuBabaBaseLeavesDL);

    if (this->actionFunc == EnKarebaba_Dying) {
        Matrix_RotateZYX(-0x4000, (s16)(this->actor.shape.rot.y - this->actor.home.rot.y), 0, MTXMODE_APPLY);
        gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
        gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemBaseDL);
    }

    func_80026608(play);

    CLOSE_DISPS(play->state.gfxCtx);

    if (this->boundFloor != NULL) {
        EnKarebaba_DrawBaseShadow(this, play);
    }
}


อปปาติกะ\nโอภา\nโอภาส\nโอม\nโอย\nโอ๊ย\nโอรส\nโอละพ่อ\nโอลิมปิก\nโอวาท\nโอษฐ์\nโอษฐชะ\nโอษฐภัย\nโอสถ\nโอห์ม\nโอหัง\nโอฬาร\nโอฬาริก\nโอฬารึก\nโอ้เอ้\nโอเอซิส\nโอ้โฮ\nไอ\nไอ้\nไอโซโทป\nไอน์สไตเนียม\nไอยรา\nไอยเรศ\nไอราพต\nไอราวัณ\nไอราวัต\nไอศกรีม\nไอศวรรย์\nไอศุริยสมบัติ\nไอศูรย์\nไอออน\nไอโอดีน\nฮกเกี้ยน\nฮด\nฮวงซุ้ย\nฮวน\nฮ้วนหมู\nฮวบ\nฮ่อ\nฮ้อ\nฮอกกี้\nฮอด\nฮ่อม\nฮ่อยจ๊อ\nฮอร์โมน\nฮอลแลนด์\nฮอลันดา\nฮะ\nฮะเบส\nฮะเรีย\nฮัก\nฮังเล\nฮัจญ์\nฮัจญะฮ์\nฮัจญี\nฮั่น\nฮั้ว\nฮา\nฮ้า\nฮ่างหลวง\nฮาจญ์\nฮาม\nฮาเร็ม\nฮาห์เนียม\nฮิจเราะห์\nฮินดู\nฮิปโปโปเตมัส\nฮิสทีเรีย\nฮีเลียม\nฮึ\nฮึก\nฮึด\nฮึดฮัด\nฮึ่ม\nฮึย\nฮึ่ย\nฮืดฮาด\nฮือ\nฮื่อ\nฮื้อ\nฮื้อฉี่\nฮุด\nฮุบ\nฮุยเลฮุย\nฮู้\nฮูก\nฮูม\nเฮ\nเฮฮา\nเฮกตาร์\nเฮกโตกรัม\nเฮกโตเมตร\nเฮกโตลิตร\nเฮง\nเฮ็ด\nเฮโมโกลบิน\nเฮย\nเฮ่ย\nเฮ้ย\nเฮโรอีน\nเฮลิคอปเตอร์\nเฮโล\nเฮละโล\nเฮ้ว\nเฮอ\nเฮ่อ\nเฮ้อ\nเฮอริเคน\nเฮิรตซ์\nเฮี้ยน\nเฮี้ยบ\nเฮี้ยว\nเฮือก\nเฮือน\nแฮ\nแฮ่\nแฮก\nแฮ่กึ๊น\nแฮนด์บอล\nแฮฟเนียม\nแฮม\nแฮะ\nโฮ\nโฮก\nโฮ่ง\nโฮ้ง\nโฮเต็ล\nโฮลเมียม\nโฮะ\nไฮ้\nไฮโกรมิเตอร์\nไฮดรา\nไฮโดร\nไฮโดรคาร์บอน\nไฮโดรเจน\nไฮโดรมิเตอร์\nไฮไฟ\nไฮโล\nไฮฮี\n"
              .split(/[\r\n]+/)
              .filter(function (w) {
                return w.length > 1;
              })
      this.addWords(words, false)
    }
    if(finalize){
      this.finalizeDict();
    }
  },

  dictSeek: function (l, r, ch, strOffset, pos) {
    var ans = null;
    while (l <= r) {
      var m = Math.floor((l + r) / 2),
        dict_item = this.dict[m],
        len = dict_item.length;
      if (len <= strOffset) {


45C004:
/* 8045C004 00457544  50 04 73 62 */	rlwimi r4, r0, 0xe, 0xd, 0x11
/* 8045C008 00457548  90 83 00 04 */	stw r4, 4(r3)
lbl_8045C00C:
/* 8045C00C 0045754C  80 10 00 14 */	lwz r0, 0x14(r16)
/* 8045C010 00457550  2C 00 00 00 */	cmpwi r0, 0
/* 8045C014 00457554  41 82 00 A0 */	beq lbl_8045C0B4
/* 8045C018 00457558  38 00 00 05 */	li r0, 5
/* 8045C01C 0045755C  38 61 0E D8 */	addi r3, r1, 0xed8
/* 8045C020 00457560  1C 80 00 50 */	mulli r4, r0, 0x50
/* 8045C024 00457564  38 AF FF FC */	addi r5, r15, -4
/* 8045C028 00457568  38 00 00 0A */	li r0, 0xa
/* 8045C02C 0045756C  7C 63 22 14 */	add r3, r3, r4
/* 8045C030 00457570  38 C3 FF FC */	addi r6, r3, -4
/* 8045C034 00457574  7C 09 03 A6 */	mtctr r0
lbl_8045C038:
/* 8045C038 00457578  80 85 00 04 */	lwz r4, 4(r5)
/* 8045C03C 0045757C  84 05 00 08 */	lwzu r0, 8(r5)
/* 8045C040 00457580  90 86 00 04 */	stw r4, 4(r6)
/* 8045C044 00457584  94 06 00 08 */	stwu r0, 8(r6)
/* 8045C048 00457588  42 00 FF F0 */	bdnz lbl_8045C038
/* 8045C04C 0045758C  80 C3 00 04 */	lwz r6, 4(r3)
/* 8045C050 00457590  38 00 00 1A */	li r0, 0x1a
/* 8045C054 00457594  50 06 D0 0A */	rlwimi r6, r0, 0x1a, 0, 5
/* 8045C058 00457598  3C 80 80 55 */	lis r4, lbl_80548078@ha
/* 8045C05C 0045759C  90 C3 00 04 */	stw r6, 4(r3)
/* 8045C060 004575A0  54 C5 36 BE */	srwi r5, r6, 0x1a
/* 8045C064 004575A4  38 84 80 78 */	addi r4, r4, lbl_80548078@l
/* 8045C068 004575A8  80 0F 00 04 */	lwz r0, 4(r15)
/* 8045C06C 004575AC  7C A4 28 AE */	lbzx r5, r4, r5
/* 8045C070 004575B0  54 00 36 BE */	srwi r0, r0, 0x1a
/* 8045C074 004575B4  7C 84 00 AE */	lbzx r4, r4, r0
/* 8045C078 004575B8  54 C0 96 FE */	rlwinm r0, r6, 0x12, 0x1b, 0x1f
/* 8045C07C 004575BC  7C 85 20 50 */	subf r4, r5, r4
/* 8045C080 004575C0  7C 04 02 15 */	add. r0, r4, r0
/* 8045C084 004575C4  40 80 00 10 */	bge lb


`)}e.showErrorMessage=t})(D||(D={}))},70558:(e,t,n)=>{"use strict";var i=n(10395);var s=n(40662);var o=n(97913);var r=n(3579);var a=n(75797);var l=n(67996);var d=n(94780);var c=n(69448);var h=n(85072);var u=n.n(h);var p=n(97825);var m=n.n(p);var g=n(77659);var f=n.n(g);var v=n(55056);var _=n.n(v);var b=n(10540);var y=n.n(b);var w=n(41113);var C=n.n(w);var x=n(51466);var S={};S.styleTagTransform=C();S.setAttributes=_();S.insert=f().bind(null,"head");S.domAPI=m();S.insertStyleElement=y();var k=u()(x.A,S);const j=x.A&&x.A.locals?x.A.locals:undefined},4202:(e,t,n)=>{"use strict";n.r(t);n.d(t,{ITerminal:()=>o,ITerminalTracker:()=>s,Terminal:()=>u});var i=n(5592);const s=new i.Token("@jupyterlab/terminal:ITerminalTracker",`A widget tracker for terminals.\n  Use this if you want to be able to iterate over and interact with terminals\n  created by the application.`);var o;(function(e){e.defaultOptions={theme:"inherit",fontFamily:'Menlo, Consolas, "DejaVu Sans Mono", monospace',fontSize:13,lineHeight:1,scrollback:1e3,shutdownOnClose:false,closeOnExit:true,cursorBlink:true,initialCommand:"",screenReaderMode:false,pasteWithCtrlV:true,autoFit:true,macOptionIsMeta:false}})(o||(o={}));var r=n(91788);var a=n(76326);var l=n(42856);var d=n(1143);const c="jp-Terminal";const h="jp-Terminal-body";class u extends d.Widget{constructor(e,t={},n){super();this._needsResize=true;this._offsetWidth=-1;this._offsetHeight=-1;this._isReady=false;this._ready=new i.PromiseDelegate;this._termOpened=false;n=n||r.nullTranslator;this._trans=n.load("jupyterlab");this.session=e;this._options={...o.defaultOptions,...t};const{theme:s,...a}=this._options;const l={theme:p.getXTermTheme(s),...a};this.addClass(c);this._setThemeAttribute(s);let d="";const h=(e,t)=>{switch(t.type){case"stdout":if(t.content){d+=t.content[0]}break;default:break}};e.messageReceived.connect(h);e.disposed.connect((()=>{if(this.getOption("closeOnExit")){this.dispose()}}),this);p.createTerminal(l).then((([t,n])=>{this._term=t;this._fitAddon=n;this._initializeTerm();this.id=`jp-Terminal-${p.id++}`;this.title.label=this._trans.__("Terminal");this._isReady=true;this._ready.resolve();if(d){this._term.write(d)}e.messageReceived.disconnect(h);e.messageReceived.connect(this._onMessage,this);if(e.connectionStatus==="connected"){this._initialConnection()}else{e.connectionStatusChanged.connect(this._initialConnection,this)}this.update()})).catch((e=>{console.error("Failed to create a terminal.\n",e);this._ready.reject(e)}))}get ready(){return this._ready.promise}getOption(e){return this._options[e]}setOption(e,t){if(e!=="theme"&&(this._options[e]===t||e==="initialCommand")){return}this._options[e]=t;switch(e){case"fontFamily":this._term.options.fontFamily=t;br


MustCompile("~*req.6", utils.InfieldSep)},
		{Tag: "Substitute",
			Path:  "Substitute",
			Type:  utils.MetaComposed,
			Value: config.NewRSRParsersMustCompile("~*req.7", utils.InfieldSep)},
		{Tag: "Append",
			Path:  "Append",
			Type:  utils.MetaComposed,
			Value: config.NewRSRParsersMustCompile("~*req.8", utils.InfieldSep)},
		{Tag: "Weight",
			Path:  "Weight",
			Type:  utils.MetaComposed,
			Value: config.NewRSRParsersMustCompile("~*req.9", utils.InfieldSep)},
	}

	rows := [][]string{
		{"cgrates.org", "ATTR_1", "*sessions;*cdrs", "*string:Account:1007", "2014-01-14T00:00:00Z", "Account", "*any", "1001", "false", "10"},
		{"cgrates.org", "ATTR_1", "", "", "", "Subject", "*any", "1001", "true", ""},
	}
	lData := make(LoaderData)
	if err := lData.UpdateFromCSV("Attributes.csv", rows[0], attrSFlds,
		"cgrates.org", nil); err != nil {
		t.Error(err)
	}
	eLData := LoaderData{"Tenant": "cgrates.org",
		"ID":                 "ATTR_1",
		"Contexts":           "*sessions;*cdrs",
		"FilterIDs":          "*string:Account:1007",
		"ActivationInterval": "2014-01-14T00:00:00Z",
		"Path":               "Account",
		"Initial":            "*any",
		"Substitute":         "1001",
		"Append":             "false",
		"Weight":             "10",
	}
	if !reflect.DeepEqual(eLData, lData) {
		t.Errorf("expecting: %+v, received: %+v", eLData, lData)
	}
	lData = make(LoaderData)
	if err := lData.UpdateFromCSV("Attributes.csv", rows[1], attrSFlds,
		"cgrates.org", nil); err != nil {
		t.Error(err)
	}
	eLData = LoaderData{"Tenant": "cgrates.org",
		"ID":                 "ATTR_1",
		"Contexts":           "",
		"FilterIDs":          "",
		"ActivationInterval": "",
		"Path":               "Subject",
		"Initial":            "*any",
		"Substitute":         "1001",
		"Append":             "true",
		"Weight":             "",
	}
	if !reflect.DeepEqual(eLData, lData) {
		t.Errorf("expecting: %+v, received: %+v", eLData, lData)
	}
}

func TestDataUpdateFromCSVOneFile2(t *testing.T) {
	attrSFlds := []*config.FCTemplate{
		{Tag: "TenantID",
			Path:      "Tenant",
			Type:      utils.MetaVariable,
			Value:     config.NewRSRParsersMustCompile("~*req.0", utils.InfieldSep),
			Mandatory: true},
		{Tag: "ProfileID",
			Path:      "ID",
			Type:      utils.MetaVariable,
			Value:     config.NewRSRParsersMustCompile("~*req.1", utils.InfieldSep),
			Mandatory: true},
		{Tag: "Contexts",
			Path:  "Contexts",
			Type:  utils.MetaVariable,
			Value: config.NewRSRParsersMustCompile("~*req.2", utils.InfieldSep)},
		{Tag: "FilterIDs",
			Path:  "FilterIDs",
			Type:  utils.MetaVariable,
			Value: config.NewRSRParsersMustCompile("~*req.3", utils.Infi


C/DfzrddlmZddlZddlmZ	d							ddZ	d							d	dZ	d
							ddZy))annotationsN)
TracebackTypect|tr|St|ts!tdt	|j
|s|r|j
|xsd|xsdS|j
SNznot expecting type zutf-8strict)errors)
isinstancebytesstr	TypeErrortype__name__encodexencodingrs   LC:\arlequim-educatec\login-automatico\Lib\site-packages\urllib3\util\util.pyto_bytesrsi!U
3
-d1g.>.>-?@AA6xx+GF4FhxGG88:ct|tr|St|ts!tdt	|j
|s|r|j
|xsd|xsdS|j
Sr)r	rr
rr
rdecoders   rto_strrsi!S
5
!-d1g.>.>-?@AA6xx+GF4FhxGG88:rcX	|j|ur|j||#d}d}wxYwN)
__traceback__with_traceback)tpvaluetbs   rreraiser s7
b(&&r**
s!#))NN)rstr | bytesr
str | Nonerr"returnr
)rr!rr"rr"r#rr)rztype[BaseException] | Noner
BaseExceptionrzTracebackType | Noner#ztyping.NoReturn)
__future__rtypingtypesrrrr rr<module>r)s"
GK		(	9C
	GK		(	9C		 $"		r


perty_List* (*Script_Lookup_get_var_with_key_w_script_instance)(Script_Instance* s, const mtt::String& key_ctx, const mtt::String& key_var);
    void (*Script_Lookup_set_var_with_key_w_script_instance)(Script_Instance* s, const mtt::String& key_ctx, const mtt::String& key_var, const Script_Property_List& val);

    dt::DrawTalk* (*DrawTalk_ctx)(void);

    uint64 (*MTT_Random)(void);
    sint64 (*MTT_Random_lower_bounded)(sint64 lower_bound_exclusive);
    sint64 (*MTT_Random_range)(sint64 lower_bound_inclusive, sint64 upper_bound_exclusive);
    float64 (*MTT_Random_Float64_value)(void);
    float64 (*MTT_Random_Float64_value_scaled)(float64 scale);
    void (*MTT_Random_Float64_value_within_circle)(float64 extent, float64* radius_out, float64* angle_radians_out);

    void (*MTT_set_active_logger)(struct MTT_Logger* logger);
    struct MTT_Logger* (*MTT_active_logger)(void);
    void (*MTT_set_default_active_logger)(void);
    void (*MTT_Logger_init)(struct MTT_Logger* logger_out, cstring subsystem, cstring category);
    void (*MTT_Logger_destroy)(struct MTT_Logger* logger);

    void (*debug_mode_log_enable)(bool state);
    bool (*debug_mode_log_is_enabled)(void);
};

void MTT_API_set(MTT_API* api_in);

#ifndef MTT_DYNAMIC_LIBRARY_CLIENT

static inline void MTT_API_init(MTT_API* api)
{
    api->MTT_ctx = mtt::ctx;
    api->Thing_make = mtt::Thing_make;
    api->Thing_try_get = mtt::Thing_try_get;
    api->Thing_destroy = mtt::Thing_destroy;

    api->Thing_make_with_collider = mtt::Thing_make_with_collider;
    api->Thing_make_with_aabb_corners = mtt::Thing_make_with_aabb_corners;
    api->Thing_make_with_aabb_dimensions = mtt::Thing_make_with_aabb_dimensions;
    api->Thing_make_with_unit_collider = mtt::Thing_make_with_unit_collider;
    api->Thing_copy = mtt::Thing_copy;
    api->get_thing_most_recently_selected_with_touch = mtt::get_thing_most_recently_selected_with_touch;

    api->Thing_set_position_w_ptr = mtt::Thing_set_position;
    api->Thing_set_position_w_id = mtt::Thing_set_position;
    api->set_pose_transform = mtt::set_pose_transform;
    api->set_pose_transform_w_ref = mtt::set_pose_transform;

    api->push_AABB = mtt::push_AABB;
    api->push_AABBs = mtt::push_AABBs;
    api->Collider_remove = mtt::Collider_remove;
    api->Collider_make_aabb = mtt::Collider_make_aabb;

    api->get_main_allocator = mem::get_main_allocator;
    api->Heap_Allocator = mem::Heap_Allocator;

    api->Arena_init = mem::Arena_init;
    api->Arena_Allocator = mem::Arena_Allocator;
    api->Arena_allocate_proc = mem::Arena_allocate_proc;
    api->Arena_deallocate_all_proc = mem::Arena_deallocate_all_proc;

    api->Arena_deinit = mem::Arena_deinit;

    api->Arena_rewind = mem::Arena_rewind;


 "MEGAFRCE.BIN" },
 { 0x7A590, MT_4k, "MAZECRZ.BIN" },
 { 0x761B8, MT_4k, "MATH_GPX.BIN" },
 { 0x80264, MT_4k, "MASTBULD.BIN" },
 { 0x72300, MT_4k, "MASH.BIN" },
 { 0xE3A01, Unk, "MARIOBRO.BIN" },
 { 0x76097, MT_4k, "MARINWAR.BIN" },
 { 0x7C25E, MT_4k, "MARFLEGR.BIN" },
 { 0x770E7, MT_4k, "MARAUDER.BIN" },
 { 0x3C811, MT_2k, "MAO17600.BIN" },
 { 0x79F28, MT_4k, "MANGIA.BIN" },
 { 0x73769, MT_4k, "MALAGAI.BIN" },
 { 0x7E228, MT_4k, "M_A_D.BIN" },
 { 0x5F691, MT_4k, "LOSTLUGG.BIN" },
 { 0x7020F, MT_4k, "LONDBLTZ.BIN" },
 { 0x806AA, MT_4k, "LOCKCHSE.BIN" },
 { 0x6FF2C, MT_4k, "LASRVOLY.BIN" },
 { 0x70B7A, MT_4k, "LASRGATE.BIN" },
 { 0x7710C, MT_4k, "NUTS.BIN" },
 { 0xC7A8A, Unk, "LANCELOT.BIN" },
 { 0x9E5A5, Unk, "OBELIX.BIN" },
 { 0x73CD9, MT_4k, "QUICKSTP.BIN" },
 { 0xD5653, Unk, "QBRTQUBE.BIN" },
 { 0x6DE9B, MT_4k, "QBERT_PB.BIN" },
 { 0x790D8, MT_4k, "PYRMDWAR.BIN" },
 { 0x7A590, MT_4k, "PUZZL_TW.BIN" },
 { 0xC97B5, Unk, "PROWREST.BIN" },
 { 0xD73C6, Unk, "PRIVEYE.BIN" },
 { 0xBB429, Unk, "PRESSURE.BIN" },
 { 0xDE082, Unk, "PORKYS.BIN" },
 { 0xCC026, Unk, "POPEYE.BIN" },
 { 0x759B0, MT_4k, "POOYAN.BIN" },
 { 0x3B81D, MT_2k, "POLO.BIN" },
 { 0xCD2E4, Unk, "POLEPSN.BIN" },
 { 0xD60BF, Unk, "POLARIS.BIN" },
 { 0x77EF2, MT_4k, "PLAQATTK.BIN" },
 { 0x73C87, MT_4k, "PLANTPAT.BIN" },
 { 0x12157E, Unk, "PITFALL2.BIN" },
 { 0x6D0E6, MT_4k, "PITFALL.BIN" },
 { 0x6C658, MT_4k, "PITF_CCE.BIN" },
 { 0xF4E4A, Unk, "PIGSPACE.BIN" },
 { 0x6AE62, MT_4k, "PIECECKE.BIN" },
 { 0x7844B, MT_4k, "PICNIC.BIN" },
 { 0x1E3898, Unk, "PICKPILE.BIN" },
 { 0xE89F9, Unk, "PHOENIX.BIN" },
 { 0x61D00, MT_4k, "PHILLY.BIN" },
 { 0x84F0E, MT_4k, "PHARHCRS.BIN" },
 { 0x745AE, MT_4k, "PHANTOM


 = ["full"] }
reqwest = { version = "0.11", features = ["json"] }
*/

// 外部依赖使用示例
mod external_dependencies {
    // 导入外部crate
    use serde::{Deserialize, Serialize};
    use tokio::time::{sleep, Duration};
    use reqwest::Client;

    // 使用外部crate的类型
    #[derive(Debug, Serialize, Deserialize)]
    pub struct ApiResponse {
        pub status: String,
        pub data: serde_json::Value,
    }

    // 异步函数使用tokio
    pub async fn async_function() {
        println!("Starting async function");
        sleep(Duration::from_secs(1)).await;
        println!("Async function completed");
    }

    // HTTP请求使用reqwest
    pub async fn make_http_request() -> Result<ApiResponse, reqwest::Error> {
        let client = Client::new();
        let response = client
            .get("https://api.example.com/data")
            .send()
            .await?;

        let api_response: ApiResponse = response.json().await?;
        Ok(api_response)
    }

    // 组合使用多个外部crate
    pub async fn complex_operation() -> Result<(), Box<dyn std::error::Error>> {
        println!("Starting complex operation");

        // 使用tokio进行异步操作
        sleep(Duration::from_millis(500)).await;

        // 使用reqwest进行HTTP请求
        let api_response = make_http_request().await?;
        println!("API Response: {:?}", api_response);

        // 使用serde进行序列化
        let json_string = serde_json::to_string(&api_response)?;
        println!("Serialized JSON: {}", json_string);

        Ok(())
    }
}

// 使用外部依赖
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    external_dependencies::async_function().await;
    external_dependencies::complex_operation().await?;

    Ok(())
}
```

## 6. 形式化证明

### 6.1 模块封装定理

**定理 6.1.1 (模块封装)**
Rust的模块系统确保正确的封装性。

**证明**：
通过可见性规则和路径解析算法证明模块封装。

### 6.2 命名空间定理

**定理 6.2.1 (命名空间)**
模块系统提供无冲突的命名空间。

**证明**：
通过模块层次结构和路径解析规则证明命名空间正确性。

## 7. 工程实践

### 7.1 最佳实践

**最佳实践**：

1. **合理的模块组织**：按功能组织模块
2. **适当的可见性**：只暴露必要的公共接口
3. **清晰的依赖关系**：避免循环依赖
4. **一致的命名规范**：使用一致的命名约定

### 7.2 常见陷阱

**常见陷阱**：

1. **循环依赖**：

   ```rust
   // 错误：循环依赖
   mod module_a {
       use crate::module_b::function_b;

       pub fn function_a() {
           function_b();
       }
   }

   mod module_b {
       use crate::module_a::function_a;

       pub fn function_b() {
           function_a();
       }
   }
   ```

2. **过度暴露**：

   ```rust
   // �


isStatic:!1},kind:"property",name:"onFocus",sourceUrl:"https://github.com/palantir/blueprint/blob/e18624bb/packages/table/src/interactions/reorderable.tsx#L45",type:"(focusedCell: IFocusedCellCoordinates) => void"},{documentation:{contents:["
A callback that is called when the user is done dragging to reorder.
\n",{tag:"param",value:"the original index of the element or set of elements"},{tag:"param",value:"the new index of the element or set of elements"},{tag:"param",value:"the number of contiguous elements that were moved"}],contentsRaw:"A callback that is called when the user is done dragging to reorder.\n\n@param the original index of the element or set of elements\n@param the new index of the element or set of elements\n@param the number of contiguous elements that were moved",metadata:{}},fileName:"../table/src/interactions/reorderable.tsx",flags:{isExported:!0,isExternal:!0,isOptional:!1,isPrivate:!1,isProtected:!1,isPublic:!1,isStatic:!1},kind:"property",name:"onReordered",sourceUrl:"https://github.com/palantir/blueprint/blob/e18624bb/packages/table/src/interactions/reorderable.tsx#L32",type:"(oldIndex: number, newIndex: number, length: number) => void"},{documentation:{contents:["
A callback that is called while the user is dragging to reorder.
\n",{tag:"param",value:"the original index of the element or set of elements"},{tag:"param",value:"the new index of the element or set of elements"},{tag:"param",value:"the number of contiguous elements that were moved"}],contentsRaw:"A callback that is called while the user is dragging to reorder.\n\n@param the original index of the element or set of elements\n@param the new index of the element or set of elements\n@param the number of contiguous elements that were moved",metadata:{}},fileName:"../table/src/interactions/reorderable.tsx",flags:{isExported:!0,isExternal:!0,isOptional:!1,isPrivate:!1,isProtected:!1,isPublic:!1,isStatic:!1},kind:"property",name:"onReordering",sourceUrl:"https://github.com/palantir/blueprint/blob/e18624bb/packages/table/src/interactions/reorderable.tsx#L23",type:"(oldIndex: number, newIndex: number, length: number) => void"},{documentation:{contents:["
When the user reorders something, this callback is called with a new\narray of Regions. This array should be considered the new selection\nstate for the entire table.
\n"],contentsRaw:"When the user reorders something, this callback is called with a new\narray of `Region`s. This array should be considered the new selection\nstate for the entire table.",metadata:{}},fileName:"../table/src/interactions/reorderable.tsx",flags:{isExported:!0,isExternal:!0,isOptional:!1,isPrivate:!1,isProtected:!1,isPublic:!1,isStatic:!1},kind:"property",name:"onSelection",sourceUrl:"https://github.com/palantir/blueprint/blob/e18624bb/packages/table/src/interactions/reorderable.tsx#L39",type:"(regions: IRegion[]) => void"},{documentation:{contents:["
An array containing the table's selection Regions.
\n"],contentsRaw:"An array containing the table's selection Regions.",metadata:{}},fileName:"../table/src/interactions/reorderable.tsx",flags:{isExported:!0,isExternal:!0,isOptional:!0,isPrivate:!1,isProtected:!1,isPublic:!1,isStatic:!1},kind:"property",name:"selected


#ifndef FOLDING_IPA_TEST_H
#define FOLDING_IPA_TEST_H

#include <iostream>
#include <memory>
#include "ipa.h"
#include "../matrix.h"

void test_ipa() {
    std::cout << "====== Test IPA ======" << std::endl;
    int seqlen = 17;
    const std::string dirpath = "../data/c_test/ipa";
    std::cout << "seqlen = " << seqlen << std::endl;
    std::cout << "dirpath = " << dirpath << std::endl;

    std::unique_ptr<InvariantPointAttention> ipa(load_invariant_point_attention(dirpath));
    matrix<float> s = matrix<float>(dirpath + "/input/s.bin", seqlen, ipa->cfg.c_s);
    matrix<float> z = matrix<float>(dirpath + "/input/z.bin", seqlen * seqlen, ipa->cfg.c_z);
    matrix<float> r = matrix<float>(dirpath + "/input/r.bin", seqlen, 4*4);
    std::unique_ptr<IPAForwardBuffer> buffer(ipa->create_buffer(seqlen));

    (*ipa)(s, z, r, s, *buffer, false);

    #define TEST_INTERMEDIATE_ALLCLOSE(NAME,ATOL) { \
        auto NAME##_ref = matrix<float>(dirpath + "/output/" #NAME ".bin", buffer->NAME.n_rows, buffer->NAME.n_cols); \
        TEST_ALLCLOSE(#NAME, buffer->NAME, NAME##_ref, ATOL); \
    }
    TEST_INTERMEDIATE_ALLCLOSE(q, 1e-6f);
    TEST_INTERMEDIATE_ALLCLOSE(k, 1e-6f);
    TEST_INTERMEDIATE_ALLCLOSE(v, 1e-6f);
    TEST_INTERMEDIATE_ALLCLOSE(q_pts, 1e-6f);
    TEST_INTERMEDIATE_ALLCLOSE(k_pts, 1e-6f);
    TEST_INTERMEDIATE_ALLCLOSE(v_pts, 1e-6f);
    TEST_INTERMEDIATE_ALLCLOSE(a, 1e-6f);
    TEST_INTERMEDIATE_ALLCLOSE(o, 1e-6f);
    #undef TEST_INTERMEDIATE_ALLCLOSE
    TEST_ALLCLOSE("final output", s, matrix<float>(dirpath + "/output/s.bin", seqlen, ipa->cfg.c_s), 1e-6f);
}

#endif // FOLDING_IPA_TEST_H


compose.runtime.getValue
import androidx.compose.ui.Modifier
import com.hedvig.android.design.system.hedvig.HedvigPreview
import com.hedvig.android.design.system.hedvig.HedvigTheme
import com.hedvig.android.design.system.hedvig.LocalContentColor
import com.hedvig.android.design.system.hedvig.Surface
import kotlin.math.sqrt

/**
 * @param amplitude A value typically coming from `MediaRecorder.getMaxAmplitude()` which usually ranges from 0-4000,
 *  and can peak to ~20000. Gets transformed to a more reasonable value of 0-1000 for the circle radius.
 */
@Composable
fun RecordingAmplitudeIndicator(amplitude: Int, modifier: Modifier = Modifier) {
  val color = LocalContentColor.current.copy(alpha = 0.12f)
  val animated by animateIntAsState(
    targetValue = (sqrt(amplitude.toDouble()).toInt() * 10).coerceAtMost(1000),
    animationSpec = spring(
      stiffness = Spring.StiffnessLow,
    ),
    label = "recordingAmplitudeIndicator",
  )

  Canvas(modifier = modifier) {
    drawCircle(
      color = color,
      radius = animated.toFloat(),
    )
  }
}

@HedvigPreview
@Composable
private fun PreviewRecordingAmplitudeIndicator() {
  val infiniteTransition = rememberInfiniteTransition()
  val amplitude by infiniteTransition.animateFloat(
    initialValue = 0f,
    targetValue = 4000f,
    animationSpec = infiniteRepeatable(
      animation = tween(1000, easing = LinearEasing),
      repeatMode = RepeatMode.Reverse,
    ),
    label = "Amplitude value",
  )
  HedvigTheme {
    Surface(color = HedvigTheme.colorScheme.backgroundPrimary) {
      RecordingAmplitudeIndicator(amplitude.toInt(), Modifier.fillMaxSize())
    }
  }
}
package com.hedvig.android.feature.deleteaccount.data

import arrow.core.toNonEmptyListOrNull
import com.apollographql.apollo.ApolloClient
import com.apollographql.apollo.cache.normalized.FetchPolicy
import com.apollographql.apollo.cache.normalized.fetchPolicy
import com.hedvig.android.apollo.safeFlow
import com.hedvig.android.featureflags.FeatureManager
import com.hedvig.android.featureflags.flags.Feature
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flatMapLatest
import octopus.DeleteAccountStateQuery
import octopus.type.ClaimStatus

internal class DeleteAccountStateUseCase(
  private val apolloClient: ApolloClient,
  private val deleteAccountRequestStorage: DeleteAccountRequestStorage,
  private val featureManager: FeatureManager,
) {
  suspend fun invoke(): Flow<DeleteAccountState> {
    return combine(
      deleteAccountRequestStorage.hasRequestedTermination(),
      featureManager.isFeatureEnabled(Feature.ENABLE_CLAIM_HISTORY).flatMapLatest { enableClaimHistory ->
        apolloClient.query(
          DeleteAccountStateQuery(enableClaimHistory),
        ).fetchPolicy(FetchPolicy.CacheAndNetwork).safeFlow {
          DeleteAccountState.NetworkError
        }
      },
    ) { hasRequestedTermination, queryResponse ->
      if (hasRequestedTermination) {
        return@combine DeleteAccountState.AlreadyRequestedDeletion
      }
      val currentMember = queryResponse.getOrNull()?.currentMember ?: return@combine DeleteAccountState.NetworkError
      val hasActiveContracts = currentMember.activeContracts.isNotEmpty()
      if (hasActiveContracts) {
        return@combine DeleteAccountState.HasActiveInsurance
      }
      val hasActiveClaims = (
        currentMember.claims?.toNonEmptyListOrNull()?.map { it.status }
          ?: currentMember.claimsActive.orEmpty().map { it.status }
      ).any { status -


->needI32());
    }
    ~PopAtomicXchg32Regs() { bc->freeI32(rv); }
#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
    explicit PopAtomicXchg32Regs(BaseCompiler* bc, ValType type,
                                 Scalar::Type viewType)
        : Base(bc) {
      rv = (type == ValType::I64) ? bc->popI64ToI32() : bc->popI32();
      if (Scalar::byteSize(viewType) < 4) {
        temps.allocate(bc);
      }
      setRd(bc->needI32());
    }
    ~PopAtomicXchg32Regs() {
      temps.maybeFree(bc);
      bc->freeI32(rv);
    }
#else
    explicit PopAtomicXchg32Regs(BaseCompiler* bc, ValType type,
                                 Scalar::Type viewType)
        : Base(bc) {
      MOZ_CRASH("BaseCompiler porting interface: PopAtomicXchg32Regs");
    }
#endif

    template <typename T>
    void atomicXchg32(const MemoryAccessDesc& access, T srcAddr) {
      bc->atomicXchg32(access, srcAddr, rv, getRd(), temps);
    }
  };

  friend class PopAtomicXchg64Regs;
  class PopAtomicXchg64Regs : public PopBase<RegI64> {
    using Base = PopBase<RegI64>;
    RegI64 rv;

   public:
#if defined(JS_CODEGEN_X64)
    explicit PopAtomicXchg64Regs(BaseCompiler* bc) : Base(bc) {
      rv = bc->popI64();
      setRd(rv);
    }
#elif defined(JS_CODEGEN_ARM64)
    explicit PopAtomicXchg64Regs(BaseCompiler* bc) : Base(bc) {
      rv = bc->popI64();
      setRd(bc->needI64());
    }
    ~PopAtomicXchg64Regs() { bc->freeI64(rv); }
#elif defined(JS_CODEGEN_X86)
    // We'll use cmpxchg8b, so rv must be in ecx:ebx, and rd must be
    // edx:eax.  But we can't reserve ebx here because we need it later, so
    // use a separate temp and set up ebx when we perform the operation.
    explicit PopAtomicXchg64Regs(BaseCompiler* bc) : Base(bc) {
      bc->needI32(bc->specific_.ecx);
      bc->needI64(bc->specific_.edx_eax);

      rv = RegI64(Register64(bc->specific_.ecx, bc->needI32()));
      bc->popI64ToSpecific(rv);

      setRd(bc->specific_.edx_eax);
    }
    ~PopAtomicXchg64Regs() { bc->freeI64(rv); }
#elif defined(JS_CODEGEN_ARM)
    // Both rv and rd must be odd/even pairs.
    explicit PopAtomicXchg64Regs(BaseCompiler* bc) : Base(bc) {
      rv = bc->popI64ToSpecific(bc->needI64Pair());
      setRd(bc->needI64Pair());
    }
    ~PopAtomicXchg64Regs() { bc->freeI64(rv); }
#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
    explicit PopAtomicXchg64Regs(BaseCompiler* bc) : Base(bc) {
      rv = bc->popI64ToSpecific(bc->needI64());
      setRd(bc->needI64());
    }
    ~PopAtomicXchg64Regs() { bc->freeI64(rv); }
#else
    explicit PopAtomicXchg64Regs(BaseCompiler* bc) : Base(bc) {
      MOZ_CRASH("BaseCompiler porting interface: xchg64");
    }
#endif