text:
#include "routing/routing_quality/routing_quality_tool/benchmark_stat.hpp"

#include "routing/routing_quality/routing_quality_tool/benchmark_results.hpp"
#include "routing/routing_quality/routing_quality_tool/error_type_counter.hpp"
#include "routing/routing_quality/routing_quality_tool/utils.hpp"

#include "routing/routing_callbacks.hpp"

#include "geometry/point2d.hpp"

#include "base/assert.hpp"
#include "base/file_name_utils.hpp"
#include "base/logging.hpp"
#include "base/string_utils.hpp"

#include <algorithm>

namespace
{
using namespace routing;
using namespace routes_builder;
using namespace routing_quality::routing_quality_tool;

bool IsErrorCode(RouterResultCode code)
{
  return code != RouterResultCode::NoError;
}

void LogIfNotConsistent(RoutesBuilder::Result const & oldRes, RoutesBuilder::Result const & newRes)
{
  auto const start = mercator::ToLatLon(oldRes.m_params.m_checkpoints.GetStart());
  auto const finish = mercator::ToLatLon(oldRes.m_params.m_checkpoints.GetFinish());
  CHECK(!oldRes.m_routes.empty(), ());
  CHECK(!newRes.m_routes.empty(), ());
  auto const & oldRoute = oldRes.m_routes.back();
  auto const & newRoute = newRes.m_routes.back();

  bool const sameETA = base::AlmostEqualAbs(oldRoute.m_eta, newRoute.m_eta, 1.0);
  bool const sameDistance = base::AlmostEqualAbs(oldRoute.m_distance, newRoute.m_distance, 1.0);
  if (!sameETA || !sameDistance)
  {
    LOG(LINFO, ("old ETA:", oldRoute.m_eta, "old distance:", oldRoute.m_distance, "new ETA:",
                newRoute.m_eta, "new distance:", newRoute.m_distance, start, finish));
  }
}

/// \brief Helps to compare route time building for routes group by old time building.
void FillInfoAboutBuildTimeGroupByPreviousResults(std::vector<std::string> & labels,
                                                  std::vector<std::vector<double>> & bars,
                                                  std::vector<TimeInfo> && times)
{
  bars.clear();
  labels.clear();

  std::sort(times.begin(), times.end(), [](auto const & a, auto const & b) {
    return a.m_oldTime < b.m_oldTime;
  });

  size_t constexpr kSteps = 10;
  size_t const step = times.size() / kSteps;

  size_t startFrom = 0;
  size_t curCount = 0;
  bars.resize(2);
  double curSumOld = 0;
  double curSumNew = 0;
  for (size_t i = 0; i < times.size(); ++i)
  {
    if (curCount < step && i + 1 != times.size())
    {
      ++curCount;
      curSumOld += times[i].m_oldTime;
      curSumNew += times[i].m_newTime;
      continue;
    }

    double const curLeft = times[startFrom].m_oldTime;
    startFrom = i + 1;
    double const curRight = times[i].m_oldTime;
    labels.emplace_back("[" + strings::to_string_dac(curLeft, 2 /* dac */) + "s, " +
                        strings::to_string_dac(curRight, 2 /* dac */) + "s]\\n" +
                        "Routes count:\\n" + std::to_string(curCount));
    if (curCount != 0)
    {
      curSumOld /= curCount;
      curSumNew /= curCount;
    }
    double const k = curSumOld == 0.0 ? 0.0 : curSumNew / curSumOld;
    bars[0].emplace_back(100.0);
    bars[1].emplace_back(100.0 * k);
    curCount = 0;
  }
}

std::vector<double> GetBoostPercents(BenchmarkResults const & oldResults,
                                     BenchmarkResults const & newResults)
{
  std::vector<double> boostPercents;
  for (size_t i = 0; i < oldResults.GetBuildTimes().size(); ++i)
  {
    auto const oldTime = oldResults.GetBuildTimes()[i];
    auto const newTime = newResults.GetBuildTimes()[i];
    if (base::AlmostEqualAbs(oldTime, newTime, 1e-2))
      continue;

    auto const diffPercent = (oldTime - newTime) / oldTime * 100.0;
    boostPercents.emplace_back(diffPercent);
  }

  return boostPercents;
}
}  // namespace

