}

.ace-github .ace_marker-layer .ace_bracket {
  margin: -1px 0 0 -1px;
  border: 1px solid rgb(192, 192, 192);
}

.ace-github .ace_gutter-active-line {
    background-color : rgba(0, 0, 0, 0.07);
}

.ace-github .ace_marker-layer .ace_selected-word {
  background: rgb(250, 250, 255);
  border: 1px solid rgb(200, 200, 250);

}

.ace-github .ace_print-margin {
  width: 1px;
  background: #e8e8e8;
}

.ace-github .ace_indent-guide {
  background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;
}.ace-merbivore-soft .ace_gutter {
  background: #262424;
  color: #E6E1DC
}

.ace-merbivore-soft .ace_print-margin {
  width: 1px;
  background: #262424
}

.ace-merbivore-soft .ace_scroller {
  background-color: #1C1C1C
}

.ace-merbivore-soft .ace_text-layer {
  color: #E6E1DC
}

.ace-merbivore-soft .ace_cursor {
  border-left: 2px solid #FFFFFF
}

.ace-merbivore-soft .ace_overwrite-cursors .ace_cursor {
  border-left: 0px;
  border-bottom: 1px solid #FFFFFF
}

.ace-merbivore-soft .ace_marker-layer .ace_selection {
  background: #494949
}

.ace-merbivore-soft.ace_multiselect .ace_selection.ace_start {
  box-shadow: 0 0 3px 0px #1C1C1C;
  border-radius: 2px
}

.ace-merbivore-soft .ace_marker-layer .ace_step {
  background: rgb(102, 82, 0)
}

.ace-merbivore-soft .ace_marker-layer .ace_bracket {
  margin: -1px 0 0 -1px;
  border: 1px solid #404040
}

.ace-merbivore-soft .ace_marker-layer .ace_active-line {
  background: #333435
}

.ace-merbivore-soft .ace_gutter-active-line {
  background-color: #333435
}

.ace-merbivore-soft .ace_marker-layer .ace_selected-word {
  border: 1px solid #494949
}

.ace-merbivore-soft .ace_invisible {
  color: #404040
}

.ace-merbivore-soft .ace_entity.ace_name.ace_tag,
.ace-merbivore-soft .ace_keyword,
.ace-merbivore-soft .ace_meta,
.ace-merbivore-soft .ace_meta.ace_tag,
.ace-merbivore-soft .ace_storage {
  color: #FC803A
}

.ace-merbivore-soft .ace_constant,
.ace-merbivore-soft .ace_constant.ace_character,
.ace-merbivore-soft .ace_constant.ace_character.ace_escape,
.ace-merbivore-soft .ace_constant.ace_other,
.ace-merbivore-soft .ace_support.ace_type {
  color: #68C1D8
}

.ace-merbivore-soft .ace_constant.ace_character.ace_esca


"""Train an HMM on amplitude envelope data.

"""

from sys import argv

if len(argv) != 3:
    print("Please pass the number of states and run id, e.g. python 1_train_hmm.py 8 1")
    exit()
n_states = int(argv[1])
run = int(argv[2])

#%% Import packages

print("Importing packages")
import pickle
from osl_dynamics.data import Data
from osl_dynamics.models.hmm import Config, Model

#%% Load data

data = Data("training_data", n_jobs=8)
methods = {
    "amplitude_envelope": {},
    "moving_average": {"n_window": 5},
    "standardize": {},
}
data.prepare(methods)

#%% Setup model

# Note:
# - The training time will depend on the sequence_length and batch_size
#   you may want to play around with these to reduce the training time on
#   your specific computer.
# - You may not need to do 20 epochs to train your model. You may find the
#   loss has converged in the first few epochs.

config = Config(
    n_states=n_states,
    n_channels=data.n_channels,
    sequence_length=200,
    learn_means=True,
    learn_covariances=True,
    batch_size=256,
    learning_rate=0.01,
    n_epochs=20,
)
model = Model(config)
model.summary()

#%% Training

init_history = model.random_state_time_course_initialization(data, n_init=3, n_epochs=1)
history = model.fit(data)

model_dir = f"results/{n_states:02d}_states/run{run:02d}/model"
model.save(model_dir)

#%% Variational free energy

free_energy = model.free_energy(data)
history["free_energy"] = free_energy

pickle.dump(init_history, open(f"{model_dir}/init_history.pkl", "wb"))
pickle.dump(history, open(f"{model_dir}/history.pkl", "wb"))


etval_int = 0;
    int		success = FALSE;

    /*
     * Get a handle to the DLL module.
     */
# if defined(USE_DLOPEN)
    /* First clear any error, it's not cleared by the dlopen() call. */
    (void)dlerror();

    hinstLib = dlopen((char *)libname, RTLD_LAZY
#  ifdef RTLD_LOCAL
	    | RTLD_LOCAL
#  endif
	    );
    if (hinstLib == NULL)
    {
	/* "dlerr" must be used before dlclose() */
	dlerr = (char *)dlerror();
	if (dlerr != NULL)
	    EMSG2(_("dlerror = \"%s\""), dlerr);
    }
# else
    hinstLib = shl_load((const char*)libname, BIND_IMMEDIATE|BIND_VERBOSE, 0L);
# endif

    /* If the handle is valid, try to get the function address. */
    if (hinstLib != NULL)
    {
# ifdef HAVE_SETJMP_H
	/*
	 * Catch a crash when calling the library function.  For example when
	 * using a number where a string pointer is expected.
	 */
	mch_startjmp();
	if (SETJMP(lc_jump_env) != 0)
	{
	    success = FALSE;
#  if defined(USE_DLOPEN)
	    dlerr = NULL;
#  endif
	    mch_didjmp();
	}
	else
# endif
	{
	    retval_str = NULL;
	    retval_int = 0;

	    if (argstring != NULL)
	    {
# if defined(USE_DLOPEN)
		ProcAdd = (STRPROCSTR)dlsym(hinstLib, (const char *)funcname);
		dlerr = (char *)dlerror();
# else
		if (shl_findsym(&hinstLib, (const char *)funcname,
					TYPE_PROCEDURE, (void *)&ProcAdd) < 0)
		    ProcAdd = NULL;
# endif
		if ((success = (ProcAdd != NULL
# if defined(USE_DLOPEN)
			    && dlerr == NULL
# endif
			    )))
		{
		    if (string_result == NULL)
			retval_int = ((STRPROCINT)ProcAdd)(argstring);
		    else
			retval_str = (ProcAdd)(argstring);
		}
	    }
	    else
	    {
# if defined(USE_DLOPEN)
		ProcAddI = (INTPROCSTR)dlsym(hinstLib, (const char *)funcname);
		dlerr = (char *)dlerror();
# else
		if (shl_findsym(&hinstLib, (const char *)funcname,
				       TYPE_PROCEDURE, (void *)&ProcAddI) < 0)
		    ProcAddI = NULL;
# endif
		if ((success = (ProcAddI != NULL
# if defined(USE_DLOPEN)
			    && dlerr == NULL
# endif
			    )))
		{
		    if (string_result == NULL)
			retval_int = ((INTPROCINT)ProcAddI)(argint);
		    else
			retval_str = (ProcAddI)(argint);
		}
	    }

	    /* Save the string before we free the library. */
	    /* Assume that a "1" or "-1" result is an illegal pointer. */
	    if (string_result == NULL)
		*number_result = retval_int;
	    else if (retval_str != NULL
		    && retval_str != (char_u *)1
		    && retval_str != (char_u *)-1)
		*string_result = vim_strsave(retval_str);
	}

# ifdef HAVE_SETJMP_H
	mch_endjmp();
#  ifdef SIGHASARG
	if (lc_signal != 0)
	{
	    int i;

	    /* try to find the name of this signal */
	    for (i = 0; signal_info[i].sig != -1; i++)
		if (lc_signal == signal_info[i].sig)
		    break;
	    EMSG2("E368: got SIG%s in libcall()", signal_info[i].name);
	}
#  endif
# endif

# if defined(USE_DLOPEN)
	/* "dlerr" must be used before dlclose() */
	if (dlerr != NULL)
	    EMSG2(_("dlerror = \"%s\""), dlerr);

	/* Free the DLL module. */
	(void)dlclose(hinstLib);
# else
	(void)shl_unload(hinstLib);
# endif
    }

    if (!success)
    {
	EMSG2(_(e_libcall), funcname);
	return FAIL;
    }

    return OK;
}
#endif


ies": [
        "NNS"
    ],
    "invasion-theory": [
        "NN"
    ],
    "Bosworth": [
        "NNP"
    ],
    "Bonnierforetagen": [
        "NNP"
    ],
    "feminism": [
        "NN"
    ],
    "assets*": [
        "NNS"
    ],
    "Clairton": [
        "NNP"
    ],
    "Non-smoking": [
        "NN"
    ],
    "half-states": [
        "NNS"
    ],
    "co-ordinates": [
        "VBZ"
    ],
    "the...": [
        ":"
    ],
    "Motorfair": [
        "NNP"
    ],
    "Af-stage": [
        "JJ"
    ],
    "reconfiguration": [
        "NN"
    ],
    "Accompanied": [
        "VBN"
    ],
    "U.N.": [
        "NNP",
        "JJ",
        "NN"
    ],
    "Kasen": [
        "NNP"
    ],
    "television-viewing": [
        "NN"
    ],
    "acute": [
        "JJ",
        "NN"
    ],
    "towel": [
        "NN"
    ],
    "coursed": [
        "VBN"
    ],
    "eight-piece": [
        "JJ"
    ],
    "Old": [
        "NNP",
        "JJ"
    ],
    "towed": [
        "VBD",
        "VBN"
    ],
    "footballs": [
        "NNS"
    ],
    "Enhancement": [
        "NNP"
    ],
    "Ludden": [
        "NNP"
    ],
    "snatches": [
        "NNS",
        "VBZ"
    ],
    "apple-tree": [
        "NN"
    ],
    "simulator": [
        "NN"
    ],
    "quick-service": [
        "JJ"
    ],
    "Master": [
        "NNP",
        "NN"
    ],
    "Muynak": [
        "NNP"
    ],
    "snatched": [
        "VBD",
        "VBN"
    ],
    "arms-reduction": [
        "NN",
        "JJ"
    ],
    "Struggling": [
        "VBG"
    ],
    "animalcare": [
        "JJ"
    ],
    "swaps": [
        "NNS"
    ],
    "tricks": [
        "NNS",
        "VBZ"
    ],
    "Cater": [
        "NNP"
    ],
    "Tettamanti": [
        "NNP"
    ],
    "Mercifully": [
        "RB"
    ],
    "kilter": [
        "NN"
    ],
    "penny-pinching": [
        "JJ"
    ],
    "Harmas": [
        "NNP"
    ],
    "cringing": [
        "VBG",
        "JJ"
    ],
    "slaughter": [
        "NN",
        "VBP"
    ],
    "pooch": [
        "NN"
    ],
    "Forsyth": [
        "NNP"
    ],
    "prattle": [
        "NN"
    ],
    "lifeboats": [
        "NNS"
    ],
    "five-consecutive": [
        "JJ"
    ],
    "treadmills": [
        "NNS"
    ],
    "fillings": [
        "NNS"
    ],
    "freight-jumper": [
        "NN"
    ],
    "Genesee": [
        "NNP"
    ],
    "thin-soled": [
        "J


}

            _pools?.Clear();
            _types?.Clear();

#if UNITY_EDITOR
            _debug?.Clear();
#endif
        }

        private static UnityEngine.Object GetUnityObject(IDisposable disposable)
        {
            if (disposable is UnityEngine.Object unityObject)
            {
                if (unityObject is Component component)
                    unityObject = component.gameObject;

                return unityObject;
            }


-color--300);
  --pf-v5-c-alert--m-success--BorderTopColor: var(--pf-v5-global--success-color--100);
  --pf-v5-c-alert--m-success__icon--Color: var(--pf-v5-global--success-color--100);
  --pf-v5-c-alert--m-success__title--Color: var(--pf-v5-global--success-color--200);
  --pf-v5-c-alert--m-danger--BorderTopColor: var(--pf-v5-global--danger-color--100);
  --pf-v5-c-alert--m-danger__icon--Color: var(--pf-v5-global--danger-color--100);
  --pf-v5-c-alert--m-danger__title--Color: var(--pf-v5-global--danger-color--200);
  --pf-v5-c-alert--m-warning--BorderTopColor: var(--pf-v5-global--warning-color--100);
  --pf-v5-c-alert--m-warning__icon--Color: var(--pf-v5-global--warning-color--100);
  --pf-v5-c-alert--m-warning__title--Color: var(--pf-v5-global--warning-color--200);
  --pf-v5-c-alert--m-info--BorderTopColor: var(--pf-v5-global--info-color--100);
  --pf-v5-c-alert--m-info__icon--Color: var(--pf-v5-global--info-color--100);
  --pf-v5-c-alert--m-info__title--Color: var(--pf-v5-global--info-color--200);
  --pf-v5-c-alert--m-inline--BoxShadow: none;
  --pf-v5-c-alert--m-inline--m-custom--BackgroundColor: var(--pf-v5-global--palette--cyan-50);
  --pf-v5-c-alert--m-inline--m-success--BackgroundColor: var(--pf-v5-global--palette--green-50);
  --pf-v5-c-alert--m-inline--m-danger--BackgroundColor: var(--pf-v5-global--palette--red-50);
  --pf-v5-c-alert--m-inline--m-warning--BackgroundColor: var(--pf-v5-global--palette--gold-50);
  --pf-v5-c-alert--m-inline--m-info--BackgroundColor: var(--pf-v5-global--palette--blue-50);
  --pf-v5-c-alert--m-inline--m-plain--BorderTopWidth: 0;
  --pf-v5-c-alert--m-inline--m-plain--BackgroundColor: transparent;
  --pf-v5-c-alert--m-inline--m-plain--PaddingTop: 0;
  --pf-v5-c-alert--m-inline--m-plain--PaddingRight: 0;
  --pf-v5-c-alert--m-inline--m-plain--PaddingBottom: 0;
  --pf-v5-c-alert--m-inline--m-plain--PaddingLeft: 0;
  --pf-v5-c-alert--m-expandable--GridTemplateColumns: auto max-content 1fr max-content;
  --pf-v5-c-alert--m-expandable--GridTemplateAreas:
    "toggle icon title action"
    ". . description description"
    ". . actiongroup actiongroup";
  --pf-v5-c-alert--m-expandable__description--action-group--PaddingTop: var(--pf-v5-c-alert__action-group--PaddingTop-base);
  --pf-v5-c-alert--m-expanded__toggle-icon--Rotate: 90deg;
  --pf-v5-c-alert--m-expanded__description--action-group


