)
    .any((prevLog) =>
        DateTime.now().millisecondsSinceEpoch - prevLog.timestampMS < 10000 &&
        prevLog.entry == entry);

void _logging(String line, [LogLevel? fixedLevel]) {
  String? stack;

  LogLevel level = LogLevel.Info;
  bool shouldLog = true;
  bool manually = false;

  Iterable<LogLevel> lineLevel =
      LogLevel.values.where((level) => line.startsWith(level.prefix));

  if (fixedLevel != null || lineLevel.isNotEmpty) {
    manually = true;
    level = lineLevel.first;
    line = line.split(level.prefix)[1];

    shouldLog = line.startsWith('[ON]');

    line = line.split(shouldLog ? '[ON]' : '[OFF]')[1].trim();

    if (line.contains('[STACK]')) {
      List<String> temp = line.split('[STACK]');
      String stack = temp[1].trim();

      if (stack.length > 1024) {
        stack = '${stack.substring(0, 1024)}...';
      }

      line = temp[0].trim();
      stack = stack;
    }
  }

  if (shouldLog &&
      _isLogNew([LogLevel.Info, LogLevel.Warning, LogLevel.Error], line)) {
    Hive.box<AppLog>(HiveKeys.AppLog.name).add(
      AppLog(
        DateTime.now().millisecondsSinceEpoch,
        level,
        line,
        stack,
        manually,
      ),
    );
  }
}

void main() async {
  await runZonedGuarded(
    () async {
      FlutterError.onError = (FlutterErrorDetails details) {
        FlutterError.dumpErrorToConsole(details);
      };
      WidgetsFlutterBinding.ensureInitialized();

      /// Initialize Date Formatting - using European style
      await initializeDateFormatting('de_DE');

      /// Create all store objects and make them available in the app (DI)
      _initializeStores();

      /// Create all hive objects with references to the persistant boxes
      await _initializeHive();

      runApp(
        const LifecycleWatcher(
          app: PurchaseBase(
            child: App(),
          ),
        ),
      );
    },
    (Object error, StackTrace stack) =>
        _logging('[ERROR][ON] $error\n[STACK]\n$stack'),
    zoneSpecification: ZoneSpecification(
      // handleUncaughtError: (self, parent, zone, error, stackTrace) =>
      //     _logging('$error\n[STACK]\n$stackTrace'),
      print: (self, parent, zone, line) {
        /// First print it out to see them while debugging
        parent.print(zone, line);

        _logging(line);
      },
    ),
  );
}
import 'package:obs_blade/types/enums/request_type.dart';

enum RequestBatchType {
  /// Get the joint information about volume and mute of all inputs. This batch
  /// will have multiple of these results and we can filter based on uuid.
  ///
  /// RequestType.GetInputVolume
  /// RequestType.GetInputMute
  /// RequestType.GetInputAudioSyncOffset
  Input,

  /// Joint request to get the current status of stream and record as well
  /// as the current performance overview
  ///
  /// RequestType.GetStreamStatus
  /// RequestType.GetRecordStatus
  /// RequestType.GetStats
  Stats,

  /// Joint request to trigger a screenshot of the current OBS scene which
  /// should be saved on the filesystem where OBS is running and getting the
  /// current screenshot to display on the app. [SaveSourceScreenshot], at least
  /// from the docs, should also return the screenshot but in reality it does
  /// not so we have to get one manually
  Screenshot,

  /// [RequestType.GetSourceFilterList] needs to be called for each scene item
  /// which would mean I have to set the [currentSceneItems] property in dashboard
  /// store for each request. To make it smarter, we will send out a batch
  /// of these requests in one go and handle them at once!
  ///
  /// RequestType.GetSourceFilterList
  FilterList,

  //


core::TermCriteria> {
		unsafe { sys::cv_ml_SVM_getTermCriteria_const(self.as_raw_SVM()) }.into_result()
	}

	/// Termination criteria of the iterative %SVM training procedure which solves a partial
	///    case of constrained quadratic optimization problem.
	///    You can specify tolerance and/or the maximum number of iterations. Default value is
	///    `TermCriteria( TermCriteria::MAX_ITER + TermCriteria::EPS, 1000, FLT_EPSILON )`;
	/// ## See also
	/// setTermCriteria getTermCriteria
	fn set_term_criteria(&mut self, val: core::TermCriteria) -> Result<()> {
		unsafe { sys::cv_ml_SVM_setTermCriteria_const_TermCriteriaR(self.as_raw_mut_SVM(), &val) }.into_result()
	}

	/// Type of a %SVM kernel.
	/// See SVM::KernelTypes. Default value is SVM::RBF.
	fn get_kernel_type(&self) -> Result<i32> {
		unsafe { sys::cv_ml_SVM_getKernelType_const(self.as_raw_SVM()) }.into_result()
	}

	/// Initialize with one of predefined kernels.
	/// See SVM::KernelTypes.
	fn set_kernel(&mut self, kernel_type: i32) -> Result<()> {
		unsafe { sys::cv_ml_SVM_setKernel_int(self.as_raw_mut_SVM(), kernel_type) }.into_result()
	}

	/// Initialize with custom kernel.
	/// See SVM::Kernel class for implementation details
	fn set_custom_kernel(&mut self, _kernel: &core::Ptr::<dyn crate::ml::SVM_Kernel>) -> Result<()> {
		unsafe { sys::cv_ml_SVM_setCustomKernel_const_Ptr_Kernel_R(self.as_raw_mut_SVM(), _kernel.as_raw_PtrOfSVM_Kernel()) }.into_result()
	}

	/// Trains an %SVM with optimal parameters.
	///
	/// ## Parameters
	/// * data: the training data that can be constructed using TrainData::create or
	///    TrainData::loadFromCSV.
	/// * kFold: Cross-validation parameter. The training set is divided into kFold subsets. One
	///    subset is used to test the model, the others form the train set. So, the %SVM algorithm is
	///    executed kFold times.
	/// * Cgrid: grid for C
	/// * gammaGrid: grid for gamma
	/// * pGrid: grid for p
	/// * nuGrid: grid for nu
	/// * coeffGrid: grid for coeff
	/// * degreeGrid: grid for degree
	/// * balanced: If true and the problem is 2-class classification then the method creates more
	///    balanced cross-validation subsets that is proportions between classes in subsets are close
	///    to such proportion in the whole train dataset.
	///
	/// The method trains the %SVM model automatically by choosing the optimal parameters C, gamma, p,
	/// nu, coef0, degree. Parameters are considered optimal when the cross-validation
	/// estimate of the test set error is minimal.
	///
	/// If there is no need to optimize a parameter, the corresponding grid step should be set to any
	/// value less than or equal to 1. For example, to avoid optimization in gamma, set `gammaGrid.step
	/// = 0`, `gammaGrid.minVal`, `gamma_grid.maxVal` as arbitrary numbers. In this case, the value
	/// `Gamma` is taken for gamma.
	///
	/// And, finally, if the optimization in a parameter is required but the corresponding grid is
	/// unknown, you may call the function SVM::getDefaultGrid. To generate a grid, for example, for
	/// gamma, call `SVM::getDefaultGrid(SVM::GAMMA)`.
	///
	/// This function works for the classification (SVM::C_SVC or SVM::NU_SVC) as we


rId)
            .ThenBy(f => f.Name)
            .ToListAsync();
    }
    /// <inheritdoc/>
    public async Task<List<DbMediaFile>> ListFiles(List<Guid> folderIds) {
        return await _dbContext.Files.Where(f => f.FolderId.HasValue && folderIds.Contains(f.FolderId.Value)).ToListAsync();
    }
    /// <inheritdoc/>
    public async Task<Guid> Create(DbMediaFile file) {
        file.Path = await MediaFolderStore.FindPathAsync(_dbContext, file.FolderId, file.Name);
        _dbContext.Files.Add(file);
        await _dbContext.SaveChangesAsync();
        return file.Id;
    }

    public async Task<List<Guid>> CreateMany(List<DbMediaFile> files) {
        var folderid = files.FirstOrDefault()?.FolderId;
        var paths = await MediaFolderStore.FindPathsAsync(_dbContext, folderid, files.Select(x => x.Name).ToArray());
        for (var i = 0; i < paths.Length; i++) {
            files[i].Path = paths[i];
        }
        _dbContext.Files.AddRange(files);
        await _dbContext.SaveChangesAsync();
        return files.Select(x => x.Id).ToList();
    }

    /// <inheritdoc/>
    public async Task Update(DbMediaFile file) {
        file.Path = await MediaFolderStore.FindPathAsync(_dbContext, file.FolderId, file.Name);
        _dbContext.Files.Update(file);
        await _dbContext.SaveChangesAsync();
    }
    /// <inheritdoc/>
    public async Task Delete(Guid fileId) {
        await _dbContext.Files.Where(f => f.Id == fileId).ExecuteDeleteAsync();
    }
    /// <inheritdoc/>
    public async Task MarkAsDeletedRange(List<Guid> ids) {
        await _dbContext.Files.Where(_ => ids.Contains(_.Id)).ExecuteUpdateAsync(f => f.SetProperty(p => p.IsDeleted, true));
    }
}


t-jwt';
import { jwtConstants } from '../constants';

//Aim: protecting endpoints by requiring a valid JWT be present on the request.
@Injectable()

//With our JwtStrategy, we've followed the same recipe described earlier for all Passport strategies. This strategy requires some initialization, so we do that by passing in an options object in the super() call.

/**
 * In our case, these options are:

*** jwtFromRequest: supplies the method by which the JWT will be extracted from the Request. We will use the standard approach of supplying a bearer token in the Authorization header of our API requests. Other options are described here.
**** ignoreExpiration: just to be explicit, we choose the default false setting, which delegates the responsibility of ensuring that a JWT has not expired to the Passport module. This means that if our route is supplied with an expired JWT, the request will be denied and a 401 Unauthorized response sent. Passport conveniently handles this automatically for us.
*** secretOrKey: we are using the expedient option of supplying a symmetric secret for signing the token. Other options, such as a PEM-encoded public key, may be more appropriate for production apps (see here for more information). In any case, as cautioned earlier, do not expose this secret publicly.
 *
 */
export class JwtStrategy extends PassportStrategy(Strategy) {
    constructor() {
        super({
            jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
            ignoreExpiration: false,
            secretOrKey: jwtConstants.secret,
        },
        );
    }

    async validate(payload: any) {
        return { userId: payload.sub, username: payload.username };
    }
}

//Method Validate():

/*
For the jwt-strategy, Passport first verifies the JWT's signature and decodes the JSON. It then invokes our validate() method passing the decoded JSON as its single parameter. Based on the way JWT signing works, we're guaranteed that we're receiving a valid token that we have previously signed and issued to a valid user.

As a result of all this, our response to the validate() callback is trivial: we simply return an object containing the userId and username properties. Recall again that Passport will build a user object based on the return value of our validate() method, and attach it as a property on the Request object.
*/

//Other additional logic un this method (DB)

/*
It's also worth pointing out that this approach leaves us room ('hooks' as it were) to inject other business logic into the process. For example, we could do a database lookup in our validate() method to extract more information about the user, resulting in a more enriched user object being available in our Request. This is also the place we may decide to do further token validation, such as looking up the userId in a list of revoked tokens, enabling us to perform token revocation. The model we've implemented here in our sample code is a fast, "stateless JWT" model, where each API call is immediately authorized based on the presence of a valid JWT, and a small bit of information about the requester (its userId and username) is available in our Request pipeline.
*/#!/usr/bin/env ts-node
import "reflect-metadata";

import minimist from "minimist";
import chalk from "chalk";
import * as _ from "lodash";

import { FINAL_CMD, cmds, IOption } from "./cli/cmd-defs";
import { bootstrap } from "../src/bootstrap-db";

const argv = minimist(process.argv.slice(2));