namespace routing_quality::routing_quality_tool
{
using namespace routing;
using namespace routes_builder;
// Shows distribution of routes time building.
static std::string const kPythonDistTimeBuilding = "show_route_time_building_dist.py";
// Shows graph of "how many routes in percents build in less time than some T".
static std::string const kPythonGraphTimeAndCount = "show_time_count_graph.py";
// Bar graph of routing errors. Labels - string representation of errors, heights - number of such
// errors.
static std::string const kPythonBarError = "show_errors_bar.py";
// Shows percent of boost distribution. Where boost percent equals:
// 100.0 * (old_time - new_time) / old_time
static std::string const kPythonBarBoostPercentDistr = "show_boost_distr.py";
// Shows distribution of non-zero difference of ETA between old and new mapsme version.
static std::string const kPythonEtaDiff = "eta_diff.py";
// The same as above but in percents.
static std::string const kPythonEtaDiffPercent = "eta_diff_percent.py";
// Groups routes by previous time building and draws two types of bars. The first one (old mapsme)
// has the same height in all groups and the second ones' height is proportional less or more
// according to difference in average time building between old and new version. The example you can
// see here: https://github.com/mapsme/omim/pull/12401
static std::string const kPythonSmartDistr = "show_smart_boost_distr.py";

void RunBenchmarkStat(
    std::vector<std::pair<RoutesBuilder::Result, std::string>> const & mapsmeResults,
    std::string const & dirForResults)
{
  BenchmarkResults benchmarkResults;
  ErrorTypeCounter errorTypeCounter;
  for (auto const & resultItem : mapsmeResults)
  {
    auto const & result = resultItem.first;
    errorTypeCounter.PushError(result.m_code);
    if (result.m_code != RouterResultCode::NoError)
      continue;

    CHECK(!result.m_routes.empty(), ());
    benchmarkResults.PushBuildTime(result.m_buildTimeSeconds);
  }

  auto pythonScriptPath = base::JoinPath(dirForResults, kPythonDistTimeBuilding);
  CreatePythonScriptForDistribution(pythonScriptPath, "Route building time, seconds",
                                    benchmarkResults.GetBuildTimes());

  LOG(LINFO, ("Average route time building:", benchmarkResults.GetAverageBuildTime(), "seconds."));

  auto times = benchmarkResults.GetBuildTimes();
  std::sort(times.begin(), times.end());
  std::vector<m2::PointD> countToTimes(times.size());
  for (size_t i = 0; i < countToTimes.size(); ++i)
  {
    countToTimes[i].x = times[i];
    countToTimes[i].y = static_cast<double>(i + 1) / times.size() * 100.0;
  }

  pythonScriptPath = base::JoinPath(dirForResults, kPythonGraphTimeAndCount);
  CreatePythonGraphByPointsXY(pythonScriptPath,
                              "Building time, seconds" /* xlabel */,
                              "Percent of routes built less than" /* ylabel */,
                              {countToTimes}, {"mapsme"} /* legends */);

  pythonScriptPath = base::JoinPath(dirForResults, kPythonBarError);

  std::vector<std::string> labels;
  std::vector<double> heights;
  FillLabelsAndErrorTypeDistribution(labels, heights, errorTypeCounter);

  CreatePythonBarByMap(pythonScriptPath, labels, {heights}, {"mapsme"} /* legends */,
                       "Type of errors" /* xlabel */, "Number of errors" /* ylabel */);
}

void RunBenchmarkComparison(
    std::vector<std::pair<RoutesBuilder::Result, std::string>> && mapsmeResults,
    std::vector<std::pair<RoutesBuilder::Result, std::string>> && mapsmeOldResults,
    std::string const & dirForResults)
{
  BenchmarkResults benchmarkResults;
  BenchmarkResults benchmarkOldResults;
  ErrorTypeCounter errorTypeCounter;
  ErrorTypeCounter errorTypeCounterOld;
  std::vector<double> etaDiffsPercent;
  std::vector<double> etaDiffs;

  std::vector<TimeInfo> times;

  for (size_t i = 0; i < mapsmeResults.size(); ++i)
  {
    auto const & mapsmeResult = mapsmeResults[i].first;

    std::pair<RoutesBuilder::Result, std::string> mapsmeOldResultPair;
    if (!FindAnotherResponse(mapsmeResult, mapsmeOldResults, mapsmeOldResultPair))
    {
      LOG(LDEBUG, ("Can not find pair for:", i));
      continue;
    }

    auto const & mapsmeOldResult = mapsmeOldResultPair.first;

    errorTypeCounter.PushError(mapsmeResult.m_code);
    errorTypeCounterOld.PushError(mapsmeOldResult.m_code);

    if (IsErrorCode(mapsmeResult.m_code) && !IsErrorCode(mapsmeOldResult.m_code))
    {
      auto const start = mercator::ToLatLon(mapsmeResult.m_params.m_checkpoints.GetStart());
      auto const finish = mercator::ToLatLon(mapsmeResult.m_params.m_checkpoints.GetFinish());
      LOG_FORCE(LWARNING, ("New version returns error code:", mapsmeResult.m_code,
                           "but old returns NoError for:", start, finish));
    }

    if (IsErrorCode(mapsmeResult.m_code) || IsErrorCode(mapsmeOldResult.m_code))
      continue;

    LogIfNotConsistent(mapsmeOldResult, mapsmeResult);

    CHECK(!mapsmeOldResult.m_routes.empty() && !mapsmeResult.m_routes.empty(), ());
    auto const etaDiff =
        (mapsmeOldResult.m_routes.back().m_eta - mapsmeResult.m_routes.back().m_eta);
    auto const etaDiffPercent = etaDiff / mapsmeOldResult.m_routes.back().m_eta * 100.0;

    etaDiffs.emplace_back(etaDiff);
    etaDiffsPercent.emplace_back(etaDiffPercent);

    auto const oldTime = mapsmeOldResult.m_buildTimeSeconds;
    auto const newTime = mapsmeResult.m_buildTimeSeconds;
    auto const diffPercent = (oldTime - newTime) / oldTime * 100.0;
    // Warn about routes building time degradation.
    double constexpr kSlowdownPercent = -10.0;
    if (diffPercent < kSlowdownPercent)
    {
      auto const start = mercator::ToLatLon(mapsmeResult.m_params.m_checkpoints.GetStart());
      auto const finish = mercator::ToLatLon(mapsmeResult.m_params.m_checkpoints.GetFinish());
      LOG(LINFO, ("oldTime:", oldTime, "newTime:", newTime, "diffPercent:", diffPercent, start, finish));
    }

    benchmarkResults.PushBuildTime(mapsmeResult.m_buildTimeSeconds);
    benchmarkOldResults.PushBuildTime(mapsmeOldResult.m_buildTimeSeconds);

    times.emplace_back(mapsmeOldResult.m_buildTimeSeconds, mapsmeResult.m_buildTimeSeconds);
  }

  LOG(LINFO, ("Comparing", benchmarkResults.GetBuildTimes().size(), "routes."));

  auto const oldAverage = benchmarkOldResults.GetAverageBuildTime();
  auto const newAverage = benchmarkResults.GetAverageBuildTime();
  auto const averageTimeDiff = (oldAverage - newAverage) / oldAverage * 100.0;
  LOG(LINFO, ("Average route time building. "
              "Old version:", oldAverage,
              "New version:", newAverage,
              "(", -averageTimeDiff, "% )"));

  std::vector<std::vector<m2::PointD>> graphics;
  for (auto const & results : {benchmarkOldResults, benchmarkResults})
  {
    auto times = results.GetBuildTimes();
    std::sort(times.begin(), times.end());
    std::vector<m2::PointD> countToTimes(times.size());
    for (size_t i = 0; i < countToTimes.size(); ++i)
    {
      countToTimes[i].x = times[i];
      countToTimes[i].y = static_cast<double>(i + 1) / times.size() * 100.0;
    }

    graphics.emplace_back(std::move(countToTimes));
  }

  auto pythonScriptPath = base::JoinPath(dirForResults, kPythonGraphTimeAndCount);
  CreatePythonGraphByPointsXY(pythonScriptPath, "Building time, seconds" /* xlabel */,
                              "Percent of routes built less than" /* ylabel */, graphics,
                              {"old mapsme", "new mapsme"} /* legends */);

  std::vector<std::string> labels;
  std::vector<std::vector<double>> errorsCount;
  FillLabelsAndErrorTypeDistribution(labels, errorsCount, errorTypeCounter, errorTypeCounterOld);

  pythonScriptPath = base::JoinPath(dirForResults, kPythonBarError);
  CreatePythonBarByMap(pythonScriptPath, labels, errorsCount,
                       {"old mapsme", "new mapsme"} /* legends */, "Type of errors" /* xlabel */,
                       "Number of errors" /* ylabel */);

  auto const boostPercents = GetBoostPercents(benchmarkOldResults, benchmarkResults);
  pythonScriptPath = base::JoinPath(dirForResults, kPythonBarBoostPercentDistr);
  CreatePythonScriptForDistribution(pythonScriptPath, "Boost percent" /* title */, boostPercents);

  pythonScriptPath = base::JoinPath(dirForResults, kPythonEtaDiff);
  CreatePythonScriptForDistribution(pythonScriptPath, "ETA diff distribution" /* title */,
                                    etaDiffs);

  pythonScriptPath = base::JoinPath(dirForResults, kPythonEtaDiffPercent);
  CreatePythonScriptForDistribution(pythonScriptPath, "ETA diff percent distribution" /* title */,
                                    etaDiffsPercent);

  std::vector<std::vector<double>> bars;
  FillInfoAboutBuildTimeGroupByPreviousResults(labels, bars, std::move(times));
  pythonScriptPath = base::JoinPath(dirForResults, kPythonSmartDistr);
  CreatePythonBarByMap(
      pythonScriptPath, labels, bars, {"old mapsme", "new mapsme"} /* legends */,
      "Intervals of groups (build time in old mapsme)" /* xlabel */,
      "Boost\\nRight column is so lower/higher than the left\\n how much the average build time "
      "has decreased in each group)" /* ylabel */,
      false /* drawPercents */);
}
}  // namespace routing_quality::routing_quality_tool


