text:
package com.wmjmc.reactspeech;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

/**
 * Created by JMC on 20/01/2016.
 */
public final class LocaleConstants {

    private LocaleConstants() { }

    public static final String LOCALE_DEFAULT = "DEFAULT";

    /****** MEU LINDO PORTUGAL *******/
    public static final String LOCALE_PT = "PT";
    public static final String LOCALE_PORTUGUESE = "PORTUGUESE";
    /*********************************/

    /****** ZUEIRA *******/
    public static final String LOCALE_BR = "BR";
    public static final String LOCALE_PORTUGUESE_BRAZIL = "PORTUGUESE_BRAZIL";
    /*********************************/

    public static final String LOCALE_BULGARIAN = "BULGARIAN";

    public static final String LOCALE_CANADA = "CANADA";
    public static final String LOCALE_CANADA_FRENCH = "CANADA_FRENCH";
    public static final String LOCALE_CZECH = "CZECH";
    public static final String LOCALE_CROATIAN = "CROATIAN";
    public static final String LOCALE_CHINA = "CHINA";
    public static final String LOCALE_CHINESE = "CHINESE";
    public static final String LOCALE_SIMPLIFIED_CHINESE = "SIMPLIFIED_CHINESE";
    public static final String LOCALE_TRADITIONAL_CHINESE = "TRADITIONAL_CHINESE";

    public static final String LOCALE_DUTCH = "DUTCH";
    public static final String LOCALE_DUTCH_BELGIUM = "DUTCH_BELGIUM";

    public static final String LOCALE_UK = "UK";
    public static final String LOCALE_US = "US";
    public static final String LOCALE_ENGLISH = "ENGLISH";
    public static final String LOCALE_AUSTRALIA = "AUSTRALIA";
    public static final String LOCALE_NEW_ZEALAND = "NEW_ZEALAND";
    public static final String LOCALE_SINGAPORE = "SINGAPORE";
    public static final String LOCALE_ENGLISH_INDIA = "ENGLISH_INDIA";
    public static final String LOCALE_ENGLISH_IRELAND = "ENGLISH_IRELAND";
    public static final String LOCALE_ENGLISH_ZIMBABWE = "ENGLISH_ZIMBABWE";

    public static final String LOCALE_ARABIC_EGYPT = "ARABIC_EGYPT";
    public static final String LOCALE_ARABIC_ISRAEL = "ARABIC_ISRAEL";

    public static final String LOCALE_FRANCE = "FRANCE";
    public static final String LOCALE_FRENCH = "FRENCH";
    public static final String LOCALE_FRENCH_BELGIUM = "FRENCH_BELGIUM";
    public static final String LOCALE_FRENCH_SWITZERLAND = "SWITZERLAND";

    public static final String LOCALE_FINNISH = "FINNISH";

    public static final String LOCALE_DANISH = "DANISH";

    public static final String LOCALE_GERMANY = "GERMANY";
    public static final String LOCALE_GERMAN = "GERMAN";
    public static final String LOCALE_GERMAN_SWITZERLAND = "GERMAN_SWITZERLAND";
    public static final String LOCALE_GREEK = "GREEK";

    public static final String LOCALE_HEBREW = "HEBREW";
    public static final String LOCALE_HINDI = "HINDI";
    public static final String LOCALE_HUNGARIAN = "HUNGARIAN";

    public static final String LOCALE_ITALY = "ITALY";
    public static final String LOCALE_ITALIAN = "ITALIAN";
    public static final String LOCALE_ITALIAN_SWITZERLAND = "ITALIAN_SWITZERLAND";
    public static final String LOCALE_INDONESIAN = "INDONESIAN";

    public static final String LOCALE_LATVIAN = "LATVIAN";
    public static final String LOCALE_LITHUANIAN = "LITHUANIAN";

    public static final String LOCALE_NORWEGIAN = "NORWEGIAN";

    public static final String LOCALE_JAPAN = "JAPAN";
    public static final String LOCALE_JAPANESE = "JAPANESE";

    public static final String LOCALE_POLISH = "POLISH";

    public static final String LOCALE_RUSSIAN = "RUSSIAN";
    public static final String LOCALE_ROMANIAN = "ROMANIAN";

    public static final String LOCALE_SPANISH = "SPANISH";
    public static final String LOCALE_CATALAN = "CATALAN";
    public static final String LOCALE_SPANISH_US = "SPANISH_US";

    public static final String LOCALE_SERBIAN = "SERBIAN";
    public static final String LOCALE_SLOVAK = "SLOVAK";
    public static final String LOCALE_SLOVENIAN = "SLOVENIAN";
    public static final String LOCALE_SWEDISH = "SWEDISH";

    public static final String LOCALE_KOREA = "KOREA";
    public static final String LOCALE_KOREAN = "KOREAN";

    public static final String LOCALE_TAIWAN = "TAIWAN";
    public static final String LOCALE_TAGALOG_PHILIPPINES = "TAGALOG_PHILIPPINES";
    public static final String LOCALE_THAI = "THAI";
    public static final String LOCALE_TURKISH = "TURKISH";

    public static final String LOCALE_UKRAINIAN = "UKRAINIAN";

    public static final String LOCALE_VIETNAMESE = "VIETNAMESE";

    public static Map<String, Object> getConstants() {
        final Map<String, Object> constants = new HashMap<>();

        constants.put(LOCALE_DEFAULT, Locale.getDefault().toString());

        /****** MEU LINDO PORTUGAL *******/
        constants.put(LOCALE_PT, "pt_PT");
        constants.put(LOCALE_PORTUGUESE, "pt_PT");
        /*********************************/

        /****** ZUEIRA *******/
        constants.put(LOCALE_BR, "pt_BR");
        constants.put(LOCALE_PORTUGUESE_BRAZIL, "pt_BR");
        /*********************************/

        constants.put(LOCALE_BULGARIAN, "bg_BG");

        constants.put(LOCALE_CZECH, "cs_CZ");
        constants.put(LOCALE_CROATIAN, "hr_HR");

        constants.put(LOCALE_CANADA, Locale.CANADA.toString());
        constants.put(LOCALE_CANADA_FRENCH, Locale.CANADA_FRENCH.toString());

        constants.put(LOCALE_CHINA, Locale.CHINA.toString());
        constants.put(LOCALE_CHINESE, Locale.CHINESE.toString());
        constants.put(LOCALE_SIMPLIFIED_CHINESE, Locale.SIMPLIFIED_CHINESE.toString());
        constants.put(LOCALE_TRADITIONAL_CHINESE, Locale.TRADITIONAL_CHINESE.toString());

        constants.put(LOCALE_DUTCH, "nl_NL");
        constants.put(LOCALE_DUTCH_BELGIUM, "nl_BE");

        constants.put(LOCALE_UK, Locale.UK.toString());
        constants.put(LOCALE_US, Locale.US.toString());
        constants.put(LOCALE_ENGLISH, Locale.ENGLISH.toString());
        constants.put(LOCALE_AUSTRALIA, "en_AU");
        constants.put(LOCALE_NEW_ZEALAND, "en_NZ");
        constants.put(LOCALE_SINGAPORE, "en_SG");
        constants.put(LOCALE_ENGLISH_INDIA, "en_IN");
        constants.put(LOCALE_ENGLISH_IRELAND, "en_IE");
        constants.put(LOCALE_ENGLISH_ZIMBABWE, "en_ZA");

        constants.put(LOCALE_ARABIC_EGYPT, "ar_EG");
        constants.put(LOCALE_ARABIC_ISRAEL, "ar_IL");

        constants.put(LOCALE_FRANCE, Locale.FRANCE.toString());
        constants.put(LOCALE_FRENCH, Locale.FRENCH.toString());
        constants.put(LOCALE_FRENCH_BELGIUM, "fr_BE");
        constants.put(LOCALE_FRENCH_SWITZERLAND, "fr_CH");
        constants.put(LOCALE_FINNISH, "fi_FI");

        constants.put(LOCALE_DANISH, "da_DK");

        constants.put(LOCALE_GERMANY, Locale.GERMANY.toString());
        constants.put(LOCALE_GERMAN, Locale.GERMAN.toString());
        constants.put(LOCALE_GERMAN_SWITZERLAND, "de_CH");
        constants.put(LOCALE_GREEK, "el_GR");

        constants.put(LOCALE_HEBREW, "iw_IL");
        constants.put(LOCALE_HINDI, "hi_IN");
        constants.put(LOCALE_HUNGARIAN, "hu_HU");

        constants.put(LOCALE_ITALY, Locale.ITALY.toString());
        constants.put(LOCALE_ITALIAN, Locale.ITALIAN.toString());
        constants.put(LOCALE_ITALIAN_SWITZERLAND, "it_CH");
        constants.put(LOCALE_INDONESIAN, "in_ID");

        constants.put(LOCALE_LATVIAN, "lv_LV");
        constants.put(LOCALE_LITHUANIAN, "lt_LT");

        constants.put(LOCALE_NORWEGIAN, "nb_NO");

        constants.put(LOCALE_JAPAN, Locale.JAPAN.toString());
        constants.put(LOCALE_JAPANESE, Locale.JAPANESE.toString());

        constants.put(LOCALE_POLISH, "pl_PL");
        constants.put(LOCALE_RUSSIAN, "ru_RU");
        constants.put(LOCALE_ROMANIAN, "ro_RO");

        constants.put(LOCALE_SPANISH, "es_ES");
        constants.put(LOCALE_CATALAN, "ca_ES");
        constants.put(LOCALE_SPANISH_US, "es_US");
        constants.put(LOCALE_SERBIAN, "sr_RS");
        constants.put(LOCALE_SLOVAK, "sk_SK");
        constants.put(LOCALE_SLOVENIAN, "sl_SI");
        constants.put(LOCALE_SWEDISH, "sv_SE");

        constants.put(LOCALE_KOREA, Locale.KOREA.toString());
        constants.put(LOCALE_KOREAN, Locale.KOREAN.toString());

        constants.put(LOCALE_TAIWAN, Locale.TAIWAN.toString());
        constants.put(LOCALE_TAGALOG_PHILIPPINES, "tl_PH");
        constants.put(LOCALE_THAI, "th_TH");
        constants.put(LOCALE_TURKISH, "tr_TR");

        constants.put(LOCALE_UKRAINIAN, "uk_UA");

        constants.put(LOCALE_VIETNAMESE, "vi_VN");

        return constants;
    }
}


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Ophiobolus barbatus Pat.

### Remarks
null

redpajama_set_name: RedPajamaGithub


text:
// This file is part of JavaSMT,
// an API wrapper for a collection of SMT solvers:
// https://github.com/sosy-lab/java-smt
//
// SPDX-FileCopyrightText: 2020 Dirk Beyer <https://www.sosy-lab.org>
//
// SPDX-License-Identifier: Apache-2.0

package org.sosy_lab.java_smt.solvers.boolector;

import static com.google.common.truth.Truth.assertThat;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.util.Arrays;
import org.junit.After;
import org.junit.AssumptionViolatedException;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.sosy_lab.common.NativeLibraries;
import org.sosy_lab.common.ShutdownNotifier;
import org.sosy_lab.common.configuration.Configuration;
import org.sosy_lab.common.configuration.ConfigurationBuilder;
import org.sosy_lab.common.configuration.InvalidConfigurationException;
import org.sosy_lab.java_smt.api.BooleanFormula;
import org.sosy_lab.java_smt.api.BooleanFormulaManager;
import org.sosy_lab.java_smt.api.FormulaManager;
import org.sosy_lab.java_smt.api.ProverEnvironment;
import org.sosy_lab.java_smt.api.SolverException;
import org.sosy_lab.java_smt.solvers.boolector.BoolectorSolverContext.SatSolver;