2&utm_source=Application%3A+nextauth+%28ID%3A+151633%29)

![Snapchat for AI](https://ph-files.imgix.net/ee1505fc-0b16-4bba-83ab-cad6d8bc3792.png?auto=format&fit=crop&frame=1&h=512&w=1024)

**关键词**：-, 产品名称：AI代理市场聊天机器人, -, 标语：即刻沟通，隐私保护, -, 简述：🚀, 无需登录，无需付款，轻松与AI代理连接，享受瞬时消息带来的完全隐私。无数据存储，无附加条件——只需无缝、安全的AI互动。立即体验！🔥✨, 关键词：AI代理，瞬时消息，隐私保护，无需登录，无需付款，安全互动
**票数**: 🔺85
**是否精选**：否
**发布时间**：2025年02月10日 PM04:01 (北京时间)

---

## [11. When To Launch](https://www.producthunt.com/posts/when-to-launch-4?utm_campaign=producthunt-api&utm_medium=api-v2&utm_source=Application%3A+nextauth+%28ID%3A+151633%29)
**标语**：通过数据驱动的洞察力规划成功的发布活动
**介绍**：When To Launch 帮助创作者通过数据驱动的洞察优化他们在 Product Hunt 上的发布，提供最佳时间和互动的建议。了解最佳发布日、峰值时段，以及你进入前三名的机会。更智能地规划发布，轻松实现成功。🚀
**产品网站**: [立即访问](https://www.producthunt.com/r/DBF26DFDOE7YKL?utm_campaign=producthunt-api&utm_medium=api-v2&utm_source=Application%3A+nextauth+%28ID%3A+151633%29)
**Product Hunt**: [查看 Product Hunt 页面](https://www.producthunt.com/posts/when-to-launch-4?utm_campaign=producthunt-api&utm_medium=api-v2&utm_source=Application%3A+nextauth+%28ID%3A+151633%29)

![When To Launch](https://ph-files.imgix.net/cfd537c2-ce20-44bf-a633-ae99436a0359.png?auto=format&fit=crop&frame=1&h=512&w=1024)

**关键词**：-, 产品名称：何时发布, -, 标语：利用数据洞察规划成功发布, -, 简述：何时发布帮助用户通过数据洞察优化其在Product, Hunt上的发布时机和互动。了解最佳发布日、峰值时段，以及进入前三名的机会。更聪明地规划发布，轻松实现成功。🚀, 关键词：数据洞察，发布时机，互动优化，成功规划，Product, Hunt
**票数**: 🔺72
**是否精选**：否
**发布时间**：2025年02月10日 PM04:01


 = "core.command.minimap-already-exists";
	public static final String COMMAND_MESSAGE_INVALID_MINIMAP = "core.command.invalid-minimap";
	public static final String COMMAND_MESSAGE_INVALID_SLOT = "core.command.invalid-slot";
	public static final String COMMAND_MESSAGE_INVALID_ARGUMENT = "core.command.invalid-argument";
	public static final String COMMAND_MESSAGE_INVALID_SETTING = "core.command.invalid-setting";
	public static final String COMMAND_MESSAGE_PROVIDE_MINIMAP = "core.command.must-provide-minimap";
	public static final String COMMAND_MESSAGE_PROVIDE_PLAYER = "core.command.must-provide-player";
	public static final String COMMAND_MESSAGE_PROVIDE_ARGUMENT = "core.command.must-provide-argument";
	public static final String COMMAND_MESSAGE_PROVIDE_SETTING = "core.command.must-provide-setting";

	// Managers
	public static final String MANAGER_MINIMAP_LOADING = "core.manager.minimap.loading-minimap";
	public static final String MANAGER_MINIMAP_UNLOADING = "core.manager.minimap.unloading-minimap";
	public static final String MANAGER_MINIMAP_DELETING = "core.manager.minimap.deleting-minimap";
	public static final String MANAGER_MODULE_RELOAD_START = "core.manager.module.reloading-modules-start";
	public static final String MANAGER_MODULE_RELOAD_FINISH = "core.manager.module.reloading-modules-finish";
	public static final String MANAGER_MODULE_LOADING = "core.manager.module.loading-module";
	public static final String MANAGER_MODULE_UNLOADING = "core.manager.module.unloading-module";
	public static final String MANAGER_MODULE_ENABLING = "core.manager.module.enabling-module";
	public static final String MANAGER_MODULE_DISABLING = "core.manager.module.disabling-module";
	public static final String MANAGER_MODULE_MISSING_DEPENDENCIES = "core.manager.module.missing-dependencies";

	// Minimap
	public static final String MINIMAP_DEFAULT_ROTATION = "core.minimap.default-rotation";
	public static final String MINIMAP_DEFAULT_SHOWNAME = "core.minimap.default-showname";
	public static final String MINIMAP_AUTO_UPDATE = "core.minimap.auto-update";
	public static final String MINIMAP_ZOOM_CIRCULAR = "core.minimap.circular-zoom";
	public static final String MINIMAP_RENDER = "core.minimap.render-out-of-border";
	public static final String MINIMAP_ZOOM_DEFAULT = "core.minimap.default-zoom";
	public static final String MINIMAP_ZOOM_ALLOWED = "core.minimap.allowed-zooms";
	public static final String MINIMAP_WORLD_WHITELIST = "core.minimap.whitelisted-worlds";
	public static final String MINIMAP_WORLD_BLACKLIST = "core.minimap.blacklisted-worlds";
	public static final String MINIMAP_LOADED_OVERLAY = "core.minimap.loaded-overlay";
	public static final String MINIMAP_LOADED_BACKGROUND = "core.minimap.loaded-background";
	public static final String MINIMAP_LOADED_DISABLED = "core.minimap.loaded-disabled";
}
/*
 * Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * WSO2 Inc. licenses this file to you 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.


o", filename="eating_spaghetti.mp4", repo_type="dataset"
... )
>>> container = av.open(file_path)

>>> # sample 16 frames
>>> indices = sample_frame_indices(clip_len=16, frame_sample_rate=1, seg_len=container.streams.video[0].frames)
>>> video = read_video_pyav(container, indices)

>>> image_processor = AutoImageProcessor.from_pretrained("MCG-NJU/videomae-base-finetuned-kinetics")
>>> model = VideoMAEForVideoClassification.from_pretrained("MCG-NJU/videomae-base-finetuned-kinetics")

>>> inputs = image_processor(list(video), return_tensors="pt")

>>> with torch.no_grad():
...     outputs = model(**inputs)
...     logits = outputs.logits

>>> # model predicts one of the 400 Kinetics-400 classes
>>> predicted_label = logits.argmax(-1).item()
>>> print(model.config.id2label[predicted_label])
eating spaghetti
```
# BertGeneration

> 原文链接: [`huggingface.co/docs/transformers/v4.37.2/en/model_doc/bert-generation`](https://huggingface.co/docs/transformers/v4.37.2/en/model_doc/bert-generation)

## 概述

BertGeneration 模型是一个可以利用 EncoderDecoderModel 进行序列到序列任务的 BERT 模型，如 Sascha Rothe, Shashi Narayan, Aliaksei Severyn 在 [利用预训练检查点进行序列生成任务](https://arxiv.org/abs/1907.12461) 中提出的那样。

论文摘要如下:

*最近，大型神经模型的无监督预训练已经彻底改变了自然语言处理。通过从公开发布的检查点开始热启动，NLP 从业者已经在多个基准测试中推动了最新技术，同时节省了大量的计算时间。到目前为止，重点主要集中在自然语言理解任务上。在本文中，我们展示了预训练检查点对序列生成的有效性。我们开发了一个基于 Transformer 的序列到序列模型，与公开可用的预训练 BERT、GPT-2 和 RoBERTa 检查点兼容，并对初始化我们的模型（编码器和解码器）使用这些检查点进行了广泛的实证研究。我们的模型在机器翻译、文本摘要、句子拆分和句子融合方面取得了新的最新技术成果。*

该模型由 [patrickvonplaten](https://huggingface.co/patrickvonplaten) 贡献。原始代码可在 [此处](https://tfhub.dev/s?module-type=text-generation&subtype=module,placeholder) 找到。

## 用法示例和提示

该模型可以与 EncoderDecoderModel 结合使用，以利用两个预训练的 BERT 检查点进行后续微调:

```py
>>> # leverage checkpoints for Bert2Bert model...
>>> # use BERT's cls token as BOS token and sep token as EOS token
>>> encoder = BertGenerationEncoder.from_pretrained("bert-large-uncased", bos_token_id=101, eos_token_id=102)
>>> # add cross attention layers and use BERT's cls token as BOS token and sep token as EOS token
>>> decoder = BertGenerationDecoder.from_pretrained(
...     "bert-large-uncased", add_cross_attention=True, is_decoder=True, bos_token_id=101, eos_token_id=102
... )
>>> bert2bert = EncoderDecoderModel(encoder=encoder, decoder=decoder)

>>> # create tokenizer...
>>> tokenizer = Bert


 25%;
}

.error_cut {
    width: 40%;
    height: 100%;
    position: relative;
}

.errorpage h1 {
    font-size: 36px;
    line-height: 200%;
}

.errorpage p {
    font-size: 18px;
    line-height: 180%;
}

.errorpage .red {
    color: #e14561;
}

.bg403 {
    background: #8dd5f5;
}

.bg404 {
    text-align: center;
}

.bg503 {
    background: #72bcc5;
}

caption {
    line-height: 50px;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    border: 1px solid #eaeaea;
    border-bottom: 0;
}

.diabultp dt {
    width: 100px !important;
    height: 100px !important;
    margin: 60px 20px 0 20px !important
}

.newcontract li input {
    width: 250px !important;
}

.newcontract .head {
    border: 1px solid #EAEAEA;
}

.newcontract .rightput {
    background: transparent url("../images/check.png") no-repeat scroll 400px center !important;
}

.newcontract .button {
    width: 100% !important;
    height: 100px;
    line-height: 100px;
}

.dizhi {
    width: 100%; /*height:123px;*/
    float: left;
    margin: 10px 0;
}

.dizhi .dizhi_s {
    width: 503px; /*height:123px;*/
    border: 1px solid #ddd;
    background: #fffbff;
    float: left;
}

.dizhi .dizhi_s .dizhi_s_1 {
    padding: 10px 0 0;
    height: 30px;
}

.dizhi .dizhi_s .dizhi_s_1 .dizhi_s_1_1 {
    width: 203px; /*height:30px;*/
    float: left;
}

.dizhi .dizhi_s .dizhi_s_1 .dizhi_s_1_1 b {
    width: 80px;
    text-align: right;
    float: left;
    line-height: 28px;
}

.dizhi .dizhi_s .dizhi_s_1 .dizhi_s_1_1 .ui-search {
    float: left;
    width: 155px;
}

.dizhi .dizhi_s .dizhi_s_2 {
    padding: 5px 10px 5px;
    height: 30px;
}

.dizhi .dizhi_s .dizhi_s_2 .dizhi_s_2_1 {
    /*height:30px;*/
    float: left;
}

.dizhi .dizhi_s .dizhi_s_2 .dizhi_s_2_1 b {
    width: 70px;
    text-align: right;
    float: left;
    line-height: 28px;
}

.dizhi .dizhi_s .dizhi_s_2 .dizhi_s_2_1 .ui-search {
    float: left;
    width: 155px;
}

.dizhi .dizhi_s .dizhi_s_2 .dizhi_s_2_1 .dizhi_city {
    cursor: pointer;
    color: #999;
    text-align: left;
}

.dizhi_city {
    cursor: pointer;
    color: #999 !important;
    text-align: left;
}

.dizhi .dizhi_s .dizhi_s_2 .dizhi_s_2_1 .dizhi_city:hover {
    border: 1px solid #D7D7D7;
}

.dizhi_t {
    right: 0;
    width: 310px;
    background: #fff;
    border: 1px solid #ed7220;
    position: absolute;
    z-index: 1000;
    display: none;
    font-size:


 30315793，不错过每场直播。

![SOFAChannel#17](https://cdn.nlark.com/yuque/0/2020/png/226702/1593573337020-6e23c27b-3bc5-4a80-88b7-0e3a00b54c8d.png)

大家好，我是本期 SOFAChannel 的分享讲师丞一，来自蚂蚁集团，是 SOFABolt 的开源负责人。今天我们来聊一下蚂蚁集团开源的网络通信框架 SOFABolt 的框架解析以及功能介绍。本期分享将从以下四个方面展开：

- SOFABolt 简介；
- 基础通信能力解析；
- 协议框架解析；
- 私有协议实现解析；

## SOFABolt 是什么

### SOFABolt 产生背景

相信大家都知道 SOFAStack，SOFAStack(Scalable Open Financial Architecture Stack)是一套用于快速构建金融级云原生架构的中间件，也是在金融场景里锤炼出来的最佳实践。

SOFABolt 则是 SOFAStack 中的网络通信框架，是一个基于 Netty 最佳实践的轻量、易用、高性能、易扩展的通信框架，他的名字 Bolt 取自迪士尼动画《闪电狗》。他一开始是怎么在蚂蚁集团内部产生的，我们可以类比一下 Netty 的产生原因：

- 为了让 Java 程序员能将更多的精力放在基于网络通信的业务逻辑实现上，而不是过多的纠结于网络底层 NIO 的实现以及处理难以调试的网络问题，Netty 应运而生；
- 为了让中间件开发者能将更多的精力放在产品功能特性实现上，而不是重复地一遍遍制造通信框架的轮子，SOFABolt 应运而生；

这些年，在微服务与消息中间件在网络通信上，蚂蚁集团解决过很多问题、积累了很多经验并持续进行着优化和完善，我们把总结的解决方案沉淀到 SOFABolt 这个基础组件里并反馈到开源社区，希望能够让更多使用网络通信的场景受益。目前该组件已经运用在了蚂蚁集团中间件的微服务 (SOFARPC)、消息中心、分布式事务、分布式开关、以及配置中心等众多产品上。

同时，已有数家企业在生产环境中使用了 SOFABolt，感谢大家的肯定，也希望 SOFABolt 可以给更多的企业带来实践价值。

![SOFABolt 企业用户](https://cdn.nlark.com/yuque/0/2020/png/226702/1593573337094-b3c35d2f-1853-438e-993f-d0ce3ed77b3a.png)

以上企业信息根据企业用户 Github 上反馈统计 — 截止 2020.06。

SOFABolt：[https://github.com/sofastack/sofa-bolt](https://github.com/sofastack/sofa-bolt)

### SO


n {
		File libDir = new File(this.gradleBuild.runner().getProjectDir(), "lib");
		libDir.mkdirs();
		new File(libDir, "foo-1.0.0.jar").createNewFile();
		this.gradleBuild.runner().withArguments("resolve").build();
		assertThat(readLines("resolved.txt")).containsOnly("foo-1.0.0.jar");
	}

	@Test
	void configurationCanBeUsedDirectlyWhenConfiguringConfigurationSpecificDependencyManagement() {
		this.gradleBuild.runner().withArguments("managedVersions").build();
		assertThat(readLines("managed-versions.txt")).containsOnly("org.springframework:spring-core -> 4.0.0.RELEASE");
	}

	@Test
	void configurationCanBeReferredToByNameWhenConfiguringConfigurationSpecificDependencyManagement() {
		this.gradleBuild.runner().withArguments("managedVersions").build();
		assertThat(readLines("managed-versions.txt")).containsOnly("org.springframework:spring-core -> 4.0.0.RELEASE");
	}

	@Test
	void whenImportingABomDependencyManagementWithAClassifierIsIgnored() {
		this.gradleBuild.runner().withArguments("managedVersions").build();
		assertThat(readLines("managed-versions.txt")).isEmpty();
	}

	@Test
	void whenImportingABomDependencyManagementWithNoVersionIsIgnored() {
		this.gradleBuild.runner().withArguments("managedVersions").build();
		assertThat(readLines("managed-versions.txt")).isEmpty();
	}

	@Test
	void exclusionThatIsMalformedIsTolerated() {
		this.gradleBuild.runner().withArguments("resolve").build();
		assertThat(readLines("resolved.txt")).containsOnly("malformed-exclude-1.0.jar", "spring-core-4.1.2.RELEASE.jar",
				"commons-logging-1.1.3.jar");
	}

	@Test
	void exclusionsAreAppliedToDependenciesVersionedWithConstraints() {
		this.gradleBuild.runner().withArguments("resolve").build();
		assertThat(readLines("resolved.txt")).containsOnly("transitive-exclude-1.0.jar",
				"spring-beans-4.1.2.RELEASE.jar", "spring-tx-4.1.2.RELEASE.jar", "spring-core-4.1.2.RELEASE.jar");
	}

	@Test
	void dependenciesWithExtremelyLargePomsAreHandled() {
		this.gradleBuild.runner().withArguments("resolve").build();
		assertThat(readLines("resolved.txt")).contains("hisrc-basicjaxb-plugins-2.1.0.jar");
	}

	@Test
	void constraintsInTransitivePlatformDependenciesDoNotPreventExclusionsFromWorking() {
		this.gradleBuild.runner().withArguments("resolve").build();
		assertThat(readLines("resolved.txt")).noneMatch((line) -> line.contains("junit"));
	}

	@Test
	void resolutionSucceedsWhenDependencyReliesOnDependencyManagementFromItsAncestors() {
		this.gradleBuild.runner().withArguments("resolve").build();
		assertThat(readLines("resolved.txt")).containsExactly("dependency-management-child-1.0.jar",
				"spring-core-5.3.27.jar", "spring-jcl-5.3.27.jar");
	}

	@Test
	void resolutionSucceedsWhenDependencyReliesOnConstraintsFromPlatformDependencies() {
		this.gradleBuild.runner().withArguments("resolve").build();
		assertThat(readLines("resolved.txt")).containsExactly("platform-consumer-1.0.jar", "spring-core-5.3.27.jar",
				"spring-jcl-5.3.27.jar");
	}

	@Test
	void resolutionSucceedsWhenDependencyHasAnInvalidPom() {
		BuildResult result = this.gradleBuild.runner().withArguments("resolve").build();
		assertThat(result.getOutput()).contains("Errors occurred while building effective model")
			.contains("Building this project requires a newer version of Maven");
	}

	@Test
	void dependenciesDeclaredIn


xer */
  std::vector<std::vector<ModuleNetId>> module_nets_by_level;
  module_nets_by_level.resize(mux_graph.num_node_levels());
  for (size_t level = 0; level < mux_graph.num_node_levels(); ++level) {
    /* Print the internal wires located at this level */
    module_nets_by_level[level].resize(mux_graph.num_nodes_at_level(level));
  }

  /* Build the location map of intermediate buffers */
  std::vector<bool> inter_buffer_location_map =
    build_mux_intermediate_buffer_location_map(circuit_lib, mux_model,
                                               mux_graph.num_node_levels());

  /* Add all the branch modules and intermediate buffers */
  for (const auto& node : mux_graph.non_input_nodes()) {
    /* Get the size of branch circuit
     * Instanciate an branch circuit by the size (fan-in) of the node
     */
    size_t branch_size = mux_graph.node_in_edges(node).size();
    /* To match the standard cell MUX2: We should have only 2 input_nodes */
    VTR_ASSERT(2 == branch_size);

    /* Last stage MUX model may have a different name */
    ModuleId curr_stage_std_cell_module_id = std_cell_module_id;
    if (true == mux_graph.is_node_output(node)) {
      curr_stage_std_cell_module_id = last_stage_std_cell_module_id;
    }
    /* Find the instance id */
    size_t std_cell_instance_id =
      module_manager.num_instance(mux_module, curr_stage_std_cell_module_id);
    /* Add the module to mux_module */
    module_manager.add_child_module(mux_module, curr_stage_std_cell_module_id);

    /* Get the node level and index in the current level */
    size_t output_node_level = mux_graph.node_level(node);
    size_t output_node_index_at_level = mux_graph.node_index_at_level(node);
    /* Set a name for the instance */
    std::string std_cell_instance_name = generate_mux_branch_instance_name(
      output_node_level, output_node_index_at_level, false);
    module_manager.set_child_instance_name(
      mux_module, curr_stage_std_cell_module_id, std_cell_instance_id,
      std_cell_instance_name);

    /* Add module nets to wire to next stage modules */
    ModuleNetId branch_net;
    if (true == mux_graph.is_node_output(node)) {
      /* This is an output node, we should use existing output nets */
      MuxOutputId output_id = mux_graph.output_id(node);
      branch_net = mux_module_output_nets[output_id];
      module_manager.add_module_net_source(
        mux_module, branch_net, curr_stage_std_cell_module_id,
        std_cell_instance_id, last_stage_std_cell_module_output,
        last_stage_std_cell_module_output_port.get_lsb());
    } else {
      VTR_ASSERT(false == mux_graph.is_node_output(node));
      branch_net = module_manager.create_module_net(mux_module);
      module_manager.add_module_net_source(
        mux_module, branch_net, curr_stage_std_cell_module_id,
        std_cell_instance_id, std_cell_module_output,
        std_cell_module_output_port.get_lsb());
    }

    /* Record the module net id in the cache */
    module_nets_by_level[output_node_level][output_node_index_at_level] =
      branch_net;


 => {
                self.outgoing_rel.remove(index).expect("Wrong index");
                let request = Request::None;
                let notification = if cfg!(feature = "acknotify") {
                    Notification::PubComp(pkid)
                } else {
                    Notification::None
                };

                Ok((notification, request))
            }
            _ => {
                error!("Unsolicited pubcomp packet: {:?}", pkid);
                Err(NetworkError::Unsolicited)
            }
        }
    }

    // check when the last control packet/pingreq packet
    // is received and return the status which tells if
    // keep alive time has exceeded
    // NOTE: status will be checked for zero keepalive times also
    pub fn handle_outgoing_ping(&mut self) -> Result<Request, NetworkError> {
        let keep_alive = self.opts.keep_alive();
        let elapsed_in = self.last_incoming.elapsed();
        let elapsed_out = self.last_outgoing.elapsed();

        // raise error if last ping didn't receive ack
        if self.await_pingresp {
            error!("Error awaiting for last ping response");
            return Err(NetworkError::AwaitPingResp);
        }

        let packet = if elapsed_in > keep_alive || elapsed_out > keep_alive {
            self.await_pingresp = true;
            Request::Ping
        } else {
            Request::None
        };

        debug!(
            "Ping = {:?}. keep alive = {},
            last incoming packet before {} secs,
            last outgoing packet before {} secs",
            packet, keep_alive.as_secs(), elapsed_in.as_secs(), elapsed_out.as_secs());

        Ok(packet)
    }

    pub fn handle_incoming_pingresp(&mut self) -> Result<(Notification, Request), NetworkError> {
        self.await_pingresp = false;
        Ok((Notification::None, Request::None))
    }

    pub fn handle_outgoing_subscribe(&mut self, mut subscription: Subscribe) -> Result<Subscribe, NetworkError> {
        let pkid = self.next_pkid();
        subscription.pkid = pkid;

        info!("Subscribe. Topics = {:?}, Pkid = {:?}", subscription.topics, subscription.pkid);
        Ok(subscription)
    }

    // pub fn handle_incoming_suback(&mut self, ack: Suback) -> Result<(), SubackError> {
    //     if ack.return_codes.iter().any(|v| *v == SubscribeReturnCodes::Failure) {
    //         Err(SubackError::Rejected)
    //     } else {
    //         Ok(())
    //     }
    // }

    fn handle_previous_session(&mut self) {
        self.await_pingresp = false;

        if self.opts.clean_session() {
            self.outgoing_pub.clear();
        }

        self.last_incoming = Instant::now();
        self.last_outgoing = Instant::now();
    }

    // http://stackoverflow.com/questions/11115364/mqtt-messageid-practical-implementation
    fn next_pkid(&mut self) -> PacketIdentifier {
        let PacketIdentifier(mut pkid) = self.last_pkid;
        if pkid == 65_535 {
            pkid = 0;
        }
        self.last_pkid = PacketIdentifier(pkid + 1);
        self.last_pkid
    }
}

fn connect_packet(mqttoptions: &MqttOptions) -> Result<Connect, ConnectError> {
    let (username, password) = match mqttoptions.security_opts() {
        SecurityOptions::UsernamePassword(username, password) => (Some(us


room3", "r")
    assert not check_state(State(kb.logic, [
        Proposition("link", [room1, door, room2]),
        Proposition("link", [room1, door, room3]),
    ]))

    door1 = Variable("door1", "d")
    door2 = Variable("door2", "d")
    room1 = Variable("room1", "r")
    room2 = Variable("room2", "r")
    assert not check_state(State(kb.logic, [
        Proposition("link", [room1, door1, room2]),
        Proposition("link", [room1, door2, room2]),
    ]))

def test_room_connections():
    kb = KnowledgeBase.default()

    room0 = Variable("room0", "r")
    room1 = Variable("room1", "r")
    room2 = Variable("room2", "r")

    # Only one connection can exist between two rooms.
    # r1
    # |
    # r0 - r1
    state = State(kb.logic, [
        Proposition("north_of", [room1, room0]),
        Proposition("south_of", [room0, room1]),
        Proposition("east_of", [room1, room0]),
        Proposition("west_of", [room0, room1])
    ])

    assert not check_state(state)

    # Non Cartesian layout are allowed.
    # r1
    # |
    # r0 - r2 - r1
    state = State(kb.logic, [
        Proposition("north_of", [room1, room0]),
        Proposition("south_of", [room0, room1]),
        Proposition("east_of", [room2, room0]),
        Proposition("west_of", [room0, room2]),
        Proposition("east_of", [room1, room2]),
        Proposition("west_of", [room2, room1])
    ])

    assert check_state(state)

    # A room cannot have more than 4 'link' propositions.
    room3 = Variable("room3", "r")
    room4 = Variable("room4", "r")
    room5 = Variable("room5", "r")
    door1 = Variable("door1", "d")
    door2 = Variable("door2", "d")
    door3 = Variable("door3", "d")
    door4 = Variable("door4", "d")
    door5 = Variable("door5", "d")

    state = State(kb.logic, [
        Proposition("link", [room0, door1, room1]),
        Proposition("link", [room0, door2, room2]),
        Proposition("link", [room0, door3, room3]),
        Proposition("link", [room0, door4, room4]),
        Proposition("link", [room0, door5, room5])
    ])

    assert not check_state(state)


{
		return this.element;
	}

	_makePropsProxy(props: Props) {
		const thisProps = new Proxy(props, {
			deleteProperty() {
				throw new Error('Нет доступа');
			},
		});
		return thisProps;
	}

	_createDocumentElement(tagName: string) {
		const element = document.createElement(tagName);
		element.setAttribute('data-id', this.uuid);
		return element;
	}

	show() {
		if (this.element) {
			this.element.style.display = 'block';
		}
	}

	hide() {
		if (this.element) {
			this.element.style.display = 'none';
		}
	}
}
import { Reducer } from 'redux'
import { GET_DEFAULT_IMAGES, SEARCH_BREED, SEARCH_BREED_ERROR, TOGGLE_LIKE } from './actions'

export interface DefaultImages {
  message: string[]
  status: string
}

export interface InitialState {
  images: DefaultImages
  liked: string[]
  error: string
}

const initialState: InitialState = {
  images: null,
  liked: [],
  error: null
}

export const rootReducer: Reducer<InitialState> = (state = initialState, action) => {
  switch (action.type) {
    case GET_DEFAULT_IMAGES:
      return {
        ...state, images: action.payload, error: null
      }
    case SEARCH_BREED:
      return {
        ...state, images: action.payload, error: null
      }
    case SEARCH_BREED_ERROR:
      return {
        ...state, error: 'Please Enter a Valid Breed'
      }
    case TOGGLE_LIKE:
      if (state.liked.includes(action.payload)) {
        return {
          ...state,
          liked: state.liked.filter((imgLink: string) => imgLink != action.payload)
        }
      } else {
        return { ...state, liked: [...state.liked, action.payload] }
      }
    default:
      return state
  }
}
import { Component, OnInit } from '@angular/core';
import { CommandService, Command } from './services/command-service.service';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

/**
 * Test system performance based on command handling time.
 *
 * This application retrieve every command issued to the system and compute average time and max time:
 *    - from command creation to command acceptance (status :  pending -> in_process)
 *    - from command acceptance to completion (status : in_process -> completed)
 *    - from command acceptance to failure (status :  in_process -> failed)
 */
export class AppComponent implements OnInit{

  commandTotalAmount : number;

  pendingCommandList : Array<Command>;
  processingCommandList : Array<Command>;
  completedCommandList : Array<Command>;
  failedCommandList : Array<Command>;

  avgAcceptTime : number;
  maxAcceptTime : number;

  avgCompletionTime : number;
  maxCompletionTime : number;

  avgFailureTime : number;
  maxFailureTime : number;

  constructor(private commandService : CommandService) {
    this.pendingCommandList = new Array<Command> ();
    this.processingCommandList = new Array<Command> ();
    this.completedCommandList = new Array<Command> ();
    this.failedCommandList = new Array<Command> ();

    this.commandTotalAmount = 0;
  }

  ng


AuthorizeOAuth2RequestValidator_InvalidResponseType);

        RuleFor(req => req.Scope)
            .Matches(Validations.OpenIdConnect.Scope)
            .WithMessage(Resources.AuthorizeOAuth2RequestValidator_InvalidScope);

        RuleFor(req => req.State)
            .Matches(Validations.OAuth2.State)
            .WithMessage(Resources.AuthorizeOAuth2RequestValidator_InvalidState)
            .When(req => req.State.HasValue());

        RuleFor(req => req.Nonce)
            .Matches(Validations.OAuth2.Nonce)
            .WithMessage(Resources.AuthorizeOAuth2RequestValidator_InvalidNonce)
            .When(req => req.Nonce.HasValue());

        RuleFor(req => req.CodeChallenge)
            .Matches(Validations.OAuth2.CodeChallenge)
            .WithMessage(Resources.AuthorizeOAuth2RequestValidator_InvalidCodeChallenge)
            .When(req => req.CodeChallenge.HasValue());

        RuleFor(req => req.CodeChallengeMethod)
            .Must(rt => Enum.TryParse(rt, true, out OpenIdConnectCodeChallengeMethod _))
            .WithMessage(Resources.AuthorizeOAuth2RequestValidator_InvalidCodeChallengeMethod)
            .When(req => req.CodeChallengeMethod.HasValue());
    }
}


                            ScheduleAtWrongType.GetAlgebraicType(registrar)
                        ),
                        new(
                            nameof(ScheduleAtCorrectType),
                            ScheduleAtCorrectType.GetAlgebraicType(registrar)
                        )
                    }
                )
            );

        SpacetimeDB.BSATN.AlgebraicType SpacetimeDB.BSATN.IReadWrite<TestScheduleIssues>.GetAlgebraicType(
            SpacetimeDB.BSATN.ITypeRegistrar registrar
        ) => GetAlgebraicType(registrar);
    }

    public override int GetHashCode()
    {
        var ___hashIdWrongType = IdWrongType == null ? 0 : IdWrongType.GetHashCode();
        var ___hashIdCorrectType = IdCorrectType.GetHashCode();
        var ___hashScheduleAtWrongType = ScheduleAtWrongType.GetHashCode();
        var ___hashScheduleAtCorrectType =
            ScheduleAtCorrectType == null ? 0 : ScheduleAtCorrectType.GetHashCode();
        return ___hashIdWrongType
            ^ ___hashIdCorrectType
            ^ ___hashScheduleAtWrongType
            ^ ___hashScheduleAtCorrectType;
    }