text:
package com.orientechnologies.lucene.tests;

import static com.orientechnologies.lucene.functions.OLuceneFunctionsUtils.doubleEscape;
import static org.assertj.core.api.Assertions.assertThat;

import com.orientechnologies.orient.core.sql.executor.OResultSet;
import java.io.InputStream;
import org.junit.Before;
import org.junit.Test;

/** Created by frank on 09/05/2017. */
public class OLuceneMetadataFieldsTest extends OLuceneBaseTest {

  @Before
  public void setUp() throws Exception {
    InputStream stream = ClassLoader.getSystemResourceAsStream("testLuceneIndex.sql");

    db.execute("sql", getScriptFromStream(stream));

    db.command("create index Song.title on Song (title) FULLTEXT ENGINE LUCENE ");
  }

  @Test
  public void shouldFetchOnlyFromACluster() throws Exception {

    assertThat(
            db.getMetadata()
                .getIndexManagerInternal()
                .getIndex(db, "Song.title")
                .getInternal()
                .size())
        .isEqualTo(585);

    int cluster = db.getMetadata().getSchema().getClass("Song").getClusterIds()[1];
    db.commit();

    OResultSet results =
        db.query("SELECT FROM Song WHERE search_class('+_CLUSTER:" + cluster + "')=true ");

    assertThat(results).hasSize(73);
    results.close();
  }