public class BoolectorNativeApiTest {

  private long btor;

  @BeforeClass
  public static void load() {
    try {
      NativeLibraries.loadLibrary("boolector");
    } catch (UnsatisfiedLinkError e) {
      throw new AssumptionViolatedException("Boolector is not available", e);
    }
  }

  @Before
  public void createEnvironment() {
    btor = BtorJNI.boolector_new();
  }

  @After
  public void freeEnvironment() {
    BtorJNI.boolector_delete(btor);
  }

  // some options have a different name in the API that their internal representation.
  // TODO why?
  // Because for some reason the return value of the get_opt method is not the correct option name
  // (check btortypes.h for correct options)
  private static final ImmutableMap<String, String> ALLOWED_DIFFS =
      ImmutableMap.<String, String>builder()
          .put("BTOR_OPT_ACKERMANNIZE", "BTOR_OPT_ACKERMANN")
          .put("BTOR_OPT_QUANT_DUAL", "BTOR_OPT_QUANT_DUAL_SOLVER")
          .put("BTOR_OPT_QUANT_SYNTHLIMIT", "BTOR_OPT_QUANT_SYNTH_LIMIT")
          .put("BTOR_OPT_QUANT_SYNTHQI", "BTOR_OPT_QUANT_SYNTH_QI")
          .put("BTOR_OPT_QUANT_MS", "BTOR_OPT_QUANT_MINISCOPE")
          .put("BTOR_OPT_QUANT_SYNTHCOMPLETE", "BTOR_OPT_QUANT_SYNTH_ITE_COMPLETE")
          .put("BTOR_OPT_BETA_REDUCE", "BTOR_OPT_BETA_REDUCE")
          .put("BTOR_OPT_DUMP_DIMACS", "BTOR_OPT_PRINT_DIMACS")
          .put("BTOR_OPT_SIMP_NORM_ADDS", "BTOR_OPT_SIMP_NORMAMLIZE_ADDERS")
          .buildOrThrow();

  @Test
  public void optionNameTest() {
    // check whether our enum is identical to Boolector's internal enum
    for (BtorOption option : BtorOption.values()) {
      String optName = BtorJNI.boolector_get_opt_lng(btor, option.getValue());
      String converted = "BTOR_OPT_" + optName.replace("-", "_").replace(":", "_").toUpperCase();
      assertThat(option.name()).isEqualTo(ALLOWED_DIFFS.getOrDefault(converted, converted));
    }
  }

  @Test
  public void satSolverTest() {
    // check whether all sat solvers are available
    for (SatSolver satSolver : SatSolver.values()) {
      long btor1 = BtorJNI.boolector_new();
      BtorJNI.boolector_set_sat_solver(btor1, satSolver.name().toLowerCase());
      long newVar = BtorJNI.boolector_var(btor1, BtorJNI.boolector_bool_sort(btor1), "x");
      BtorJNI.boolector_assert(btor1, newVar);
      int result = BtorJNI.boolector_sat(btor1);
      assertThat(result).isEqualTo(BtorJNI.BTOR_RESULT_SAT_get());
      BtorJNI.boolector_delete(btor1);
    }
  }

  /**
   * For each available solver, we build a context and solver a small formula.
   *
   * <p>This should be sufficient to test whether the sat-solver can be loaded.
   */
  @Test
  public void satSolverBackendTest()
      throws InvalidConfigurationException, InterruptedException, SolverException {

    for (SatSolver satsolver : BoolectorSolverContext.SatSolver.values()) {
      ConfigurationBuilder config =
          Configuration.builder().setOption("solver.boolector.satSolver", satsolver.name());
      try (BoolectorSolverContext context =
          BoolectorSolverContext.create(
              config.build(),
              ShutdownNotifier.createDummy(),
              null,
              1,
              NativeLibraries::loadLibrary)) {
        BooleanFormulaManager bfmgr = context.getFormulaManager().getBooleanFormulaManager();
        BooleanFormula fa = bfmgr.makeVariable("a");
        BooleanFormula fb = bfmgr.makeVariable("b");
        BooleanFormula fc = bfmgr.makeVariable("c");
        BooleanFormula f1 = bfmgr.or(fa, fb, fc);
        BooleanFormula f2 = bfmgr.and(fa, fb, fc);
        try (ProverEnvironment prover = context.newProverEnvironment()) {
          prover.addConstraint(bfmgr.equivalence(f1, f2));
          assertThat(prover.isUnsat()).isFalse();
        }
      }
    }
  }

  @Test
  public void dumpVariableTest() throws InvalidConfigurationException {
    ConfigurationBuilder config = Configuration.builder();
    try (BoolectorSolverContext context =
        BoolectorSolverContext.create(
            config.build(),
            ShutdownNotifier.createDummy(),
            null,
            1,
            NativeLibraries::loadLibrary)) {
      FormulaManager mgr = context.getFormulaManager();
      BooleanFormulaManager bfmgr = mgr.getBooleanFormulaManager();
      for (String name : ImmutableList.of("a", "a", "b", "abc", "ABC")) {
        BooleanFormula f = bfmgr.makeVariable(name);
        String s = mgr.dumpFormula(f).toString();
        assertThat(s).contains(String.format("(declare-fun %s () (_ BitVec 1))", name));
        // assertThat(s).contains(String.format("(assert %s)", name)); // assertion not available
      }
    }
  }

  @Test
  public void dumpVariableWithAssertionsOnStackTest()
      throws InvalidConfigurationException, InterruptedException {
    ConfigurationBuilder config = Configuration.builder();
    try (BoolectorSolverContext context =
        BoolectorSolverContext.create(
            config.build(),
            ShutdownNotifier.createDummy(),
            null,
            1,
            NativeLibraries::loadLibrary)) {
      FormulaManager mgr = context.getFormulaManager();
      BooleanFormulaManager bfmgr = mgr.getBooleanFormulaManager();
      try (ProverEnvironment prover = context.newProverEnvironment()) {
        prover.push(bfmgr.makeVariable("x"));
        for (String name : ImmutableList.of("a", "a", "b", "abc", "ABC")) {
          BooleanFormula f = bfmgr.makeVariable(name);
          String s = mgr.dumpFormula(f).toString();
          // TODO why is there a prefix "BTOR_2@"?
          // Possible reason: we are on the second level of the solver stack.
          // - first level comes from the constructor of ReusableStackTheoremProver.
          // - second level comes from the PUSH above.
          // We do actually not want to have such names in the dump.
          assertThat(s).contains(String.format("(declare-fun BTOR_2@%s () (_ BitVec 1))", name));
          // assertThat(s).contains(String.format("(assert "));
        }
      }
    }
  }

  @Test
  public void repeatedDumpFormulaTest() throws InvalidConfigurationException {
    ConfigurationBuilder config = Configuration.builder();
    try (BoolectorSolverContext context =
        BoolectorSolverContext.create(
            config.build(),
            ShutdownNotifier.createDummy(),
            null,
            1,
            NativeLibraries::loadLibrary)) {
      FormulaManager mgr = context.getFormulaManager();
      BooleanFormulaManager bfmgr = mgr.getBooleanFormulaManager();
      BooleanFormula fa = bfmgr.makeVariable("a");
      BooleanFormula fb = bfmgr.makeVariable("b");
      BooleanFormula fc = bfmgr.makeVariable("c");
      BooleanFormula f1 = bfmgr.or(fa, bfmgr.and(fb, fc));
      BooleanFormula f2 = bfmgr.or(fa, bfmgr.and(fb, fc));
      String s1 = mgr.dumpFormula(f1).toString();
      // repeat several times to increase probability for non-deterministic behavior
      for (int i = 0; i < 10; i++) {
        assertThat(s1).isEqualTo(mgr.dumpFormula(f2).toString());
      }
    }
  }

  /*
   * Test Boolector model with bvs
   * x > 0 && y > 0 && x <= 100 && y <= 100 && x * y < 100 with overflow protection
   */
  @Test
  public void bvModelTest() {
    // Activate model gen
    BtorJNI.boolector_set_opt(btor, BtorOption.BTOR_OPT_MODEL_GEN.getValue(), 1);

    // Create the formula and assert
    long bvSort = BtorJNI.boolector_bitvec_sort(btor, 8);

    long x = BtorJNI.boolector_var(btor, bvSort, "x");
    long y = BtorJNI.boolector_var(btor, bvSort, "y");
    long zero = BtorJNI.boolector_zero(btor, bvSort);
    long hundred = BtorJNI.boolector_int(btor, 100, bvSort);

    long zeroLTX = BtorJNI.boolector_ult(btor, zero, x);
    long xLTEHundred = BtorJNI.boolector_ulte(btor, x, hundred);
    long zeroLTY = BtorJNI.boolector_ult(btor, zero, y);
    long yLTEHundred = BtorJNI.boolector_ulte(btor, y, hundred);
    long mulXY = BtorJNI.boolector_mul(btor, y, x);
    long mulXYLTHundred = BtorJNI.boolector_ult(btor, mulXY, hundred);

    long formulaBigger0 = BtorJNI.boolector_and(btor, zeroLTX, zeroLTY);
    long formulaLTE100 = BtorJNI.boolector_and(btor, xLTEHundred, yLTEHundred);
    long formula0And100 = BtorJNI.boolector_and(btor, formulaBigger0, formulaLTE100);
    long formula = BtorJNI.boolector_and(btor, mulXYLTHundred, formula0And100);
    BtorJNI.boolector_assert(btor, formula);
    // Overflow protection
    long overflow = BtorJNI.boolector_not(btor, BtorJNI.boolector_umulo(btor, x, y));
    BtorJNI.boolector_assert(btor, overflow);
    // Check SAT
    assertThat(BtorJNI.boolector_sat(btor)).isEqualTo(BtorJNI.BTOR_RESULT_SAT_get());

    // use get_value() to get values from nodes
    long xValue = BtorJNI.boolector_get_value(btor, x);
    long yValue = BtorJNI.boolector_get_value(btor, y);

    // check the type
    assertThat(BtorJNI.boolector_get_sort(btor, xValue))
        .isEqualTo(BtorJNI.boolector_get_sort(btor, x));
    assertThat(BtorJNI.boolector_get_sort(btor, yValue))
        .isEqualTo(BtorJNI.boolector_get_sort(btor, y));

    String xValueString = BtorJNI.boolector_bv_assignment(btor, xValue);
    String yValueString = BtorJNI.boolector_bv_assignment(btor, yValue);

    // Check that the values are the same
    assertThat(xValueString).isEqualTo(BtorJNI.boolector_bv_assignment(btor, x));
    assertThat(yValueString).isEqualTo(BtorJNI.boolector_bv_assignment(btor, y));
    assertThat(Integer.parseInt(xValueString, 2) * Integer.parseInt(yValueString, 2))
        .isLessThan(100);
    assertThat(Integer.parseInt(xValueString, 2)).isAtMost(100);
    assertThat(Integer.parseInt(yValueString, 2)).isAtMost(100);
    assertThat(Integer.parseInt(xValueString, 2)).isAtLeast(1);
    assertThat(Integer.parseInt(yValueString, 2)).isAtLeast(1);
  }