#nullable enable
    public bool Equals(TestScheduleIssues that)
    {
        var ___eqIdWrongType =
            this.IdWrongType == null
                ? that.IdWrongType == null
                : this.IdWrongType.Equals(that.IdWrongType);
        var ___eqIdCorrectType = this.IdCorrectType.Equals(that.IdCorrectType);
        var ___eqScheduleAtWrongType = this.ScheduleAtWrongType.Equals(that.ScheduleAtWrongType);
        var ___eqScheduleAtCorrectType =
            this.ScheduleAtCorrectType == null
                ? that.ScheduleAtCorrectType == null
                : this.ScheduleAtCorrectType.Equals(that.ScheduleAtCorrectType);
        return ___eqIdWrongType
            && ___eqIdCorrectType
            && ___eqScheduleAtWrongType
            && ___eqScheduleAtCorrectType;
    }

    public override bool Equals(object? that)
    {
        if (that == null)
        {
            return false;
        }
        var that_ = that as TestScheduleIssues?;
        if (((object?)that_) == null)
        {
            return false;
        }
        return Equals(that_);
    }

    public static bool operator ==(TestScheduleIssues this_, TestScheduleIssues that)
    {
        if (((object?)this_) == null || ((object?)that) == null)
        {
            return object.Equals(this_, that);
        }
        return this_.Equals(that);
    }

    public static bool operator !=(TestScheduleIssues this_, TestScheduleIssues that)
    {
        if (((object?)this_) == null || ((object?)that) == null)
        {
            return !object.Equals(this_, that);
        }
        return !this_.Equals(that);
    }