  @Test
  public void shouldFetchByRid() throws Exception {

    String ridQuery = doubleEscape("#26:4 #26:5");
    OResultSet results =
        db.query("SELECT FROM Song WHERE search_class('RID:(" + ridQuery + ") ')=true ");

    assertThat(results).hasSize(2);
    results.close();
  }
}

redpajama_set_name: RedPajamaGithub


text:
<TITLE>Review for Lion King, The (1994)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Lion King, The (1994)

reviewed by
Ethan Solomita

                                 THE LION KING
                       A film review by Ethan Solomita
                        Copyright 1994 Ethan Solomita

     Ready for some controversy?  Good!  Well, off we go:

     First, the animation quality was amazing!  It was the best I've
ever seen from a Disney movie, certainly for anything of the length of
a feature film!. And, best of all, I couldn't tell where the computer
effects were used.

     In ALADDIN, I could pick it out: carpet, cave-o'-wonders,
carpet-chase, etc.  Here, I only had guesses.

     Also, unlike ALADDIN, the background artwork was a major factor in
the quality.  No boring backgrounds here (well, except for the simple
sheer rock cliffs).

     Moving on, however.  Yes, the songs needed improvement.  The
opening "Circle of Life" I really liked, thanks mostly to Hans Zimmer and
the Chorus.  And, like a prior poster, I thought that 'Can't Wait to be
King" felt thrown in just because they *had* to have a showy dance
number.  However, I did think the animation was quite good, and
interesting the way everything changed for that segment.

     The plot ...  Ah yes, the plot ...  Well, it was more "adult" than