  /*
   * Test array model for Boolector.
   *    (= (select arr 5) x)
   *    (= x 123)
   *    (= (select arr 2) y)
   *    (= y 0)
   */
  @Test
  public void bvArrayModelTest() {
    // Activate model gen
    BtorJNI.boolector_set_opt(btor, BtorOption.BTOR_OPT_MODEL_GEN.getValue(), 1);

    // Create the formula and assert
    long bvSort = BtorJNI.boolector_bitvec_sort(btor, 8);
    long arraySort = BtorJNI.boolector_array_sort(btor, bvSort, bvSort);

    long array = BtorJNI.boolector_array(btor, arraySort, "array");
    long x = BtorJNI.boolector_var(btor, bvSort, "x");
    long y = BtorJNI.boolector_var(btor, bvSort, "y");
    long zero = BtorJNI.boolector_zero(btor, bvSort);
    long const123 = BtorJNI.boolector_int(btor, 123, bvSort);
    long const2 = BtorJNI.boolector_int(btor, 2, bvSort);
    long const5 = BtorJNI.boolector_int(btor, 5, bvSort);
    // (= (select arr 5) x)
    long xEqArrayAt5 = BtorJNI.boolector_eq(btor, x, BtorJNI.boolector_read(btor, array, const5));
    // (= x 123)
    long xEq123 = BtorJNI.boolector_eq(btor, x, const123);
    // (= y 0)
    long yEq0 = BtorJNI.boolector_eq(btor, y, zero);
    // (= (select arr 2) y)
    long yEqArrayAt2 = BtorJNI.boolector_eq(btor, y, BtorJNI.boolector_read(btor, array, const2));

    long arrayAt5Formulas = BtorJNI.boolector_and(btor, xEqArrayAt5, xEq123);
    long arrayAt2Formulas = BtorJNI.boolector_and(btor, yEq0, yEqArrayAt2);
    long formula = BtorJNI.boolector_and(btor, arrayAt5Formulas, arrayAt2Formulas);
    BtorJNI.boolector_assert(btor, formula);

    // Check SAT
    assertThat(BtorJNI.boolector_sat(btor)).isEqualTo(BtorJNI.BTOR_RESULT_SAT_get());

    // use get_value() to get values from nodes
    long xValue = BtorJNI.boolector_get_value(btor, x);
    long yValue = BtorJNI.boolector_get_value(btor, y);
    long arrayValue = BtorJNI.boolector_get_value(btor, array);

    // check the type
    assertThat(BtorJNI.boolector_get_sort(btor, xValue))
        .isEqualTo(BtorJNI.boolector_get_sort(btor, x));
    assertThat(BtorJNI.boolector_get_sort(btor, yValue))
        .isEqualTo(BtorJNI.boolector_get_sort(btor, y));
    assertThat(BtorJNI.boolector_get_sort(btor, arrayValue))
        .isEqualTo(BtorJNI.boolector_get_sort(btor, array));

    // Check that the values are the same
    assertThat(BtorJNI.boolector_bv_assignment(btor, xValue))
        .isEqualTo(BtorJNI.boolector_bv_assignment(btor, x));
    assertThat(BtorJNI.boolector_bv_assignment(btor, yValue))
        .isEqualTo(BtorJNI.boolector_bv_assignment(btor, y));
    // The assignment_helper generates the assignments in a array of arrays!
    String[][] arrayValueHelperArray = BtorJNI.boolector_array_assignment_helper(btor, arrayValue);
    String[] arrayValueIndices = arrayValueHelperArray[0];
    Arrays.sort(arrayValueIndices);
    String[] arrayValueValues = arrayValueHelperArray[1];
    Arrays.sort(arrayValueValues);
    String[][] arrayHelperArray = BtorJNI.boolector_array_assignment_helper(btor, array);
    String[] arrayIndices = arrayHelperArray[0];
    Arrays.sort(arrayIndices);
    String[] arrayValues = arrayHelperArray[1];
    Arrays.sort(arrayValues);

    // TODO: Is it better to convert arrays into lists and check via containsExactlyElementsIn() or
    // sort them and compare?
    assertThat(arrayValueIndices).isEqualTo(arrayIndices);
    assertThat(arrayValueValues).isEqualTo(arrayValues);
    assertThat(arrayValueIndices).asList().containsExactly("00000010", "00000101");
    assertThat(arrayValueValues).asList().containsExactly("00000000", "01111011");
  }

  /*
   * Test uf model for Boolector.
   *    (= f(x) 5)
   *    (= x 123)
   *    (= g(2) y)
   *    (= y 0)
   */
  @Test
  public void ufModelTest1() {
    // Activate model gen
    BtorJNI.boolector_set_opt(btor, BtorOption.BTOR_OPT_MODEL_GEN.getValue(), 1);

    // Create the formula and assert
    long bvSort = BtorJNI.boolector_bitvec_sort(btor, 8);
    long funSort = BtorJNI.boolector_fun_sort(btor, new long[] {bvSort}, 1, bvSort);

    long uf1 = BtorJNI.boolector_uf(btor, funSort, "f");
    long uf2 = BtorJNI.boolector_uf(btor, funSort, "g");

    long x = BtorJNI.boolector_var(btor, bvSort, "x");
    long y = BtorJNI.boolector_var(btor, bvSort, "y");
    long zero = BtorJNI.boolector_zero(btor, bvSort);
    long const123 = BtorJNI.boolector_int(btor, 123, bvSort);
    long const2 = BtorJNI.boolector_int(btor, 2, bvSort);
    long const5 = BtorJNI.boolector_int(btor, 5, bvSort);

    long applyUf1EqX =
        BtorJNI.boolector_eq(btor, BtorJNI.boolector_apply(btor, new long[] {x}, 1, uf1), const5);
    long xEq123 = BtorJNI.boolector_eq(btor, x, const123);
    long yEq0 = BtorJNI.boolector_eq(btor, y, zero);
    long applyUf2EqY =
        BtorJNI.boolector_eq(btor, BtorJNI.boolector_apply(btor, new long[] {const2}, 1, uf2), y);

    long subformula1 = BtorJNI.boolector_and(btor, applyUf1EqX, xEq123);
    long subformula2 = BtorJNI.boolector_and(btor, yEq0, applyUf2EqY);
    long formula = BtorJNI.boolector_and(btor, subformula1, subformula2);
    BtorJNI.boolector_assert(btor, formula);

    // Check SAT
    assertThat(BtorJNI.boolector_sat(btor)).isEqualTo(BtorJNI.BTOR_RESULT_SAT_get());

    // use get_value() to get values from nodes
    long xValue = BtorJNI.boolector_get_value(btor, x);
    long yValue = BtorJNI.boolector_get_value(btor, y);
    long uf1Value = BtorJNI.boolector_get_value(btor, uf1);
    long uf2Value = BtorJNI.boolector_get_value(btor, uf2);

    // check the type
    assertThat(BtorJNI.boolector_get_sort(btor, uf1Value))
        .isEqualTo(BtorJNI.boolector_get_sort(btor, uf1));
    assertThat(BtorJNI.boolector_get_sort(btor, uf2Value))
        .isEqualTo(BtorJNI.boolector_get_sort(btor, uf2));

    String[][] uf1Assignments = BtorJNI.boolector_uf_assignment_helper(btor, uf1);
    String[][] uf2Assignments = BtorJNI.boolector_uf_assignment_helper(btor, uf2);

    // Check that the values are the same
    assertThat(BtorJNI.boolector_bv_assignment(btor, xValue))
        .isEqualTo(BtorJNI.boolector_bv_assignment(btor, x));
    assertThat(BtorJNI.boolector_bv_assignment(btor, yValue))
        .isEqualTo(BtorJNI.boolector_bv_assignment(btor, y));

    // Argument of f (=123)
    assertThat(uf1Assignments[0][0]).isEqualTo("01111011");
    // Value of f (=5)
    assertThat(uf1Assignments[1][0]).isEqualTo("00000101");
    // Argument of g (=2)
    assertThat(uf2Assignments[0][0]).isEqualTo("00000010");
    // Value of g (=0)
    assertThat(uf2Assignments[1][0]).isEqualTo("00000000");
  }

  /*
   * Test that the value node stays valid if the values from which it is derived change.
   *
   * x > 0 && y > 0 && x <= 100 && y <= 100 && x * y < 100 with overflow protection
   * Get value nodes. Check value for x and y and add inequalities such that they can't
   * be the same value as before. Check SAT and get new value nodes and check all
   * value nodes.
   */
  @Test
  public void bvModelConsistencyTest() {
    // Activate model gen
    BtorJNI.boolector_set_opt(btor, BtorOption.BTOR_OPT_MODEL_GEN.getValue(), 1);
    // Incremental mode to enable multiple SAT calls
    BtorJNI.boolector_set_opt(btor, BtorOption.BTOR_OPT_INCREMENTAL.getValue(), 1);

    // Create the formula and assert
    long bvSort = BtorJNI.boolector_bitvec_sort(btor, 8);

    long x = BtorJNI.boolector_var(btor, bvSort, "x");
    long y = BtorJNI.boolector_var(btor, bvSort, "y");
    long zero = BtorJNI.boolector_zero(btor, bvSort);
    long hundred = BtorJNI.boolector_int(btor, 100, bvSort);

    long zeroLTX = BtorJNI.boolector_ult(btor, zero, x);
    long xLTEHundred = BtorJNI.boolector_ulte(btor, x, hundred);
    long zeroLTY = BtorJNI.boolector_ult(btor, zero, y);
    long yLTEHundred = BtorJNI.boolector_ulte(btor, y, hundred);
    long mulXY = BtorJNI.boolector_mul(btor, y, x);
    long mulXYLTHundred = BtorJNI.boolector_ult(btor, mulXY, hundred);

    long formulaBigger0 = BtorJNI.boolector_and(btor, zeroLTX, zeroLTY);
    long formulaLTE100 = BtorJNI.boolector_and(btor, xLTEHundred, yLTEHundred);
    long formula0And100 = BtorJNI.boolector_and(btor, formulaBigger0, formulaLTE100);
    long formula = BtorJNI.boolector_and(btor, mulXYLTHundred, formula0And100);
    BtorJNI.boolector_assert(btor, formula);
    // Overflow protection
    long overflow = BtorJNI.boolector_not(btor, BtorJNI.boolector_umulo(btor, x, y));
    BtorJNI.boolector_assert(btor, overflow);
    // Check SAT
    assertThat(BtorJNI.boolector_sat(btor)).isEqualTo(BtorJNI.BTOR_RESULT_SAT_get());

    // remember values and nodes
    long xValueInitial = BtorJNI.boolector_get_value(btor, x);
    long yValueInitial = BtorJNI.boolector_get_value(btor, y);
    String xStringInitial = BtorJNI.boolector_bv_assignment(btor, xValueInitial);
    String yStringInitial = BtorJNI.boolector_bv_assignment(btor, yValueInitial);

    // Add x != old value and the same for y
    long xNEQx =
        BtorJNI.boolector_not(
            btor,
            BtorJNI.boolector_eq(
                btor, BtorJNI.boolector_int(btor, Integer.parseInt(xStringInitial, 2), bvSort), x));
    long yNEQy =
        BtorJNI.boolector_not(
            btor,
            BtorJNI.boolector_eq(
                btor, BtorJNI.boolector_int(btor, Integer.parseInt(yStringInitial, 2), bvSort), y));
    long formulaVarsNE = BtorJNI.boolector_and(btor, xNEQx, yNEQy);
    BtorJNI.boolector_assert(btor, formulaVarsNE);
    // Check SAT again
    assertThat(BtorJNI.boolector_sat(btor)).isEqualTo(BtorJNI.BTOR_RESULT_SAT_get());

    long xValueNew = BtorJNI.boolector_get_value(btor, x);
    long yValueNew = BtorJNI.boolector_get_value(btor, y);
    String xStringNew = BtorJNI.boolector_bv_assignment(btor, xValueNew);
    String yStringNew = BtorJNI.boolector_bv_assignment(btor, yValueNew);

    // Check that the values are not the same
    assertThat(xStringInitial).isNotEqualTo(xStringNew);
    assertThat(yStringInitial).isNotEqualTo(yStringNew);
  }
}