#nullable restore
} // TestScheduleIssues


# Copyright 2025 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
#
#     https://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.

"""Generator."""

import common

def generate(size=None, color=None):
  """Returns input and output grids according to the given parameters.

  Args:
    size: the width and height of the (square) grid
    color: a digit representing a color to be used
  """
  if size is None:
    size = 2 * common.randint(2, 7) + 1
    color = common.random_color()

  grid, output = common.grids(size, size, color)
  grid[size // 2][size // 2] = common.black()
  for i in range(size):
    output[i][i] = common.black()
    output[i][size - 1 - i] = common.black()
    output[size - 1 - i][i] = common.black()
    output[size - 1 - i][size - 1 - i] = common.black()
  return {"input": grid, "output": output}

def validate():
  """Validates the generator."""
  train = [
      generate(size=3, color=1),
      generate(size=5, color=2),
      generate(size=7, color=3),
  ]
  test = [
      generate(size=11, color=6),
  ]
  return {"train": train, "test": test}


skeleton_duration_+%
		/// </summary>
		SkeletonDurationPct = 1145,

		/// <summary>
		/// local_poison_on_hit
		/// </summary>
		LocalPoisonOnHit = 1146,

		/// <summary>
		/// main_hand_local_poison_on_hit
		/// </summary>
		MainHandLocalPoisonOnHit = 1147,

		/// <summary>
		/// off_hand_local_poison_on_hit
		/// </summary>
		OffHandLocalPoisonOnHit = 1148,

		/// <summary>
		/// on_low_mana
		/// </summary>
		OnLowMana = 1149,

		/// <summary>
		/// spell_damage_taken_+%_when_on_low_mana
		/// </summary>
		SpellDamageTakenPctWhenOnLowMana = 1150,

		/// <summary>
		/// spell_damage_taken_+%
		/// </summary>
		SpellDamageTakenPct = 1151,

		/// <summary>
		/// evasion_rating_+_when_on_full_life
		/// </summary>
		EvasionRatingWhenOnFullLife = 1152,

		/// <summary>
		/// aura_effect_on_self_+%
		/// </summary>
		AuraEffectOnSelfPct = 1153,

		/// <summary>
		/// minions_have_aura_effect_+%
		/// </summary>
		MinionsHaveAuraEffectPct = 1154,

		/// <summary>
		/// reflect_curses
		/// </summary>
		ReflectCurses = 1155,

		/// <summary>
		/// global_critical_strike_chance_+%_while_holding_staff
		/// </summary>
		GlobalCriticalStrikeChancePctWhileHoldingStaff = 1156,

		/// <summary>
		/// global_critical_strike_multiplier_+_while_holding_staff
		/// </summary>
		GlobalCriticalStrikeMultiplierWhileHoldingStaff = 1157,

		/// <summary>
		/// secondary_damage_critical_strike_multiplier_+
		/// </summary>
		SecondaryDamageCriticalStrikeMultiplier = 1158,

		/// <summary>
		/// old_do_not_use_life_leech_from_spell_damage_%
		/// </summary>
		OldDoNotUseLifeLeechFromSpellDamagePct = 1159,

		/// <summary>
		/// old_do_not_use_mana_leech_from_spell_damage_%
		/// </summary>
		OldDoNotUseManaLeechFromSpellDamagePct = 1160,

		/// <summary>
		/// punishment_physical_damage_%_reflected_for_normal_monsters
		/// </summary>
		PunishmentPhysicalDamagePctReflectedForNormalMonsters = 1161,

		/// <summary>
		/// punishment_physical_damage_%_reflected_for_magic_monsters
		/// </summary>
		PunishmentPhysicalDamagePctReflectedForMagicMonsters = 1162,

		/// <summary>
		/// punishment_physical_damage_%_reflected_for_rare_monsters
		/// </summary>
		PunishmentPhysicalDamagePctReflectedForRareMonsters = 1163,

		/// <summary>
		/// punishment_physical_damage_%_reflected_for_unique_monsters
		/// </summary>
		PunishmentPhysicalDamagePctReflectedForUniqueMonsters = 1164,

		/// <summary>
		/// is_player_minion
		/// </summary>
		IsPlayerMinion = 1165,

		/// <summary>
		/// Local Flask Curse Immunity While Healing
		/// </summary>
		LocalFlaskCurseImmunityWhileHealing = 1166,

		/// <summary>
		/// attacks_deal_no_physical_damage
		/// </summary>
		AttacksDealNoPhysicalDamage = 1167,

		/// <summary>
		/// whirling_blades_base_ground_fire_damage_to


 "Main"
_trigon.Main_8.Position = UDim2.new(0.502747, 0, 0.5, 0)
_trigon.Main_8.Parent = _trigon.execClipboard

_trigon.UIPadding_10.PaddingRight = UDim.new(0.05, 0)
_trigon.UIPadding_10.PaddingLeft = UDim.new(0.06, 0)
_trigon.UIPadding_10.Parent = _trigon.Main_8

_trigon.UIListLayout_3.FillDirection = Enum.FillDirection.Horizontal
_trigon.UIListLayout_3.HorizontalAlignment = Enum.HorizontalAlignment.Center
_trigon.UIListLayout_3.VerticalAlignment = Enum.VerticalAlignment.Center
_trigon.UIListLayout_3.SortOrder = Enum.SortOrder.LayoutOrder
_trigon.UIListLayout_3.Padding = UDim.new(0.05, 0)
_trigon.UIListLayout_3.ItemLineAlignment = Enum.ItemLineAlignment.Center
_trigon.UIListLayout_3.Parent = _trigon.Main_8

_trigon.Icon_7.ImageColor3 = Color3.fromRGB(241, 241, 241)
_trigon.Icon_7.BorderSizePixel = 0
_trigon.Icon_7.ScaleType = Enum.ScaleType.Fit
_trigon.Icon_7.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
_trigon.Icon_7.Position = UDim2.new(0.175027, 0, 0.5, 0)
_trigon.Icon_7.Name = "Icon"
_trigon.Icon_7.AnchorPoint = Vector2.new(0.5, 0.5)
_trigon.Icon_7.Image = "rbxassetid://14906044812"
_trigon.Icon_7.Size = UDim2.new(0.154936, 0, 1.09524, 0)
_trigon.Icon_7.BorderColor3 = Color3.fromRGB(0, 0, 0)
_trigon.Icon_7.BackgroundTransparency = 1
_trigon.Icon_7.Parent = _trigon.Main_8

_trigon.UIAspectRatioConstraint_9.AspectRatio = 0.417535
_trigon.UIAspectRatioConstraint_9.Parent = _trigon.Icon_7

_trigon.TextLabel_9.TextWrapped = true
_trigon.TextLabel_9.BorderSizePixel = 0
_trigon.TextLabel_9.TextScaled = true
_trigon.TextLabel_9.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
_trigon.TextLabel_9.FontFace = Font.new("rbxasset://fonts/families/Ubuntu.json", Enum.FontWeight.Bold, Enum.FontStyle.Normal)
_trigon.TextLabel_9.Position = UDim2.new(0.618524, 0, 0.5, 0)
_trigon.TextLabel_9.AnchorPoint = Vector2.new(0.5, 0.5)
_trigon.TextLabel_9.TextSize = 14
_trigon.TextLabel_9.Size = UDim2.new(0.771559, 0, 0.452381, 0)
_trigon.TextLabel_9.TextColor3 = Color3.fromRGB(241, 241, 241)
_trigon.TextLabel_9.BorderColor3 = Color3.fromRGB(0, 0, 0)
_trigon.TextLabel_9.Text = "Execute Clipboard"
_trigon.TextLabel_9.BackgroundTransparency = 1
_trigon.TextLabel_9.TextXAlignment = Enum.TextXAlignment.Left
_trigon.TextLabel_9.Parent = _trigon.Main_8

_trigon.UIPadding_11.Parent = _trigon.TextLabel_9

_trigon.Paste.BorderSizePixel = 0
_trigon.Paste.Position = UDim2.new(0.1806


Bech32(hrp, data);
  }

  /// Validates if a string is a valid mostro: URL
  /// Format: mostro:order-id&relays=wss://relay1,wss://relay2
  static bool isValidMostroUrl(String url) {
    if (!url.startsWith('mostro:')) return false;

    try {
      final uri = Uri.parse(url);
      if (uri.scheme != 'mostro') return false;

      // Check if we have an order ID (path)
      final orderId = uri.path;
      if (orderId.isEmpty) return false;

      // Check if relays parameter exists
      final relaysParam = uri.queryParameters['relays'];
      if (relaysParam == null || relaysParam.isEmpty) return false;

      // Validate relay URLs
      final relays = relaysParam.split(',');
      for (final relay in relays) {
        final trimmedRelay = relay.trim();
        if (!trimmedRelay.startsWith('wss://') &&
            !trimmedRelay.startsWith('ws://')) {
          return false;
        }
      }

      return true;
    } catch (e) {
      return false;
    }
  }

  /// Parses a mostro: URL and returns order information
  /// Format: mostro:order-id&relays=wss://relay1,wss://relay2
  /// Returns a map with 'orderId' and 'relays' keys
  static Map<String, dynamic>? parseMostroUrl(String url) {
    if (!isValidMostroUrl(url)) return null;

    try {
      final uri = Uri.parse(url);

      final orderId = uri.path;
      final relaysParam = uri.queryParameters['relays'];

      if (orderId.isEmpty || relaysParam == null) return null;

      final relays = relaysParam
          .split(',')
          .map((relay) => relay.trim())
          .where((relay) => relay.isNotEmpty)
          .toList();

      return {
        'orderId': orderId,
        'relays': relays,
      };
    } catch (e) {
      return null;
    }
  }

  static Future<String?> pubKeyFromIdentifierNip05(
      String internetIdentifier) async {
    return await _instance.services.utils
        .pubKeyFromIdentifierNip05(internetIdentifier: internetIdentifier);
  }

  // Method to generate event ID in Nostr
  static String generateId(Map<String, dynamic> eventData) {
    final jsonString = jsonEncode([
      0, // Event version
      eventData['pubkey'], // Public key
      eventData['created_at'], // Timestamp
      eventData['kind'], // Event type
      eventData['tags'], // Event tags
      eventData['content'] // Event content
    ]);

    // Calculate SHA-256 hash to generate ID
    final bytes = utf8.encode(jsonString);
    final digest = sha256.convert(bytes);

    return digest.toString(); // Return ID as hex string
  }

  /// Generates a timestamp between now and 48 hours ago to enhance privacy
  /// by decorrelating event timing from creation time.
  /// @throws if system clock is ahead of network time
  static DateTime randomNow() {
    final now = DateTime.now();
    // Validate system time isn't ahead
    final networkTime = DateTime.now().toUtc();
    if (now.isAfter(networkTime.add(Duration(minutes: 5)))) {
      throw Exception('System clock is ahead of network time');
    }
    final randomSeconds = Random().nextInt(2 * 24 * 60 * 60);
    return now.subtract(Duration(seconds: randomSeconds));
  }

  static Future<String> createRumor(NostrKeyPairs senderKeyPair,
      String wrapperKey, String recipientPubKey, String content) async {
    final rumorEvent = NostrEvent.fromPartialData(
      kind: 1,
      keyPairs: senderKeyPair,
      content: content,
      createdAt: DateTime.now(),
      tags: [
        ["p", recipientPubKey]
      ],
    );

    try {
      return await encryptNIP44(


/// Major/minor supported RRF version (optional)
        /// </summary>
        public string? RrfVersion
        {
            get => _rrfVersion;
            set => SetPropertyValue(ref _rrfVersion, value);
        }
        private string? _rrfVersion;

        /// <summary>
        /// Custom plugin data to be populated in the object model (DSF/DWC in SBC mode - or - DWC in standalone mode).
        /// Before <see cref="Commands.SetPluginData"/> can be used, corresponding properties must be registered via this property first!
        /// </summary>
        /// <seealso cref="Commands.SetPluginData"/>
        public JsonModelDictionary Data { get; } = new JsonModelDictionary(false);

        /// <summary>
        /// Check if the given version satisfies a required version
        /// </summary>


// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2021, 2024, Oracle and/or its affiliates.
 */

#include <bpf_asm_helpers.h>

/*
 * void dt_dirname(const dt_dctx_t *dctx, char *src, char *dst);
 */
	.text
	.align	4
	.global	dt_dirname
	.type	dt_dirname, @function
dt_dirname :
#define SRC %r6
#define DST %r7
#define LEN %r8

	/* store copies of input arguments */
	mov	SRC, %r2
	mov	DST, %r3

	/*
	 * Copy src to dst for two reasons:
	 *   - to get the string length
	 *   - to have a copy that we can access directly
	 */
	/* r0 = bpf_probe_read_str(dst, STRSZ + 1, src) */
	mov	%r1, DST
	lddw	%r2, STRSZ
	add	%r2, 1
	mov	%r3, SRC
	call	BPF_FUNC_probe_read_str

	/* if (r0 s<= 1) goto Ldot */
	jsle	%r0, 1, .Ldot

	/* len = r0 - 1 */
	mov	LEN, %r0
	sub	LEN, 1

	/*
	 * In general, the string will look like
	 * "dirname////basename////".
	 */

	/*
	 * Back up, looking for a non-'/' char.
	 * That gives us the end of basename.
	 */
.L1:
	/* len-- */
	sub	LEN, 1
	/* if (len s< 0) goto Lslash */
	jslt	LEN, 0, .Lslash
	/* if (dst[len] == '/') goto L1 */
	mov	%r0, DST
	add	%r0, LEN
	ldxb	%r0, [%r0+0]
	and	%r0, 0xff
	j


actual = count.wordsOnly;

                expect(actual.sortedWords).toEqual(expected);
            });

        });
    });

});
import {
    Action,
    Module,
    Mutation,
    VuexModule,
} from 'vuex-module-decorators';