old-time movies like BAMBI, in that it presented life more harshly.
But it was very rushed.  I'm afraid the sudden growth during "Hakuna
Matata" doesn't make up for character development!  In an effort to save
money, and time, Disney won't make their movies longer.  Other movie
houses have to spend $100M+ to bring in the blockbusters, and Disney
won't do it.  Disappointing.

     So it was enjoyable, and it really was very funny (I often
couldn't hear the lines over the laughter in the theater), but in the
end it was so rushed I wasn't drawn into the characters (especially
Simba) to care.

     By the way, was that the entirety of the lion pride?  Where's
everyone else?  How about some other males?  (Maybe I just don't know
enough about real lion packs, but then again, most lion packs don't
have kings that rule the jungle. :-) )

     So, that's it!  I did enjoy it, and I'm sure I'll see it again,
but for me the storyline didn't hold the adult level of appeal of
BEAUTY AND THE BEAST.

     But, for all the feature animation people reading this:  GREAT
WORK!

     -- Ethan

.

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Threading;
using Xunit;

namespace System.Reflection.Emit.Lightweight.Tests
{
    public class DynamicMethodctor5
    {
        [Fact]
        public void PosTest1()
        {
            Module mod = typeof(MethodTestClass5).GetTypeInfo().Module;
            bool skipVisb = true;
            DynamicMethod dynamicMeth = new DynamicMethod("Pos1method", MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, typeof(void), null, mod, skipVisb);
            MethodAttributes attributes = dynamicMeth.Attributes;
            CallingConventions callCon = dynamicMeth.CallingConvention;
            Assert.False(dynamicMeth == null || dynamicMeth.Name != "Pos1method" || attributes != (MethodAttributes.Public | MethodAttributes.Static) || callCon != CallingConventions.Standard);
        }

        [Fact]
        public void PosTest2()
        {
            Module mod = typeof(MethodTestClass5).GetTypeInfo().Module;
            bool skipVisb = false;
            DynamicMethod dynamicMeth = new DynamicMethod("Pos2method", MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, typeof(void), new Type[] { typeof(int), typeof(string) }, mod, skipVisb);
            MethodAttributes attributes = dynamicMeth.Attributes;
            CallingConventions callCon = dynamicMeth.CallingConvention;
            Assert.False(dynamicMeth == null || dynamicMeth.Name != "Pos2method" || attributes != (MethodAttributes.Public | MethodAttributes.Static) || callCon != CallingConventions.Standard);
        }

        [Fact]
        public void PosTest3()
        {
            Module mod = typeof(MethodTestClass5).GetTypeInfo().Module;
            bool skipVisib = true;
            DynamicMethod dynamicMeth = new DynamicMethod("Pos3method", MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, typeof(string), new Type[] { typeof(int), typeof(string) }, mod, skipVisib);
            MethodAttributes attributes = dynamicMeth.Attributes;
            Assert.False(dynamicMeth == null || dynamicMeth.Name != "Pos3method" || attributes != (MethodAttributes.Static | MethodAttributes.Public) || dynamicMeth.CallingConvention != CallingConventions.Standard);
        }

        [Fact]
        public void NegTest1()
        {
            Module mod = typeof(MethodTestClass5).GetTypeInfo().Module;
            bool[] skipVisibs = new bool[] { false, true };
            for (int i = 0; i < skipVisibs.Length; i++)
            {
                Assert.Throws<ArgumentException>(() => { DynamicMethod dynamicMeth = new DynamicMethod("Neg1method", MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, typeof(void), new Type[] { null, typeof(string) }, mod, skipVisibs[i]); });
            }
        }

        [Fact]
        public void NegTest2()
        {
            Module mod = typeof(MethodTestClass5).GetTypeInfo().Module;
            bool[] skipVisibs = new bool[] { false, true };
            for (int i = 0; i < skipVisibs.Length; i++)
            {
                Assert.Throws<ArgumentException>(() => { DynamicMethod dynamicMeth = new DynamicMethod("Neg2method", MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, typeof(void), new Type[] { typeof(void), typeof(string) }, mod, skipVisibs[i]); });
            }
        }