text:
@interface PreferViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIImageView *currentHeadImageV;
@property (weak, nonatomic) IBOutlet UILabel *currentUserName;
@property (weak, nonatomic) IBOutlet UIButton *changeCurrentUser;
@property (weak, nonatomic) IBOutlet UIButton *exitCurrentUser;

@end


text:
package com.thehen101.csgoexternal.memory;

public enum Netvar {
	HEALTH("Health"),
	FLAGS("Flags"),
	TEAM("Team"),
	DORMANT("Dormant"),
	ORIGIN("Origin"),
	VIEWOFFSET("ViewOffset"),
	LIFESTATE("LifeState"),
	BONEMANAGER("BoneManager"),
	VIEWPUNCH("ViewPunch"),
	IMMUNE("Immune"),
	GLOWINDEX("GlowIndex"),
	CROSSHAIR("Crosshair");

	private final String name;
	private int offset;

	Netvar(String name) {
		this(name, 0);
	}

	Netvar(String name, int offset) {
		this.name = name;
		this.offset = offset;
	}

	public String getName() {
		return this.name;
	}

	public int getOffset() {
		return this.offset;
	}

	public void setOffset(int newOffset) {
		this.offset = newOffset;
	}
}


text:
package com.cognitree.bootique.discovery;

import com.cognitree.bootique.discovery.consul.ConsulDiscoveryService;
import com.cognitree.bootique.discovery.consul.ConsulDiscoveryServiceConfig;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import io.bootique.ConfigModule;
import io.bootique.config.ConfigurationFactory;

public class ConsulDiscoveryModule extends ConfigModule {