import store from '..';

import axios from 'axios';
import { IDashboard } from '../interfaces/IDashboard';
import { IStoreActionResponse } from '../interfaces/IStoreActionResponse';

export interface IWeatherState {
    readonly dashboard: IDashboard | null;
    fetchDashboard(reload?: boolean): Promise<IStoreActionResponse<IDashboard | null>>
}

@Module({ dynamic: true, store, name: 'weather' })
export default class WeatherState extends VuexModule implements IWeatherState {
    private DASHBOARD: IDashboard = null as any;

    //#region GETTERS
    get dashboard(): IDashboard | null {
        if(!this.DASHBOARD) return null;
        return Object.assign({}, this.DASHBOARD);
    }

    //#endregion

    //#region ACTIONS
    @Action
    async fetchDashboard(reload = false): Promise<IStoreActionResponse<IDashboard | null>> {
        if (!reload && this.DASHBOARD) return { success: true, data: Object.assign({}, this.DASHBOARD)};

        try {
            const fetchDashboardUrl = `http://localhost:3000/dashboard`;
            const axiosResponse = await axios.get(fetchDashboardUrl);

            if(axiosResponse && axiosResponse.data) {
                this.context.commit('setDashboard', axiosResponse.data);
            }

            const returnData = this.DASHBOARD ? Object.assign({}, this.DASHBOARD): null;
            return { success: true, data: returnData as any};
        }
        catch (e) {
            console.error('Weather Store Dashboard Error:', e);
        }

        return { success: false, reason: 'Error fetching dashboard.' };
    }

    //#endregion

    //#region MUTATIONS

    @Mutation
    async setDashboard(dashboard: IDashboard) {
        this.DASHBOARD = dashboard;
    }
    //#endregion
}
// Understanding the basics of Typescript

// Adding types to function parameters to specify what we should receive => use the colon and give the type
function addStuff(n1: number, n2: number) {
  return n1 + n2;
}

// Assigning types mannualy => Only not-initialized variables
let num1: string;
num1 = "3.3";

let num2: number;
num2 = 2.7;

console.log(addStuff(+num1, num2));
import { useCallback, useState } from "react";
import { Nullable } from "../../genericTypes";

export default function useLocalStorage<T>(key: string, initialValue?: T) {
  const [data, setData] = useState<T>(() => {
    try {
      const dataJson: Nullable<string> = localStorage.getItem(key);

      if (dataJson) {
        return JSON.parse(dataJson);
      }

      return initialValue;
    } catch (ex) {
      console.warn(ex);
      return initialValue;
    }
  });

  const setLocalStorage = useCallback(
    (data: T) => {
      try {
        setData(data);
        localStorage.setItem(key, JSON.stringify(data));
      } catch (ex) {
        console.warn(ex);
      }
    },
    [key, setData]
  );

  return [data, setLocalStorage] as [T, (data: T) => void];
}
import express from 'express'
const app = express()
const router = express.Router()
const path = require('path');

express.urlencoded({extended:true})
app.use(express.json())
const fs = require('fs');