const printCommandList = (currentTree: any) => {
  console.log("Available options:


83D"},
	0x2F83E:  {0x2F83E, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F83E"},
	0x2F83F:  {0x2F83F, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F83F"},
	0x2F840:  {0x2F840, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F840"},
	0x2F841:  {0x2F841, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F841"},
	0x2F842:  {0x2F842, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F842"},
	0x2F843:  {0x2F843, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F843"},
	0x2F844:  {0x2F844, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F844"},
	0x2F845:  {0x2F845, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F845"},
	0x2F846:  {0x2F846, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F846"},
	0x2F847:  {0x2F847, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F847"},
	0x2F848:  {0x2F848, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F848"},
	0x2F849:  {0x2F849, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F849"},
	0x2F84A:  {0x2F84A, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F84A"},
	0x2F84B:  {0x2F84B, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F84B"},
	0x2F84C:  {0x2F84C, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F84C"},
	0x2F84D:  {0x2F84D, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F84D"},
	0x2F84E:  {0x2F84E, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F84E"},
	0x2F84F:  {0x2F84F, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F84F"},
	0x2F850:  {0x2F850, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F850"},
	0x2F851:  {0x2F851, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F851"},
	0x2F852:  {0x2F852, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F852"},
	0x2F853:  {0x2F853, Unicode3_1, WidthWide, CatLo, "CJK COMPATIBILITY IDEOGRAPH-2F853"},
	0x2F854:  {0x2F854, Unicode3_1, W


import re

from llmebench.datasets import QCRIDialectalArabicPOSDataset
from llmebench.models import LegacyOpenAIModel
from llmebench.tasks import ArabicPOSTask

mapTags = {
    "UNK": "UNK",
    "EOS": "EOS",
    ".": "PUNC",
    "NNP": "NOUN",
    "JJR": "ADJ",
    "CD": "NOUN",
    "ADJ": "ADJ",
    "adjective": "ADJ",
    "JJ": "ADJ",
    "MD": "ADJ",
    "ADJF": "ADJ",
    "ADV": "ADV",
    "ADP": "ADV",
    "adverb": "ADV",
    "conjunction": "CONJ",
    "CONJ": "CONJ",
    "SCONJ": "CONJ",
    "CCONJ": "CONJ",
    "CC": "CONJ",
    "DT": "DET",
    "DET": "DET",
    "hashtag": "HASH",
    "NOUN": "NOUN",
    "noun": "NOUN",
    "N": "NOUN",
    "NN": "NOUN",
    "INTJ": "NOUN",
    "PROPN": "NOUN",
    "NEG": "PART",
    "PART": "PART",
    "NEG_PART": "PART",
    "IN": "PART",
    "preposition": "PREP",
    "P": "PREP",
    "PREP": "PREP",
    "PRP": "PREP",
    "PRON": "PRON",
    "pronoun": "PRON",
    "REL": "PRON",
    "DEM": "PRON",
    "PUNC": "PUNC",
    "punctuation": "PUNC",
    "PUNCT": "PUNC",
    "SYM": "PUNC",
    "verb": "V",
    "VERB": "V",
    "V": "V",
    "VB": "V",
    "RB": "ADV",
    "VBG": "V",
    "VBZ": "V",
    "PRO": "PRON",
    "conj": "CONJ",
    "punct": "PUNC",
    "neg": "PART",
    "pron": "PRON",
    "prep": "PREP",
    "COMP": "ADJ",
    "interjection": "PART",
    "number": "NOUN",
    "MOD": "PART",
    "NUM": "NOUN",
    "determiner": "DET",
    "negation": "PART",
    "url": "URL",
    "demonstrative": "PRON",
    "particle": "PART",
    "HASHTAG": "HASH",
    "NPROP": "NOUN",
    "EMOJI": "EMOJI",
    ",": "PUNC",
    "RELPRO": "PRON",
    "X": "NOUN",
    "MENTION": "MENTION",
    "اسم": "NOUN",
    "اسم علم": "NOUN",
    "حرف جر": "PREP",
    "حرف شرطي": "PART",
    "حرف عطف": "CONJ",
    "حرف نداء": "PART",
    "حرف نفي": "PART",
    "عدد": "NOUN",
    "فاصلة": "ADJ",
    "فعل": "V",
    "": "",
}

def metadata():
    return {
        "author": "Arabic Language Technologies, QCRI, HBKU",
        "model": "gpt-35-turbo (version 0301)",
        "description": "GPT35 model hosted on Azure, using the Completion API. API version '2023-03-15-preview'.",
        "scores": {"Accuracy": "0.073"},
    }

def config():
    return {
        "dataset": QCRIDialectalArabicPOSDataset,
        "task": ArabicPOSTask,
        "model": LegacyOpenAIModel,
        "model_args": {
            "max_tries": 3,
        },
    }

def prompt(input_sample):
    return {
        "system_message": "You are an AI assistant that helps people find information.",
        "messages": [
            {
                "sender": "user",
                "text": f"Please provide the POS tags for each word in the input sentence. The input will be a list of words in the sentence. "
                + "The output format should be a list of tuples, where each tuple consists of a word from the input text and its "
                + "corresponding POS tag label from the tag label set: "
                + '["ABBREV", "ADJ", "ADV", "CASE", "CONJ", "DET", "EMOT", "FOREIGN", "FUT_PART", "HASH", "MENTION", "NEG_PART", "NOUN", '
                + '"NSUFF", "NUM", "PART", "PREP", "PROG_PART", "PRON", "PUNC", "URL", "V"].'
                + "Note: Your response should include only a list of tuples, in the order that the words appear in the input sentence, "
                + "with each tuple containing the corresponding POS tag label for a word. Input:+: {input_sample}",
            }
        ],
    }

def post_process(response):
    text = response["choices"][0]["text"]

    if "Sorry, I cannot" in text or "Unfortunately" in text:
        return None

    text = re.sub(r"Here's the segmented sentence in a JSON format:", "", text)

    pattern = r"\([\"\']([^\"\']+)[\'\"], [\"\']([^\"\']+)[\'\"]\)"
    matches = re.finditer(pattern, text)
    results = []

    for m in matches:
        tag = m.group(2)
        ntag = []
        for t in tag.split("+"):
            ntag.append(mapTags[t] if t in mapTags else t)
        results.append("+".join(ntag))

    return " ".join(results)


_name)
    else
        local pose = get_pose(obj, image_name)
        if duration == nil then
            obj:SetPose(pose, fade)
        else
            obj:SetPose(pose, fade, duration)
        end
        __Nova.imageUnlockHelper:Unlock(obj.imageFolder .. '/' .. pose)
    end
end
add_preload_pattern('show')

function show_no_fade(obj, image_name, coord, color)
    show(obj, image_name, coord, color, false)
end
add_preload_pattern('show_no_fade')

function hide(obj, fade)
    local duration
    if fade == nil then
        fade = (auto_fade_off_count == 0)
    elseif type(fade) == 'number' then
        duration = fade
        fade = true
    end

    local _type = obj:GetType()
    if _type == typeof(Nova.PrefabLoader) then
        obj:ClearPrefab()
    elseif _type == typeof(Nova.SpriteController) then
        obj:ClearImage()
    else
        if duration == nil then
            obj:ClearImage(fade)
        else
            obj:ClearImage(fade, duration)
        end
    end
    schedule_gc()
end

function hide_no_fade(obj)
    hide(obj, false)
end


tch_and(!LOCKED_BIT, Ordering::Relaxed);
            } else {
                self.0
                    .fetch_and(!(LOCKED_BIT | PARKED_BIT), Ordering::Relaxed);
            }
            TOKEN_NORMAL
        };
        // SAFETY:
        //   * `addr` is an address we control.
        //   * `callback` does not panic or call into any function of `parking_lot`.
        unsafe {
            parking_lot_core::unpark_one(addr, callback);
        }
    }
}

impl<'a> Drop for LockGuard<'a> {
    fn drop(&mut self) {
        self.0.fetch_add(WRITE_INCREMENT, Ordering::Relaxed);
        fence(Ordering::Release);
        self.unlock();
    }
}
<reponame>dahlia-os/fuchsia-pine64-pinephone<filename>src/sys/pkg/bin/omaha-client/src/installer.rs<gh_stars>1-10
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//! This is the Fuchsia Installer implementation that talks to fuchsia.update.installer FIDL API.

use crate::install_plan::FuchsiaInstallPlan;
use anyhow::Context;
use fidl_fuchsia_hardware_power_statecontrol::RebootReason;
use fidl_fuchsia_update_installer::{
    InstallerMarker, RebootControllerMarker, RebootControllerProxy,
};
use fuchsia_url::pkg_url::PkgUrl;

use fidl_fuchsia_update_installer_ext::{start_update, Initiator, Options};
use fuchsia_component::client::connect_to_service;
use fuchsia_zircon as zx;
use futures::future::BoxFuture;
use futures::prelude::*;
use log::info;
use omaha_client::{
    installer::{Installer, ProgressObserver},
    protocol::request::InstallSource,
};
use thiserror::Error;

#[derive(Debug, Error)]
pub enum FuchsiaInstallError {
    #[error("generic error: {0}")]
    Failure(#[from] anyhow::Error),

    #[error("FIDL error: {0}")]
    FIDL(#[from] fidl::Error),

    /// System update installer error.
    #[error("system update installer failed")]
    Installer,

    /// URL parse error.
    #[error("Parse error")]
    Parse(#[source] fuchsia_url::boot_url::ParseError),
}

#[derive(Debug)]
pub struct FuchsiaInstaller {
    reboot_controller: Option<RebootControllerProxy>,
}

impl FuchsiaInstaller {
    // Unused until temp_installer.rs is removed.
    #[allow(dead_code)]
    pub fn new() -> Result<Self, anyhow::Error> {
        Ok(FuchsiaInstaller { reboot_controller: None })
    }
}

impl Installer for FuchsiaInstaller {
    type InstallPlan = FuchsiaInstallPlan;
    type Error = FuchsiaInstallError;

    fn perform_install(
        &mut self,
        install_plan: &FuchsiaInstallPlan,
        _observer: Option<&dyn ProgressObserver>,
    ) -> BoxFuture<'_, Result<(), FuchsiaInstallError>> {
        let url = install_plan.url.to_string();

        let options = Options {
            initiator: match install_plan.install_source {
                InstallSource::ScheduledTask => Initiator::Service,
                InstallSource::OnDemand => Initiator::User,
            },
            should_write_recovery: true,
            allow_attach_to_existing_attempt: true,
        };

        async move {
            let pkgurl = PkgUrl::parse(&url).map_err(FuchsiaInstallError::Parse)?;
            let proxy = fuchsia_component::client::connect_to_service::<InstallerMarker>()
                .map_err(|_| FuchsiaInstallError::Installer)?;

            let (reboot_controller, reboot_controller_server_end) =
                fidl::endpoints::create_proxy::<RebootControllerMarker>()
                    .map_err(FuchsiaInstallError


AggregateBuilder Params(string name, string value)
        {
            _params.Add(name);
            _params.Add(value);
            return this;
        }
        public AggregateBuilder Dialect(int value)
        {
            _dia


authors[i] = "zHTML xD.5375.0500.0006.0095.";
top.titles[i] =  "NLS:Hourly Data Size";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0096.";
top.titles[i] =  "NLS:License Database";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0097.";
top.titles[i] =  "NLS:License ID";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0098.";
top.titles[i] =  "NLS:License Service Provider";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0099.";
top.titles[i] =  "NLS:LSP Revision";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0100.";
top.titles[i] =  "NLS:Owner";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0101.";
top.titles[i] =  "NLS:Peak Installed Data";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0102.";
top.titles[i] =  "NLS:Peak Used Data";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0103.";
top.titles[i] =  "NLS:Product";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0104.";
top.titles[i] =  "NLS:Publisher";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0105.";
top.titles[i] =  "NLS:Revision";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0106.";
top.titles[i] =  "NLS:Search Type";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0107.";
top.titles[i] =  "NLS:Summary Update Time";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0108.";
top.titles[i] =  "NLS:Summary Version";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0109.";
top.titles[i] =  "NLS:Transaction Database";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0110.";
top.titles[i] =  "NLS:Transaction Log Name";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0111.";
top.titles[i] =  "NLS:Transaction Log Size";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0112.";
top.titles[i] =  "NLS:Version";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0113.";
top.titles[i] =  "Notification Consumers";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0114.";
top.titles[i] =  "Notification Profile";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006.0115.";
top.titles[i] =  "Notification Service Enabled";
i++;

top.authors[i] = "zHTML xD.5375.0500.0006


":        {114.8, 30.85},
	"黄石市":        {115.03, 30.2},
	"黄石港区":       {115.07, 30.23},
	"西塞山区":       {115.12, 30.2},
	"下陆区":        {114.97, 30.18},
	"铁山区":        {114.9, 30.2},
	"阳新县":        {115.2, 29.85},
	"大冶市":        {114.97, 30.1},
	"十堰市":        {110.78, 32.65},
	"茅箭区":        {110.82, 32.6},
	"张湾区":        {110.78, 32.65},
	"郧县":         {110.82, 32.83},
	"郧西县":        {110.42, 33},
	"竹山县":        {110.23, 32.23},
	"竹溪县":        {109.72, 32.32},
	"房县":         {110.73, 32.07},
	"丹江口市":       {111.52, 32.55},
	"宜昌市":        {111.28, 30.7},
	"西陵区":        {111.27, 30.7},
	"伍家岗区":       {111.35, 30.65},
	"点军区":        {111.27, 30.7},
	"猇亭区":        {111.42, 30.53},
	"夷陵区":        {111.32, 30.77},
	"远安县":        {111.63, 31.07},
	"兴山县":        {110.75, 31.35},
	"秭归县":        {110.98, 30.83},
	"长阳土家族自治县":   {111.18, 30.47},
	"五峰土家族自治县":   {110.67, 30.2},
	"宜都市":        {111.45, 30.4},
	"当阳市":        {111.78, 30.82},
	"枝江市":        {111.77, 30.43},
	"襄樊市":        {112.15, 32.02},
	"襄城区":        {112.15, 32.02},
	"樊城区":        {112.13, 32.03},
	"襄阳区":        {112.2, 32.08},
	"南漳县":        {111.83, 31.78},
	"谷城县":        {111.65, 32.27},
	"保康县":        {111.25, 31.88},
	"老河口市":       {111.67, 32.38},
	"枣阳市":        {112.75, 32.13},
	"宜城市":        {112.25, 31.72},
	"鄂州市":        {114.88, 30.4},
	"梁子湖区":       {114.67, 30.08},
	"华容区":        {114.73, 30.53},
	"鄂城区":        {114.88, 30.4},
	"荆门市":        {112.2, 31.03},
	"东宝区":        {112.2, 31.05},
	"掇刀区":        {112.2, 30.98},
	"京山县":        {113.1, 31.02},
	"沙洋县":        {112.58, 30.7},
	"�


 10 * $unit;

  background-color: $yellow;

  &:after {
    z-index: 10;
    content: $UTF8_BLACK_STAR;
    line-height: $union-jack-height;
    text-align:center;
    color: $yellow;
    display: block;
    position: absolute;
    width: $union-jack-width;
    height: $union-jack-height;
    left: 0;
    top: 0;
    background:
                circle($blue, $circle-size, $circle-left, $circle-top),
                union-jack($union-jack-width, $union-jack-height, $blue)
                    ;
  }

  &:before {
    z-index: 20;
    @include symbol($UTF8_BLACK_STAR, transparent, $star-size, $circle-left, $circle-top);
    text-shadow:
                (0px) (-$star-top-offset) 0px $yellow,
                $star-left-offset 0px 0px $yellow,
                0px $star-top-offset 0px $yellow,
                -$star-left-offset 0px 0px $yellow
              ;
  }
};
// Greece
// http://www.crwflags.com/fotw/flags/gr.html
// http://www.vexilla-mundi.com/greece_flag.html
@mixin flag-grc() {
  @include ratio(2 / 3);
  $unit: $h18;
  $blue: #0033a0;
  $white: #FFF;

  $stripe-size: percentage(1/9);
  $canton-size: 10 * $unit;
  $cross-left: 4 * $unit;
  $cross-top: 4 * $unit;
  $cross-size: 2 * $unit;

  background-image:
                   lines(
                     $blue, $stripe-size,
                     $white, $stripe-size,
                     $blue, $stripe-size,
                     $white, $stripe-size,
                     $blue, $stripe-size,
                     $white, $stripe-size,
                     $blue, $stripe-size,
                     $white, $stripe-size,
                     $blue, $stripe-size
                   );

  &:before {
    @include square($blue, $canton-size);
    background-image:
                      h-stripe($white, $cross-size, $cross-top),
                      v-stripe($white, $cross-size, $cross-left)
                    ;
  }

};
body {
  padding: 10px 10px 50px 10px;
}
.inspired {
  position:fixed;
  bottom:0;
  right:0;
  left:0;
  margin: 0;
  padding: 1rem;
  text-align:center;
  background: white;
}

/* SplashScreen */
.splashscreen {
  padding:5rem;
  font-size:12rem;
  text-align:center;
}

/* Website Takeover */
.fromTwitter {
  padding:1rem;
}
.fromTwitter h1 {
  text-align:center;
}
.fromTwitter .fromTwitter-image {
  text-align:center;
}
.fromTwitter .fromTwitter-text {
  padding-top: 4rem;
  font-size:2rem;
  text-align: left;
  max-width: 980px;
  margin: 0 auto;
}
.fromTwitter .fromTwitter-text bold {
  font-weight: bold;
}
.fromTwitter .fromTwitter-thankyou  {
  font-style: italic;
}
.fromTwitter .fromTwitter-choices {
  list-style:none;
  margin:0;
  padding:0;
  overflow:hidden;
}
.fromTwitter .fromTwitter-choices li {
  float:left;
  text-align:center;
  width:33%;
  margin-left:15%;
}
.fromTwitte


         = 1 << 21,
        UnsignedRightShift = 1 << 22,
        Equal              = 1 << 23, // return bool
        NotEqual           = 1 << 24, // return bool
        EqualCustom        = 1 << 25, // return custom struct
        NotEqualCustom     = 1 << 26, // return custom struct
        Greater            = 1 << 27,
        Lesser             = 1 << 28,
        GreaterEqual       = 1 << 29,
        LesserEqual        = 1 << 30,
    }

    public static class OperatorKinds
    {
        private static readonly OperatorKind[] s_all;

        static OperatorKinds()
        {
            s_all = (OperatorKind[])Enum.GetValues(typeof(OperatorKind));

            var all = s_all.AsSpan();
            var excludeFirst = all.Slice(1);
            excludeFirst.CopyTo(all);

            Array.Resize(ref s_all, s_all.Length - 1);
        }

        public static ReadOnlySpan<OperatorKind> All => s_all;
    }
}


, %r1
	.word 0x98b42d4c  ! 404: ORNcc_I	orncc 	%r16, 0x0d4c, %r12
	.word 0x96842654  ! 404: ADDcc_I	addcc 	%r16, 0x0654, %r11
!Div by Zero Trap
	.word 0x14800003  ! 406: BG	bg  	<label_0x3>
	.word 0x96740000  ! 407: UDIV_R	udiv 	%r16, %r0, %r11
	.word 0xad2c2001  ! 409: SLL_I	sll 	%r16, 0x0001, %r22
	.word 0xb20420f1  ! 409: ADD_I	add 	%r16, 0x00f1, %r25
	.word 0x92042745  ! 409: ADD_I	add 	%r16, 0x0745, %r9
	.word 0x88c40011  ! 409: ADDCcc_R	addccc 	%r16, %r17, %r4
	.word 0xa9342001  ! 409: SRL_I	srl 	%r16, 0x0001, %r20
	.word 0xb00c0011  ! 409: AND_R	and 	%r16, %r17, %r24
!Branch couple 4
	.word 0x26400001  ! 411: BPL	bl,a,pn	%icc, <label_0x1>
	.word 0x2c600002  ! 413: BPNEG	bneg,a,pn	%xcc, <label_0x2>
	.word 0x26cc0002  ! 415: BRLZ	brlz,a,pt	%r16,<label_0xc0002>
	.word 0x04600001  ! 417: BPLE	ble
	.word 0xa73c0011  ! 419: SRA_R	sra 	%r16, %r17, %r19
	.word 0x83343001  ! 419: SRLX_I	srlx	%r16, 0x0001, %r1
	.word 0xb8ac0011  ! 419: ANDNcc_R	andncc 	%r16, %r17, %r28
	.word 0x8c0c212a  ! 419: AND_I	and 	%r16, 0x012a, %r6
	.word 0xb97c2401  ! 419: MOVR_I	movre	%r16, 0x1, %r28
!dcerr br
thr0_dc_err_18:
!$EV error(0,expr(@VA(.MAIN.thr0_dc_err_18), 16, 16),1,DC_TAG,71)
	.word 0xf8440000  ! 420: LDSW_R	ldsw	[%r16 + %r0], %r28
	.word 0x16800002  ! 422: BGE	bge  	<label_0x2>
	.word 0x88040011  ! 424: ADD_R	add 	%r16, %r17, %r4
	.word 0x8abc0011  ! 424: XNORcc_R	xnorcc 	%r16, %r17, %r5
	.word 0x9c1427b1  ! 424: OR_I	or 	%r16, 0x07b1, %r14
	.word 0x8a040011  ! 424: ADD_R	add 	%r16, %r17, %r5
	.word 0x9abc0011  ! 424: XNORcc_R	xnorcc 	%r16, %r17, %r13
	.word 0x840c0011  ! 424: AND_R	and 	%r16, %r17, %r2
!stb8 br fstw
	.word 0xda2c2b1a  ! 425: STB_I	stb	%


potent() {
    let val64 = 0xdeadbeef_deadbeef_u64;
    assert_eq!(hash(&val64), hash(&val64));
    let val32 = 0xdeadbeef_u32;
    assert_eq!(hash(&val32), hash(&val32));
}

#[test]
fn test_hash_no_bytes_dropped_64() {
    let val = 0xdeadbeef_deadbeef_u64;

    assert!(hash(&val) != hash(&zero_byte(val, 0)));
    assert!(hash(&val) != hash(&zero_byte(val, 1)));
    assert!(hash(&val) != hash(&zero_byte(val, 2)));
    assert!(hash(&val) != hash(&zero_byte(val, 3)));
    assert!(hash(&val) != hash(&zero_byte(val, 4)));
    assert!(hash(&val) != hash(&zero_byte(val, 5)));
    assert!(hash(&val) != hash(&zero_byte(val, 6)));
    assert!(hash(&val) != hash(&zero_byte(val, 7)));

    fn zero_byte(val: u64, byte: usize) -> u64 {
        assert!(byte < 8);
        val & !(0xff << (byte * 8))
    }
}

#[test]
fn test_hash_no_bytes_dropped_32() {
    let val = 0xdeadbeef_u32;

    assert!(hash(&val) != hash(&zero_byte(val, 0)));
    assert!(hash(&val) != hash(&zero_byte(val, 1)));
    assert!(hash(&val) != hash(&zero_byte(val, 2)));
    assert!(hash(&val) != hash(&zero_byte(val, 3)));

    fn zero_byte(val: u32, byte: usize) -> u32 {
        assert!(byte < 4);
        val & !(0xff << (byte * 8))
    }
}

#[test]
fn test_hash_no_concat_alias() {
    let s = ("aa", "bb");
    let t = ("aabb", "");
    let u = ("a", "abb");

    assert!(s != t && t != u);
    assert!(hash(&s) != hash(&t) && hash(&s) != hash(&u));

    let u = [1, 0, 0, 0];
    let v = (&u[..1], &u[1..3], &u[3..]);
    let w = (&u[..], &u[4..4], &u[4..4]);

    assert!(v != w);
    assert!(hash(&v) != hash(&w));
}

#[test]
fn test_write_short_works() {
    let test_usize = 0xd0c0b0a0usize;
    let mut h1 = SipHasher128::new_with_keys(0, 0);
    h1.write_usize(test_usize);
    h1.write(b"bytes");
    h1.write(b"string");
    h1.write_u8(0xFFu8);
    h1.write_u8(0x01u8);
    let mut h2 = SipHasher128::new_with_keys(0, 0);
    h2.write(unsafe {
        slice::from_raw_parts(&test_usize as *const _ as *const u8,
                                mem::size_of::<usize>())
    });
    h2.write(b"bytes");
    h2.write(b"string");
    h2.write(&[0xFFu8, 0x01u8]);
    assert_eq!(h1.finish128(), h2.finish128());
}
<reponame>JahooYoung/genshin_artifact
use crate::artifacts::{Artifact, ArtifactSetName};
use crate::artifacts::effect_config::{ArtifactEffectConfig, ArtifactEffectConfigBuilder, ConfigRate};
use crate::attribute::{Attribute, AttributeName, SimpleAttributeGraph2};
use crate::character::{Character, CharacterName};
use crate::character::character_common_data::CharacterCommonData;
use crate::character::characters::Xinyan;
use crate::character::prelude::CharacterTrait;
use crate::character::skill_config::CharacterSkillConfig;
use crate::common::item_config_type::{ItemConfig, ItemConfigType};
use crate::common::StatName;
use crate::damage::{DamageContext, SimpleDamageBuilder};
use


  text-align: center;
}

.nvtooltip span {
  display: inline-block;
  margin: 2px 0;
}

.nvtooltip table {
  margin: 6px;
  border-spacing:0;
}

.nvtooltip table td {
  padding: 2px 9px 2px 0;
  vertical-align: middle;
}

.nvtooltip table td.key {
  font-weight:normal;
}
.nvtooltip table td.value {
  text-align: right;
  font-weight: bold;
}

.nvtooltip table tr.highlight td {
  padding: 1px 9px 1px 0;
  border-bottom-style: solid;
  border-bottom-width: 1px;
  border-top-style: solid;
  border-top-width: 1px;
}

.nvtooltip table td.legend-color-guide div {
  width: 8px;
  height: 8px;
  vertical-align: middle;
}

.nvtooltip .footer {
  padding: 3px;
  text-align: center;
}

.nvtooltip-pending-removal {
  position: absolute;
  pointer-events: none;
}

/********************
 * SVG CSS
 */

svg {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  /* Trying to get SVG to act like a greedy block in all browsers */
  display: block;
  width:100%;
  height:100%;
}

svg text {
  font: normal 12px Arial;
}

svg .title {
 font: bold 14px Arial;
}

.nvd3 .nv-background {
  fill: white;
  fill-opacity: 0;
  /*
  pointer-events: none;
  */
}

.nvd3.nv-noData {
  font-size: 18px;
  font-weight: bold;
}

/**********
*  Brush
*/

.nv-brush .extent {
  fill-opacity: .125;
  shape-rendering: crispEdges;
}

/**********
*  Legend
*/

.nvd3 .nv-legend .nv-series {
  cursor: pointer;
}

.nvd3 .nv-legend .disabled circle {
  fill-opacity: 0;
}

/**********
*  Axes
*/
.nvd3 .nv-axis {
  pointer-events:none;
}

.nvd3 .nv-axis path {
  fill: none;
  stroke: #000;
  stroke-opacity: .75;
  shape-rendering: crispEdges;
}

.nvd3 .nv-axis path.domain {
  stroke-opacity: .75;
}

.nvd3 .nv-axis.nv-x path.domain {
  stroke-opacity: 0;
}

.nvd3 .nv-axis line {
  fill: none;
  stroke: #e5e5e5;
  shape-rendering: crispEdges;
}

.nvd3 .nv-axis .zero line,
/*this selector may not be necessary*/ .nvd3 .nv-axis line.zero {
  stroke-opacity: .75;
}

.nvd3 .nv-axis .nv-axisMaxMin text {
  font-weight: bold;
}

.nvd3 .x  .nv-axis .nv-axisMaxMin text,
.nvd3 .x2 .nv-axis .nv-axisMaxMin text,
.nvd3 .x3 .nv-axis .nv-axisMaxMin text {
  text-anchor: middle
}

/**********
*  Brush
*/

.nv-brush .resize path {
  fill: #eee;
  stroke: #666;
}

/**********
*  Bars
*/

.nvd3 .nv-bars .negative rect {
    zfill: brown;
}

.nvd3 .nv-bars rect {
  zfill: steelblue;
  fill-


04,0x13,0x1C,0x16,0x17,0x16,0x16,0x14,0x07,0xF9
	.byte 0xF6,0xF7,0x01,0x07,0x07,0x00,0xFD,0x05,0x07,0x07,0x04,0x05,0x04,0x06,0x05,0x05
	.byte 0x04,0x02,0x03,0x03,0x04,0x05,0x05,0x04,0x06,0x0A,0x09,0x0C,0x0F,0x0F,0x13,0x11
	.byte 0x0F,0x0E,0x0B,0x0A,0x08,0x07,0x07,0x06,0x04,0x01,0xFE,0xFC,0xFA,0xF8,0xF8,0xF5
	.byte 0xF2,0xEF,0xEE,0xF0,0xF1,0xEF,0xEF,0xEF,0xEF,0xF0,0xF0,0xEF,0xEE,0xED,0xEB,0xEA
	.byte 0xE9,0xE8,0xE7,0xE6,0xE6,0xE6,0xE7,0xE8,0xE8,0xE9,0xEA,0xEA,0xEB,0xEC,0xEC,0xEA
	.byte 0xEA,0xEB,0xEC,0xED,0xED,0xED,0xED,0xEE,0xEF,0xF1,0xF2,0xF2,0xF1,0xF0,0xF0,0xF2

	.byte 0xF4,0xF5,0xF5,0xF5,0xF4,0xF4,0xF5,0xF5,0xF5,0xF4,0xF4,0xF2,0xF1,0xF1,0xF0,0xEF
	.byte 0xEF,0xF0,0xF0,0xF0,0xF1,0xF2,0xF3,0xF4,0xF6,0xF7,0xF9,0xF9,0xF8,0xF7,0xF7,0xF7
	.byte 0xF8,0xF9,0xF8,0xF9,0xFA,0xFC,0xFE,0xFE,0xFD,0xFD,0xFE,0x00,0x00,0x02,0x03,0x02
	.byte 0xFB,0xF8,0xFA,0xFB,0xFC,0xFB,0xFC,0xFD,0xFE,0xFE,0xFF,0x00,0x00,0x02,0x02,0x03
	.byte 0x03,0x03,0x04,0x05,0x06,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0D,0x0E,0x10,0x11,0x12
	.byte 0x13,0x15,0x15,0x16,0x16,0x16,0x17,0x17,0x17,0x16,0x16,0x15,0x14,0x14,0x13,0x13
	.byte 0x13,0x12,0x12,0x13,0x12,0x12,0x11,0x12,0x11,0x11,0x10,0x10,0x10,0x10,0x0F,0x0F
	.byte 0x0E,0x0D,0x0D,0x0D,0x0E,0x0F,0x0E,0x0F,0x10,0x10,0x10,0x10,0x10,0x1


2>');
			expect(unprettifiedElement.innerHTML).toContain(
				'Agreement to change description evidence date must be a real date'
			);
		});

		it('should send a patch request to the appeal documents endpoint and redirect to the check your answers page, if complete and valid document details were provided', async () => {
			expect(addDocumentsResponse.statusCode).toBe(302);

			const response = await request
				.post(`${baseUrl}/1${appellantCasePagePath}/add-document-details/1/1`)
				.send({
					items: [
						{
							documentId: '4541e025-00e1-4458-aac6-d1b51f6ae0a7',
							receivedDate: {
								day: '1',
								month: '2',
								year: '2023'
							},
							redactionStatus: 2
						}
					]
				});

			expect(response.statusCode).toBe(302);
			expect(response.text).toBe(
				'Found. Redirecting to /appeals-service/appeal-details/1/appellant-case/add-documents/1/1/check-your-answers'
			);
		});
	});

	describe('GET /appellant-case/add-documents/:folderId/check-your-answers', () => {
		beforeEach(() => {
			nock.cleanAll();
			nock('http://test/').get('/appeals/1').reply(200, appealData).persist();
			nock('http://test/')
				.get('/appeals/1/document-folders/1')
				.reply(200, documentFolderInfo)
				.persist();
			nock('http://test/')
				.get('/appeals/document-redaction-statuses')
				.reply(200, documentRedactionStatuses)
				.persist();
		});
		afterEach(() => {
			nock.cleanAll();
		});

		it('should render a 500 error page if fileUploadInfo is not present in the session', async () => {
			const response = await request.get(
				`${baseUrl}/1${appellantCasePagePath}/add-documents/1/check-your-answers`
			);

			expect(response.statusCode).toBe(500);
			const element = parseHtml(response.text);
			expect(element.innerHTML).toMatchSnapshot();

			const unprettifiedElement = parseHtml(response.text, { skipPrettyPrint: true });

			expect(unprettifiedElement.innerHTML).toContain(
				'Sorry, there is a problem with the service
'
			);
		});

		it('should render the add documents check and confirm page with summary list displaying info on the uploaded document', async () => {
			const addDocumentsResponse = await request
				.post(`${baseUrl}/1${appellantCasePagePath}/add-documents/1`)
				.send({
					'upload-info': fileUploadInfo
				});

			expect(addDocumentsResponse.statusCode).toBe(302);

			const response = await request.get(
				`${baseUrl}/1${appellantCasePagePath}/add-documents/1/check-your-answers`
			);

			expect(response.statusCode).toBe(200);

			const unprettifiedElement = parseHtml(response.text, { skipPrettyPrint: true });

			expect(unprettifiedElement.innerHTML).toContain('Check your answers
');
			expect(unprettifiedElement.innerHTML).toContain('File
');
			expect(unprettifiedElement.innerHTML).toContain(
				'test-document.txt
'
			);
			expect(unprettifiedElement.innerHTML).toContain(
				`href="/appeals-service/appeal-details/1/appellant-case/add-documents/${documentFolderInfo.folderId}">Change<span class="govuk-visually-hidden"> file test-document.txt</span></a>`


# Copyright (c) 2025 Kodo Robotics
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import ast

from parser.context import ParseContext
from parser.parser.postprocessing import simplify_launch_configurations
from parser.parser.registry import register_handler
from parser.resolution.utils import resolve_call_signature

@register_handler("IfCondition", "launch.conditions.IfCondition")
def handle_if_condition(node: ast.Call, context: ParseContext) -> dict:
    args, kwargs = resolve_call_signature(node, context.engine)
    if args:
        kwargs["expression"] = args[0]

    expression = simplify_launch_configurations(kwargs["expression"])
    return f"${{IfCondition:{expression}}}"

@register_handler("UnlessCondition", "launch.conditions.UnlessCondition")
def handle_unless_condition(node: ast.Call, context: ParseContext) -> dict:
    args, kwargs = resolve_call_signature(node, context.engine)
    if args:
        kwargs["expression"] = args[0]

    expression = simplify_launch_configurations(kwargs["expression"])
    return f"${{UnlessCondition:{expression}}}"


var c,d,e;c=a.i.b;d=a.i.d;switch(c){case 201:return CB(a),e=AB(a,d,1==b),new kC(b,e,a.d.wb());case 208:CB(a);a:{var f;try{f=a.d.Qd(d)}catch(g){g=v(g);if(z(g,203)){nB(a,g.k,new D(h,l,If));c=null;break a}throw g;}c=new mC(a.d.wb(),b,f)}return c;case 70:return CB(a),d=a.i.d,201!=a.i.b&&oB(a,li+(ix(),T)[201]+Ma+(201==a.i.b?Qj+a.i.d+Ja:-1==a.i.b?eb:Ja+T[a.i.b]+Ja)),CB(a),jC(d)||nB(a,"Local name ["+d+"] contains invalid characters",new D(h,l,1==a.e?xg:Ef)),new nC(a.d.wb(),b,d);case 207:return CB(a),
Ky(b);case 69:return cC(a);default:return nB(a,"Unrecognized node test",new D(h,l,1==a.e?xg:Ef)),null}}function KB(a){var b;var c=a.i.d;if(0<=Pt(c,Qt(101))||0<=Pt(c,Qt(69)))try{b=new uA(oC(c))}catch(d){if(d=v(d),z(d,338))b=($x(),ay);else throw d;}else b=0<=Pt(c,Qt(46))?pC(c):qC(c),b=z(b,237)?($x(),ay):B(b,257);b.yg()&&oB(a,"Invalid numeric literal "+uB(a.i.d,4));CB(a);b=new cx(b);!b.u&&cw(b,a.c);return b}
function rC(a){var b,c;switch(a.i.b){case 2:CB(a);b=new sC;!b.u&&cw(b,a.c);a:switch(a.i.b){case 46:case 57:case 45:case 47:c=!0;break a;default:c=!1}c&&oB(a,"Operator '"+(ix(),T)[a.i.b]+"' is not allowed after '/'");a:switch(a.i.b){case 35:case 3:case 201:case 208:case 70:case 207:case 69:case 205:case 206:case 34:case 202:case 209:case 5:case 21:c=!0;break a;default:c=!1}c&&(b=tC(a,b),!b.sc()&&cw(b,a.c));return b;case 8:return CB(a),c=new sC,!c.u&&cw(c,a.c),b=new Ey(5,null),!b.u&&cw(b,a.c),b=tC(a,
new uC(c,b)),!b.sc()&&cw(b,a.c),b;default:var d;for(b=vC(a,1==a.e);2==a.i.b||8==a.i.b;)d=a.i.b,CB(a),c=vC(a,!1),2!=d&&(d=new Ey(5,null),!d.u&&cw(d,a.c),c=new uC(d,c),!c.u&&cw(c,a.c)),b=new uC(b,c),!b.sc()&&cw(b,a.c);return b}}functio


fun Array<MyComparable>.assertSorted(message: String = "") {
    for (i in 1 until size) {
        assertTrue(this[i - 1] <= this[i], message)
    }
}

data class ComparatorInfo(val name: String, val comparator: Comparator<Int>, val isCorrect: Boolean)

class MyComparable (val value: Int, val comparator: Comparator<Int>): Comparable<MyComparable> {
    override fun compareTo(other: MyComparable): Int = comparator.compare(value, other.value)
}

// Assert that the array is sorted in terms of a comparator only for correct/partially correct cases
val comparators = listOf<ComparatorInfo>(
    ComparatorInfo("Correct increasing", correctIncreasing ,  true),
    ComparatorInfo("Correct decreasing", correctDecreasing ,  true),
    ComparatorInfo("Incorrect increasing", Comparator { a ,b -> if (a > b) 1 else -1 },  false),
    ComparatorInfo("Incorrect decreasing", Comparator { a ,b -> if (a < b) 1 else -1 },  false),
    ComparatorInfo("Always 1",  Comparator { a ,b ->  1  },  false),
    ComparatorInfo("Always -1", Comparator { a ,b ->  -1 },  false),
    ComparatorInfo("Always 0",  Comparator { a ,b ->  0  },  false)
)

val arrays = listOf<Array<Int>>(
    arrayOf(),
    arrayOf(1),
    arrayOf(Int.MIN_VALUE, 0, Int.MAX_VALUE),
    arrayOf(Int.MAX_VALUE, 0, Int.MIN_VALUE),
    arrayOf(1, 2, 3),
    arrayOf(-2, -1, 99, 1, 2),
    arrayOf(90, 91, 0, 98, 99),
    arrayOf(2, 1, 99, -1, 2),
    arrayOf(99, 98, 0, 91, 90),
    arrayOf(42, 42, 42),
    arrayOf(99, 42, 0, 42, 50),
    arrayOf(
        100000, 190001, 200002, 200003, 200004, 210005, 220006, 250007, 300008, 310009, 360010, 365011,
        380012, 390013, 390014, 399015, 400016, 400017, 400018, 400019, 400020, 400021, 400022, 400023,
        400024, 400025, 400026, 450027, 450028, 480029, 480030, 500031, 500032, 500033, 500034, 500035,
        500036, 500037, 500038, 500039, 500040, 500041, 500042, 500043, 500044, 500045, 500046, 500047,
        500048, 500049, 500050, 500051, 500052, 500053, 505054, 510055, 510056, 510057, 510058, 510059,
        510060, 510061, 510062, 510063, 410064, 410065, 511066, 511067, 520068, 520069, 420070, 520071,
        530072, 530073, 530074, 430075, 430076, 530077, 540078, 540079, 540080, 540081, 540082, 540083,
        540084, 490085, 540086, 540087, 542088, 544089, 546090, 550091, 550092, 550093, 550094, 590095,
        590096, 595097, 600098, 600099, 600100, 600101, 600102, 600103, 600104, 550105, 600106, 600107,
        600108, 600109, 600110, 610111, 610112, 610113, 620114, 620115, 620116, 620117, 620118, 620119,
        640120, 640121, 645122, 645123, 645124, 645125, 645126, 645127, 650128, 700129, 700130
    )
)

@Test fun runTest() {
    arrays.forEach { array ->
        comparators.forEach {
            // Test with custom comparator
            val arrayUnderTest = array.copyOf()
            arrayUnderTest.sortWith(it.comparator)
            if (it.isCorrect) {
                arrayUnderTest.assertSorted(it.comparator, """
                    Assert sorted failed for comparator: "${it.name}"
                    Array: ${array.joinToString()}
                    Array after sor


tensions"] = {
				[==[APPLE_fence]==],
			},
		},
		{
			["value"] = [==[0x8C8E]==],
			["name"] = [==[TRANSFORM_FEEDBACK_BUFFER_NV]==],
			["extensions"] = {
				[==[NV_transform_feedback]==],
			},
		},
		{
			["value"] = [==[0x8C8D]==],
			["name"] = [==[SEPARATE_ATTRIBS_NV]==],
			["extensions"] = {
				[==[NV_transform_feedback]==],
			},
		},
		{
			["value"] = [==[0x80D6]==],
			["name"] = [==[COLOR_TABLE_SCALE]==],
			["extensions"] = {
				[==[ARB_imaging]==],
			},
		},
		{
			["value"] = [==[0x8C8A]==],
			["name"] = [==[MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV]==],
			["extensions"] = {
				[==[NV_transform_feedback]==],
			},
		},
		{
			["value"] = [==[0x80A6]==],
			["name"] = [==[4PASS_2_EXT]==],
			["extensions"] = {
				[==[EXT_multisample]==],
			},
		},
		{
			["value"] = [==[0x8C89]==],
			["name"] = [==[RASTERIZER_DISCARD_NV]==],
			["extensions"] = {
				[==[NV_transform_feedback]==],
			},
		},
		{
			["value"] = [==[0x8C87]==],
			["name"] = [==[PRIMITIVES_GENERATED_NV]==],
			["extensions"] = {
				[==[NV_transform_feedback]==],
			},
		},
		{
			["value"] = [==[0x8C86]==],
			["name"] = [==[TRANSFORM_FEEDBACK_RECORD_NV]==],
			["extensions"] = {
				[==[NV_transform_feedback]==],
			},
		},
		{
			["value"] = [==[0x821A]==],
			["extensions"] = {
				[==[ARB_framebuffer_object]==],
			},
			["name"] = [==[DEPTH_STENCIL_ATTACHMENT]==],
			["core"] = {
				{
					[==[3.0]==],
					[==[core]==],
				},
			},
		},
		{
			["value"] = [==[0x881F]==],
			["name"] = [==[LUMINANCE_ALPHA_FLOAT16_ATI]==],
			["extensions"] = {
				[==[ATI_texture_float]==],
			},
		},
		{
			["value"] = [==[0x8C85]==],
			["name"] = [==[TRANSFORM_FEEDBACK_BUFFER_SIZE_NV]==],
			["extensions"] = {
				[==[NV_transform_feedback]==],
			},
		},
		{
			["value"] = [==[0x8C84]==],
			["name"] = [==[TRANSFORM_FEEDBACK_BUFFER_START_NV]==],
			["extensions"] = {
				[==[NV_transform_feedback]==],
			},
		},
		{
			["value"] = [==[0x8961]==],
			["name"] = [==[MOV_ATI]==],
			["extensions"] = {
				[==[ATI_fragment_shader]==],
			},
		},
		{
			["value"] = [==[0x912A]==],
			["extensions"] = {
				[==[ARB_comp


    [0x0F]=true,  --Closing Spotlight
    [0x10]=true,  --Opening Spotlight
    [0x11]=true,  --Happens when you fall into a hole from the OW.
    [0x12]=true,  --Death Mode
    [0x13]=true,  --Boss Victory Mode (refills stats)
    [0x14]=false,  --History Mode (Title Screen Demo)
    [0x15]=true,  --Module for Magic Mirror
    [0x16]=true,  --Module for refilling stats after boss.
    [0x17]=false,  --Restart mode (save and quit)
    [0x18]=true,  --Ganon exits from Agahnim's body. Chase Mode.
    [0x19]=true,  --Triforce Room scene
    [0x1A]=false,  --End sequence
    [0x1B]=false,  --Screen to select where to start from (House, sanctuary, etc.)
}

local continueHP = {
	[03] = 03,
	[04] = 03,
	[05] = 04,
	[06] = 04,
	[07] = 05,
	[08] = 05,
	[09] = 06,
	[10] = 06,
	[11] = 07,
	[12] = 07,
	[13] = 07,
	[14] = 08,
	[15] = 08,
	[16] = 08,
	[17] = 09,
	[18] = 09,
	[19] = 09,
	[20] = 10,
}

local deathQueue = {}
function tableCount(table)
	local count = 0
    for _, _ in pairs(table) do
        count = count + 1
    end
    return count
end

local prevRAM = nil
local gameMode
local prevGameMode = nil

local gameLoaded
local prevGameLoaded = true
local dying = false
local prevmode = 0
local lttp_ram = {}
local playercount = 1

-- Writes value to RAM using little endian
local prevDomain = ""
function writeRAM(domain, address, size, value)
	-- update domain
	if (prevDomain ~= domain) then
		prevDomain = domain
		if not memory.usememorydomain(domain) then
			return
		end
	end

	-- default size short
	if (size == nil) then
		size = 2
	end

	if (value == nil) then
		return
	end

	if size == 1 then
		memory.writebyte(address, value)
	elseif size == 2 then
		memory.write_u16_le(address, value)
	elseif size == 4 then
		memory.write_u32_le(address, value)
	end
end

-- Reads a value from RAM using little endian
function readRAM(domain, address, size)
	-- update domain
	if (prevDomain ~= domain) then
		prevDomain = domain
		if not memory.usememorydomain(domain) then
			return
		end
	end

	-- default size short
	if (size == nil) then
		size = 2
	end

	if size == 1 then
		return memory.readbyte(address)
	elseif size == 2 then
		return memory.read_u16_le(address)
	elseif size == 4 then
		return memory.read_u32_le(address)
	end
end

-- Return the new value only when changing from 0
local function zeroChange(newValue, prevValue)
	if (newValue == 0 or (newValue ~= 0 and prevValue == 0)) then
		return newValue
	else
		return prevValue
	end
end

local function clamp(newValue, prevValue, address, item)
	if item.min then
		newValue = math.max(newValue, item.min)
	end


SELECT
    c.oid INTO v_table_oid
  FROM
    pg_catalog.pg_class c
    LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
  WHERE
    1 = 1
    AND c.relkind = 'r'
    AND c.relname = in_table_name
    AND n.nspname = in_schema_name;
  -- the schema
  -- throw an error if table was not found
  IF (v_table_oid IS NULL) THEN
    RAISE EXCEPTION 'table(%) does not exist',in_table_name;
  END IF;
  -- start the create definition
  v_table_ddl := concat(
    'DROP TABLE IF EXISTS ',
    in_schema_name,
    '.""',
    in_table_name,
    '"";',
    newline,
    'CREATE TABLE ',
    in_schema_name,
    '.""',
    in_table_name,
    '"" (',
    newline
  );
  -- define all of the columns in the table; https://stackoverflow.com/a/8153081/3068233
  FOR v_column_record IN
  SELECT
    c.table_schema,
    c.table_name,
    c.column_name,
    c.data_type,
    c.character_maximum_length,
    c.is_nullable,
    c.column_default,
    col_description(
      format('%s.""%s""', c.table_schema, c.table_name) :: regclass :: oid,
      c.ordinal_position
    ) AS column_comment
  FROM
    information_schema.columns c
  WHERE
    (table_schema, table_name) = (in_schema_name, in_table_name)
  ORDER BY
    ordinal_position LOOP v_table_ddl := concat(
      v_table_ddl,
      '  ""',
      v_column_record.column_name,
      '"" ',
      v_column_record.data_type,
      CASE
        WHEN v_column_record.character_maximum_length IS NOT NULL THEN concat('(', v_column_record.character_maximum_length, ')')
        ELSE ''
      END,
      ' ',
      CASE
        WHEN v_column_record.is_nullable = 'NO' THEN 'NOT NULL'
        ELSE 'NULL'
      END,
      CASE
        WHEN v_column_record.column_default IS NOT NULL THEN concat(' DEFAULT ', v_column_record.column_default)
        ELSE ''
      END,
      ',',
      newline
    );
  -- column comment
  v_column_comment := concat(
    v_column_comment,
    newline,
    'COMMENT ON COLUMN ',
    v_column_record.table_schema,
    '.""',
    v_column_record.table_name,
    '"".""',
    v_column_record.column_name,
    '"" IS ''',
    v_column_record.column_comment,
    ''';'
  );
  END LOOP;
  -- define all the constraints in the; https://dba.stackexchange.com/a/214877/75296
  FOR v_constraint_record IN
  SELECT
    con.conname AS constraint_name,
    con.contype AS constraint_type,
    CASE
      WHEN con.contype = 'p' THEN 1 -- primary key constraint
      WHEN con.contype = 'u' THEN 2 -- unique constraint
      WHEN con.contype = 'f' THEN 3 -- foreign key constraint
      WHEN con.contype = 'c' THEN 4
      ELSE 5
    END AS type_rank,
    pg_get_constraintdef(con.oid) AS constraint_definition
  FROM
    pg_catalog.pg_constraint con
    JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid
    JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace
  WHERE
    nsp.nspname = in_schema_name
    AND rel.relname = in_table_name
  ORDER BY
    type_rank LOOP v_table_ddl := concat(
      v_table_ddl,
      '  ',
      'CONSTRAINT ""',
      v_constraint_record.constraint_name,
      '"" ',
      v_con


handlePOST或者doPOST函数内部。也许我们可以借此访问某些局部变量。

如果大家不熟悉Ruby，这里我稍微介绍下。Ruby提供了强大的元编程（metaprogramming）以及内省（introspection）功能，读者可以访问此链接了解更多细节。作为攻击者，我们可以使用其中某些功能（如前面提到的类的.methods以及.name方法）来探索程序的内部结构。我们可以使用如下载荷获取目标所需的具体参数：

ruby <%= self.method(:handle_POST).parameters %>

结果如下：

从结果中，我们可知handle_POST需要3个req参数，该参数可能代表的是某个请求（request）对象；rsp参数可能代表的是响应数据的引用；最后的session参数可能是某个id或者某个对象。我们可以继续探索，以确认session对象的具体含义，使用的载荷如下：

ruby <%= session.class.name %>

结果如下：

<p style="text-indent: 2


。';
			case 'intro.last_slide_descr2': return '祝您使用愉快！如果您有任何疑问或建议，请随时与我们联系……';
			case 'home.title': return '面板';
			case 'home.filter_transactions': return '筛选交易';
			case 'home.hello_day': return '您好，';
			case 'home.hello_night': return '晚上好，';
			case 'home.total_balance': return '总余额';
			case 'home.my_accounts': return '我的账户';
			case 'home.active_accounts': return '活动账户';
			case 'home.no_accounts': return '尚未创建账户';
			case 'home.no_accounts_descr': return '要开始使用 Monekin，请创建至少一个账户，以便开始添加交易';
			case 'home.last_transactions': return '最近的交易';
			case 'home.should_create_account_header': return 'Oops!';
			case 'home.should_create_account_message': return '在可以开始创建交易之前，您必须拥有至少一个未被归档的账户';
			case 'financial_health.display': return '财务健康';
			case 'financial_health.review.very_good': return ({required GenderContext context}) {
				switch (context) {
					case GenderContext.male:
						return '很好！';
					case GenderContext.female:
						return '很好！';
				}
			};
			case 'financial_health.review.good': return ({required GenderContext context}) {
				switch (context) {
					case GenderContext.male:
						return '好';
					case GenderContext.female:
						return '好';
				}
			};
			case 'financial_health.review.normal': return ({required GenderContext context}) {
				switch (context) {
					case GenderContext.male:
						return '一般';
					case GenderContext.female:
						return '一般';
				}
			};
			case 'financial_health.review.bad': return ({required GenderContext context}) {
				switch (context) {
					case GenderContext.male:
						return '不好';
					case GenderContext.female:
						return '不好';
				}
			};
			case 'financial_health.review.very_bad': return ({required GenderContext context}) {
				switch (context) {
					case GenderContext.male:
						return '很不好';
					case GenderContext.female:
						return '很不好';
				}
			};
			case 'financial_health.review.insufficient_data': return ({required GenderContext context}) {
				switch (context) {
					case GenderContext.male:
						return '数据不足';
					case GenderContext.female:
						return '数据不足';
				}
			};
			case 'financial_health.review.desc


er.query)
                            putExtra(
                                AnimalDetailActivity.EXTRA_QUERY_ANIMAL_CATEGORY,
                                presenter.selectedAnimalCategory
                            )
                            putExtra(
                                AnimalDetailActivity.EXTRA_QUERY_ANIMAL_SUBCATEGORY,
                                presenter.selectedAnimalSubcategory
                            )
                            putExtra(
                                AnimalDetailActivity.EXTRA_QUERY_SORT_BY,
                                presenter.selectedSortBy
                            )
                            putExtra(
                                AnimalDetailActivity.EXTRA_MODEL_NAME,
                                presenter.modelName
                            )
                            putExtra(AnimalDetailActivity.EXTRA_SEARCH_ID, presenter.searchID)
                        }
                        startActivity(intent)
                    }
                }
            )

            searchView.setQuery(presenter.query, true)
        }

        requireActivity().findViewById<FloatingActionButton>(R.id.add_animal_button).apply {
            setOnClickListener {
                val intent = Intent(context, AnimalRegistrationActivity::class.java)
                startActivity(intent)
            }
        }
        return root
    }

    companion object {
        fun newInstance(): AnimalListFragment {
            return AnimalListFragment()
        }
    }
}package com.sch.share.share

import android.app.Activity
import android.app.AlertDialog
import android.app.ProgressDialog
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.net.Uri
import android.text.TextUtils
import android.widget.Toast
import com.sch.share.Options
import com.sch.share.R
import com.sch.share.ShareInfo
import com.sch.share.WXShareMultiImageHelper
import com.sch.share.constant.WX_LAUNCHER_UI
import com.sch.share.constant.WX_PACKAGE_NAME
import com.sch.share.constant.WX_SHARE_TO_TIMELINE_UI
import com.sch.share.manager.ImageManager
import com.sch.share.service.ServiceManager
import com.sch.share.utils.ClipboardUtil
import java.io.File
import kotlin.concurrent.thread

/**
 * Created by StoneHui on 2019-11-28.
 * <p>
 * 分享到朋友圈
 */
object TimelineShare : BaseShare() {

    /**
     * 分享图片 [images] 到朋友圈。
     * 使用 [options] 设置是否自动填充文案、是否自动发布、回调函数等配置。
     */
    fun share(activity: Activity, images: Array<Bitmap>, options: Options) {
        if (!checkShareEnable(activity)) {
            return
        }
        WXShareMultiImageHelper.clearTmpFile(activity)
        startShare(activity, images.asList(), options)
    }

    /**
     * 分享图片 [images] 到朋友圈。
     * 使用 [options] 设置是否自动填充文案、是否自动发布、回调函数等配置。
     */
    fun share(activity: Activity, images: Array<File>, options: Options) {
        share(activity, images.map { BitmapFactory.decodeFile(it.path) }.toTypedArray(), options)
    }

    /**
     * 分享到微信朋友圈。
     *
     * @param activity [Context]
     * @param images 图片列表。
     * @param options [Options] 可选项。
     */
    private fun startShare(activity: Activity, images: List<Bitmap>, options: Options) {
        if (!options.isAutoFill || WXShareMultiImageHelper.isServiceEnabled(activity)) {
            internalShare(activity, images, options)
            return


					bout.close();
				}
				else if(o instanceof InputStream){
					InputStream is = (InputStream) o;
					bout = new java.io.ByteArrayOutputStream();
			    	byte [] readB = new byte[8192];
					int readByte = 0;
					while((readByte = is.read(readB))!= -1)
						bout.write(readB,0,readByte);
					is.close();
					bout.flush();
					bout.close();
				}
				else if(o instanceof String){
					s = (String) o;
					bout = new ByteArrayOutputStream();
					bout.write(s.getBytes());
					bout.flush();
					bout.close();
				}
				else{
					// Provo con codiceOriginale ma in jboss non funziona sempre
					jakarta.activation.DataHandler dh= bodyPart.getDataHandler();
			    	java.io.InputStream inputDH = dh.getInputStream();
					bout = new java.io.ByteArrayOutputStream();
			    	byte [] readB = new byte[8192];
					int readByte = 0;
					while((readByte = inputDH.read(readB))!= -1)
						bout.write(readB,0,readByte);
					inputDH.close();
					bout.flush();
					bout.close();
				}
			}
			else{
				// Provo con codiceOriginale ma in jboss non funziona sempre
				jakarta.activation.DataHandler dh= bodyPart.getDataHandler();
		    	java.io.InputStream inputDH = dh.getInputStream();
				bout = new java.io.ByteArrayOutputStream();
		    	byte [] readB = new byte[8192];
				int readByte = 0;
				while((readByte = inputDH.read(readB))!= -1)
					bout.write(readB,0,readByte);
				inputDH.close();
				bout.flush();
				bout.close();
			}
			// Per non perdere quanto letto
			// in rest con le api utilizzate non sembra necessario ricostruirlo come si fa in soap.
			// anche il caso del tunnel soap non esiste.
			if(convert && MailcapActivationReader.existsDataContentHandler(bodyPart.getContentType())){
				if(bodyPart.getContentType()!=null && bodyPart.getContentType().startsWith(HttpConstants.CONTENT_TYPE_PLAIN)){
					processContentTypeTextPlain(s, bodyPart, bout);
				}
				else{
					//bodyPart.setDataHandler(new jakarta.activation.DataHandler(bout.toByteArray(),bodyPart.getContentType()));
					// Nel caso sia xml si ottiene il seguente errore:
					//Invalid Object type = class [B. XmlDCH can only convert DataSource or Source to XML.
					// Si potrebbe vederlo di gestire come e' stato fatto per il rebuild dell'attachment su SOAP.
				}
			}
			if(s!=null){
				if(forceReturnAsByteArrayOutputStream) {
					return bout;
				}
				else {
					return s;
				}
			}else{
				return bout;
			}
		}catch(Exception e){
			throw new MessageException(e.getMessage(),e);
		}
	}

	private static void processContentTypeTextPlain(String s, BodyPart bodyPart, java.io.ByteArrayOutputStream bout) throws Exception {
		// Se siamo in text plain non devo fare nulla. Comunque non l'ho perso.
		// Se uso il codice sotto, poi si perde il content-type, non viene serializzato
		/*
		if(s!=null){
			bodyPart.setDataHandler(new jakarta.activation.DataHandler(s,bodyPart.getContentType()));
			//bodyPart.setContent(s,bodyPart.getContentType());
			//bodyPart.setText(s);
		}
		else{
			//bodyPart.setDataHandler(new jakarta.activation.DataHandler(bout.toByteArray(),bodyPart.getContentType()));
			//


elds) =>
                        fields.iter().map(|f| storage::Field {
                            name: f.name.clone(),
                            designation: f.designation.clone(),
                            value_length: f.value_length.clone()
                        }).collect::<Vec<_>>(),
                    Fields::Missing() => vec![],
                };
                // Patch selected item's fields
                if selected_item.uuid == i.uuid {
                    item_fields = new_fields.iter().map(|f| storage::Field {
                        name: f.name.clone(),
                        designation: f.designation.clone(),
                        value_length: f.value.len(),
                    }).collect::<Vec<_>>();
                }
                storage::Item {
                    uuid: i.uuid.clone(),
                    name: i.name.clone(),
                    url: i.url.clone(),
                    fields: item_fields,
                    tags: i.tags.clone(),
                }
            }).collect::<Vec<_>>();
        storage::Account {
            token: Some(match &a.token {
                Token::Stale(t) => t,
                Token::Fresh(t) => t,
            }.clone()),
            shorthand: a.shorthand.clone(),
            email: a.email.clone(),
            uuid: a.uuid.clone(),
            items: account_items,
        }
    }).collect();

    let cache = storage::Cache {
        accounts
    };

    debug!("{:?}", cache);

    cache::write(&cache)
}

fn format_field(field: &logical::FullField) -> String {
    format!("Designation: {}, Field name: {}, Value: {}", field.designation, field.name, field.value)
}

fn format_redacted_field(field: &logical::RedactedField) -> String {
    format!("Designation: {}, Field name: {}, Value: {}", field.designation, field.name, "*".repeat(field.value_length))
}

fn select<T, H: Fn(&T) -> String, F: FnOnce() -> Result<()>>(items: &Vec<T>, format: H, foo: F) -> Result<Option<&T>> {
    let input = items.iter()
        .map(|item| format(item))
        .join("\n");

    let result = dmenu::select(&input, foo)
        .with_context(||"Error running dmenu")?
        .map(|choice|
            items.iter().find(|&i| format(i) == choice)
        ).flatten();
    Ok(result)
}
use std::{ffi::CString, marker::PhantomData, ptr::NonNull, rc::Rc, slice};

use spine_sys::{
    spSkeleton, spSkeleton_create, spSkeleton_dispose, spSkeleton_findSlot,
    spSkeleton_setAttachment, spSkeleton_updateWorldTransform,
};

use crate::{
    atlas::AtlasPage,
    geometry::{Bounds, Vertex},
    result::Result,
};

use super::{attachment::Attachment, data::SkeletonData, slot::Slot};

pub const MAX_VERTICES_PER_ATTACHMENT: usize = 2048;

pub const OFFSET: usize = 0;
pub const STRIDE: usize = 2;

pub const QUAD_INDICES: [u16; 6] = [0, 1, 2, 2, 3, 0];

pub struct Skeleton {
    pub(crate) pointer: NonNull<spSkeleton>,
    pub(crate) _skeleton_data: Rc<SkeletonData>,
}

impl Skeleton {
    pub fn new(skeleton_data: &Rc<SkeletonData>) -> Self {
        let pointer = unsafe { spSkeleton_create(skeleton_data.pointer.as_ptr()) };

        Skeleton {
            pointer: NonNull::new(pointer).unwrap(),
            _skeleton_data: skeleton_data.clone(),
        }
    }

    pub fn get_bounds(&mut self) -> Bounds {
        let mut bounds = Bounds::dummy();

        self.for_each_mesh(|vertices, _| {
            for vertex in vertices {
                bounds.cover(vertex.in_position[0], vertex.in_position[1]);
            }

            Ok(())
        })
        .unwrap();

        bounds
    }

    pub fn set_x(&mut self, x: f


/ BSD-style license that can be found in the LICENSE file.

import "package:expect/expect.dart";

// Tests that local DateTime constructor works correctly around
// time zone changes.

void main() {
  // Find two points in time with different time zones.
  // Search linearly back from 2020-01-01 in steps of 60 days.
  // Stop if reaching 1970-01-01 (epoch) without finding anything.
  var time = DateTime.utc(2020, 1, 1).millisecondsSinceEpoch;
  var offset = DateTime.fromMillisecondsSinceEpoch(
    time,
  ).timeZoneOffset.inMilliseconds;
  var time2 = time;
  var offset2 = offset;
  // Whether the first change found moved the clock forward.
  bool changeForward = false;
  // 60 days.
  const delta = 60 * Duration.millisecondsPerDay;
  while (time2 > 0) {
    time2 -= delta;
    offset2 = DateTime.fromMillisecondsSinceEpoch(
      time2,
    ).timeZoneOffset.inMilliseconds;
    if (verbose) {
      print("Search: ${tz(time2, offset2)} - ${tz(time, offset)}");
    }
    if (offset2 != offset) {
      // Two different time zones found. Now find the precise (to the minute)
      // time where a change happened, and test that.
      test(findChange(time2, time));
      // Remember if the change moved the clock forward or backward.
      changeForward = offset2 < offset;
      break;
    }
  }
  time = time2;
  // Find a change in the other direction.
  // Keep iterating backwards to find another time zone
  // where the change was in the other direction.
  while (time > 0) {
    time -= delta;
    offset = DateTime.fromMillisecondsSinceEpoch(
      time,
    ).timeZoneOffset.inMilliseconds;
    if (verbose) {
      print("Search: ${tz(time2, offset2)} - ${tz(time, offset)}");
    }
    if (offset != offset2) {
      if ((offset < offset2) != changeForward) {
        test(findChange(time, time2));
        break;
      } else {
        // Another change in the same direction.
        // Probably rare, but move use this time
        // as end-point instead, so the binary search will be shorter.
        time2 = time;
        offset2 = offset;
      }
    }
  }
}

/// Tests that a local time zone change is correctly represented
/// by local time [DateTime] objects created from date-time values.
void test(TimeZoneChange change) {
  if (verbose) print("Test of $change");
  // Sanity check. The time zones match the [change] one second
  // before and after the change.
  var before = DateTime.fromMillisecondsSinceEpoch(
    change.msSinceEpoch - Duration.millisecondsPerSecond,
  );
  Expect.equals(change.msOffsetBefore, before.timeZoneOffset.inMilliseconds);
  var after = DateTime.fromMillisecondsSinceEpoch(
    change.msSinceEpoch + Duration.millisecondsPerSecond,
  );
  Expect.equals(change.msOffsetAfter, after.timeZoneOffset.inMilliseconds);

  if (verbose) print("From MS    : ${dtz(before)} --- ${dtz(after)}");

  // Create local DateTime objects for the same YMDHMS as the
  // values above. See that we pick the correct local time for them.

  // One second before the change, even if clock moves backwards,
  // we pick a value that is in the earlier time zone.
  var localBefore = DateTime(
    before.year,
    before.month,
    before.day,
    before.hour,
    before.minute,
    before.second,
  );
  Expect.equals(before, localBefore);


.039347 345.138668l266.976494 0 0 266.975471-266.976494 0 0-266.975471Z" p-id="8442" /><path d="M67.039347 656.610562l266.976494 0 0 266.976494-266.976494 0 0-266.976494Z" p-id="8443" /><path d="M378.511241 345.138668l266.976494 0 0 266.975471-266.976494 0 0-266.975471Z" p-id="8444" /><path d="M378.511241 656.610562l266.976494 0 0 266.976494-266.976494 0 0-266.976494Z" p-id="8445" /><path d="M689.983135 345.138668l266.976494 0 0 266.975471-266.976494 0 0-266.975471Z" p-id="8446" /><path d="M689.983135 656.610562l266.976494 0 0 266.976494-266.976494 0 0-266.976494Z" p-id="8447" /></symbol>'});s.a.add(r);t.default=r},"pYJ+":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n("Wc9H"),i=n.n(a),o=n("IaZV"),s=n.n(o),r=new i.a({id:"icon-wechat",use:"icon-wechat-usage",viewBox:"0 0 1024 1024",content:'<symbol class="icon" viewBox="0 0 1024 1024" id="icon-wechat"><defs><style type="text/css"></style></defs><path d="M669.029188 317.395814c10.181291 0 20.235686 0.748037 30.23789 1.865487C672.100256 192.728466 536.831031 98.730629 382.414962 98.730629c-172.618362 0-314.03484 117.659747-314.03484 267.066545 0 86.2422 47.044337 157.061129 125.674313 211.988112l-31.406554 94.467535 109.75511-55.05285c39.302708 7.78122 70.80955 15.765055 110.010947 15.765055 9.849726 0 19.624747-0.481977 29.323017-1.243317-6.144182-20.996197-9.69827-42.982954-9.69827-65.792449C402.040732 428.732551 519.845498 317.395814 669.029188 317.395814zM500.167537 232.256738c23.639342 0 39.302708 15.550161 39.302708 39.185464 0 23.536043-15.66439 39.300075-39.302708 39.300075-23.535984 0-47.146672-15.765055-47.146672-39.300075C453.021889 247.806899 476.632577 232.256738 500.167537 232.256738zM280.402504 310.7433c-23.537007 0-47.300174-15.765055-47.300174-39.300075 0-23.635303 23.76419-39.185464 47.300174-39.185464 23.53496 0 39.200373 15.550161 39.200373 39.185464C319.602877 294.978245 303.937464 310.7433 280.402504 310.7433z" p-id="9338" /><path d="M955.617831 562.14712c0-125.543298-125.622123-227.882104-266.733643-227.882104-149.41292 0-267.090791 102.33880


= new ArrayList<>(Arrays.asList(POINT_13.split(";")));

        for (DefaultEvent event : events) {
            List<String> wkt = new ArrayList<>();

            for (DefaultField field : event.getFields()) {
                if (field.getName().equals(GEO_FIELD))
                    wkt.add(field.getValueString());
            }

            // ensure that this is one of the ingested events
            Assert.assertTrue(pointList.removeAll(wkt));
        }

        Assert.assertEquals(0, pointList.size());
    }

    @Test
    public void valueListWithNegationTest() throws Exception {
        // @formatter:off
        String query = "((_Bounded_ = true) && (" + GEO_QUERY_FIELD + " >= '" + INDEX_1 + "' && " + GEO_QUERY_FIELD + " <= '" + INDEX_12 + "')) && " +
                "not(" + GEO_QUERY_FIELD + " == '" + INDEX_1 + "' || " + GEO_QUERY_FIELD + " == '" + INDEX_2 + "' || " + GEO_QUERY_FIELD + " == '" + INDEX_3 + "' || " +
                GEO_QUERY_FIELD + " == '" + INDEX_5 + "' || " + GEO_QUERY_FIELD + " == '" + INDEX_6 + "' || " + GEO_QUERY_FIELD + " == '" + INDEX_7 + "' || " +
                GEO_QUERY_FIELD + " == '" + INDEX_9 + "' || " + GEO_QUERY_FIELD + " == '" + INDEX_10 + "' || " + GEO_QUERY_FIELD + " == '" + INDEX_11 + "')";
        // @formatter:on

        maxOrExpansionThreshold = 1;
        maxOrFstThreshold = 100;
        maxOrRangeThreshold = 100;
        maxOrRangeIvarators = 1;
        maxRangesPerRangeIvarator = 1;

        List<DefaultEvent> events = getQueryResults(query);
        Assert.assertEquals(4, events.size());

        List<String> pointList = new ArrayList<>();
        pointList.addAll(Arrays.asList(POINT_4, POINT_8, POINT_12));
        pointList.addAll(Arrays.asList(POINT_13.split(";")));

        for (DefaultEvent event : events) {
            List<String> wkt = new ArrayList<>();

            for (DefaultField field : event.getFields()) {
                if (field.getName().equals(GEO_FIELD))
                    wkt.add(field.getValueString());
            }

            // ensure that this is one of the ingested events
            Assert.assertTrue(pointList.removeAll(wkt));
        }

        Assert.assertEquals(0, pointList.size());
    }

    @Test
    public void fstTest() throws Exception {
        // @formatter:off
        String query = "(" + GEO_QUERY_FIELD + " == '" + INDEX_1 + "' || " + GEO_QUERY_FIELD + " == '" + INDEX_2 + "' || " + GEO_QUERY_FIELD + " == '" + INDEX_3 + "' || " +
                "" + GEO_QUERY_FIELD + " == '" + INDEX_5 + "' || " + GEO_QUERY_FIELD + " == '" + INDEX_6 + "' || " + GEO_QUERY_FIELD + " == '" + INDEX_7 + "' || " +
                "" + GEO_QUERY_FIELD + " == '" + INDEX_9 + "' || " + GEO_QUERY_FIELD + " == '" + INDEX_10 + "' || " + GEO_QUERY_FIELD + " == '" + INDEX_11 + "')";
        // @formatter:on

        maxOrExpansionThreshold = 100;
        maxOrFstThreshold = 1;
        maxOrRangeThreshold = 100;
        maxOrRangeIvarators = 1;
        maxRangesPerRangeIvarator = 1;

        List<DefaultEvent> events = getQueryResults(query);
        Assert.assertEquals(9, events.size());

        List<String> pointList = new ArrayList<>();
        pointList.addAll(Arrays


ne_compare) {
            offset = 0;
        }
        line = line1;
    }
}

enum {
    VGA_DRAW_LINE2,
    VGA_DRAW_LINE2D2,
    VGA_DRAW_LINE4,
    VGA_DRAW_LINE4D2,
    VGA_DRAW_LINE8D2,
    VGA_DRAW_LINE8,
	VGA_DRAW_LINE15,
	VGA_DRAW_LINE15X2,
	VGA_DRAW_LINE16,
	VGA_DRAW_LINE16X2,
	VGA_DRAW_LINE24,
	VGA_DRAW_LINE24X2,
	VGA_DRAW_LINE32,
	VGA_DRAW_LINE32X2,
	VGA_DRAW_LINE_NB,
};

static vga_draw_line_func * const vga_draw_line_table[NB_DEPTHS * VGA_DRAW_LINE_NB] = {
    vga_draw_line2_8,
    vga_draw_line2_16,
    vga_draw_line2_16,
    vga_draw_line2_32,
    vga_draw_line2_32,
    vga_draw_line2_16,
    vga_draw_line2_16,

    vga_draw_line2d2_8,
    vga_draw_line2d2_16,
    vga_draw_line2d2_16,
    vga_draw_line2d2_32,
    vga_draw_line2d2_32,
    vga_draw_line2d2_16,
    vga_draw_line2d2_16,

    vga_draw_line4_8,
    vga_draw_line4_16,
    vga_draw_line4_16,
    vga_draw_line4_32,
    vga_draw_line4_32,
    vga_draw_line4_16,
    vga_draw_line4_16,

    vga_draw_line4d2_8,
    vga_draw_line4d2_16,
    vga_draw_line4d2_16,
    vga_draw_line4d2_32,
    vga_draw_line4d2_32,
    vga_draw_line4d2_16,
    vga_draw_line4d2_16,

    vga_draw_line8d2_8,
    vga_draw_line8d2_16,
    vga_draw_line8d2_16,
    vga_draw_line8d2_32,
    vga_draw_line8d2_32,
    vga_draw_line8d2_16,
    vga_draw_line8d2_16,

    vga_draw_line8_8,
    vga_draw_line8_16,
    vga_draw_line8_16,
    vga_draw_line8_32,
    vga_draw_line8_32,
    vga_draw_line8_16,
    vga_draw_line8_16,

	vga_draw_line15_8,
	vga_draw_line15_15,
	vga_draw_line15_16,
	vga_draw_line15_32,
	vga_draw_line15_32bgr,
	vga_draw_line15_15bgr,
	vga_draw_line15_16bgr,

	vga_draw_line15x2_8,
	vga_draw_line15x2_15,
	vga_draw_line15x2_16,
	vga_draw_line15x2_32,
	vga_draw_line15x2_32bgr,
	vga_draw_line15x2_15bgr,
	vga_draw_line15x2_16bgr,

	vga_draw_line16_8,
	vga_draw_line16_15,
	vga_draw_line16_16,
	vga_draw_line16_32,
	vga_draw_line16_32bgr,
	vga_draw_line16_15bgr,
	vga_draw_line16_16bgr,

	vga_draw_line16x2_8,
	vga_draw_line16x2_15,
	vga_draw_line16x2_16,
	vga_draw_line16x2_32,
	vga_draw_line16x2_32bgr,
	vga_draw_line16x2_15bgr,
	vga_draw_line16x2_16bgr,

	vga_draw_line24_8,
	vga_draw_line24_15,
	vga_draw_line24_16,
	vga_draw_line24_32,
	vga_draw_line24_32bgr,
	vga_draw_line24_15bgr,
	vga_draw_line24_16bgr,

	vga_draw_line24x2_8,
	vga_draw_line24x2_15,
	vga_draw_line24x2_16,
	vga_draw_line24


哈希索引(ahi)

*   预读(read ahead)

### 存储引擎选择

*   如果没有特别的需求，使用默认的`Innodb`即可。

*   MyISAM：以读写插入为主的应用程序，比如博客系统、新闻门户网站。

*   Innodb：更新（删除）操作频率也高，或者要保证数据的完整性；并发量高，支持事务和外键。比如OA自动化办公系统。

## 索引

### 什么是索引？

*   索引是一种特殊的文件(InnoDB数据表上的索引是表空间的一个组成部分)，它们包含着对数据表里所有记录的引用指针。

*   索引是一种数据结构。数据库索引，是数据库管理系统中一个排序的数据结构，以协助快速查询、更新数据库表中数据。索引的实现通常使用B树及其变种B+树。

*   更通俗的说，索引就相当于目录。为了方便查找书中的内容，通过对内容建立索引形成目录。索引是一个文件，它是要占据物理空间的。

### 索引有哪些优缺点？

**索引的优点**

*   可以大大加快数据的检索速度，这也是创建索引的最主要的原因。
*   通过使用索引，可以在查询的过程中，使用优化隐藏器，提高系统的性能。

**索引的缺点**

*   时间方面：创建索引和维护索引要耗费时间，具体地，当对表中的数据进行增加、删除和修改的时候，索引也要动态的维护，会降低增/改/删的执行效率；
*   空间方面：索引需要占物理空间。

### 怎么创建索引的，有什么好处，有哪些分类

1.  创建索引的语法：create index depe_unique_ide on depe(dept_no) tablespace idx_
2.  创建索引可以增加查询速度，唯一索引可以保证数据库列的一致性，可以确定表与表之间的连接
3.  索引的分类：                         逻辑分类：单列索引，复合索引，唯一索引，非唯一索引，函数索引                         物理分类：B数索引，反向键索引，位图索引

### 简述有哪些索引和作用

`索引的作用：通过索引可以大大的提高数据库的检索速度，改善数据库性能`


// PsychroLib (version 2.5.0) (https://github.com/psychrometrics/psychrolib).
// Copyright (c) 2018-2020 The PsychroLib Contributors. Licensed under the MIT License.

using System;
using NUnit.Framework;

namespace PsychroLib.Tests
{
    public class PsychroLibUnitTests
    {
        private void RelativeDifference(double actual, double expected, double eps, string description)
        {
            var absActual = Math.Abs(actual);
            var absExpected = Math.Abs(expected);
            var max = absActual > absExpected ? absActual : absExpected;

            var result = Math.Abs((actual - expected) / max);

            if (result > eps)
                throw new Exception(
                    $"expected {actual} to be close to {expected} with rel error {eps}.\r\n{description}");
        }

        [Test]
        public void GetTKelvinFromTCelsius()
        {
            var psy = new Psychrometrics(UnitSystem.SI);
            Assert.That(psy.GetTKelvinFromTCelsius(20), Is.EqualTo(293.15).Within(0.000001));
        }

        [Test]
        public void GetTCelsiusFromTKelvin()
        {
            var psy = new Psychrometrics(UnitSystem.SI);
            Assert.That(psy.GetTCelsiusFromTKelvin(293.15), Is.EqualTo(20).Within(0.000001));
        }

        [Test]
        public void GetTRankineFromTFahrenheit()
        {
            var psy = new Psychrometrics(UnitSystem.IP);
            psy.UnitSystem = UnitSystem.SI;
            Assert.That(psy.GetTRankineFromTFahrenheit(70), Is.EqualTo(529.67).Within(0.000001));
        }

        [Test]
        public void GetTFahrenheitFromTRankine()
        {
            var psy = new Psychrometrics(UnitSystem.IP);
            psy.UnitSystem = UnitSystem.SI;
            Assert.That(psy.GetTFahrenheitFromTRankine(529.67), Is.EqualTo(70).Within(0.000001));
        }

        /// <summary>
        /// Test saturation vapour pressure calculation
        /// The values are tested against the values published in Table 3 of ch. 1 of the 2017 ASHRAE Handbook - Fundamentals
        /// over the range [-148, +392] F & over the range [-100, +200] C
        /// ASHRAE's assertion is that the formula is within 300 ppm of the true values, which is true except for the value at -76 F
        /// </summary>
        [TestCase(UnitSystem.IP, -4, 0.014974, 0.0003)]
        [TestCase(UnitSystem.IP, 23, 0.058268, 0.0003)]
        [TestCase(UnitSystem.IP, 41, 0.12656, 0.0003)]
        [TestCase(UnitSystem.IP, 77, 0.45973, 0.0003)]
        [TestCase(UnitSystem.IP, 122, 1.79140, 0.0003)]
        [TestCase(UnitSystem.IP, 212, 14.7094, 0.0003)]
        [TestCase(UnitSystem.IP, 300, 67.0206, 0.0003)]
        [TestCase(UnitSystem.SI, -20, 103.24, 0.0003)]
        [TestCase(UnitSystem.SI, -5, 401.74, 0.0003)]
        [TestCase(UnitSystem.SI, 5, 872.6, 0.0003)]
        [TestCase(UnitSystem.SI, 25, 3169.7, 0.0003)]
        [TestCase(UnitSystem.SI, 50, 12351.3, 0.0003)]
        [TestCase(UnitSystem.SI, 100, 101418.0, 0.0003)]
        [TestCase(UnitSystem.SI, 150, 476101.4, 0.0003)]
        public void GetSatVapPres_Relative(
            UnitSystem system,
            double dryBulb,
            double expected,
            double within)
        {
            var psy = new Psychrometrics(system);


"Quest"] = "Free the Pridelings|0|44|38|28088|0|0",
		["Start"] = "47471|64|32|12.8|34.0",
		["End"] = "47471|64|32|12.8|34.0",
		["Objectives"] = 	{
			[1] = 		{
				"|64|35|11|32|15.03|3.34",
				"|64|35|10.5|32.5|20.04|3.34",
				"|64|35|9|33|35.07|20.04",
				"|64|35|9|36|40.08|3.34",
				"|64|35|9.5|36.5|40.08|3.34",
				"|64|35|10|37|45.09|6.68",
				"|64|35|10.5|38|40.08|3.34",
				"|64|35|12.5|38.5|20.04|3.34",
				"|64|35|13|39|15.03|3.34"
			}
		}
	},
	[28087] = {
		["Quest"] = "Death to all Trappers!|0|44|38|28088|0|0",
		["Start"] = "47471|64|32|12.8|34.0",
		["End"] = "47471|64|32|12.8|34.0",
		["Objectives"] = 	{
			[1] = 		{
				"|64|35|10.5|31|15.03|10.02",
				"|64|35|10|32.5|20.04|6.68",
				"|64|35|9.5|33.5|25.05|3.34",
				"|64|35|9|34|35.07|13.36",
				"|64|35|9.5|36|30.06|3.34",
				"|64|35|10|36.5|30.06|3.34",
				"|64|35|10.5|37|30.06|3.34",
				"|64|35|10.5|37.5|35.07|10.02",
				"|64|35|10.5|39|20.04|3.34",
				"|64|35|11|39.5|10.02|3.34"
			}
		}
	},
	[28088] = {
		["Quest"] = "Release Heartrazor|0|44|38|28098|0|0",
		["Start"] = "47471|64|32|12.8|34.0",
		["End"] = "47471|64|32|12.8|34.0",
		["Objectives"] = 	{
			[1] = 		{
				"|64|35|17.5|40.5|10.02|6.68"
			}
		}
	},
	[28098] = {
		["Quest"] = "The Twilight Skymaster|0|44|38|28124|0|0",
		["Start"] = "47471|64|32|12.8|34.0",
		["End"] = "47471|64|32|12.8|34.0",
		["Objectives"] = 	{
			[1] = 		{
				"|64|35|12.5|34|5.01|3.34"
			},
			[2] = 		{
				"|64|35|19|48|5.01|6.68"
			}
		}
	},
	[28099] = {
		["Quest"] = "Rasha'krak|0|48|46|0|0|0",
		["Start"] = "14625|32|32|38.1|27.0",
		["End"] = "14625|32|32|38.1|27.0",
		["Objectives"] = 	{
			[1] = 		{
				"|32|35|40.5|33.5|5.01|3.34",
				"|32|35|40|34|15.03|3.34",
				"|32|35|40|34.5|20.04|3.34",
				"|32|35|40|35|25.05|3.


 .sparkline12-graph, .tree-viewer-area .sparkline13-graph, .tree-viewer-area .sparkline14-graph{
	text-align:left;
}
/*----------------------------------------*/
/*  36.  Static Table css
/*----------------------------------------*/
.sparkline7-graph .static-table-list, .sparkline8-graph .static-table-list, .sparkline9-graph .static-table-list, .sparkline11-graph .static-table-list, .sparkline12-graph .static-table-list, .sparkline13-graph .static-table-list, .sparkline14-graph .static-table-list{
	text-align:left;
}
.static-table-list .table{
	margin-bottom:0px;
}
.static-table-list .table>thead>tr>th{
	border-bottom:1px solid #ddd;
}
.sparkle-table>tbody>tr:nth-of-type(odd) {
    background-color: #f9f9f9;
}
.border-table{
	border: 1px solid #EBEBEB;
}
.border-table > thead > tr > th{
	background-color: #F5F5F6;
}
.hover-table>tbody>tr:hover {
    background-color: #f5f5f5;
}
/*----------------------------------------*/
/*  37.  Basic Form css
/*----------------------------------------*/
.sparkline8-graph .basic-login-inner, .sparkline8-graph .login-social-inner, .sparkline9-graph .basic-login-form-ad, .sparkline11-graph .basic-login-form-ad{
	text-align:left;
}
.form-group-inner {
    margin-bottom: 15px;
}
.form-group-inner label{
	font-size:14px;
	color:#303030;
}
.form-group-inner input[type="email"], .form-group-inner input[type="password"], .form-group-inner input[type="text"], .form-select-list .custom-select-value{
	font-size:14px;
	color:#303030;
	border:1px solid #ddd;
	outline:none;
	border-radius:0px;
	box-shadow: none;
}
.form-group-inner input[type="email"]:focus, .form-group-inner input[type="password"]:focus, .form-group-inner input[type="text"]:focus, .form-select-list .custom-select-value:focus{
	border:1px solid #ff9966;
	outline:none;
	border-radius:0px;
	box-shadow: none;
}
.icheckbox_square-green, .iradio_square-green {
    display: inline-block;
    vertical-align: middle;
    margin: 0;
    padding: 0;
    width: 22px;
    height: 22px;
    background: url(img/green1.png) no-repeat;
    border: none;
    cursor: pointer;
}
.icheckbox_square-green {
    background-position: 0 0;
}
.icheckbox_square-green.hover {
    background-position: -22px 0;
}
.icheckbox_square-green.checked {
    background-position: -44px 0;
	transition: all 0.3s ease 0s;
}
.login-btn-inner .check-label{
	margin-left:5px;
}
.login-btn-inner .label-check-inner{
	margin:0px;
	padding-top:5px;
}
.login-btn-inner .login-submit-cs{
	background: linear-gradient(to bottom, #ff9966 0%, #d75151 100%);
    border-color: #ff9966;
	font-size:14px;
	font-weight:400;
	border-radius:0px;
}
.login-btn-inner .btn-primary.active.focus, .login-btn-inner .btn-primary.act


 let delta_y = y2 as f32 - y1 as f32;
        let mut error = 0.0;
        let delta_error = (delta_y / delta_x).abs();

        let y_increment: i32 = if y2 > y1 { 1 } else { -1 };
        let mut y = y1 as usize;
        let (x1,x2) = (x1 as usize,x2 as usize);
        for x in x1..x2 {
            assert!(x < width);
            assert!(y < height);

            func(x,y);

            error += delta_error;
            while error >= 0.5 {
                func(x,y);
                if y_increment != -1 || y > 0 {
                    y = (y as i32 + y_increment) as usize;
                }
                error -= 1.0;
            }
        }
    }

    pub fn line(&self,buffer: &mut [u8],width: usize,height: usize,x1: i32,y1: i32,x2: i32,y2: i32) {
        Self::line_foreach(width,height,x1,y1,x2,y2,|x,y| {
            let index: usize = (y * width + x) * 3;
            buffer[index + 0] = self.pen.red;
            buffer[index + 1] = self.pen.green;
            buffer[index + 2] = self.pen.blue;
        });
    }
 }

use ndarray::{arr1, stack, Array1, Array2, Axis};

use gauss_newton_rs::ndarray_ver::{GaussNewton, Problem};

struct SampleProblem {
    x: Array1<f32>,
    s: Array1<f32>,
    v: Array1<f32>,
}

impl SampleProblem {
    fn new() -> Self {
        let x = arr1(&[1.5, 1.5]);
        let s = arr1(&[0.038, 0.194, 0.425, 0.626, 1.253, 2.500, 3.740]);
        let v = arr1(&[0.050, 0.127, 0.094, 0.2122, 0.2729, 0.2665, 0.3317]);
        Self { x, s, v }
    }
}

impl Problem for SampleProblem {
    type T = f32;

    fn params(&self) -> &Array1<Self::T> {
        &self.x
    }

    fn update_params(&mut self, delta_params: &Array1<Self::T>) {
        self.x += delta_params;
    }

    fn error_vector(&self) -> Array1<Self::T> {
        let predicted = &self.s * self.x[0] / (&self.s + self.x[1]);
        &self.v - &predicted
    }

    fn jacobian(&self) -> Array2<Self::T> {
        let c1 = -&self.s / (&self.s + self.x[1]);
        let c2 = &self.s * self.x[0] / (&self.s + self.x[1]).mapv(|a| a.powi(2));
        let jacobian = stack![Axis(1), c1.insert_axis(Axis(1)), c2.insert_axis(Axis(1))];
        jacobian
    }
}

#[test]
fn test_gauss_newton_ndarray() {
    let problem = SampleProblem::new();
    let begin_squared_error = problem.squared_error();

    let mut gauss_newton = GaussNewton::new(problem);
    gauss_newton.solve_until_converged();

    let end_squared_error = gauss_newton.problem.squared_error();

    println!("{} iter(s)", gauss_newton.iters());
    assert!(begin_squared_error > end_squared_error);
    assert!(0.1 > end_squared_error);
    assert!(gauss_newton
        .problem
        .x
        .all_close(&arr1(&[0.362, 0.556]), 1e-3));
}
<reponame>bk-rs/pulsar-rs<filename>pulsar-binary-protocol-spec/src/compression/zlib.rs
use std::io::{self, Write};

use flate2::{
    write::{ZlibDecoder, ZlibEncoder},
    Compression,
};


#pragma once

// Wrap tensor operation outputs as PyObject*

#include <ATen/ATen.h>
#include "torch/csrc/python_headers.h"
#include <tuple>

#include "torch/csrc/Dtype.h"
#include "torch/csrc/Layout.h"
#include "torch/csrc/autograd/python_variable.h"
#include "torch/csrc/autograd/variable.h"
#include "torch/csrc/utils/python_numbers.h"

namespace torch { namespace autograd { namespace utils {

inline PyObject* wrap(at::Tensor tensor) {
  return THPVariable_Wrap(Variable(std::move(tensor)));
}

inline PyObject* wrap(std::tuple<at::Tensor, at::Tensor> tensors) {
  auto r = THPObjectPtr{PyTuple_New(2)};
  if (!r) throw python_error();
  PyTuple_SET_ITEM(r.get(), 0, wrap(std::get<0>(tensors)));
  PyTuple_SET_ITEM(r.get(), 1, wrap(std::get<1>(tensors)));
  return r.release();
}

inline PyObject* wrap(std::tuple<at::Tensor, at::Tensor, at::Tensor> tensors) {
  auto r = THPObjectPtr{PyTuple_New(3)};
  if (!r) throw python_error();
  PyTuple_SET_ITEM(r.get(), 0, wrap(std::move(std::get<0>(tensors))));
  PyTuple_SET_ITEM(r.get(), 1, wrap(std::move(std::get<1>(tensors))));
  PyTuple_SET_ITEM(r.get(), 2, wrap(std::move(std::get<2>(tensors))));
  return r.release();
}

inline PyObject* wrap(std::tuple<at::Tensor, at::Tensor, at::Tensor, at::Tensor> tensors) {
  auto r = THPObjectPtr{PyTuple_New(4)};
  if (!r) throw python_error();
  PyTuple_SET_ITEM(r.get(), 0, wrap(std::move(std::get<0>(tensors))));
  PyTuple_SET_ITEM(r.get(), 1, wrap(std::move(std::get<1>(tensors))));
  PyTuple_SET_ITEM(r.get(), 2, wrap(std::move(std::get<2>(tensors))));
  PyTuple_SET_ITEM(r.get(), 3, wrap(std::move(std::get<3>(tensors))));
  return r.release();
}

inline PyObject* wrap(std::tuple<at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor> tensors) {
  auto r = THPObjectPtr{PyTuple_New(5)};
  if (!r) throw python_error();
  PyTuple_SET_ITEM(r.get(), 0, wrap(std::move(std::get<0>(tensors))));
  PyTuple_SET_ITEM(r.get(), 1, wrap(std::move(std::get<1>(tensors))));
  PyTuple_SET_ITEM(r.get(), 2, wrap(std::move(std::get<2>(tensors))));
  PyTuple_SET_ITEM(r.get(), 3, wrap(std::move(std::get<3>(tensors))));
  PyTuple_SET_ITEM(r.get(), 4, wrap(std::move(std::get<4>(tensors))));
  return r.release();
}

inline PyObject* wrap(at::TensorList tl) {
  auto r = THPObjectPtr{PyTuple_New(tl.size())};
  if (!r) throw python_error();
  for (size_t i = 0; i < tl.size(); ++i) {
    PyTuple_SET_ITEM(r.get(), i, wrap(tl[i]));
  }
  return r.release();
}

inline PyObject* wrap(bool value) {
  if (value) {
    Py_RETURN_TRUE;
  } else {
    Py_RETURN_FALSE;
  }
}

inline PyObject* wrap(int64_t value) {
  return THPUtils_packInt64(value);
}

inline PyObject* wrap(double value) {
  return PyFloat_FromDouble(value);
}

inline PyObject* wrap(void* value) {
  return THPUtils_packInt64(reinterpret_cast<intptr_t>(value));
}

inline PyObject* wrap(at::Scalar scalar) {
  return wrap(scalar.toTensor());
}

inline PyObject* wrap(THPDtype *dtype) {
  Py_INCREF(dtype);
  return (PyObject*)dtype;
}

inline PyObject* wrap(THPLayout *layout) {
  Py_INCREF(layout);
  return (PyObject*)layout;
}

}}} // namespace torch::autograd::utils


-image-overlay {
    font-size: 4em;
}
.modifier-card-tiny .modifier-card-label {
    font-size: 0.9em;
}
.modifier-card:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 16px 5px rgba(0, 0, 0, 0.25);
}
.modifier-card-image-container {
    border-radius: 5px 5px 0 0;
    width: inherit;
    height: 100%;
    background-color: rgba(0, 0, 0, .2);
    grid-area: modifier-card-image-container;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgb(255 255 255 / 8%);
}
.modifier-card-image-container img {
    width: inherit;
    height: 100%;
    border-radius: 5px 5px 0 0;
}
.modifier-card-image-container * {
    position: absolute;
    text-align: center;
}
.modifier-card-container {
    text-align: center;
    background-color: rgba(0,0,0,0.5);
    border-radius: 0 0 5px 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    grid-area: modifier-card-container;
    font-weight: 100;
    font-size: .9em;
    width: inherit;
}
.modifier-card-label {
    padding: 4px;
    word-break: break-word;
    text-transform: capitalize;
}
.modifier-card-image-overlay {
    width: inherit;
    height: inherit;
    background-color: rgb(0 0 0 / 50%);
    z-index: 2;
    position: absolute;
    border-radius: 5px 5px 0 0;
    opacity: 0;
    font-size: 4em;
    font-weight: 900;
    color: rgb(255 255 255 / 50%);
    display: flex;
    align-items: center;
    justify-content: center;
}
.modifier-card-overlay {
    width: inherit;
    height: inherit;
    position: absolute;
    z-index: 3;
}
.modifier-card-active .modifier-card-overlay {
    background-color: rgb(169 78 241 / 40%);
}
.modifier-card:hover > .modifier-card-image-container .modifier-card-image-overlay {
    opacity: 1;
}
.modifier-card:hover > .modifier-card-image-container img {
    filter: blur(.1em);
}
.modifier-card:active {
    transform: scale(0.95);
    box-shadow: 0 5px 16px 5px rgba(0, 0, 0, 0.5);
}
.modifier-card-active {
    border: 2px solid rgb(179 82 255 / 94%);
    box-shadow: 0 0px 10px 0 rgb(170 0 229 / 58%);
}
#modifier-card-size-slider {
    width: 6em;
    height: 4pt;
    vertical-align: middle;
}
#modifier-settings-config textarea {
    margin-left: 5%;
    margin-top: 2ex;


ize / NarrowSize;
  unsigned LeftoverSize = Size - NumParts * NarrowSize;
  assert(Size > NarrowSize);

  if (LeftoverSize == 0)
    return {NumParts, 0};

  if (NarrowTy.isVector()) {
    unsigned EltSize = OrigTy.getScalarSizeInBits();
    if (LeftoverSize % EltSize != 0)
      return {-1, -1};
    LeftoverTy = LLT::scalarOrVector(LeftoverSize / EltSize, EltSize);
  } else {
    LeftoverTy = LLT::scalar(LeftoverSize);
  }

  int NumLeftover = LeftoverSize / LeftoverTy.getSizeInBits();
  return std::make_pair(NumParts, NumLeftover);
}

LegalizerHelper::LegalizerHelper(MachineFunction &MF,
                                 GISelChangeObserver &Observer,
                                 MachineIRBuilder &Builder)
    : MIRBuilder(Builder), MRI(MF.getRegInfo()),
      LI(*MF.getSubtarget().getLegalizerInfo()), Observer(Observer) {
  MIRBuilder.setMF(MF);
  MIRBuilder.setChangeObserver(Observer);
}

LegalizerHelper::LegalizerHelper(MachineFunction &MF, const LegalizerInfo &LI,
                                 GISelChangeObserver &Observer,
                                 MachineIRBuilder &B)
    : MIRBuilder(B), MRI(MF.getRegInfo()), LI(LI), Observer(Observer) {
  MIRBuilder.setMF(MF);
  MIRBuilder.setChangeObserver(Observer);
}
LegalizerHelper::LegalizeResult
LegalizerHelper::legalizeInstrStep(MachineInstr &MI) {
  LLVM_DEBUG(dbgs() << "Legalizing: "; MI.print(dbgs()));

  if (MI.getOpcode() == TargetOpcode::G_INTRINSIC ||
      MI.getOpcode() == TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS)
    return LI.legalizeIntrinsic(MI, MRI, MIRBuilder) ? Legalized
                                                     : UnableToLegalize;
  auto Step = LI.getAction(MI, MRI);
  switch (Step.Action) {
  case Legal:
    LLVM_DEBUG(dbgs() << ".. Already legal\n");
    return AlreadyLegal;
  case Libcall:
    LLVM_DEBUG(dbgs() << ".. Convert to libcall\n");
    return libcall(MI);
  case NarrowScalar:
    LLVM_DEBUG(dbgs() << ".. Narrow scalar\n");
    return narrowScalar(MI, Step.TypeIdx, Step.NewType);
  case WidenScalar:
    LLVM_DEBUG(dbgs() << ".. Widen scalar\n");
    return widenScalar(MI, Step.TypeIdx, Step.NewType);
  case Lower:
    LLVM_DEBUG(dbgs() << ".. Lower\n");
    return lower(MI, Step.TypeIdx, Step.NewType);
  case FewerElements:
    LLVM_DEBUG(dbgs() << ".. Reduce number of elements\n");
    return fewerElementsVector(MI, Step.TypeIdx, Step.NewType);
  case MoreElements:
    LLVM_DEBUG(dbgs() << ".. Increase number of elements\n");
    return moreElementsVector(MI, Step.TypeIdx, Step.NewType);
  case Custom:
    LLVM_DEBUG(dbgs() << ".. Custom legalization\n");
    return LI.legalizeCustom(MI, MRI, MIRBuilder, Observer) ? Legalized
                                                            : UnableToLegalize;
  default:
    LLVM_DEBUG(dbgs() << ".. Unable to legalize\n");
    return UnableToLegalize;
  }
}

void LegalizerHelper::extractParts(Register Reg, LLT Ty, int NumParts,
                                   SmallVectorImpl<Register> &VRegs) {
  for (int i = 0; i < NumParts; ++i)
    VRegs.push_back(MRI.createGenericVirtualRegister(Ty));
  MIRBuilder.buildUnmerge(VRegs, Reg);
}

bool LegalizerHelper::extractParts(Register Reg, LLT RegTy,
                                   LLT MainTy, LLT &LeftoverTy