    @Singleton
    @Provides
    ConsulDiscoveryService createConsulDiscoveryService(ConfigurationFactory configurationFactory) throws DiscoveryException {
        final ConsulDiscoveryServiceConfig agentConfig = configurationFactory.config(ConsulDiscoveryServiceConfig.class, "discovery");
        return new ConsulDiscoveryService(agentConfig);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Igneel.Collections
{
    public class ObservedDictionary<TKey, TValue> : ICollection<TValue>
    {
        List<TValue> _items;
        Dictionary<TKey, TValue> _itemLookup;

        Action<TValue> _itemAdded;
        Action<TValue> _itemRemoved;
        Func<TValue, TKey> _keySelector;

        public ObservedDictionary(Action<TValue> itemAdded, Action<TValue> itemRemoved, Func<TValue, TKey> keySelector)
        {
            this._itemAdded = itemAdded;
            this._itemRemoved = itemRemoved;
            this._keySelector = keySelector;

            _items = new List<TValue>();
            _itemLookup = new Dictionary<TKey, TValue>();
        }

        public ObservedDictionary(int capacity, Action<TValue> itemAdded, Action<TValue> itemRemoved, Func<TValue, TKey> keySelector)
        {
            this._itemAdded = itemAdded;
            this._itemRemoved = itemRemoved;
            this._keySelector = keySelector;

            _items = new List<TValue>(capacity);
            _itemLookup = new Dictionary<TKey, TValue>(capacity);
        }

        public TValue this[int index]
        {
            get { return _items[index]; }
        }

        public TValue this[TKey key]
        {
            get { return _itemLookup[key]; }
        }

        public bool TryGetValue(TKey key, out TValue value)
        {
            return _itemLookup.TryGetValue(key, out value);
        }

        public void Add(TValue item)
        {
            var key = _keySelector(item);
            if (_itemLookup.ContainsKey(key))
                return;

            _items.Add(item);
            _itemLookup.Add(key, item);
            if (_itemAdded != null)
                _itemAdded(item);
        }

        public void Clear()
        {
            _items.Clear();
            _itemLookup.Clear();
        }

        public bool Contains(TValue item)
        {
            return _itemLookup.ContainsKey(_keySelector(item));
        }

        public bool ContainsKey(TKey key)
        {
            return _itemLookup.ContainsKey(key);
        }

        public void CopyTo(TValue[] array, int arrayIndex)
        {
            _items.CopyTo(array, arrayIndex);
        }

        public int Count
        {
            get { return _items.Count; }
        }

        public int IndexOf(TValue item)
        {
            return _items.IndexOf(item);
        }

        public void RemoveAt(int index)
        {
            var item = _items[index];
            _items.RemoveAt(index);
            var key = _keySelector(item);
            _itemLookup.Remove(key);

            if (_itemRemoved != null)
                _itemRemoved(item);
        }

        public void AddRange(IEnumerable<TValue> items)
        {
            foreach (var item in items)
            {
                Add(item);
            }
        }

        public void RemoveRange(IEnumerable<TValue> items)
        {
            foreach (var item in items)
            {
                Remove(item);
            }
        }

        bool ICollection<TValue>.IsReadOnly
        {
            get { return false; }
        }

        public bool Remove(TValue item)
        {
            var key = _keySelector(item);
            if (_itemLookup.Remove(key))
            {
                _items.Remove(item);
                if (_itemRemoved != null)
                    _itemRemoved(item);
                return true;
            }
            return false;
        }

        public void ChangeKey(TKey oldKey, TKey newKey)
        {
            var item = _itemLookup[oldKey];
            _itemLookup.Remove(oldKey);
            _itemLookup.Add(newKey, item);
        }

        IEnumerator<TValue> IEnumerable<TValue>.GetEnumerator()
        {
           return _items.GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return _items.GetEnumerator();
        }

        public List<TValue>.Enumerator GetEnumerator()
        {
            return _items.GetEnumerator();
        }
    }
}


text:
import { Router, Route, Switch, Redirect } from 'react-router';
import { Provider } from 'react-redux';
import history from './history';
import { store } from '@/redux/store';

// 开放页面
import App from '_V/App';               // 首页
import Article from '_V/Article';           // 文章列表
import ArticleInfo from '_V/ArticleInfo';   // 文章详情页
import About from '_V/Profile';             // 关于
import Case from '_V/Case';                 // 案例及案例列表
import CaseInfo from '_V/CaseInfo';         // 案例详情页
import Github from '_V/Github';             // github
import Contact from '_V/Contact';           // 联系我
import NotFound from '_V/NotFound';         // 404
import Error from '_C/Error';

// 认证页面
import AuthorizedRoute from '_C/AuthorizedRoute';   // 认证组件
import Login from '_V/auth/Login';                  // 登录页, 认证入口
import GetPassword from '_V/auth/GetPassword';      // 找回密码
import Center from '_V/auth/Center';                // 验证后页面
import Logout from '_V/auth/Logout';                // 退出页, 认证出口

const Routers = (
  <Provider store={store}>
    <Router history={history} >
      <Switch>
        {/* 开放页面 */}
        <Route exact path="/" component={ App } />
        <Route path="/article/:category" component={ Article } />
        <Route path="/article/:category/:id" component={ ArticleInfo } />
        <Route path="/about" component={ About } />
        <Route path="/case" component={ Case } />
        <Route path="/case/:category" component={ Case } />
        <Route path="/case/:category/:id" component={ CaseInfo } />
        <Route path="/github" component={ Github } />
        <Route path="/contact" component={ Contact } />
        <Route path="/error" component={ Error } />
        {/* 认证页面 */}
        <Route path="/auth/admin" component={ Login } />
        <AuthorizedRoute path="/auth/resetpass" component={ GetPassword } />
        <AuthorizedRoute path="/auth/center" component={ Center } />
        <AuthorizedRoute path="/auth/logout" component={ Logout } />

        {/* 路由匹配时是一个自上而下的过程,当以上均匹配不到时才匹配到*,404 */}
        <Route component={ NotFound } from="*" to="/404" />
        {/* 重定向是指一种一次性的组件,它会将应用程序发送到另一个位置,并且很可能从树上消失。如果它保持持久性并响应更新,那么很可能会进入无限循环重定向。 */}
      </Switch>
    </Router>
  </Provider>
);

module.exports = Routers;


text:
title: 把現有的project folder變為git repository
categories:
    - git
---
首先,在localhost建立一個假project

```bash
cd ~/
mkdir project1
cd project1/
echo "HelloWorld!" >> test.txt
```

驗證是否確實將Hello World 寫入test.txt

```bash
cat test.txt
```

建立git repository

```bash
git init
```
在remote host 建立bare repository,以下的blog詳細解釋了什麼是bare git repository

[http://www.saintsjd.com/2011/01/what-is-a-bare-git-repository/](http://www.saintsjd.com/2011/01/what-is-a-bare-git-repository/)

```bash
cd ~/
mkdir project1.git
cd project1.git/
git init --bare
```

在localhost,

```bash
cd ~/project1
```

新增remote origin url

```bash
git remote add origin ssh://<username>@<ip address>/<path to bare repo>/project1.git
```

萬一新增的url 有錯,可以透過下列指令更新remote origin url

```bash
git remote set-url origin <url>
```

最后,輸入我們最熟悉的git指令

```bash
git push origin master
```


text:
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/policy/core/browser/signin/user_cloud_signin_restriction_policy_fetcher.h"

#include <set>

#include "base/command_line.h"
#include "base/strings/stringprintf.h"
#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/policy/core/common/cloud/cloud_policy_client_registration_helper.h"
#include "components/policy/core/common/policy_switches.h"
#include "components/policy/proto/secure_connect.pb.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "google_apis/gaia/core_account_id.h"
#include "google_apis/gaia/gaia_constants.h"
#include "net/base/load_flags.h"
#include "net/base/url_util.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/url_response_head.mojom.h"

namespace policy {

namespace {

const char kAuthorizationHeaderFormat[] = "Bearer %s";
const char kProtobufferContentType[] = "application/x-protobuf";
const char kSecureConnectApiGetManagedAccountsSigninRestrictionsUrl[] =
    "https://secureconnect-pa.clients6.google.com/"
    "v1:getManagedAccountsSigninRestriction";

std::unique_ptr<network::SimpleURLLoader> CreateUrlLoader(
    const GURL& url,
    const std::string& access_token,
    net::NetworkTrafficAnnotationTag annotation) {
  auto resource_request = std::make_unique<network::ResourceRequest>();

  resource_request->url = url;
  resource_request->method = net::HttpRequestHeaders::kGetMethod;
  resource_request->load_flags = net::LOAD_DISABLE_CACHE;
  resource_request->headers.SetHeader(
      net::HttpRequestHeaders::kAuthorization,
      base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str()));
  resource_request->headers.SetHeader(net::HttpRequestHeaders::kContentType,
                                      kProtobufferContentType);
  resource_request->credentials_mode = network::mojom::CredentialsMode::kOmit;
  auto url_loader =
      network::SimpleURLLoader::Create(std::move(resource_request), annotation);
  return url_loader;
}

}  // namespace

UserCloudSigninRestrictionPolicyFetcher::
    UserCloudSigninRestrictionPolicyFetcher(
        policy::BrowserPolicyConnector* browser_policy_connector,
        scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
    : browser_policy_connector_(browser_policy_connector),
      url_loader_factory_(url_loader_factory) {}

UserCloudSigninRestrictionPolicyFetcher::
    ~UserCloudSigninRestrictionPolicyFetcher() = default;

void UserCloudSigninRestrictionPolicyFetcher::
    GetManagedAccountsSigninRestriction(
        signin::IdentityManager* identity_manager,
        const CoreAccountId& account_id,
        base::OnceCallback<void(const std::string&)> callback) {
  // base::Unretained is safe here because the callback is called in the
  // lifecycle of `this`.
  FetchAccessToken(
      identity_manager, account_id,
      base::BindOnce(&UserCloudSigninRestrictionPolicyFetcher::
                         GetManagedAccountsSigninRestrictionInternal,
                     base::Unretained(this), std::move(callback)));
}

void UserCloudSigninRestrictionPolicyFetcher::FetchAccessToken(
    signin::IdentityManager* identity_manager,
    const CoreAccountId& account_id,
    base::OnceCallback<void(const std::string&)> callback) {
  DCHECK(callback);
  DCHECK(!account_id.empty());
  DCHECK(identity_manager->HasAccountWithRefreshToken(account_id));
  DCHECK(!access_token_fetcher_);

  // base::Unretained is safe here because `access_token_fetcher_` is owned by
  // `this`.
  access_token_fetcher_ = identity_manager->CreateAccessTokenFetcherForAccount(
      account_id, /*oauth_consumer_name=*/"cloud_policy", /*scopes=*/
      {GaiaConstants::kGoogleUserInfoProfile},
      base::BindOnce(
          &UserCloudSigninRestrictionPolicyFetcher::OnFetchAccessTokenResult,
          base::Unretained(this), std::move(callback)),
      signin::AccessTokenFetcher::Mode::kImmediate);
}

void UserCloudSigninRestrictionPolicyFetcher::OnFetchAccessTokenResult(
    base::OnceCallback<void(const std::string&)> callback,
    GoogleServiceAuthError error,
    signin::AccessTokenInfo token_info) {
  std::move(callback).Run(
      error.state() == GoogleServiceAuthError::NONE ? token_info.token : "");
}

void UserCloudSigninRestrictionPolicyFetcher::
    GetManagedAccountsSigninRestrictionInternal(
        base::OnceCallback<void(const std::string&)> callback,
        const std::string& access_token) {
  net::NetworkTrafficAnnotationTag annotation =
      net::DefineNetworkTrafficAnnotation(
          "managed_acccount_signin_restrictions_secure_connect", R"(
    semantics {
      sender: "SecureConnect Service"
      description:
        "A request to the SecureConnect API to retrieve the value of the "
        "ManagedAccountsSigninRestriction policy for the signed in user."
      trigger:
        "After a user signs into a managed account and if they have not "
        "explicitely accepted to use a managed profile and no value for the "
        "profile separation is not enforced by any machine level policy."
      data:
        "Gaia access token."
      destination: GOOGLE_OWNED_SERVICE
    }
    policy {
      cookies_allowed: NO
      chrome_policy {
        SigninInterceptionEnabled {
          SigninInterceptionEnabled: false
        }
      }
    })");

  // Each url loader can only be used for one request.
  url_loader_ =
      CreateUrlLoader(GetSecureConnectApiGetAccountSigninRestrictionUrl(),
                      access_token, annotation);

  // base::Unretained is safe here because `url_loader_` is owned by `this`.
  url_loader_->DownloadToString(
      url_loader_factory_for_testing_ == nullptr
          ? url_loader_factory_.get()
          : url_loader_factory_for_testing_.get(),
      base::BindOnce(&UserCloudSigninRestrictionPolicyFetcher::
                         OnManagedAccountsSigninRestrictionResult,
                     base::Unretained(this), std::move(callback)),
      1024 * 1024 /* 1 MiB */);
}

void UserCloudSigninRestrictionPolicyFetcher::
    OnManagedAccountsSigninRestrictionResult(
        base::OnceCallback<void(const std::string&)> callback,
        std::unique_ptr<std::string> response_body) {
  std::string restriction;
  std::unique_ptr<network::SimpleURLLoader> url_loader = std::move(url_loader_);

  // TODO (crbug/1261474): Add metrics for the failure rate.
  GoogleServiceAuthError error = GoogleServiceAuthError::AuthErrorNone();
  if (url_loader->NetError() != net::OK) {
    if (url_loader->ResponseInfo() && url_loader->ResponseInfo()->headers) {
      int response_code = url_loader->ResponseInfo()->headers->response_code();
      LOG(WARNING)
          << "ManagedAccountsSigninRestriction request failed with HTTP code: "
          << response_code;
    } else {
      error =
          GoogleServiceAuthError::FromConnectionError(url_loader->NetError());
      LOG(WARNING)
          << "ManagedAccountsSigninRestriction request failed with error: "
          << url_loader->NetError();
    }
  }

  if (error.state() == GoogleServiceAuthError::NONE) {
    enterprise_management::GetManagedAccountsSigninRestrictionResponse response;
    if (response_body && response.ParseFromString(*response_body) &&
        (!response.has_has_error() || !response.has_error())) {
      restriction = response.policy_value();
    } else {
      LOG(WARNING) << "Failed to ManagedAccountsSigninRestriction response";
    }
  }

  std::move(callback).Run(std::move(restriction));
}

GURL UserCloudSigninRestrictionPolicyFetcher::
    GetSecureConnectApiGetAccountSigninRestrictionUrl() const {
  base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
  std::string url =
      command_line->HasSwitch(policy::switches::kSecureConnectApiUrl) &&
              browser_policy_connector_ &&
              browser_policy_connector_->IsCommandLineSwitchSupported()
          ? command_line->GetSwitchValueASCII(
                policy::switches::kSecureConnectApiUrl)
          : kSecureConnectApiGetManagedAccountsSigninRestrictionsUrl;
  return GURL(url);
}

}  //  namespace policy


text:
/*****************************************************************************
 *                                  dfd.h
 *
 * Digital Filter Design.
 *
 * This is a base class for FIR and IIR filter design. It contains the design
 * specifies and some universal parameters of filter.
 *
 * Zhang Ming, 2010-03, Xi'an Jiaotong University.
 *****************************************************************************/

#ifndef DFD_H
#define DFD_H

#include <string>
#include <vector.h>

namespace splab
{

    const double    FREQ_MIN    =   1.0E-3;     // min freqency
    const double    FREQ_MAX    =   1.0E12;     // max freqency
    const double    GAIN_PASS   =   -1.0E-2;    // max passband gain
    const double    GAIN_TRAN   =   -3.0103;    // min pb, max sb gain
    const double    GAIN_STOP   =   -1.0E02;    // min stopband gain

    class DFD
    {

     public:

        DFD( const string &select );
        virtual ~DFD();

        void setParams( double fs, double f1, double a1,
                        double f2, double a2 );
        void setParams( double fs, double f1, double a1, double f2,
                        double f3, double a2, double f4, double a3 );

        virtual void design() = 0;
        virtual void dispInfo() const = 0;

    protected:

        double  fsamp;              // sampling frequency
        double  wpass1, wpass2;     // passband edge frequency
        double  wstop1, wstop2;     // stopband edge frequency

        double  apass1, apass2;     // passband gain
        double  astop1, astop2;     // stopband gain

        string  filtType;           // filter type
        int     order;              // length of filter

        inline double getValue( double x, double min, double max );

    };
    // class DFD

    #include <dfd-impl.h>

}
// namespace splab

#endif
// DFD_H


text:
<xproperties>
    <xproperties>
        <entry>
            <key>summa.control.service.port</key>
            <value class="int">27084</value>
        </entry>
        <entry>
            <key>summa.control.service.id</key>
            <value class="string">indextest</value>
        </entry>
        <entry>
            <key>filter.name</key>
            <value class="string">Simple fagref index</value>
        </entry>
        <entry>
            <key>filtercontrol.sequential</key>
            <value class="boolean">true</value>
        </entry>
        <entry>
            <key>filtercontrol.chains</key>
            <value class="list">
                <xproperties>
                    <entry>
                        <key>filter.name</key>
                        <value class="string">SingleChain</value>
                    </entry>
                    <entry>
                        <key>summa.filter.sequence.filters</key>
                        <value class="list">

                            <xproperties>
                                <entry>
                                    <key>filter.name</key>
                                    <value class="string">StorageReader</value>
                                </entry>
                                <entry>
                                    <key>summa.filter.sequence.filterclass</key>
                                    <value class="string">dk.statsbiblioteket.summa.storage.api.filter.RecordReader</value>
                                </entry>
                                <entry>
                                    <key>summa.storage.recordreader.startfromscratch</key>
                                    <value class="boolean">false</value>
                                </entry>
                                <entry>
                                    <key>summa.storage.recordreader.maxread.records</key>
                                    <value class="int">-1</value>
                                </entry>
                                <entry>
                                    <key>summa.storage.recordreader.base</key>
                                    <value class="string">fagref</value>
                                </entry>
                                <entry>
                                    <key>summa.rpc.vendor</key>
                                    <value class="string">${index_storage}</value>
                                </entry>
                            </xproperties>

                            <xproperties>
                                <entry>
                                    <key>filter.name</key>
                                    <value class="string">XMLTransformer</value>
                                </entry>
                                <entry>
                                    <key>summa.filter.sequence.filterclass</key>
                                    <value class="string">dk.statsbiblioteket.summa.index.XMLTransformer</value>
                                </entry>
                                <entry>
                                    <key>summa.xmltransformer.xslt</key>
                                    <value class="string">${fagref_xslt}</value>
                                </entry>
                                <entry>
                                    <key>summa.xmltransformer.ignorexmlnamespaces</key>
                                    <value class="boolean">false</value>
                                </entry>
                            </xproperties>

                            <xproperties>
                                <entry>
                                    <key>filter.name</key>
                                    <value class="string">OldToNewTransformer</value>
                                </entry>
                                <entry>
                                    <key>summa.filter.sequence.filterclass</key>
                                    <value class="string">dk.statsbiblioteket.summa.index.XMLTransformer</value>
                                </entry>
                                <entry>
                                    <key>summa.xmltransformer.xslt</key>
                                    <value class="string">LegacyToSummaDocumentXML.xslt</value>
                                </entry>
                                <entry>
                                    <key>summa.xmltransformer.ignorexmlnamespaces</key>
                                    <value class="boolean">false</value>
                                </entry>
                            </xproperties>

                            <xproperties>
                                <entry>
                                    <key>filter.name</key>
                                    <value class="string">DocumentCreator</value>
                                </entry>
                                <entry>
                                    <key>summa.filter.sequence.filterclass</key>
                                    <value class="string">dk.statsbiblioteket.summa.index.lucene.StreamingDocumentCreator</value>
                                </entry>
                                <entry>
                                    <key>summa.index.descriptorsetup</key>
                                    <value class="xproperties">
                                        <entry>
                                            <key>summa.common.indexdescriptor.absolutelocation</key>
                                            <value class="string">${fagref_descriptor}</value>
                                        </entry>
                                    </value>
                                </entry>
                            </xproperties>

                            <xproperties>
                                <entry>
                                    <key>filter.name</key>
                                    <value class="string">IndexUpdate</value>
                                </entry>
                                <entry>
                                    <key>summa.filter.sequence.filterclass</key>
                                    <value class="string">dk.statsbiblioteket.summa.index.IndexControllerImpl</value>
                                </entry>
                                <entry>
                                    <key>summa.index.createnewindex</key>
                                    <value class="boolean">true</value>
                                </entry>
                                <entry>
                                    <key>summa.index.indexrootlocation</key>
                                    <value class="string">/tmp/summatest/data/fagref</value>
                                </entry>
                                <entry>
                                    <key>summa.index.manipulators</key>
                                    <value class="list">
                                        <xproperties>
                                            <entry>
                                                <key>summa.index.manipulatorclass</key>
                                                <value class="string">dk.statsbiblioteket.summa.index.lucene.LuceneManipulator</value>
                                            </entry>
                                            <entry>
                                                <key>summa.index.descriptorsetup</key>
                                                <value class="xproperties">
                                                    <entry>
                                                        <key>summa.common.indexdescriptor.absolutelocation</key>
                                                        <value class="string">${fagref_descriptor}</value>
                                                    </entry>
                                                </value>
                                            </entry>
                                        </xproperties>
                                    </value>
                                </entry>
                            </xproperties>
                        </value>
                    </entry>
                </xproperties>
            </value>
        </entry>
    </xproperties>
</xproperties>


text:
<!doctype html>

    <title>Code coverage report for ./src/client/app/filters/unique.js</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="../../../../prettify.css">
    <link rel="stylesheet" href="../../../../base.css">

Code coverage report for ./src/client/app/filters/unique.js

        Statements: 13.64% (3 / 22)
        Branches: 0% (0 / 15)
        Functions: 20% (1 / 5)
        Lines: 13.64% (3 / 22)
        Ignored: none

All files » ./src/client/app/filters/ » unique.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47	1

1

1

(function() {
    'use strict';

    angular
        .module('ipsf.filters')
        .filter('unique', Unique);

    function Unique() {
        return function(items, filterOn) {
            if (filterOn === false) {
                return items;
            }

            if ((filterOn || angular.isUndefined(filterOn)) && angular.isArray(items)) {
                var hashCheck = {},
                    newItems = [];

                var extractValueToCompare = function(item) {
                    if (angular.isObject(item) && angular.isString(filterOn)) {
                        return item[filterOn];
                    } else {
                        return item;
                    }
                };

                angular.forEach(items, function(item) {
                    var valueToCheck, isDuplicate = false;

                    for (var i = 0; i < newItems.length; i++) {
                        if (angular.equals(extractValueToCompare(newItems[i]), extractValueToCompare(item))) {
                            isDuplicate = true;
                            break;
                        }
                    }
                    if (!isDuplicate) {
                        newItems.push(item);
                    }

                });
                items = newItems;
            }
            return items;
        };
    }

})();

Generated by istanbul at Thu Dec 17 2015 20:57:37 GMT+0000 (Greenwich Standard Time)


text:
package com.likya.tlossw.web.utils;

import java.util.ArrayList;

import com.likya.tlos.model.xmlbeans.nrperesults.CpuKullanimType.Timein;
import com.likya.tlos.model.xmlbeans.nrperesults.MessageDocument.Message;
import com.likya.tlos.model.xmlbeans.nrperesults.NrpeDataDocument.NrpeData;
import com.likya.tlos.model.xmlbeans.nrperesults.ResponseDocument.Response;
import com.likya.tlos.model.xmlbeans.nrperesults.ResponseDocument.Response.Command;
import com.likya.tlos.model.xmlbeans.sla.ForWhatAttribute.ForWhat;
import com.likya.tlossw.model.client.resource.CpuInfoTypeClient;
import com.likya.tlossw.model.client.resource.DiskInfoTypeClient;
import com.likya.tlossw.model.client.resource.MemoryInfoTypeClient;
import com.likya.tlossw.model.client.resource.NrpeDataInfoTypeClient;
import com.likya.tlossw.model.client.spc.JobInfoTypeClient;

public class LiveUtils {

	public static String jobPath(JobInfoTypeClient job) {
		String jobPath = new String();
		jobPath = job.getFullPath() + "." + job.getJobId(); //job.getTreePath() + "." + job.getJobId();
		return jobPath;
	}

	public static String getConcatenatedPathAndFileName(String path, String fileName) {
		if (path.indexOf('\\') >= 0) {
			if (path.lastIndexOf('\\') == path.length() - 1) {
				path = path.substring(0, path.length() - 1);
			}
			path = path + "\\";
		} else if (path.indexOf('/') >= 0) {
			if (path.lastIndexOf('/') == path.length() - 1) {
				path = path.substring(0, path.length() - 1);
			}
			path = path + "/";
		}

		return path + fileName;
	}

	public static NrpeDataInfoTypeClient convertNrpeData(NrpeData nrpeData) {

		NrpeDataInfoTypeClient nrpeDataInfoTypeClient = new NrpeDataInfoTypeClient();

		ArrayList<CpuInfoTypeClient> cpuInfoTypeClientList = new ArrayList<CpuInfoTypeClient>();
		ArrayList<DiskInfoTypeClient> diskInfoTypeClientList = new ArrayList<DiskInfoTypeClient>();
		ArrayList<MemoryInfoTypeClient> memoryInfoTypeClientList = new ArrayList<MemoryInfoTypeClient>();

		// kac ayri mesaj geldiyse o kadar tariyor, iceriklerini gerekli yerlere set ediyor
		for (int i = 0; i < nrpeData.getNrpeCallArray(0).getMessageArray().length; i++) {

			Message message = nrpeData.getNrpeCallArray(0).getMessageArray(i);

			// her komut icin ayri response degeri geldigi icin tum response degerleri taraniyor
			for (int j = 0; j < message.getResponseArray().length; j++) {

				Response response = message.getResponseArray(j);

				// cpu response kismi icin buraya geliyor
				if (response.getCommand().equals(Command.ALIAS_CPU)) {

					CpuInfoTypeClient cpuInfoTypeClient = new CpuInfoTypeClient();
					cpuInfoTypeClient.setCpuUnit(response.getCpuArray(0).getBirim().toString());

					for (int cpuCnt = 0; cpuCnt < response.getCpuArray().length; cpuCnt++) {
						if (response.getCpuArray(cpuCnt).getTimein().equals(Timein.X_1)) {
							cpuInfoTypeClient.setUsedCpuOneMin(response.getCpuArray(cpuCnt).getStringValue());

						} else if (response.getCpuArray(cpuCnt).getTimein().equals(Timein.X_5)) {
							cpuInfoTypeClient.setUsedCpuFiveMin(response.getCpuArray(cpuCnt).getStringValue());

						} else if (response.getCpuArray(cpuCnt).getTimein().equals(Timein.X_15)) {
							cpuInfoTypeClient.setUsedCpuFifteenMin(response.getCpuArray(cpuCnt).getStringValue());
						}
					}

					cpuInfoTypeClientList.add(cpuInfoTypeClient);

					// disk response kismi icin buraya geliyor
				} else if (response.getCommand().equals(Command.ALIAS_DISK)) {

					DiskInfoTypeClient diskInfoTypeClient = new DiskInfoTypeClient();
					diskInfoTypeClient.setDiskUnit(response.getDiskArray(0).getBirim().toString());

					for (int diskCnt = 0; diskCnt < response.getDiskArray().length; diskCnt++) {
						if (response.getDiskArray(diskCnt).getForWhat().toString().equals(ForWhat.USED.toString())) {
							diskInfoTypeClient.setUsedDisk(response.getDiskArray(diskCnt).getStringValue());

						} else if (response.getDiskArray(diskCnt).getForWhat().toString().equals(ForWhat.FREE.toString())) {
							diskInfoTypeClient.setFreeDisk(response.getDiskArray(diskCnt).getStringValue());
						}
					}

					diskInfoTypeClientList.add(diskInfoTypeClient);

					// memory response kismi icin buraya geliyor
				} else if (response.getCommand().equals(Command.ALIAS_MEM)) {

					MemoryInfoTypeClient memoryInfoTypeClient = new MemoryInfoTypeClient();
					memoryInfoTypeClient.setMemoryUnit(response.getMemArray(0).getBirim().toString());

					for (int memCnt = 0; memCnt < response.getMemArray().length; memCnt++) {
						if (response.getMemArray(memCnt).getForWhat().toString().equals(ForWhat.USED.toString())) {
							memoryInfoTypeClient.setUsedMemory(response.getMemArray(memCnt).getStringValue());

						} else if (response.getMemArray(memCnt).getForWhat().toString().equals(ForWhat.FREE.toString())) {
							memoryInfoTypeClient.setFreeMemory(response.getMemArray(memCnt).getStringValue());
						}
					}

					memoryInfoTypeClientList.add(memoryInfoTypeClient);
				}
			}
		}

		nrpeDataInfoTypeClient.setCpuInfoTypeClientList(cpuInfoTypeClientList);
		nrpeDataInfoTypeClient.setDiskInfoTypeClientList(diskInfoTypeClientList);
		nrpeDataInfoTypeClient.setMemoryInfoTypeClientList(memoryInfoTypeClientList);

		return nrpeDataInfoTypeClient;
	}
}


text:
package com.esri.core.geometry;

//An internal helper class. Do not use.
public class OGCStructureInternal {
	private static class EditShapeCursor extends GeometryCursor {
		EditShape m_shape;
		int m_geom;
		int m_index;

		EditShapeCursor(EditShape shape, int index) {
			m_shape = shape;
			m_geom = -1975;
			m_index = index;
		}

		@Override
		public Geometry next() {
			if (m_shape != null) {
				if (m_geom == -1975)
					m_geom = m_shape.getFirstGeometry();
				else
					m_geom = m_shape.getNextGeometry(m_geom);

				if (m_geom == -1) {
					m_shape = null;
				} else {
					return m_shape.getGeometry(m_geom);
				}

			}

			return null;
		}

		@Override
		public int getGeometryID() {
			return m_shape.getGeometryUserIndex(m_geom, m_index);
		}

		@Override
		public boolean hasNext() {
			if (m_geom == -1975) {
				return m_shape != null && m_shape.getFirstGeometry() != -1;
			}
			return m_shape != null && m_shape.getNextGeometry(m_geom) != -1;
		}
	}

	public static GeometryCursor prepare_for_ops_(GeometryCursor geoms, SpatialReference sr) {
		assert (geoms != null);
		EditShape editShape = new EditShape();
		int geomIndex = editShape.createGeometryUserIndex();
		for (Geometry g = geoms.next(); g != null; g = geoms.next()) {
			int egeom = editShape.addGeometry(g);
			editShape.setGeometryUserIndex(egeom, geomIndex, geoms.getGeometryID());
		}

		Envelope2D env = editShape.getEnvelope2D();
		double tolerance = InternalUtils.calculateToleranceFromGeometry(sr,
				env, true);

		CrackAndCluster.execute(editShape, tolerance, null, true);
		return OperatorSimplifyOGC.local().execute(new EditShapeCursor(editShape, geomIndex), sr, false, null);
	}
}


text:
package de.newsarea.homecockpit.connector;

import de.newsarea.homecockpit.connector.event.ValueChangedEventListener;
import org.apache.commons.lang3.event.EventListenerSupport;

public abstract class AbstractGeneralConnector<E> implements GeneralConnector<E> {

    private EventListenerSupport<ValueChangedEventListener> eventListeners;

    public AbstractGeneralConnector() {
        eventListeners = EventListenerSupport.create(ValueChangedEventListener.class);
    }

    public void addEventListener(ValueChangedEventListener<E> eventListener) {
        eventListeners.addListener(eventListener);
    }

    protected void fireEvent(E data) {
        eventListeners.fire().valueChanged(data);
    }

}


text:
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// This file is a part of the 'esoco-business' project.
// Copyright 2017 Elmar Sonnenschein, esoco GmbH, Flensburg, Germany
//
// 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.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package de.esoco.process.ui.event;

import de.esoco.process.ui.UiComponent;
import de.esoco.process.ui.UiInputField;
import de.esoco.process.ui.component.UiList;

import java.util.function.Consumer;

/********************************************************************
 * An event listener abstraction that indicates that a component can produce
 * events if a displayed value has been updated (e.g. text typed, item
 * selected). Update events are typically mapped onto more specific events of
 * components like {@link UiInputField#onInput(Consumer)} or {@link
 * UiList#onSelection(Consumer)}.
 *
 * @author eso
 */
public interface UiHasUpdateEvents<T, C extends UiComponent<T, ?>>
{
	//~ Methods ----------------------------------------------------------------

	/***************************************
	 * Registers an event handler that will be invoked on update events with the
	 * new component value.
	 *
	 * @param  rEventHandler The event handler to be invoked
	 *
	 * @return The component the handler has been registered on
	 */
	public C onUpdate(Consumer<T> rEventHandler);
}


text:
using System;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Data;
using System.ComponentModel;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
using System.Linq.Expressions;

namespace S11Context
{

    /// <summary>
    /// Глобальные настройки
    /// </summary>
    [Table(Name = @"s11.GlobalPreferences")]
    public partial class GlobalPreference : INotifyPropertyChanging, INotifyPropertyChanged
    {

        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(System.String.Empty);

        private int _Id;

        private string _Code;

        private string _Name;

        private string _Value = @"";

        private string _Note;

        #region Extensibility Method Definitions
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
        partial void OnIdChanging(int value);
        partial void OnIdChanged();
        partial void OnCodeChanging(string value);
        partial void OnCodeChanged();
        partial void OnNameChanging(string value);
        partial void OnNameChanged();
        partial void OnValueChanging(string value);
        partial void OnValueChanged();
        partial void OnNoteChanging(string value);
        partial void OnNoteChanged();
        #endregion

        public GlobalPreference()
        {
            OnCreated();
        }

        /// <summary>
        /// There are no comments for Id in the schema.
        /// </summary>
        [Column(Name = @"id", Storage = "_Id", AutoSync = AutoSync.OnInsert, CanBeNull = false, DbType = "INT(10) NOT NULL AUTO_INCREMENT", IsDbGenerated = true, IsPrimaryKey = true)]
        public int Id
        {
            get
            {
                return this._Id;
            }
            set
            {
                if (this._Id != value)
                {
                    this.OnIdChanging(value);
                    this.SendPropertyChanging();
                    this._Id = value;
                    this.SendPropertyChanged("Id");
                    this.OnIdChanged();
                }
            }
        }

        /// <summary>
        /// Уникальный код настройки
        /// </summary>
        [Column(Name = @"code", Storage = "_Code", CanBeNull = false, DbType = "VARCHAR(16) NOT NULL")]
        public string Code
        {
            get
            {
                return this._Code;
            }
            set
            {
                if (this._Code != value)
                {
                    this.OnCodeChanging(value);
                    this.SendPropertyChanging();
                    this._Code = value;
                    this.SendPropertyChanged("Code");
                    this.OnCodeChanged();
                }
            }
        }

        /// <summary>
        /// Наименование
        /// </summary>
        [Column(Name = @"name", Storage = "_Name", CanBeNull = false, DbType = "VARCHAR(400) NOT NULL")]
        public string Name
        {
            get
            {
                return this._Name;
            }
            set
            {
                if (this._Name != value)
                {
                    this.OnNameChanging(value);
                    this.SendPropertyChanging();
                    this._Name = value;
                    this.SendPropertyChanged("Name");
                    this.OnNameChanged();
                }
            }
        }

        /// <summary>
        /// Значение
        /// </summary>
        [Column(Name = @"value", Storage = "_Value", CanBeNull = false, DbType = "VARCHAR(128) NOT NULL")]
        public string Value
        {
            get
            {
                return this._Value;
            }
            set
            {
                if (this._Value != value)
                {
                    this.OnValueChanging(value);
                    this.SendPropertyChanging();
                    this._Value = value;
                    this.SendPropertyChanged("Value");
                    this.OnValueChanged();
                }
            }
        }

        /// <summary>
        /// примечание(возможные варианты?)
        /// </summary>
        [Column(Name = @"note", Storage = "_Note", DbType = "VARCHAR(64)")]
        public string Note
        {
            get
            {
                return this._Note;
            }
            set
            {
                if (this._Note != value)
                {
                    this.OnNoteChanging(value);
                    this.SendPropertyChanging();
                    this._Note = value;
                    this.SendPropertyChanged("Note");
                    this.OnNoteChanged();
                }
            }
        }

        public event PropertyChangingEventHandler PropertyChanging;

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            if (this.PropertyChanging != null)
                this.PropertyChanging(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanging(System.String propertyName)
        {
            if (this.PropertyChanging != null)
                this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
        }

        protected virtual void SendPropertyChanged(System.String propertyName)
        {
             if (this.PropertyChanged != null)
                 this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }

}


text:
FROM node:6.11.1
MAINTAINER Axel Amigo <adamigo@neversyn.com>

#Define the environment variables
ENV SERVER_PORT=8009

#Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

#Install the sexy dependencies
COPY package.json /usr/src/app/
RUN npm install

# Bundle app source (this is not a sexy process)
COPY . /usr/src/app

EXPOSE ${SERVER_PORT}

CMD [ "npm", "runscript", "prod" ]


text:
function S = extractRandomDefinitions(F)
S = {};
for i = 1:length(F)
    S{i}.variables = F.clauses{i}.data;
    S{i}.distribution =  struct(F.clauses{1}.data).extra.distribution;
end


text:
package org.apache.shardingsphere.driver.state;

import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.spi.singleton.SingletonSPI;
import org.apache.shardingsphere.spi.typed.TypedSPI;

import java.sql.Connection;

/**
 * Driver state.
 */
public interface DriverState extends TypedSPI, SingletonSPI {

    /**
     * Get connection.
     *
     * @param schemaName schema name
     * @param contextManager context manager
     * @return connection
     */
    Connection getConnection(String schemaName, ContextManager contextManager);
}


text:
@interface
SentryBreadcrumbTracker (Private)

+ (NSString *)sanitizeViewControllerName:(NSString *)controller;

@end

@interface SentryTests : XCTestCase

@end

@implementation SentryTests

- (void)setUp
{
    [SentrySDK.currentHub bindClient:nil];
}

- (void)testVersion
{
    NSDictionary *info = [[NSBundle bundleForClass:[SentryClient class]] infoDictionary];
    NSString *version = [NSString stringWithFormat:@"%@", info[@"CFBundleShortVersionString"]];
    if ([info[@"CFBundleIdentifier"] isEqualToString:@"io.sentry.Sentry"]) {
        // This test is running on a bundle that is not the SDK
        // (code was loaded inside an app for example)
        // in this case, we don't care about asserting our hard coded value matches
        // since this will be the app version instead of our SDK version.
        XCTAssert([version isEqualToString:SentryMeta.versionString]);
    }
}

- (void)testSharedClient
{
    NSError *error = nil;
    SentryOptions *options = [[SentryOptions alloc]
            initWithDict:@{ @"dsn" : @"https://username:password@app.getsentry.com/12345" }
        didFailWithError:&error];

    SentryClient *client = [[SentryClient alloc] initWithOptions:options];
    XCTAssertNil(error);
    XCTAssertNil([SentrySDK.currentHub getClient]);
    [SentrySDK.currentHub bindClient:client];
    XCTAssertNotNil([SentrySDK.currentHub getClient]);
    [SentrySDK.currentHub bindClient:nil];
}

- (void)testSDKDefaultHub
{
    [SentrySDK startWithOptions:@{ @"dsn" : @"https://username:password@app.getsentry.com/12345" }];
    XCTAssertNotNil([SentrySDK.currentHub getClient]);
    [SentrySDK.currentHub bindClient:nil];
}

- (void)testSDKBreadCrumbAdd
{
    [SentrySDK startWithOptions:@{ @"dsn" : @"https://username:password@app.getsentry.com/12345" }];

    SentryBreadcrumb *crumb = [[SentryBreadcrumb alloc] initWithLevel:kSentryLevelInfo
                                                             category:@"testCategory"];
    crumb.type = @"testType";
    crumb.message = @"testMessage";
    crumb.data = @{ @"testDataKey" : @"testDataVaue" };

    [SentrySDK addBreadcrumb:crumb];
}

- (void)testSDKCaptureEvent
{
    [SentrySDK startWithOptions:@{ @"dsn" : @"https://username:password@app.getsentry.com/12345" }];

    SentryEvent *event = [[SentryEvent alloc] initWithLevel:kSentryLevelFatal];

    event.timestamp = [NSDate date];
    event.message = [[SentryMessage alloc] initWithFormatted:@"testy test"];

    [SentrySDK captureEvent:event];
}

- (void)testSDKCaptureError
{
    [SentrySDK startWithOptions:@{ @"dsn" : @"https://username:password@app.getsentry.com/12345" }];

    NSError *error =
        [NSError errorWithDomain:@"testworld"
                            code:200
                        userInfo:@{ NSLocalizedDescriptionKey : @"test ran out of money" }];
    [SentrySDK captureError:error];
}

- (void)testLevelNames
{
    XCTAssertEqualObjects(@"none", SentryLevelNames[kSentryLevelNone]);
    XCTAssertEqualObjects(@"debug", SentryLevelNames[kSentryLevelDebug]);
    XCTAssertEqualObjects(@"info", SentryLevelNames[kSentryLevelInfo]);
    XCTAssertEqualObjects(@"warning", SentryLevelNames[kSentryLevelWarning]);
    XCTAssertEqualObjects(@"error", SentryLevelNames[kSentryLevelError]);
    XCTAssertEqualObjects(@"fatal", SentryLevelNames[kSentryLevelFatal]);
}

- (void)testLevelOrder
{
    XCTAssertGreaterThan(kSentryLevelFatal, kSentryLevelError);
    XCTAssertGreaterThan(kSentryLevelError, kSentryLevelWarning);
    XCTAssertGreaterThan(kSentryLevelWarning, kSentryLevelInfo);
    XCTAssertGreaterThan(kSentryLevelInfo, kSentryLevelDebug);
    XCTAssertGreaterThan(kSentryLevelDebug, kSentryLevelNone);
}

- (void)testDateCategory
{
    NSTimeInterval timeInterval = 1605888590.123;
    NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeInterval];
    XCTAssertEqual(
        [[NSDate sentry_fromIso8601String:[date sentry_toIso8601String]] timeIntervalSince1970],
        timeInterval);
}

- (void)testDateCategoryPrecision
{
    NSDate *date1 = [NSDate dateWithTimeIntervalSinceReferenceDate:0.1234];
    XCTAssertEqualObjects([date1 sentry_toIso8601String], @"2001-01-01T00:00:00.123Z");

    NSDate *date2 = [NSDate dateWithTimeIntervalSinceReferenceDate:0.9995];
    XCTAssertEqualObjects([date2 sentry_toIso8601String], @"2001-01-01T00:00:01.000Z");
}

- (void)testDateCategoryCompactibility
{
    NSDate *date = [NSDate sentry_fromIso8601String:@"2020-02-27T11:35:26Z"];
    XCTAssertEqual([date timeIntervalSince1970], 1582803326.0);
}

@end


text: CKEDITOR.plugins.setLang("removeformat","sl",{toolbar:"Odstrani oblikovanje"});


text:
def checksum(source, dest):
    return source + dest

def formatMessage(dest, source, message):
    return  str(dest) + ";" + str(source) + ";" + message + ";" + str(checksum(int(source), int(dest)))


text:
using LambdicSql.ConverterServices;
using LambdicSql.ConverterServices.SymbolConverters;

namespace LambdicSql.SqlServer
{
    //@@@
    public static partial class Symbol
    {
        /// <summary>
        /// @@TOTAL_WRITE
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/error-transact-sql
        /// </summary>
        /// <returns></returns>
        [ClauseStyleConverter(Name = "@@ERROR")]
        public static int AtAtError() => throw new InvalitContextException(nameof(AtAtError));

        /// <summary>
        /// @@IDENTITY
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/identity-transact-sql
        /// </summary>
        /// <returns></returns>
        [ClauseStyleConverter(Name = "@@IDENTITY")]
        public static decimal AtAtIdentity() => throw new InvalitContextException(nameof(AtAtIdentity));

        /// <summary>
        /// @@PACK_RECEIVED
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/pack-received-transact-sql
        /// </summary>
        /// <returns></returns>
        [ClauseStyleConverter(Name = "@@PACK_RECEIVED")]
        public static int AtAtPackReceived() => throw new InvalitContextException(nameof(AtAtPackReceived));

        /// <summary>
        /// @@ROWCOUNT
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/rowcount-transact-sql
        /// </summary>
        /// <returns></returns>
        [ClauseStyleConverter(Name = "@@ROWCOUNT")]
        public static int AtAtRowCount() => throw new InvalitContextException(nameof(AtAtRowCount));

        /// <summary>
        /// @@TRANCOUNT
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/trancount-transact-sql
        /// </summary>
        /// <returns></returns>
        [ClauseStyleConverter(Name = "@@TRANCOUNT")]
        public static int AtAtTranCount() => throw new InvalitContextException(nameof(AtAtError));

        /// <summary>
        /// BINARY_CHECKSUM
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/binary-checksum-transact-sql
        /// </summary>
        /// <param name="expression">columns or Asterisk()</param>
        /// <returns>check sum.</returns>
        [FuncStyleConverter]
        public static int Binary_CheckSum(params object[] expression) => throw new InvalitContextException(nameof(Binary_CheckSum));

        /// <summary>
        /// CHECKSUM
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/checksum-transact-sql
        /// </summary>
        /// <param name="expression">columns or Asterisk()</param>
        /// <returns>check sum.</returns>
        [FuncStyleConverter]
        public static int CheckSum(params object[] expression) => throw new InvalitContextException(nameof(CheckSum));

        /// <summary>
        /// COMPRESS
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/compress-transact-sql
        /// </summary>
        /// <param name="expression">columns or Asterisk()</param>
        /// <returns>Compressed value.</returns>
        [FuncStyleConverter]
        public static byte[] Compress(object expression) => throw new InvalitContextException(nameof(Compress));

        /// <summary>
        /// CONNECTIONPROPERTY
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/connectionproperty-transact-sql
        /// </summary>
        /// <param name="property">columns or Asterisk()</param>
        /// <returns>Connection property.</returns>
        [FuncStyleConverter]
        public static object ConnectionProperty(object property) => throw new InvalitContextException(nameof(ConnectionProperty));

        /// <summary>
        /// CONTEXT_INFO
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/context-info-transact-sql
        /// </summary>
        /// <returns>context_info.</returns>
        [FuncStyleConverter]
        public static byte[] Context_Info() => throw new InvalitContextException(nameof(Context_Info));

        /// <summary>
        /// CURRENT_REQUEST_ID
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/current-request-id-transact-sql
        /// </summary>
        /// <returns>To find exact information about the current session and current request, use @@SPID and CURRENT_REQUEST_ID(), respectively.</returns>
        [FuncStyleConverter]
        public static short Current_Request_Id() => throw new InvalitContextException(nameof(Current_Request_Id));

        /// <summary>
        /// CURRENT_TRANSACTION_ID
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/current-transaction-id-transact-sql
        /// </summary>
        /// <returns>Transaction ID of the current transaction in the current session, taken from sys.dm_tran_current_transaction (Transact-SQL).</returns>
        [FuncStyleConverter]
        public static long Current_Transaction_Id() => throw new InvalitContextException(nameof(Current_Transaction_Id));

        /// <summary>
        /// DECOMPRESS
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/decompress-transact-sql
        /// </summary>
        /// <param name="expression">compressed value.</param>
        /// <returns>decompressed value.</returns>
        [FuncStyleConverter]
        public static byte[] Decompress(byte[] expression) => throw new InvalitContextException(nameof(Decompress));

        /// <summary>
        /// ERROR_LINE
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/error-line-transact-sql
        /// </summary>
        /// <returns>error line.</returns>
        [FuncStyleConverter]
        public static int Error_Line() => throw new InvalitContextException(nameof(Error_Line));

        /// <summary>
        /// ERROR_MESSAGE
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/error-message-transact-sql
        /// </summary>
        /// <returns>error message.</returns>
        [FuncStyleConverter]
        public static int Error_Message() => throw new InvalitContextException(nameof(Error_Message));

        /// <summary>
        /// ERROR_NUMBER
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/error-number-transact-sql
        /// </summary>
        /// <returns>error number.</returns>
        [FuncStyleConverter]
        public static int Error_Number() => throw new InvalitContextException(nameof(Error_Number));

        /// <summary>
        /// ERROR_PROCEDURE
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/error-procedure-transact-sql
        /// </summary>
        /// <returns>error procedure.</returns>
        [FuncStyleConverter]
        public static int Error_Procedure() => throw new InvalitContextException(nameof(Error_Procedure));

        /// <summary>
        /// ERROR_SEVERITY
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/error-severity-transact-sql
        /// </summary>
        /// <returns>error severity.</returns>
        [FuncStyleConverter]
        public static int Error_Severity() => throw new InvalitContextException(nameof(Error_Severity));

        /// <summary>
        /// ERROR_STATE
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/error-state-transact-sql
        /// </summary>
        /// <returns>error .</returns>
        [FuncStyleConverter]
        public static int Error_State() => throw new InvalitContextException(nameof(Error_State));

        /// <summary>
        /// FORMATMESSAGE
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/formatmessage-transact-sql
        /// </summary>
        /// <param name="msg">msg.</param>
        /// <param name="param_values">param_values.</param>
        /// <returns>formated message.</returns>
        [FuncStyleConverter]
        public static string FormatMessage(object msg, params object[] param_values) => throw new InvalitContextException(nameof(FormatMessage));

        /// <summary>
        /// GET_FILESTREAM_TRANSACTION_CONTEXT
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/get-filestream-transaction-context-transact-sql
        /// </summary>
        /// <returns>token.</returns>
        [FuncStyleConverter]
        public static object Get_FileStream_Transaction_Context() => throw new InvalitContextException(nameof(Get_FileStream_Transaction_Context));

        /// <summary>
        /// GETANSINULL
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/getansinull-transact-sql
        /// </summary>
        /// <param name="database">database.</param>
        /// <returns>Returns the default nullability for the database for this session.</returns>
        [FuncStyleConverter]
        public static int GetAnsiNull(string database) => throw new InvalitContextException(nameof(GetAnsiNull));

        /// <summary>
        /// HOST_ID
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/host-id-transact-sql
        /// </summary>
        /// <returns>host id.</returns>
        [FuncStyleConverter]
        public static string Host_Id() => throw new InvalitContextException(nameof(Host_Id));

        /// <summary>
        /// HOST_NAME
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/host-name-transact-sql
        /// </summary>
        /// <returns>host name.</returns>
        [FuncStyleConverter]
        public static string Host_Name() => throw new InvalitContextException(nameof(Host_Name));

        /// <summary>
        /// Replaces NULL with the specified replacement value.
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/isnull-transact-sql
        /// </summary>
        /// <param name="check_expression"></param>
        /// <param name="replacement_value"></param>
        /// <returns>check_expression or replacement_value.</returns>
        [FuncStyleConverter]
        public static object IsNull(object check_expression, object replacement_value) => throw new InvalitContextException(nameof(IsNull));

        /// <summary>
        /// ISNUMERIC
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/isnumeric-transact-sql
        /// </summary>
        /// <param name="expression"></param>
        /// <returns>is numeric expression.</returns>
        [FuncStyleConverter]
        public static int IsNumeric(object expression) => throw new InvalitContextException(nameof(IsNumeric));

        /// <summary>
        /// MIN_ACTIVE_ROWVERSION
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/min-active-rowversion-transact-sql
        /// </summary>
        /// <returns></returns>
        [FuncStyleConverter]
        public static object Min_Active_Rowversion() => throw new InvalitContextException(nameof(Min_Active_Rowversion));

        /// <summary>
        /// NEWID
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/newid-transact-sql
        /// </summary>
        /// <returns>new id.</returns>
        [FuncStyleConverter]
        public static object NewId() => throw new InvalitContextException(nameof(NewId));

        /// <summary>
        /// NEWSEQUENTIALID
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/newsequentialid-transact-sql
        /// </summary>
        /// <returns>new sequential id.</returns>
        [FuncStyleConverter]
        public static object NewSequentialdId() => throw new InvalitContextException(nameof(NewSequentialdId));

        /// <summary>
        /// ROWCOUNT_BIG
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/rowcount-big-transact-sql
        /// </summary>
        /// <returns>row count.</returns>
        [FuncStyleConverter]
        public static long RowCount_Big() => throw new InvalitContextException(nameof(RowCount_Big));

        /// <summary>
        /// SESSION_CONTEXT
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/session-context-transact-sql
        /// </summary>
        /// <param name="key">key.</param>
        /// <returns>session context.</returns>
        [FuncStyleConverter]
        public static object Session_Context(string key) => throw new InvalitContextException(nameof(Session_Context));

        /// <summary>
        /// SESSION_ID
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/session-id-transact-sql
        /// </summary>
        /// <returns>sesson id.</returns>
        [FuncStyleConverter]
        public static string Session_Id() => throw new InvalitContextException(nameof(Session_Id));

        /// <summary>
        /// XACT_STATE
        /// https://docs.microsoft.com/en-us/sql/t-sql/functions/xact-state-transact-sql
        /// </summary>
        /// <returns>transaction state of a current running request. </returns>
        [FuncStyleConverter]
        public static short Xact_State() => throw new InvalitContextException(nameof(Xact_State));

        //TODO ????
        /*
        $PARTITION
        */
    }
}


text:
status: publish
tags:
- mozilla
- myspace
- privacy
- USA
- websights
published: true
title: MySpace Email Blocking
type: post
meta:
  _oembed_94791b7e59bb3ec96332fc6982e301e1: "{{unknown}}"
  _oembed_cf70811e1a2b5a1ae003e185ece6a2a7: "{{unknown}}"
  _oembed_a5839a42cf823ed22213a7b91e9c9a94: "{{unknown}}"
  _oembed_e66cb067cdbd575a807d540e739228a1: "{{unknown}}"
layout: post
---
Today, I received my first MySpace invitation spam ever, featuring some text along the lines of:

Hi gorgeous i loved your profile
you want to have great time... blah, blah...

Sadly for her, I am not a MySpace member and probably never will, but when I almost hit the "Report Spam" button, I realized that myspace has a proactive approach against spam from their members (also described in their privacy policy). The end of the mail reads:

If you want to block any emails from MySpace members in the future, you can click here:

http://www1.myspace.com/...

Or send a single blank email with the subject line "BLOCK" to:

privacy (at) myspace (dot) com

You can also block future email or direct any other inquiries by regular postal mail to:

MySpace, Inc.
8391 Beverly Blvd. #349
Los Angeles, CA 90048
USA

After making sure the mail was not a phishing attack, I went to the provided link and put my address on MySpace's block list and now I am fairly confident this first invitation spam message will also have been my last.

As they tend to live off the sharing of private data, social networking sites almost never deserve praise for something they do privacy-related. This, I believe, is a notable exception.

(Note: A double opt-in system would be even better, yet that would defeat the purpose of "inviting one's friends" into a social network, who have not opted into the network (yet) by definition.)


text:
class CreateFantasyDraftStyles < ActiveRecord::Migration
  def change
    create_table :fantasy_draft_styles do |t|
      t.string :name

      t.timestamps
    end
  end
end