        [Fact]
        public void NegTest3()
        {
            Module mod = typeof(MethodTestClass5).GetTypeInfo().Module;
            bool[] skipVisibs = new bool[] { false, true };
            for (int i = 0; i < skipVisibs.Length; i++)
            {
                Assert.Throws<ArgumentNullException>(() => { DynamicMethod dynamicMeth = new DynamicMethod(null, MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, typeof(void), new Type[] { typeof(string) }, mod, skipVisibs[i]); });
            }
        }

        [Fact]
        public void NegTest4()
        {
            Module mod = null;
            bool[] skipVisibs = new bool[] { false, true };
            for (int i = 0; i < skipVisibs.Length; i++)
            {
                Assert.Throws<ArgumentNullException>(() => { DynamicMethod dynamicMeth = new DynamicMethod("Neg4method", MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, typeof(void), new Type[] { typeof(string) }, mod, skipVisibs[i]); });
            }
        }

        [Fact]
        public void NegTest5()
        {
            Module mod = typeof(MethodTestClass5).GetTypeInfo().Module;
            bool[] skipVisibs = new bool[] { false, true };
            Type tpA = CreateType();
            for (int i = 0; i < skipVisibs.Length; i++)
            {
                Assert.Throws<NotSupportedException>(() => { DynamicMethod dynamicMeth = new DynamicMethod("Neg4method", MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, tpA, new Type[] { typeof(string) }, mod, skipVisibs[i]); });
            }
        }

        [Fact]
        public void NegTest6()
        {
            Module mod = typeof(MethodTestClass5).GetTypeInfo().Module;
            bool[] skipVisibs = new bool[] { false, true };
            for (int i = 0; i < skipVisibs.Length; i++)
            {
                Assert.Throws<NotSupportedException>(() => { DynamicMethod dynamicMeth = new DynamicMethod("Neg6method", MethodAttributes.Private | MethodAttributes.Virtual, CallingConventions.Standard, typeof(void), new Type[] { typeof(string) }, mod, skipVisibs[i]); });
            }
        }

        [Fact]
        public void NegTest7()
        {
            Module mod = typeof(MethodTestClass5).GetTypeInfo().Module;
            bool[] skipVisibs = new bool[] { false, true };
            for (int i = 0; i < skipVisibs.Length; i++)
            {
                Assert.Throws<NotSupportedException>(() => { DynamicMethod dynamicMeth = new DynamicMethod("Neg7method", MethodAttributes.Public | MethodAttributes.Static, CallingConventions.VarArgs, typeof(void), new Type[] { typeof(string) }, mod, skipVisibs[i]); });
            }
        }

        private static Type CreateType()
        {
            AssemblyName assemName = new AssemblyName("assemName");
            AssemblyBuilder myAssemBuilder = AssemblyBuilder.DefineDynamicAssembly(assemName, AssemblyBuilderAccess.Run);
            ModuleBuilder myModB = Utilities.GetModuleBuilder(myAssemBuilder, "Module1");
            TypeBuilder myTypeB = myModB.DefineType("testType");
            return myTypeB.MakeByRefType();
        }
    }

    public class MethodTestClass5
    {
        private int _id = 0;
        public MethodTestClass5(int id)
        {
            _id = id;
        }
        public int ID
        {
            get
            {
                return _id;
            }
        }
    }
}


text:
using System;
using System.Collections.Generic;

namespace ThinkingHome.Core.Plugins.Utils
{
	public class InternalDictionary<T> : Dictionary<string, T>
		where T : class
	{
		private readonly object lockObject = new object();

		public InternalDictionary()
			: base(StringComparer.InvariantCultureIgnoreCase)
		{
		}

		public void Register(string key, T obj)
		{
			if (string.IsNullOrWhiteSpace(key) || obj == null)
			{
				return;
			}

			lock (lockObject)
			{
				if (ContainsKey(key))
				{
					var msg = string.Format("duplicated key {0} ({1})", key, obj);
					throw new Exception(msg);
				}

				Add(key, obj);
			}
		}
	}
}


text:
package com.github.sqrlserverjava.enums;

import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;

public enum SqrlServerSideKey {
	/*
	 * The spec defines these in lower case, so we do the same. It breaks java convention but is more readable
	 */

	// @formatter:off
	idk(false),
	pidk(false),
	suk(true),
	vuk(true);

	// @formatter:on
	/**
	 * Whether the given key needs to be associated with a SQRL Identity and persisted by the SQRL server
	 */
	private final boolean needsBePersisted;

	SqrlServerSideKey(final boolean shouldBeStored) {
		this.needsBePersisted = shouldBeStored;
	}