////Webs


 calculate maximum and minimum values for all plots of given units
    void calcMaxAndMin(int units) {
	maxValue = -1e8;
	minValue = 1e8;
    	int i;
    	int si;
    	for (si = 0; si != visiblePlots.size(); si++) {
    	    ScopePlot plot = visiblePlots.get(si);
    	    if (plot.units != units)
    		continue;
    	    int ipa = plot.startIndex(rect.width);
    	    double maxV[] = plot.maxValues;
    	    double minV[] = plot.minValues;
    	    for (i = 0; i != rect.width; i++) {
    		int ip = (i+ipa) & (scopePointCount-1);
    		if (maxV[ip] > maxValue)
    		    maxValue = maxV[ip];
    		if (minV[ip] < minValue)
    		    minValue = minV[ip];
    	    }
        }
    }

    // adjust scale of a plot
    void calcPlotScale(ScopePlot plot) {
	if (manualScale)
	    return;
    	int i;
    	int ipa = plot.startIndex(rect.width);
    	double maxV[] = plot.maxValues;
    	double minV[] = plot.minValues;
    	double max = 0;
    	double gridMax = scale[plot.units];
    	for (i = 0; i != rect.width; i++) {
    	    int ip = (i+ipa) & (scopePointCount-1);
    	    if (maxV[ip] > max)
    		max = maxV[ip];
    	    if (minV[ip] < -max)
    		max = -minV[ip];
    	}
    	// scale fixed at maximum?
    	if (maxScale)
    	    gridMax = Math.max(max, gridMax);
    	else
    	    // adjust in powers of two
    	    while (max > gridMax)
    		gridMax *= 2;
    	scale[plot.units] = gridMax;
    }

    double calcGridStepX() {
	int multptr=0;
    	double gsx = 1e-15;

    	double ts = sim.maxTimeStep*speed;
    	while (gsx < ts*20) {
    	    gsx *=multa[(multptr++)%3];
    	}
    	return gsx;
    }

    double getGridMaxFromManScale(ScopePlot plot) {
	return ((double)(manDivisions)/2+0.05)*plot.manScale;
    }

    void drawPlot(Graphics g, ScopePlot plot, boolean allPlotsSameUnits, boolean selected, boolean allSelected) {
	if (plot.elm == null)
	    return;
    	int i;
    	String col;

    	double gridMid, positionOffset;
    	int multptr=0;
    	int x = 0;
    	final int maxy = (rect.height-1)/2;

    	String color = (somethingSelected) ? "#A0A0A0" : plot.color;
	if (allSelected || (sim.scopeSelected == -1  && plot.elm.isMouseElm()))
    	    color = CircuitElm.selectColor.getHexValue();
	else if (selected)
	    color = plot.color;
    	int ipa = plot.startIndex(rect.width);
    	double maxV[] = plot.maxValues;
    	double minV[] = plot.minValues;
    	double gridMax;

    	// Calculate the max value (positive) to show and the value at the mid point of the grid
    	if (!isManualScale()) {
    	    	gridMax = scale[plot.units];
    	    	gridMid = 0;
    	    	positionOffset = 0;
        	if (allPlotsSameUnits) {
        	    // if we don't have overlapping scopes of different


.ccx, fty);
    debug!("struct_field_ptr: Field type is {:?}", ll_fty);
    bcx.pointercast(byte_ptr, ll_fty.ptr_to())
}

/// Construct a constant value, suitable for initializing a
/// GlobalVariable, given a case and constant values for its fields.
/// Note that this may have a different LLVM type (and different
/// alignment!) from the representation's `type_of`, so it needs a
/// pointer cast before use.
///
/// The LLVM type system does not directly support unions, and only
/// pointers can be bitcast, so a constant (and, by extension, the
/// GlobalVariable initialized by it) will have a type that can vary
/// depending on which case of an enum it is.
///
/// To understand the alignment situation, consider `enum E { V64(u64),
/// V32(u32, u32) }` on Windows.  The type has 8-byte alignment to
/// accommodate the u64, but `V32(x, y)` would have LLVM type `{i32,
/// i32, i32}`, which is 4-byte aligned.
///
/// Currently the returned value has the same size as the type, but
/// this could be changed in the future to avoid allocating unnecessary
/// space after values of shorter-than-maximum cases.
pub fn trans_const<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>, discr: Disr,
                             vals: &[ValueRef]) -> ValueRef {
    let l = ccx.layout_of(t);
    let dl = &ccx.tcx().data_layout;
    match *l {
        layout::CEnum { discr: d, min, max, .. } => {
            assert_eq!(vals.len(), 0);
            assert_discr_in_range(Disr(min), Disr(max), discr);
            C_integral(Type::from_integer(ccx, d), discr.0, true)
        }
        layout::General { discr: d, ref variants, .. } => {
            let variant = &variants[discr.0 as usize];
            let lldiscr = C_integral(Type::from_integer(ccx, d), discr.0 as u64, true);
            let mut vals_with_discr = vec![lldiscr];
            vals_with_discr.extend_from_slice(vals);
            let mut contents = build_const_struct(ccx, &variant, &vals_with_discr[..]);
            let needed_padding = l.size(dl).bytes() - variant.stride().bytes();
            if needed_padding > 0 {
                contents.push(padding(ccx, needed_padding));
            }
            C_struct(ccx, &contents[..], false)
        }
        layout::UntaggedUnion { ref variants, .. }=> {
            assert_eq!(discr, Disr(0));
            let contents = build_const_union(ccx, variants, vals[0]);
            C_struct(ccx, &contents, variants.packed)
        }
        layout::Univariant { ref variant, .. } => {
            assert_eq!(discr, Disr(0));
            let contents = build_const_struct(ccx, &variant, vals);
            C_struct(ccx, &contents[..], variant.packed)
        }
        layout::Vector { .. } => {
            C_vector(vals)
        }
        layout::RawNullablePointer { nndiscr, .. } => {
            let nnty = compute_fields(ccx, t, nndiscr as usize, false)[0];
            if discr.0 == nndiscr {
                assert_eq!(vals.len(), 1);
                vals[0]
            } else {
                C_null(type_of::sizing_type_of(ccx, nnty))
            }
        }
        layout::StructWrappedNullablePointer { ref nonnull, nndiscr, .. } => {
            if discr.0 == nndiscr {


idx++] = i * this._height / this._segmentsH - hh;
				positions[vidx++] = -hd;

				positions[vidx++] = -hw;
				positions[vidx++] = i * this._height / this._segmentsH - hh;
				positions[vidx++] = hd;

				thickness[fidx++] = 1;

				positions[vidx++] = hw;
				positions[vidx++] = hh - i * this._height / this._segmentsH;
				positions[vidx++] = -hd;

				positions[vidx++] = hw;
				positions[vidx++] = hh - i * this._height / this._segmentsH;
				positions[vidx++] = hd;

				thickness[fidx++] = 1;
			}

			for (i = 0; i < this._segmentsD; ++i) {
				positions[vidx++] = hw;
				positions[vidx++] = -hh;
				positions[vidx++] = i * this._depth / this._segmentsD - hd;

				positions[vidx++] = hw;
				positions[vidx++] = hh;
				positions[vidx++] = i * this._depth / this._segmentsD - hd;

				thickness[fidx++] = 1;

				positions[vidx++] = -hw;
				positions[vidx++] = -hh;
				positions[vidx++] = hd - i * this._depth / this._segmentsD;

				positions[vidx++] = -hw;
				positions[vidx++] = hh;
				positions[vidx++] = hd - i * this._depth / this._segmentsD;

				thickness[fidx++] = 1;
			}

			//top/bottom face
			for (i = 0; i < this._segmentsD; ++i) {
				positions[vidx++] = -hw;
				positions[vidx++] = -hh;
				positions[vidx++] = hd - i * this._depth / this._segmentsD;

				positions[vidx++] = hw;
				positions[vidx++] = -hh;
				positions[vidx++] = hd - i * this._depth / this._segmentsD;

				thickness[fidx++] = 1;

				positions[vidx++] = -hw;
				positions[vidx++] = hh;
				positions[vidx++] = i * this._depth / this._segmentsD - hd;

				positions[vidx++] = hw;
				positions[vidx++] = hh;
				positions[vidx++] = i * this._depth / this._segmentsD - hd;

				thickness[fidx++] = 1;
			}

			for (i = 0; i < this._segmentsW; ++i) {
				positions[vidx++] = hw - i * this._width / this._segmentsW;
				positions[vidx++] = -hh;
				positions[vidx++] = -hd;

				positions[vidx++] = hw - i * this._width / this._segmentsW;
				positions[vidx++] = -hh;
				positions[vidx++] = hd;

				thickness[fidx++] = 1;

				positions[vidx++] = i * this._width / this._segmentsW - hw;
				positions[vidx++] = hh;
				positions[vidx++] = -hd;

				positions[vidx++] = i * this._width / this._segmentsW - hw;
				positions[vidx++] = hh;
				positions[vidx++] = hd;

				thickness[fidx++] = 1;
			}

			// build real data from raw data
			lineGraphics.setPositions(positions);
			lineGraphics.setThickness(thickness);
		}
	}

	/**
	 * @inheritDoc
	 */
	public _pBuildUVs(target: ElementsBase, elementsType: string): void {
		let i: number, j: number, index: number;
		let uvs: ArrayBufferView;
		let stride: number;

		let u_t


p(row1, 0, allParaOccurrences[1], allParaOccurrences[1]);
			var cellPart1_1 = m_helper.MakeMovedTextMarker(row1, 1, cellPart1_0, true);
			EndSetupTask();

			// SUT
			m_logic.MoveCellBack(MakeLocObj(row1, 1)); // Nothing should happen now!

			// Verify
			// Same WordGroup and marker should still be there
			VerifyRowContents(1, new IConstituentChartCellPart[]{cellPart1_0, cellPart1_1});
			VerifyMovedText(1, 1, m_logic.AllMyColumns[1], cellPart1_0, true);
		}

		/// <summary>
		/// Tests MoveCellBack() moving into and through a MovedText marker to make sure the result
		/// has the right columns and order of cell parts in the row.
		/// Exposed by LT-13543.
		/// </summary>
		[Test]
		public void MoveCellBackPastMarkerDoesntMessupColumns()
		{
			var allParaOccurrences = m_helper.MakeAnalysesUsedN(4);
			var row0 = m_helper.MakeRow1a();
			var row1 = m_helper.MakeSecondRow();
			var ilastCol = m_logic.AllMyColumns.Length - 1;
			m_helper.MakeWordGroup(row0, 1, allParaOccurrences[0], allParaOccurrences[0]);
			var cellPart1_0 = m_helper.MakeWordGroup(row1, 0, allParaOccurrences[1], allParaOccurrences[1]);
			var cellPart1_1 = m_helper.MakeMovedTextMarker(row1, 2, cellPart1_0, true);
			var cellPartMoving = m_helper.MakeWordGroup(row1, 3, allParaOccurrences[2], allParaOccurrences[3]);
			EndSetupTask();

			// SUT
			m_logic.MoveCellBack(MakeLocObj(row1, 3));
			m_logic.MoveCellBack(MakeLocObj(row1, 2)); // move back through and past MovedTextMarker

			// Verify
			// Same WordGroups and marker should still be there
			VerifyRowContents(1, new IConstituentChartCellPart[] { cellPart1_0, cellPartMoving, cellPart1_1 });
			VerifyMovedText(1, 2, m_logic.AllMyColumns[2], cellPart1_0, true);
			VerifyWordGroup(1, 1, m_logic.AllMyColumns[1], new List<AnalysisOccurrence>() {allParaOccurrences[2], allParaOccurrences[3]});
		}

		/// <summary>
		/// Tests MoveCellForward() moving into and through a MovedText marker to make sure the result
		/// has the right columns and order of cell parts in the row.
		/// </summary>
		[Test]
		public void MoveCellForwardPastMarkerDoesntMessupColumns()
		{
			var allParaOccurrences = m_helper.MakeAnalysesUsedN(4);
			var row0 = m_helper.MakeRow1a();
			var row1 = m_helper.MakeSecondRow();
			var ilastCol = m_logic.AllMyColumns.Length - 1;
			m_helper.MakeWordGroup(row0, 1, allParaOccurrences[0], allParaOccurrences[0]);
			var cellPart1_0 = m_helper.MakeWordGroup(row1, 0, allParaOccurrences[1], allParaOccurrences[1]);
			var cellPartMoving = m_helper.MakeWordGroup(row1, 1, allParaOccurrences[2], allParaOccurrences[3]);
			var cellPart1_1 = m_helper.MakeMovedTextMarker(row1, 2, cellPart1_0, true);
			EndSetupTask();

			// SUT
			m_logic.MoveCellForward(MakeLocObj(row1, 1));
			m_logic.MoveCellForward(MakeLocObj(row1, 2)); // move forward through and past MovedTextMarker

			// Verify


_ScreenWelcome_screen_init();
    ui_ScreenWIFIConnecting_screen_init();
    ui_ScreenWIFIDisconnect_screen_init();
    ui_ScreenExtrude_screen_init();
    ui_ScreenMove_screen_init();
    ui_ScreenTemp_screen_init();
    ui_ScreenSetTemp_screen_init();
    ui_ScreenSetExtrude_screen_init();
    ui_ScreenPrinting_screen_init();
    ui_ScreenHeatingNozzle_screen_init();
    ui_ScreenHeatingBed_screen_init();
    ui_ScreenRoller_screen_init();
    ui_ScreenQRCode_screen_init();
    ui_ScreenBacklight_screen_init();
    ui_ScreenDialog_screen_init();
    ui_ScreenPopup_screen_init();
    ui_ScreenColorWheel_screen_init();
    ui_ScreenInfo_screen_init();
    ui_ScreenTestImg_screen_init();
    ui_ScreenTestSensor_screen_init();
    ui____initial_actions0 = lv_obj_create(NULL);
    lv_disp_load_scr(ui_ScreenMainGif);
}


[u8]| -> Result<(), String> {
            println!("hashing block at {:#x}: {:#x} bytes", offset, data.len());

            let block_hash = digest(&SHA256, data);
            let mut state = thread_state.lock().unwrap();

            // Only the last block in the stream can be smaller than the full block size.
            if let Some(other_offset) = state.incomplete_block_offset {
                // Check where the other one is; if it's after this, it might be okay because it
                // might be the last block in the stream.
                if other_offset < offset {
                    return Err(format!("got incomplete block mid-stream at {:#x}", other_offset));
                }
            }
            if data.len() != BLOCK_SIZE {
                if let Some(other_offset) = state.incomplete_block_offset {
                    return Err(format!("got incomplete block mid-stream at {:#x}",
                        offset.min(other_offset)));
                }
                state.incomplete_block_offset = Some(offset);
            }

            if offset == state.next_offset {
                state.overall_hash.update(block_hash.as_ref());
                state.next_offset += BLOCK_SIZE as u64;
            } else {
                state.update_overall_hash();
                state.blocks.insert(offset, block_hash);
            }

            Ok(())
        }));
    if let Err(e) = result {
        eprintln!("{}", e);
        exit(3);
    }

    // No other thread should have a copy of the Arc now, so extract the State struct out of the
    // Arc and Mutex so we can call finish() on the hash context.
    let mut state = match Arc::try_unwrap(state) {
        Ok(state) => state,
        Err(_) => panic!(),
    }.into_inner().unwrap();

    state.update_overall_hash();
    assert!(state.blocks.is_empty(), "all blocks should be incorporated in the overall hash now");
    println!("{:?}", state.overall_hash.finish());
}
pub mod animation;
mod default_pipeline;
mod depth;
pub mod gltf;
pub mod material;
pub mod mesh;
pub mod render;
pub mod scene;
pub mod shape;
pub mod skeleton;
pub mod sky;
pub mod transform3d;

pub use animation::*;
pub use material::*;
pub use mesh::*;
pub use render::*;
pub use scene::*;
pub use skeleton::*;
pub use sky::*;
pub use transform3d::*;
<gh_stars>0
// 如下 for ... in Expression 的本质是迭代器。 其中 1..101是一个Range类型，它是一个迭代器。
fn main() {
    for n in 1..101 {
        if n % 15 == 0 {
            println!("fizzbuzz");
        } else if n % 3 == 0 {
            println!("fizz");
        } else if n % 5 == 0 {
            println!("buzz")
        } else {
            println!("{}", n);
        }
    }
}

// 样例代码: Rust 无限循环需要使用 loop，不能使用 while true
fn while_true(x: i32) -> i32 {

    // while true Expression 返回的结果是 () 单元值，该函数要求返回的是 i32 类型值。
    // 因为 Rust 编译器在对 while 循环做流分析（Flow Sensitive）的时候，不会检查循环条件，编译器会认为 while 条件可真可假，循环体里面的表达式也会忽略。
    // 编译器只知道 while Expression 返回的是 () 单元值，其他什么都不知道。这都是由于 CTFE 功能的限制，只能等 CTFE 功能完善了。
    while true {
        return x + 1;
    }
    x
}

fn main() {
    let y = while_


   |
| :-------------: | :-----: | :-----: | :------: | :----: | :--------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|    R-50-FPN     | pytorch |   3x    |   3.5    |  39.5  |    [config](./retinanet_r50_fpn_ms-640-800-3x_coco.py)     |               [model](https://download.openmmlab.com/mmdetection/v2.0/retinanet/retinanet_r50_fpn_mstrain_3x_coco/retinanet_r50_fpn_mstrain_3x_coco_20210718_220633-88476508.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/retinanet/retinanet_r50_fpn_mstrain_3x_coco/retinanet_r50_fpn_mstrain_3x_coco_20210718_220633-88476508.log.json)               |
|    R-101-FPN    |  caffe  |   3x    |   5.4    |  40.7  |     [config](./retinanet_r101-caffe_fpn_ms-3x_coco.py)     | [model](https://download.openmmlab.com/mmdetection/v2.0/retinanet/retinanet_r101_caffe_fpn_mstrain_3x_coco/retinanet_r101_caffe_fpn_mstrain_3x_coco_20210721_063439-88a8a944.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/retinanet/retinanet_r101_caffe_fpn_mstrain_3x_coco/retinanet_r101_caffe_fpn_mstrain_3x_coco_20210721_063439-88a8a944.log.json) |
|    R-101-FPN    | pytorch |   3x    |   5.4    |   41   |    [config](./retinanet_r101_fpn_ms-640-800-3x_coco.py)    |             [model](https://download.openmmlab.com/mmdetection/v2.0/retinanet/retinanet_r101_fpn_mstrain_3x_coco/retinanet_r101_fpn_mstrain_3x_coco_20210720_214650-7ee888e0.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/retinanet/retinanet_r101_fpn_mstrain_3x_coco/retinanet_r101_fpn_mstrain_3x_coco_20210720_214650-7ee888e0.log.json)             |
| X-101-64x4d-FPN | pytorch |   3x    |   9.8    |  41.6  | [config](./retinanet_x101-64x4d_fpn_ms-640-800-3x_coco.py) | [model](https://download.openmmlab.com/mmdetection/v2.0/retinanet/retinanet_x101_64x4d_fpn_mstrain_3x_coco/retinanet_x101_64x4d_fpn_mstrain_3x_coco_20210719_051838-022c2187.pth) \| [log](https://download.openmmlab.com/mmdetection/v2.0/retinanet/retinanet_x101_64x4d_fpn_mstrain_3x_coco/retinanet_x101_64x4d_fpn_mstrain_3x


art_RtlIncrementCorrelationVector>('RtlIncrementCorrelationVector'))(
      CorrelationVector,
    );
  }

  _dart_RtlIncrementCorrelationVector? _RtlIncrementCorrelationVector;

  int RtlExtendCorrelationVector(
    ffi.Pointer<CORRELATION_VECTOR> CorrelationVector,
  ) {
    return (_RtlExtendCorrelationVector ??= _dylib.lookupFunction<
        _c_RtlExtendCorrelationVector,
        _dart_RtlExtendCorrelationVector>('RtlExtendCorrelationVector'))(
      CorrelationVector,
    );
  }

  _dart_RtlExtendCorrelationVector? _RtlExtendCorrelationVector;

  int RtlValidateCorrelationVector(
    ffi.Pointer<CORRELATION_VECTOR> Vector,
  ) {
    return (_RtlValidateCorrelationVector ??= _dylib.lookupFunction<
        _c_RtlValidateCorrelationVector,
        _dart_RtlValidateCorrelationVector>('RtlValidateCorrelationVector'))(
      Vector,
    );
  }

  _dart_RtlValidateCorrelationVector? _RtlValidateCorrelationVector;

  void CUSTOM_SYSTEM_EVENT_TRIGGER_INIT(
    ffi.Pointer<PCUSTOM_SYSTEM_EVENT_TRIGGER_CONFIG> Config,
    ffi.Pointer<ffi.Uint16> TriggerId,
  ) {
    return (_CUSTOM_SYSTEM_EVENT_TRIGGER_INIT ??= _dylib.lookupFunction<
            _c_CUSTOM_SYSTEM_EVENT_TRIGGER_INIT,
            _dart_CUSTOM_SYSTEM_EVENT_TRIGGER_INIT>(
        'CUSTOM_SYSTEM_EVENT_TRIGGER_INIT'))(
      Config,
      TriggerId,
    );
  }

  _dart_CUSTOM_SYSTEM_EVENT_TRIGGER_INIT? _CUSTOM_SYSTEM_EVENT_TRIGGER_INIT;

  int RtlRaiseCustomSystemEventTrigger(
    ffi.Pointer<PCUSTOM_SYSTEM_EVENT_TRIGGER_CONFIG> TriggerConfig,
  ) {
    return (_RtlRaiseCustomSystemEventTrigger ??= _dylib.lookupFunction<
            _c_RtlRaiseCustomSystemEventTrigger,
            _dart_RtlRaiseCustomSystemEventTrigger>(
        'RtlRaiseCustomSystemEventTrigger'))(
      TriggerConfig,
    );
  }

  _dart_RtlRaiseCustomSystemEventTrigger? _RtlRaiseCustomSystemEventTrigger;

  int RtlIsZeroMemory(
    ffi.Pointer<ffi.Void> Buffer,
    int Length,
  ) {
    return (_RtlIsZeroMemory ??=
        _dylib.lookupFunction<_c_RtlIsZeroMemory, _dart_RtlIsZeroMemory>(
            'RtlIsZeroMemory'))(
      Buffer,
      Length,
    );
  }

  _dart_RtlIsZeroMemory? _RtlIsZeroMemory;

  int RtlNormalizeSecurityDescriptor(
    ffi.Pointer<ffi.Pointer<ffi.Void>> SecurityDescriptor,
    int SecurityDescriptorLength,
    ffi.Pointer<ffi.Pointer<ffi.Void>> NewSecurityDescriptor,
    ffi.Pointer<ffi.Uint64> NewSecurityDescriptorLength,
    int CheckOnly,
  ) {
    return (_RtlNormalizeSecurityDescriptor ??= _dylib.lookupFunction<
            _c_RtlNormalizeSecurityDescriptor,
            _dart_RtlNormalizeSecurityDescriptor>(
        'RtlNormalizeSecurityDescriptor'))(
      SecurityDescriptor,
      SecurityDescriptorLength,
      NewSecurityDescriptor,
      NewSecurityDescriptorLength,
      CheckOnly,
    );
  }

  _dart_RtlNormalizeSecurityDescriptor? _RtlNormalizeSecurityDescriptor;

  void RtlGetDeviceFamilyInfoEnum(
    ffi.Pointer<ffi.Uint64> pullUAPInfo,
    ffi.Pointer<ffi.Uint64> pulDev


igner=dict(
                type='mmdet.MaxIoUAssigner',
                pos_iou_thr=0.7,
                neg_iou_thr=0.3,
                min_pos_iou=0.3,
                match_low_quality=True,
                ignore_iof_thr=-1,
                iou_calculator=dict(type='RBbox2HBboxOverlaps2D')),
            sampler=dict(
                type='mmdet.RandomSampler',
                num=256,
                pos_fraction=0.5,
                neg_pos_ub=-1,
                add_gt_as_proposals=False),
            allowed_border=0,
            pos_weight=-1,
            debug=False),
        rpn_proposal=dict(
            nms_pre=2000,
            max_per_img=2000,
            nms=dict(type='nms', iou_threshold=0.7),
            min_bbox_size=0),
        rcnn=[
            dict(
                assigner=dict(
                    type='mmdet.MaxIoUAssigner',
                    pos_iou_thr=0.5,
                    neg_iou_thr=0.5,
                    min_pos_iou=0.5,
                    match_low_quality=False,
                    ignore_iof_thr=-1,
                    iou_calculator=dict(type='RBbox2HBboxOverlaps2D')),
                sampler=dict(
                    type='mmdet.RandomSampler',
                    num=512,
                    pos_fraction=0.25,
                    neg_pos_ub=-1,
                    add_gt_as_proposals=True),
                pos_weight=-1,
                debug=False),
            dict(
                assigner=dict(
                    type='mmdet.MaxIoUAssigner',
                    pos_iou_thr=0.5,
                    neg_iou_thr=0.5,
                    min_pos_iou=0.5,
                    match_low_quality=False,
                    ignore_iof_thr=-1,
                    iou_calculator=dict(type='RBboxOverlaps2D')),
                sampler=dict(
                    type='mmdet.RandomSampler',
                    num=512,
                    pos_fraction=0.25,
                    neg_pos_ub=-1,
                    add_gt_as_proposals=True),
                pos_weight=-1,
                debug=False)
        ]),
    test_cfg=dict(
        rpn=dict(
            nms_pre=2000,
            max_per_img=2000,
            nms=dict(type='nms', iou_threshold=0.7),
            min_bbox_size=0),
        rcnn=dict(
            nms_pre=2000,
            min_bbox_size=0,
            score_thr=0.05,
            nms=dict(type='nms_rotated', iou_threshold=0.1),
            max_per_img=2000)))

optim_wrapper = dict(optimizer=dict(lr=0.005))


 validGetRequest()
	req.HttpRequest.Host = "developer.ngmoco.com"

	filt := hr.SelectPipeline(req)
	if filt != sf2 {
		t.Errorf("Host router didn't get the right pipeline")
	}

	req.HttpRequest.Host = "ngmoco.com"
	filt = hr.SelectPipeline(req)
	if filt != nil {
		t.Errorf("Host router got currently unsupported fuzzy match so you should update this test")
	}
}
package falcore

import (
	"errors"
	"log"
	"time"
)

// I really want to use log4go... but i need to support falling back to standard (shitty) logger :(
// I suggest using go-timber for the real logger
type Logger interface {
	// Matches the log4go interface
	Finest(arg0 interface{}, args ...interface{})
	Fine(arg0 interface{}, args ...interface{})
	Debug(arg0 interface{}, args ...interface{})
	Trace(arg0 interface{}, args ...interface{})
	Info(arg0 interface{}, args ...interface{})
	Warn(arg0 interface{}, args ...interface{}) error
	Error(arg0 interface{}, args ...interface{}) error
	Critical(arg0 interface{}, args ...interface{}) error
}

var logger Logger = NewStdLibLogger()

func SetLogger(newLogger Logger) {
	logger = newLogger
}

// Helper for calculating times
func TimeDiff(startTime time.Time, endTime time.Time) float32 {
	return float32(endTime.Sub(startTime)) / 1.0e9
}

// Global Logging
func Finest(arg0 interface{}, args ...interface{}) {
	logger.Finest(arg0, args...)
}

func Fine(arg0 interface{}, args ...interface{}) {
	logger.Fine(arg0, args...)
}

func Debug(arg0 interface{}, args ...interface{}) {
	logger.Debug(arg0, args...)
}

func Trace(arg0 interface{}, args ...interface{}) {
	logger.Trace(arg0, args...)
}

func Info(arg0 interface{}, args ...interface{}) {
	logger.Info(arg0, args...)
}

func Warn(arg0 interface{}, args ...interface{}) error {
	return logger.Warn(arg0, args...)
}

func Error(arg0 interface{}, args ...interface{}) error {
	return logger.Error(arg0, args...)
}

func Critical(arg0 interface{}, args ...interface{}) error {
	return logger.Critical(arg0, args...)
}

// This is a simple Logger implementation that
// uses the go log package for output.  It's not
// really meant for production use since it isn't
// very configurable.  It is a sane default alternative
// that allows us to not have any external dependencies.
// Use timber or log4go as a real alternative.
type StdLibLogger struct{}

func NewStdLibLogger() Logger {
	return new(StdLibLogger)
}

type level int

const (
	FINEST level = iota
	FINE
	DEBUG
	TRACE
	INFO
	WARNING
	ERROR
	CRITICAL
)

var (
	levelStrings = [...]string{"[FNST]", "[FINE]", "[DEBG]", "[TRAC]", "[INFO]", "[WARN]", "[EROR]", "[CRIT]"}
)

func (fl StdLibLogger) Finest(arg0 interface{}, args ...interface{}) {
	fl.Log(FINEST, arg0, args...)
}

func (fl StdLibLogger) Fine(arg0 interface{}, args ...interface{}) {
	fl.Log(FINE, arg0, args...)
}

func (fl StdLibLogger) Debug(arg0 interface{}, args ...interface{}) {
	fl.Log(DEBUG, arg0, args...)
}