	private static final Map<String, SqrlServerSideKey> LOOKUP_TABLE;
	static {
		final Map<String, SqrlServerSideKey> tempTable = new TreeMap<>();
		for (final SqrlServerSideKey aKey : values()) {
			tempTable.put(aKey.toString(), aKey);
		}
		LOOKUP_TABLE = Collections.unmodifiableMap(tempTable);
	}

	/**
	 * A version of {@code values} which is case-insensitive and returns null when not found instead of throwing an
	 * exception
	 *
	 * @return the key for this name or null
	 */
	public static SqrlServerSideKey valueOfOrNull(final String toFind) {
		return LOOKUP_TABLE.get(toFind.toLowerCase());
	}

	/**
	 * Whether the given key, if sent in a SQRL client request, must be associated with the users SQRL Identity and
	 * persisted
	 *
	 * @return if the key should be persisted
	 */
	public boolean needsToBePersisted() {
		return needsBePersisted;
	}

	/**
	 * Checks to see if a given name from the {@CLIENT} param is a key that needs to be associated with the users SQRL
	 * Identity and persisted
	 *
	 * @param dataName
	 *            name of a name/value pair passed in the {@CLIENT} param
	 * @return true if it represents a key and that key should be persisted
	 */
	public static boolean isRequestDataAKeyThatNeedsToBePersisted(final String dataName) {
		for (final SqrlServerSideKey aKey : SqrlServerSideKey.values()) {
			if (aKey.toString().equals(dataName) && SqrlServerSideKey.valueOf(dataName).needsToBePersisted()) {
				return true;
			}
		}
		return false;
	}
}


text:
---
title: Attach a Fallback value to a CSS Variable
---
## Attach a Fallback value to a CSS Variable

<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds  -->
We need to add a fallback value of ```black``` to the ```background``` property of the ```.penguin-top``` and ```.penguin-bottom``` classes.

## Solution

Add a fallback value of ```black``` to the ```background``` property of the ```.penguin-bottom``` class:

```js
  .penguin-bottom {
    top: 40%;
    left: 23.5%;
    /* change code below */
    background: var(--pengiun-skin,black);
    /* change code above */
    width: 53%;
    height: 45%;
    border-radius: 70% 70% 100% 100%;
  }
```

Add a fallback value of ```black``` to the ```background``` property of the ```.penguin-top``` class:

```js
  .penguin-top {
    top: 10%;
    left: 25%;
    /* change code below */
    background: var(--pengiun-skin,black);
    /* change code above */
    width: 50%;
    height: 45%;
    border-radius: 70% 70% 60% 60%;
  }
```


text: require 'tk/mngfocus'