func (fl StdLibLogger) Trace(arg0 interface{}, args ...interface{}) {
	fl.Log(TRACE, arg0, args


i-issue-dark: #EB5A29;
  --sui-issue-light: #FFECE5;
  --sui-warning: #F2BD24;
  --sui-warning-dark: #8D6E15;
  --sui-warning-light: #FFF8E2;
  --sui-code: #845ED6;
  --sui-gray-35: #FEFEFE;
  --sui-gray-40: #F7F8F8;
  --sui-gray-45: #EBECED;
  --sui-gray-50: #E9EAEB;
  --sui-gray-55: #D7D8DA;
  --sui-gray-60: #C3C5C8;
  --sui-gray-65: #9C9FA4;
  --sui-gray-70: #898D93;
  --sui-gray-75: #767A81;
  --sui-gray-80: #636870;
  --sui-gray-85: #5A6573;
  --sui-gray-90: #383F47;
  --sui-gray-95: #2A3645;
  --sui-gray-100: #182435;
  --sui-link-color: #1068a6;
  --sui-link-color-dark: #057fd1;
  --sui-link-color-light: #1f98e9;
  --sui-ghost-white: #f8f8ff;
  --sui-ghost-dark: #282a36;
  --sui-white: 255 255 255;
  --sui-card-dark: 13 20 37;
  --sui-card-darker: 0 23 49;
  --sui-blue-primary: 77 162 255;
  --sui-gray: #ABBDCC;
  --sui-white: #f7f7f8;
  --sui-button-hover: #1a88ff;
  --sui-line: rgba(247, 247, 248, .1);
  --sui-max-width-desktop: 1162px;
  --sui-dark-blue-bkg: #011829;

  --primaryFont: 'Inter', sans-serif;
  --headerFont: 'Twkeverett', sans-serif;
  --monoFont: "Twkeverett Mono", monospace;
}

/* For readability concerns, you should choose a lighter palette in dark mode. */
[data-theme='dark'] {
  --ifm-color-primary: #4ca2ff;
  --ifm-color-primary-dark: #2b91ff;
  --ifm-color-primary-darker: #1a88ff;
  --ifm-color-primary-darkest: #006fe8;
  --ifm-color-primary-light: #6db3ff;
  --ifm-color-primary-lighter: #7ebcff;
  --ifm-color-primary-lightest: #afd6ff;
  --ifm-background-color: #030F1C;
  --ifm-menu-color: var(--sui-white);
  --ifm-menu-color-background-active: rgba(247, 247, 248, .05);
  --ifm-navbar-sidebar-link-color: #F7F7F8;
  --ifm-navbar-sidebar-background-color: #030F1C;
}

.active-scroll-spy {
  @apply bg-sui-ghost-white dark:bg-sui-ghost-dark rounded-lg;
}

/* Inverts the image in the stadards/closed-loop-token.mdx in dark mode. */
[data-theme='dark'] img.balance-coin-token {
  filter: invert(1);
}

/** navbar overrides */
.navbar-sidebar .menu__link {
  color: var(--ifm-navbar-sidebar-link-color);
}

.navbar-sidebar .menu__link--active, .navbar-sidebar .menu__link--active:hover, [data-theme='dark'] .navbar-sidebar .menu__link--active, [data-the


)
		golems_spawn = true
	elseif e.hp_event == 25 then
		--add Ikaav's Venom AE
		eq.set_timer("VenomAE", 30 * 1000)
		e.self:CastSpell(751,e.self:GetID())
		eq.set_next_hp_event(10)
	elseif e.hp_event == 10 then
		-- At approximately 10% health, she increases her attack speed and begins flurrying much more (every round)
		e.self:SetSpecialAbilityParam(SpecialAbility.flurry, 0, 100)
		e.self:Say("That's it!  You have past the point of being bothersome. I grow weary of this encounter. It is time for it to end.")
	end
end

function PRT_Timer(e)
	if e.timer == "Delusional" then
		-- Delusional Vision single target DD/Drunk whole fight
		e.self:SpellFinished(889, e.self:GetHateTop()) -- CastToClient? --no need unless using client-based methods
	elseif e.timer == "VenomAE" then
		-- Ikaav's Venom 751
		e.self:CastSpell(751,e.self:GetID())
	elseif e.timer == "SpawnGolem" then
		local construct_locs = {
			[1] = { 189.61, -586.55, -8.55,128},
			[2] = { 180.10, -569.03, -8.55,380},
			[3] = { 180.10, -609.61, -8.55,128},
			[4] = { 107.81, -586.55, -8.55,128}
		}

		if e.self:GetHPRatio() >= 20 then
			if construct < 12 then
				local rng = math.random(4, 4)
				local spawned = 0

				for i = construct+1, 12 do
					local ran = math.random(1,4)
					eq.spawn2(298045, 0, 0, unpack(construct_locs[ran]))
					spawned = spawned + 1
					if spawned == rng then
						break;
					end
				end
				construct = construct + spawned
			end
		elseif e.self:GetHPRatio() > 10 and e.self:GetHPRatio() < 20 then
			if construct < 12 then
				local rng = math.random(8, 8)
				local spawned = 0

				for i = construct+1, 12 do
					local ran = math.random(1,4)
					eq.spawn2(298045, 0, 0, unpack(construct_locs[ran]))
					spawned = spawned + 1
					if spawned == rng then
						break
					end
				end
				construct = construct + spawned
			end
			eq.set_timer("SpawnGolem", 4 * 1000) -- speed up timer
		elseif e.self:GetHPRatio() < 10 then
			if construct < 12 then
				local rng = math.random(12, 12)
				local spawned = 0

				for i = construct+1, 12 do
					local ran = math.random(1,4)
					eq.spawn2(298045, 0, 0, unpack(construct_locs[ran]))
					spawned = spawned + 1
					if spawned == rng then
						break
					end
				end
				construct = construct + spawned
			end
			eq.set_timer("SpawnGolem", 2 * 1000) -- speed up timer
		end
	elseif e.timer == 'wipecheck' then
		eq.stop_timer('wipecheck')
		e.self:SetHP(e.self:GetMaxHP())
		e.self:SetSpecialAbility(SpecialAbility.flurry, 0)
		e.self:SetSpecialAbility(SpecialAbility.summon, 0) -- No Summon
		e.self:ModifyNPCStat("attack_delay","16")
		eq.unique_spawn(298002, 0, 0, 229.0, -572.0, -3.25, 384


-medium {
    font-weight: 500;
  }

  .sm\:font-semibold {
    font-weight: 600;
  }

  .sm\:font-bold {
    font-weight: 700;
  }

  .sm\:font-extrabold {
    font-weight: 800;
  }

  .sm\:font-black {
    font-weight: 900;
  }

  .sm\:h-0 {
    height: 0px;
  }

  .sm\:h-1 {
    height: 0.25rem;
  }

  .sm\:h-2 {
    height: 0.5rem;
  }

  .sm\:h-3 {
    height: 0.75rem;
  }

  .sm\:h-4 {
    height: 1rem;
  }

  .sm\:h-5 {
    height: 1.25rem;
  }

  .sm\:h-6 {
    height: 1.5rem;
  }

  .sm\:h-7 {
    height: 1.75rem;
  }

  .sm\:h-8 {
    height: 2rem;
  }

  .sm\:h-9 {
    height: 2.25rem;
  }

  .sm\:h-10 {
    height: 2.5rem;
  }

  .sm\:h-11 {
    height: 2.75rem;
  }

  .sm\:h-12 {
    height: 3rem;
  }

  .sm\:h-14 {
    height: 3.5rem;
  }

  .sm\:h-16 {
    height: 4rem;
  }

  .sm\:h-20 {
    height: 5rem;
  }

  .sm\:h-24 {
    height: 6rem;
  }

  .sm\:h-28 {
    height: 7rem;
  }

  .sm\:h-32 {
    height: 8rem;
  }

  .sm\:h-36 {
    height: 9rem;
  }

  .sm\:h-40 {
    height: 10rem;
  }

  .sm\:h-44 {
    height: 11rem;
  }

  .sm\:h-48 {
    height: 12rem;
  }

  .sm\:h-52 {
    height: 13rem;
  }

  .sm\:h-56 {
    height: 14rem;
  }

  .sm\:h-60 {
    height: 15rem;
  }

  .sm\:h-64 {
    height: 16rem;
  }

  .sm\:h-72 {
    height: 18rem;
  }

  .sm\:h-80 {
    height: 20rem;
  }

  .sm\:h-96 {
    height: 24rem;
  }

  .sm\:h-auto {
    height: auto;
  }

  .sm\:h-px {
    height: 1px;
  }

  .sm\:h-0\.5 {
    height: 0.125rem;
  }

  .sm\:h-1\.5 {
    height: 0.375rem;
  }

  .sm\:h-2\.5 {
    height: 0.625rem;
  }

  .sm\:h-3\.5 {
    height: 0.875rem;
  }

  .sm\:h-1\/2 {
    height: 50%;
  }

  .sm\:h-1\/3 {
    height: 33.333333%;
  }

  .sm\:h-2\/3 {
    height: 66.666667%;
  }

  .sm\:h-1\/4 {
    height: 25%;
  }

  .sm\:h-2\/4 {
    height: 50%;
  }

  .sm\:h-3\/4 {
    height: 75%;
  }

  .sm\:h-1\/5 {
    height: 20%;
  }

  .sm\:h-2\/5 {
    height: 40%;
  }

  .sm\:h-3\/5 {
    height: 60%;
  }

  .sm\:h-4\/5 {
    height: 80%;
  }

  .sm\:h-1


etLocalOption(key: 'access_token'),
        "device_groups": deviceGroups.map((e) => e.toGroupCacheJson()).toList(),
        "users": users.map((e) => e.toGroupCacheJson()).toList(),
        'peers': peers.map((e) => e.toGroupCacheJson()).toList()
      });
      bind.mainSaveGroup(json: jsonEncode(map));
    } catch (e) {
      debugPrint('group save:$e');
    }
  }

  Future<void> loadCache() async {
    try {
      if (_cacheLoadOnceFlag || groupLoading.value || initialized) return;
      _cacheLoadOnceFlag = true;
      final access_token = bind.mainGetLocalOption(key: 'access_token');
      if (access_token.isEmpty) return;
      final cache = await bind.mainLoadGroup();
      if (groupLoading.value) return;
      final data = jsonDecode(cache);
      if (data == null || data['access_token'] != access_token) return;
      deviceGroups.clear();
      users.clear();
      peers.clear();
      if (data['device_groups'] is List) {
        for (var u in data['device_groups']) {
          deviceGroups.add(DeviceGroupPayload.fromJson(u));
        }
      }
      if (data['users'] is List) {
        for (var u in data['users']) {
          users.add(UserPayload.fromJson(u));
        }
      }
      if (data['peers'] is List) {
        for (final peer in data['peers']) {
          peers.add(Peer.fromJson(peer));
        }
        _callbackPeerUpdate();
      }
    } catch (e) {
      debugPrint("load group cache: $e");
    }
  }

  reset() async {
    groupLoadError.value = '';
    deviceGroups.clear();
    users.clear();
    peers.clear();
    selectedAccessibleItemName.value = '';
    await bind.mainClearGroup();
  }

  void _callbackPeerUpdate() {
    for (var listener in _peerIdUpdateListeners.values) {
      listener();
    }
  }

  void addPeerUpdateListener(String key, VoidCallback listener) {
    _peerIdUpdateListeners[key] = listener;
  }

  void removePeerUpdateListener(String key) {
    _peerIdUpdateListeners.remove(key);
  }

  void _tryHandlePullError() {
    String errorMessage = groupLoadError.value;
    // The error message is "Retrieving accessible devices is disabled."
    if (errorMessage.toLowerCase().contains('disabled')) {
      users.clear();
      peers.clear();
      deviceGroups.clear();
    }
  }
}
import 'dart:convert';
import 'package:flutter/material.dart';

void handlePluginEvent(
  Map<String, dynamic> evt,
  Function(Map<String, dynamic> e) handleMsgBox,
) {
  Map<String, dynamic>? content;
  try {
    content = json.decode(evt['content']);
  } catch (e) {
    debugPrint(
        'Json decode plugin event content failed: $e, ${evt['content']}');
  }
  if (content?['t'] == 'MsgBox') {
    handleMsgBox(content?['c']);
  }
}
import 'dart:convert';

typedef PluginId = String;

// ui location
const String kLocationHostMainPlugin = 'host|main|settings|plugin';
const String kLocationClientRemoteToolbarDisplay =
    'client|remote|toolbar|display';

class MsgFromUi {
  String id;
  String name;
  String location;
  String key;
  String value;
  String action;

  MsgFromUi({
    required this.id,
    required this.name,
    required this.location,
    required this.key,
    required this.value,
    required this.action,
  });

  Map<String, dynamic> toJson() {
    return <String, dynamic>{
      'id': id,
      'name': name,
      'location': location,
      'key': key,
      'value': value,
      '


 => {
                        let mut builder = ds.init_u64(x.len() as u32);
                        populate_primitive_list(&mut builder, x);
                    }
                    DataSection::I64(x) => {
                        let mut builder = ds.init_i64(x.len() as u32);
                        populate_primitive_list(&mut builder, x);
                    }
                    DataSection::Null(count) => ds.set_null(*count as u64),
                }
            }
        }
    }
    let mut buffer = Vec::new();
    capnp::serialize::write_message(&mut buffer, &builder).unwrap();
    buffer
}

fn encoding_type_to_capnp(t: Type) -> EncodingType {
    match t {
        Type::U8 => EncodingType::U8,
        Type::U16 => EncodingType::U16,
        Type::U32 => EncodingType::U32,
        Type::U64 => EncodingType::U64,
        Type::I64 => EncodingType::I64,
        Type::Null => EncodingType::Null,
        _ => panic!("Trying to encode unsupported type {:?}", t)
    }
}

fn populate_primitive_list<'a, T>(builder: &mut capnp::primitive_list::Builder<'a, T>, values: &[T])
    where T: capnp::private::layout::PrimitiveElement + Copy {
    for (i, &x) in values.iter().enumerate() {
        builder.set(i as u32, x);
    }
}
<reponame>david-mcgillicuddy-moixa/dbus-rs
extern crate dbus;

use dbus::{Connection, BusType, Props};

fn main() {
    let c = Connection::get_private(BusType::System).unwrap();
    let p = Props::new(&c, "org.freedesktop.PolicyKit1", "/org/freedesktop/PolicyKit1/Authority",
        "org.freedesktop.PolicyKit1.Authority", 10000);
    println!("BackendVersion: {:?}", p.get("BackendVersion").unwrap())
}
<filename>nimble-derive/src/util.rs
use proc_macro2::TokenStream;
use quote::{quote, quote_spanned};
use syn::{
    punctuated::Iter, spanned::Spanned, DataEnum, Field, Fields, GenericParam, Generics, Ident,
    Type, TypeParamBound, Variant,
};

pub trait FieldExt {
    /// Returns name of the field
    fn get_name(&self) -> Option<&Ident>;

    /// Returns type of the field
    fn get_type(&self) -> &Type;
}

impl FieldExt for Field {
    #[inline]
    fn get_name(&self) -> Option<&Ident> {
        self.ident.as_ref()
    }

    #[inline]
    fn get_type(&self) -> &Type {
        &self.ty
    }
}

/// Type of fields in a struct or enum variant
#[derive(Debug, Clone, Copy)]
pub enum FieldsType {
    /// Named fields { a: u8, b: u16 }
    Named,
    /// Unnamed fields (u8, u16)
    Unnamed,
    /// ()
    Unit,
}

pub trait FieldsExt {
    /// Get type of fields. (Named, Unnamed or Unit)
    fn get_type(&self) -> FieldsType;

    /// Get an iterator over all the fields.
    fn iter_fields(&self) -> Iter<Field>;
}

impl FieldsExt for Fields {
    fn get_type(&self) -> FieldsType {
        match self {
            Fields::Named(_) => FieldsType::Named,
            Fields::Unnamed(_) => FieldsType::Unnamed,
            Fields::Unit => FieldsType::Unit,
        }
    }

    #[inline]
    fn iter_fields(&self) -> Iter<Field> {
        self.iter()
    }
}

pub trait VariantExt {
    /// Returns name of enum variant
    fn get_name(&self) -> &Ident;
}

impl VariantExt for Varian