text:
[![build status](https://semaphoreci.com/api/v1/niftylettuce/koa-manifest-rev/branches/master/shields_badge.svg)](https://semaphoreci.com/niftylettuce/koa-manifest-rev)
[![code coverage](https://img.shields.io/codecov/c/github/niftylettuce/koa-manifest-rev.svg)](https://codecov.io/gh/niftylettuce/koa-manifest-rev)
[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://github.com/lassjs/lass)
[![license](https://img.shields.io/github/license/niftylettuce/koa-manifest-rev.svg)](<>)

> Dynamically load assets into your views from your `rev-manifest.json` manifest
> revision file (e.g. `<script src="{{ manifest('foo.js'); }}"></script>`
> returns `<script src="/foo-0775041dd4.js"></script>` when rendered).
>
> **Works with any templating engine**, such as [pug][], [ejs][], or
> [nunjucks][]. Inspired by [express-rev][] and built for [koa][].

## Table of Contents

* [Install](#install)
* [Usage](#usage)
* [API](#api)
* [Contributors](#contributors)
* [License](#license)

## Install

[npm][]:

```sh
npm install koa-manifest-rev
```

[yarn][]:

```sh
yarn add koa-manifest-rev
```

## Usage

1. Require the package and include the middleware

   ```js
   import Koa from 'koa';
   import koaManifestRev from 'koa-manifest-rev';
   import path from 'path';

   const app = new Koa();

   app.use(koaManifestRev({
     manifest: path.join(__dirname, 'build', 'rev-manifest.json'),
     prepend: '/'
   }));
   ```

2. Call the `manifest(str)` helper function in your views when you need to include assets (requires a templating engine).

   > [pug][]:

   ```pug
   html
     head
       title Foo
     body
       h1 Foo
       script(src=manifest('foo.js'))
   ```

   > [ejs][]

   ```ejs
   <html>
     <head>
       <title>Foo</title>
     </head>
     <body>
       <h1>Foo</h1>
       <script src="<%= manifest('foo.js'); %>"></script>
     </body>
   </html>
   ```

   > [nunjucks][] (via [koa-nunjucks-promise][]):

   ```html
   <html>
     <head>
       <title>Foo</title>
     </head>
     <body>
       <h1>Foo</h1>
       <script src="{{ manifest('foo.js'); }}"></script>
     </body>
   </html>
   ```

## API

* `koaManifestRev(options)` - accepts a required `options` argument for setup. Returns middleware for use in `app.use` statement (which in turn binds to `ctx.state` a helper function called `manifest`). Here are the properties accepts in the `options` argument.

  * `manifest` (**required**) - path to a valid `rev-manifest.json` file (e.g. as built by [gulp-rev][] or [gulp-rev-all][])
  * `prepend` (optional) - string to prepend before file paths rendered after lookup (e.g. if you type `{{ manifest('foo.js'); }}` in your view, and you have passed `prepend: '/dist/'` in your setup, then your tag would render as `<script src="/dist/foo-0775041dd4.js"></script>` (defaults to `/`)

* `manifest(str)` - the helper function bound to `ctx.state` when `koaManifestRev` middleware is included in your app. Returns the string found from a lookup in your `rev-manifest.json` file for the `str` argument passed (e.g. if you type `{{ manifest('foo.js'); }}` in your view, then it returns for the value of the `foo.js` property as defined in your `manifest` file, such as `foo-0775041dd4.js`). If the found is not found, then the input `str` argument is returned.

## Contributors

| Name           | Website                    |
| -------------- | -------------------------- |
| **Nick Baugh** | <http://niftylettuce.com/> |

## License

[MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com/)

##

[npm]: https://www.npmjs.com/

[yarn]: https://yarnpkg.com/

[koa-nunjucks-promise]: https://github.com/hanai/koa-nunjucks-promise

[koa]: https://github.com/koajs/koa

[gulp-rev-all]: https://github.com/smysnk/gulp-rev-all

[gulp-rev]: https://github.com/sindresorhus/gulp-rev

[nunjucks]: https://mozilla.github.io/nunjucks/

[pug]: https://github.com/pugjs/pug

[ejs]: http://ejs.co/

[express-rev]: https://github.com/xpepermint/express-rev


text:
using XenAdmin.Diagnostics.Checks;
using XenAPI;

namespace XenAdmin.Diagnostics.Problems.VMProblem
{
    public class VmHasVgpu : VMProblem
    {
        public VmHasVgpu(Check check, VM vm)
            : base(check, vm) { }

        public override string Description
        {
            get { return string.Format(Messages.UPDATES_WIZARD_VM_HAS_VGPU, VM.Name); }
        }
    }
}


text:
package org.apache.hadoop.tools.util;

/**
 *  WorkReport{@literal <T>} is a simple container for items of class T and its
 *  corresponding retry counter that indicates how many times this item
 *  was previously attempted to be processed.
 */
public class WorkReport<T> {
  private T item;
  private final boolean success;
  private final int retry;
  private final Exception exception;

  /**
   *  @param  item       Object representing work report.
   *  @param  retry      Number of unsuccessful attempts to process work.
   *  @param  success    Indicates whether work was successfully completed.
   */
  public WorkReport(T item, int retry, boolean success) {
    this(item, retry, success, null);
  }

  /**
   *  @param  item       Object representing work report.
   *  @param  retry      Number of unsuccessful attempts to process work.
   *  @param  success    Indicates whether work was successfully completed.
   *  @param  exception  Exception thrown while processing work.
   */
  public WorkReport(T item, int retry, boolean success, Exception exception) {
    this.item = item;
    this.retry = retry;
    this.success = success;
    this.exception = exception;
  }

  public T getItem() {
    return item;
  }

  /**
   *  @return True if the work was processed successfully.
   */
  public boolean getSuccess() {
    return success;
  }

  /**
   *  @return  Number of unsuccessful attempts to process work.
   */
  public int getRetry() {
    return retry;
  }

  /**
   *  @return  Exception thrown while processing work.
   */
  public Exception getException() {
    return exception;
  }
}