text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.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.
  -->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.apache.druid.extensions</groupId>
  <artifactId>druid-avro-extensions</artifactId>
  <name>druid-avro-extensions</name>
  <description>druid-avro-extensions</description>

  <parent>
    <groupId>org.apache.druid</groupId>
    <artifactId>druid</artifactId>
    <version>0.14.2-incubating</version>
    <relativePath>../../pom.xml</relativePath>
  </parent>

  <properties>
    <schemarepo.version>0.1.3</schemarepo.version>
    <confluent.version>3.0.1</confluent.version>
    <avro.version>1.8.2</avro.version>
    <pig.version>0.15.0</pig.version>
  </properties>

  <repositories>
    <repository>
      <id>confluent</id>
      <url>http://packages.confluent.io/maven/</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>org.apache.avro</groupId>
      <artifactId>avro</artifactId>
      <version>${avro.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.jackson</groupId>
          <artifactId>jackson-core-asl</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.jackson</groupId>
          <artifactId>jackson-mapper-asl</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.avro</groupId>
      <artifactId>avro-mapred</artifactId>
      <classifier>hadoop2</classifier>
      <version>${avro.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.codehaus.jackson</groupId>
          <artifactId>jackson-core-asl</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.jackson</groupId>
          <artifactId>jackson-mapper-asl</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.druid</groupId>
      <artifactId>druid-core</artifactId>
      <version>${project.parent.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.schemarepo</groupId>
      <artifactId>schema-repo-api</artifactId>
      <version>${schemarepo.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.schemarepo</groupId>
      <artifactId>schema-repo-client</artifactId>
      <version>${schemarepo.version}</version>
    </dependency>
    <dependency>
      <groupId>org.schemarepo</groupId>
      <artifactId>schema-repo-avro</artifactId>
      <version>${schemarepo.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.apache.avro</groupId>
          <artifactId>avro</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>kafka-schema-registry-client</artifactId>
      <version>${confluent.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.avro</groupId>
          <artifactId>avro</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-databind</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-client</artifactId>
    </dependency>
    <!-- Tests -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>2.2.10</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.pig</groupId>
      <artifactId>pig</artifactId>
      <version>${pig.version}</version>
      <classifier>h2</classifier>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.apache.avro</groupId>
          <artifactId>avro</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-net</groupId>
          <artifactId>commons-net</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.jackson</groupId>
          <artifactId>jackson-core-asl</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.jackson</groupId>
          <artifactId>jackson-mapper-asl</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.pig</groupId>
      <artifactId>piggybank</artifactId>
      <version>${pig.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.pig</groupId>
          <artifactId>pig</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.avro</groupId>
          <artifactId>avro</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.druid</groupId>
      <artifactId>druid-processing</artifactId>
      <version>${project.parent.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.avro</groupId>
        <artifactId>avro-maven-plugin</artifactId>
        <version>${avro.version}</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>schema</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>strict</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <compilerArgs>
                <!-- Avro-generated classes miss @Override, that is not easy to fix -->
                <arg>-Xep:MissingOverride:WARN</arg>
              </compilerArgs>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>


text:
using FluentAssertions;
using System;
using Xunit;

namespace Ritter.Infra.Crosscutting.Tests.Extensions
{
    public class Object_ConvertTo
    {
        [Fact]
        public void ConvertNumbersSuccessullyGivenValidValue()
        {
            short shortValue = 3;

            int intValue = shortValue.ConvertTo<int>();
            intValue.Should().Be(3).And.BeOfType(typeof(int));

            long longValue = intValue.ConvertTo<long>();
            longValue.Should().Be(3).And.BeOfType(typeof(long));
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
using Microsoft.AspNetCore.Mvc;

namespace RoutingWebSite;

// This controller is reachable via traditional routing.
public class LoginController : Controller
{
    private readonly TestResponseGenerator _generator;

    public LoginController(TestResponseGenerator generator)
    {
        _generator = generator;
    }

    public IActionResult Index()
    {
        return _generator.Generate(Url.RouteUrl("ActionAsMethod", null, Url.ActionContext.HttpContext.Request.Scheme));
    }

    public IActionResult Sso()
    {
        return _generator.Generate(Url.RouteUrl("ActionAsMethod", null, Url.ActionContext.HttpContext.Request.Scheme));
    }
}


text:
using Dealership.Common;
using Dealership.Data.Common;
using Dealership.Data.Common.Enums;
using Dealership.Data.Contracts;

namespace Dealership.Data.Models
{
    public class Car : Vehicle, ICar
    {
        private const string SeatsProperty = "Seats";

        private readonly int seats;

        public Car(string make, string model, decimal price, int seats)
            : base(make, model, price, VehicleType.Car)
        {
            this.seats = seats;

            this.ValidateFields();
        }

        public int Seats
        {
            get
            {
                return this.seats;
            }
        }

        protected override string PrintAdditionalInfo()
        {
            return string.Format("  {0}: {1}", SeatsProperty, this.Seats);
        }

        private void ValidateFields()
        {
            Validator.ValidateIntRange(this.seats, Constants.MinSeats, Constants.MaxSeats, string.Format(Constants.NumberMustBeBetweenMinAndMax, SeatsProperty, Constants.MinSeats, Constants.MaxSeats));
        }
    }
}


text:
require 'test_helper'
require 'geocoder/esri_token'

class EsriTest < GeocoderTestCase

  def setup
    Geocoder.configure(lookup: :esri)
  end

  def test_query_for_geocode
    query = Geocoder::Query.new("Bluffton, SC")
    lookup = Geocoder::Lookup.get(:esri)
    res = lookup.query_url(query)
    assert_equal "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?f=pjson&outFields=%2A&text=Bluffton%2C+SC",
      res
  end

  def test_query_for_geocode_with_source_country
    Geocoder.configure(esri: {source_country: 'USA'})
    query = Geocoder::Query.new("Bluffton, SC")
    lookup = Geocoder::Lookup.get(:esri)
    url = lookup.query_url(query)
    assert_match %r{sourceCountry=USA}, url
  end

  def test_query_for_geocode_with_preferred_label_values
    Geocoder.configure(esri: {preferred_label_values: 'localCity'})
    query = Geocoder::Query.new("Bluffton, SC")
    lookup = Geocoder::Lookup.get(:esri)
    url = lookup.query_url(query)
    assert_match %r{preferredLabelValues=localCity}, url
  end

  def test_query_for_geocode_with_token_and_for_storage
    token = Geocoder::EsriToken.new('xxxxx', Time.now + 60*60*24)
    Geocoder.configure(esri: {token: token, for_storage: true})
    query = Geocoder::Query.new("Bluffton, SC")
    lookup = Geocoder::Lookup.get(:esri)
    url = lookup.query_url(query)
    assert_match %r{forStorage=true}, url
    assert_match %r{token=xxxxx}, url
  end

  def test_token_from_options
    options_token = Geocoder::EsriToken.new('options_token', Time.now + 60*60*24)
    query = Geocoder::Query.new("Bluffton, SC", token: options_token)
    lookup = Geocoder::Lookup.get(:esri)
    url = lookup.query_url(query)
    assert_match %r{token=options_token}, url
  end

  def test_token_from_options_overrides_configuration
    config_token = Geocoder::EsriToken.new('config_token', Time.now + 60*60*24)
    options_token = Geocoder::EsriToken.new('options_token', Time.now + 60*60*24)
    Geocoder.configure(esri: { token: config_token })
    query = Geocoder::Query.new("Bluffton, SC", token: options_token)
    lookup = Geocoder::Lookup.get(:esri)
    url = lookup.query_url(query)
    assert_match %r{token=options_token}, url
  end

  def test_query_for_geocode_with_config_for_storage_false
    Geocoder.configure(esri: {for_storage: false})

    query = Geocoder::Query.new("Bluffton, SC", for_storage: true)
    lookup = Geocoder::Lookup.get(:esri)
    url = lookup.query_url(query)
    assert_match %r{forStorage=true}, url

    query = Geocoder::Query.new("Bluffton, SC", for_storage: false)
    lookup = Geocoder::Lookup.get(:esri)
    url = lookup.query_url(query)
    assert_no_match %r{forStorage}, url
  end

  def test_query_for_geocode_with_config_for_storage_true
    Geocoder.configure(esri: {for_storage: true})

    query = Geocoder::Query.new("Bluffton, SC", for_storage: true)
    lookup = Geocoder::Lookup.get(:esri)
    url = lookup.query_url(query)
    assert_match %r{forStorage=true}, url

    query = Geocoder::Query.new("Bluffton, SC", for_storage: false)
    lookup = Geocoder::Lookup.get(:esri)
    url = lookup.query_url(query)
    assert_no_match %r{forStorage}, url
  end

  def test_token_generation_doesnt_overwrite_existing_config
    Geocoder.configure(esri: {api_key: ['id','secret'], for_storage: true})

    query = Geocoder::Query.new("Bluffton, SC")
    lookup = Geocoder::Lookup.get(:esri)

    lookup.instance_eval do
      # redefine `create_token` to return a manually-created token
      def create_token
        "xxxxx"
      end
    end

    url = lookup.query_url(query)

    assert_match %r{forStorage=true}, url
    assert_match %r{token=xxxxx}, url
  end

  def test_query_for_reverse_geocode
    query = Geocoder::Query.new([45.423733, -75.676333])
    lookup = Geocoder::Lookup.get(:esri)
    res = lookup.query_url(query)
    assert_equal "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&location=-75.676333%2C45.423733&outFields=%2A",
      res
  end

  def test_results_component
    result = Geocoder.search("Madison Square Garden, New York, NY").first
    assert_equal "10001", result.postal_code
    assert_equal "USA", result.country
    assert_equal "Madison Square Garden", result.address
    assert_equal "New York", result.city
    assert_equal "New York", result.state
    assert_equal "Madison Square Garden", result.place_name
    assert_equal "Sports Complex", result.place_type
    assert_equal(40.75004981300049, result.coordinates[0])
    assert_equal(-73.99423889799965, result.coordinates[1])
  end

  def test_results_component_when_location_type_is_national_capital
    result = Geocoder.search("washington dc").first
    assert_equal "Washington", result.city
    assert_equal "District of Columbia", result.state
    assert_equal "USA", result.country
    assert_equal "Washington, D. C., District of Columbia, United States", result.address
    assert_equal "Washington", result.place_name
    assert_equal "National Capital", result.place_type
    assert_equal(38.895107833000452, result.coordinates[0])
    assert_equal(-77.036365517999627, result.coordinates[1])
  end

  def test_results_component_when_location_type_is_state_capital
    result = Geocoder.search("austin tx").first
    assert_equal "Austin", result.city
    assert_equal "Texas", result.state
    assert_equal "USA", result.country
    assert_equal "Austin, Texas, United States", result.address
    assert_equal "Austin", result.place_name
    assert_equal "State Capital", result.place_type
    assert_equal(30.267145960000448, result.coordinates[0])
    assert_equal(-97.743055550999657, result.coordinates[1])
  end

  def test_results_component_when_location_type_is_city
    result = Geocoder.search("new york ny").first
    assert_equal "New York City", result.city
    assert_equal "New York", result.state
    assert_equal "USA", result.country
    assert_equal "New York City, New York, United States", result.address
    assert_equal "New York City", result.place_name
    assert_equal "City", result.place_type
    assert_equal(40.714269404000447, result.coordinates[0])
    assert_equal(-74.005969928999662, result.coordinates[1])
  end

  def test_results_component_when_reverse_geocoding
    result = Geocoder.search([45.423733, -75.676333]).first
    assert_equal "75007", result.postal_code
    assert_equal "FRA", result.country
    assert_equal "4 Avenue Gustave Eiffel", result.address
    assert_equal "Paris", result.city
    assert_equal "Île-de-France", result.state
    assert_equal "4 Avenue Gustave Eiffel", result.place_name
    assert_equal "Address", result.place_type
    assert_equal(48.858129997357558, result.coordinates[0])
    assert_equal(2.2956200048981574, result.coordinates[1])
  end

  def test_results_viewport
    result = Geocoder.search("Madison Square Garden, New York, NY").first
    assert_equal [40.744050000000001, -74.000241000000003, 40.756050000000002, -73.988241000000002],
      result.viewport
  end

  def test_cache_key_doesnt_include_api_key_or_token
    token = Geocoder::EsriToken.new('xxxxx', Time.now + 60)
    Geocoder.configure(esri: {token: token, api_key: "xxxxx", for_storage: true})
    query = Geocoder::Query.new("Bluffton, SC")
    lookup = Geocoder::Lookup.get(:esri)
    key = lookup.send(:cache_key, query)
    assert_match %r{forStorage}, key
    assert_no_match %r{token}, key
    assert_no_match %r{api_key}, key
  end

  def teardown
    Geocoder.configure(esri: {token: nil, for_storage: nil})
  end
end


text:
require 'geokit'

require 'geokit-rails3/railtie'
require 'geokit-rails3/core_extensions'

require 'geokit-rails3/defaults'
require 'geokit-rails3/adapters/abstract'
require 'geokit-rails3/acts_as_mappable'
require 'geokit-rails3/geocoder_control'
require 'geokit-rails3/ip_geocode_lookup'


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Cephalosporium-artige Schimmelpilze (Stuttgart) 46 (1971)

#### Original name
Cephalosporium charticola Lindau, 1904

### Remarks
null


text:
'use strict'

// https://atlassian.mycompany/confluence/rest/api/space?type=global&status=current&expand=description.plain&limit=100
// https://atlassian.mycompany/confluence/rest/api/space?type=global&status=current&expand=description.plain&start=100&limit=100
// https://atlassian.mycompany/confluence/rest/api/space?type=global&status=current&expand=description.plain&start=200&limit=100

// https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-get-space-with-category-using-Confluence-REST-API/qaq-p/500904
// https://atlassian.mycompany/confluence/rest/spacedirectory/1/search?type=global&status=current

const spaces = require('./spaces.json')

const DELIM = ';'

console.log(`key${DELIM}name${DELIM}description${DELIM}url`)
for (let space of spaces.results) {
  const { key, name, description: { plain: { value: description } } } = space
  const url = `${spaces._links.base}/display/${key}`
  console.log(`${key}${DELIM}"${name}"${DELIM}"${description}"${DELIM}${url}`)
}


text:
/*************************************************************************/
/*  input_map.h                                                          */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                      https://godotengine.org                          */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/

#ifndef INPUT_MAP_H
#define INPUT_MAP_H

#include "core/input/input_event.h"
#include "core/object/class_db.h"
#include "core/object/object.h"
#include "core/templates/hash_map.h"

template <typename T>
class TypedArray;

class InputMap : public Object {
	GDCLASS(InputMap, Object);

public:
	/**
	 * A special value used to signify that a given Action can be triggered by any device
	 */
	static int ALL_DEVICES;

	struct Action {
		int id;
		float deadzone;
		List<Ref<InputEvent>> inputs;
	};

private:
	static InputMap *singleton;

	mutable HashMap<StringName, Action> input_map;
	HashMap<String, List<Ref<InputEvent>>> default_builtin_cache;
	HashMap<String, List<Ref<InputEvent>>> default_builtin_with_overrides_cache;

	List<Ref<InputEvent>>::Element *_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool p_exact_match = false, bool *r_pressed = nullptr, float *r_strength = nullptr, float *r_raw_strength = nullptr) const;

	TypedArray<InputEvent> _action_get_events(const StringName &p_action);
	TypedArray<StringName> _get_actions();

protected:
	static void _bind_methods();

public:
	static _FORCE_INLINE_ InputMap *get_singleton() { return singleton; }

	bool has_action(const StringName &p_action) const;
	List<StringName> get_actions() const;
	void add_action(const StringName &p_action, float p_deadzone = 0.5);
	void erase_action(const StringName &p_action);

	float action_get_deadzone(const StringName &p_action);
	void action_set_deadzone(const StringName &p_action, float p_deadzone);
	void action_add_event(const StringName &p_action, const Ref<InputEvent> &p_event);
	bool action_has_event(const StringName &p_action, const Ref<InputEvent> &p_event);
	void action_erase_event(const StringName &p_action, const Ref<InputEvent> &p_event);
	void action_erase_events(const StringName &p_action);

	const List<Ref<InputEvent>> *action_get_events(const StringName &p_action);
	bool event_is_action(const Ref<InputEvent> &p_event, const StringName &p_action, bool p_exact_match = false) const;
	bool event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool p_exact_match = false, bool *r_pressed = nullptr, float *r_strength = nullptr, float *r_raw_strength = nullptr) const;

	const HashMap<StringName, Action> &get_action_map() const;
	void load_from_project_settings();
	void load_default();

	String suggest_actions(const StringName &p_action) const;

	String get_builtin_display_name(const String &p_name) const;
	// Use an Ordered Map so insertion order is preserved. We want the elements to be 'grouped' somewhat.
	const HashMap<String, List<Ref<InputEvent>>> &get_builtins();
	const HashMap<String, List<Ref<InputEvent>>> &get_builtins_with_feature_overrides_applied();

	InputMap();
	~InputMap();
};

#endif // INPUT_MAP_H


text:
namespace {

llvm::cl::opt<std::string>
    HeaderDefFile("def", llvm::cl::desc("Path to the .h.def file."),
                  llvm::cl::value_desc("<filename>"), llvm::cl::Required);
llvm::cl::opt<std::string> StandardHeader(
    "header",
    llvm::cl::desc("The standard header file which is to be generated."),
    llvm::cl::value_desc("<header file>"));
llvm::cl::list<std::string> ReplacementValues(
    "args", llvm::cl::desc("Command separated <argument name>=<value> pairs."),
    llvm::cl::value_desc("<name=value>[,name=value]"));

void ParseArgValuePairs(std::unordered_map<std::string, std::string> &Map) {
  for (std::string &R : ReplacementValues) {
    auto Pair = llvm::StringRef(R).split('=');
    Map[std::string(Pair.first)] = std::string(Pair.second);
  }
}

} // anonymous namespace

namespace llvm_libc {

bool HeaderGeneratorMain(llvm::raw_ostream &OS, llvm::RecordKeeper &Records) {
  std::unordered_map<std::string, std::string> ArgMap;
  ParseArgValuePairs(ArgMap);
  Generator G(HeaderDefFile, StandardHeader, ArgMap);
  G.generate(OS, Records);

  return false;
}

} // namespace llvm_libc

int main(int argc, char *argv[]) {
  llvm::cl::ParseCommandLineOptions(argc, argv);
  return TableGenMain(argv[0], &llvm_libc::HeaderGeneratorMain);
}


text:
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Observable } from 'rxjs';
import { debounceTime, first, share, tap } from 'rxjs/operators';
import { connect, Socket } from 'socket.io-client';

enum NATIVE_EVENTS {
    CONNECT = 'connect',
    DISCONNECT = 'disconnect',
    ERROR = 'error',
    RECONNECT = 'reconnect',
}

export class SocketService {
    private host = 'ws://localhost:10109';
    private events$: Record<string, Observable<any>> = {};
    socket: typeof Socket;

    errors$: Observable<any>;
    isConnected$: Observable<boolean>;

    constructor(defer?: boolean) {
        this.socket = connect(
            this.host,
            {
                autoConnect: !defer,
                forceNew: true
            },
        );

        this.errors$ = this.on('disconnect-reason');
        this.on<string>(NATIVE_EVENTS.DISCONNECT)
            .pipe(
                tap(reason => `disconnected: ${reason}`),
                debounceTime(5000),
            )
            .subscribe(reason => {
                if (reason === 'io server disconnect') {
                }
            });
    }

    on<T = any>(event: string): Observable<T> {
        if (this.events$[event]) {
            return this.events$[event];
        }

        this.events$[event] = new Observable<T>(observer => {
            this.socket.on(event, observer.next.bind(observer));

            return () => {
                this.socket.off(event);
                delete this.events$[event];
            };
        }).pipe(share());

        return this.events$[event];
    }

    once<T = any>(event: string): Observable<T> {
        return this.on(event).pipe(first());
    }
    emit<T = any>(event: string, data?: T, ack?: false): void;
    // This overloading is not working in TS 3.0.1
    // emit<S = any>(event: string, data?: any, ack?: true): Observable<S>;
    emit<T = any, S = any>(event: string, data?: T, ack?: true): Observable<S>;
    emit<T = any,S = any>(
      event: string,
      data?: T,
      ack?: boolean
    ): void | Observable<S> {
        if (ack) {
            return new Observable<S>(observer => {
                this.socket.emit(event, data, observer.next.bind(observer));
            }).pipe(first());
        } else {
            this.socket.emit(event, data);
        }
    }

    open() {
        this.socket.connect();
    }

    close() {
        this.socket.disconnect();
    }
}


text:
import os
import sys

#path to directory of the .wgsi file ('[directory]/')
wsgi_dir = os.path.abspath(os.path.dirname(__file__))

# path to project root directory (osqa '/')
project_dir = os.path.dirname(wsgi_dir)

# add project  directory to system's Path
sys.path.append(project_dir)
sys.path.append(project_dir+"/main")

os.environ['DJANGO_SETTINGS_MODULE'] = 'main.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()


text:
using System;
using System.ComponentModel;
using System.Drawing;
using XenAdmin.Controls;
using XenAdmin.Core;
using XenAPI;
using XenAdmin.Actions;

namespace XenAdmin.Dialogs
{
    public partial class AttachDiskDialog : XenDialogBase
    {
        private readonly VM TheVM;
        private DiskListVdiItem oldSelected = null;
        private bool oldROState = false;

        private readonly CollectionChangeEventHandler SR_CollectionChangedWithInvoke;
        public AttachDiskDialog(VM vm) : base(vm.Connection)
        {
            TheVM = vm;

            InitializeComponent();

            DiskListTreeView.ShowCheckboxes = false;
            DiskListTreeView.ShowDescription = true;
            DiskListTreeView.ShowImages = true;
            DiskListTreeView.SelectedIndexChanged += DiskListTreeView_SelectedIndexChanged;
            SR_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(SR_CollectionChanged);
            connection.Cache.RegisterCollectionChanged<SR>(SR_CollectionChangedWithInvoke);

            Pool poolofone = Helpers.GetPoolOfOne(connection);
            if (poolofone != null)
                poolofone.PropertyChanged += Server_Changed;

            readonlyCheckboxToolTipContainer.SuppressTooltip = false;
            DeactivateControlsForHvmVm();

            BuildList();
            DiskListTreeView_SelectedIndexChanged(null, null);
        }

        void SR_CollectionChanged(object sender, CollectionChangeEventArgs e)
        {
            Program.Invoke(this, BuildList);
        }

        private bool skipSelectedIndexChanged;
        void DiskListTreeView_SelectedIndexChanged(object sender, EventArgs e)
        {
            if(skipSelectedIndexChanged)
                return;

            if (DiskListTreeView.SelectedItem is DiskListSrItem || DiskListTreeView.SelectedItem == null)
            {
                //As we're changing the index below - stall the SelectedIndexChanged event until we're done
                skipSelectedIndexChanged = true;
                try
                {
                    DiskListTreeView.SelectedItem = oldSelected;
                    OkBtn.Enabled = DiskListTreeView.SelectedItem != null;
                    DeactivateAttachButtonIfHvm();
                }
                finally
                {
                    //Ensure the lock is released
                    skipSelectedIndexChanged = false;
                }

                return;
            }

            DiskListVdiItem item = DiskListTreeView.SelectedItem as DiskListVdiItem;
            ReadOnlyCheckBox.Enabled = !item.ForceReadOnly;
            ReadOnlyCheckBox.Checked = item.ForceReadOnly ? true : oldROState;
            OkBtn.Enabled = true;
            oldSelected = item;
            DeactivateControlsForHvmVm();
        }

        private void DeactivateControlsForHvmVm()
        {
            DeactivateReadOnlyCheckBoxForHvmVm();
            DeactivateAttachButtonIfHvm();
        }

        private void DeactivateAttachButtonIfHvm()
        {
            if (!TheVM.IsHVM)
                return;

            DiskListVdiItem vdiItem = DiskListTreeView.SelectedItem as DiskListVdiItem;
            if (vdiItem != null && vdiItem.ForceReadOnly)
                OkBtn.Enabled = false;
        }

        private void DeactivateReadOnlyCheckBoxForHvmVm()
        {
            if (!TheVM.IsHVM)
                return;

            readonlyCheckboxToolTipContainer.SetToolTip(Messages.ATTACH_DISK_DIALOG_READONLY_DISABLED_FOR_HVM);
            ReadOnlyCheckBox.Enabled = false;
        }

        private void BuildList()
        {
            Program.AssertOnEventThread();

            DiskListVdiItem lastSelected = DiskListTreeView.SelectedItem as DiskListVdiItem;

            String oldRef = "";
            if (lastSelected != null)
                oldRef = lastSelected.TheVDI.opaque_ref;

            DiskListTreeView.BeginUpdate();
            try
            {
                DiskListTreeView.ClearAllNodes();

                foreach (SR sr in connection.Cache.SRs)
                {
                    DiskListSrItem item = new DiskListSrItem(sr, TheVM);
                    if (item.Show)
                    {
                        DiskListTreeView.AddNode(item);
                        foreach (VDI TheVDI in sr.Connection.ResolveAllShownXenModelObjects(sr.VDIs, Properties.Settings.Default.ShowHiddenVMs))
                        {
                            DiskListVdiItem VDIitem = new DiskListVdiItem(TheVDI);
                            if (VDIitem.Show)
                                DiskListTreeView.AddChildNode(item, VDIitem);
                            TheVDI.PropertyChanged -= new PropertyChangedEventHandler(Server_Changed);
                            TheVDI.PropertyChanged += new PropertyChangedEventHandler(Server_Changed);
                        }
                    }
                    sr.PropertyChanged -= new PropertyChangedEventHandler(Server_Changed);
                    sr.PropertyChanged += new PropertyChangedEventHandler(Server_Changed);
                }
            }
            finally
            {
                DiskListTreeView.EndUpdate();
                DiskListTreeView.SelectedItem = SelectByRef(oldRef);
            }
        }

        private object SelectByRef(string oldRef)
        {
            for (int i = 0; i < DiskListTreeView.Items.Count; i++)
            {
                DiskListVdiItem item = DiskListTreeView.Items[i] as DiskListVdiItem;
                if (item == null)
                    continue;
                else if (item.TheVDI.opaque_ref == oldRef)
                    return item;
            }
            return null;
        }

        private void Server_Changed(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "name_label" || e.PropertyName == "VDIs" || e.PropertyName == "VBDs" || e.PropertyName == "default_SR")
            {
                Program.Invoke(this, BuildList);
            }
        }

        private void ReadOnlyCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            if (ReadOnlyCheckBox.Enabled)
                oldROState = ReadOnlyCheckBox.Checked;
        }

        private void OkBtn_Click(object sender, EventArgs e)
        {
            DiskListVdiItem item = DiskListTreeView.SelectedItem as DiskListVdiItem;
            if (item == null)
                return;

            VDI TheVDI = item.TheVDI;

            // Run this stuff off the event thread, since it involves a server call
            System.Threading.ThreadPool.QueueUserWorkItem((System.Threading.WaitCallback)delegate(object o)
            {
                // Get a spare userdevice
                string[] uds = VM.get_allowed_VBD_devices(connection.DuplicateSession(), TheVM.opaque_ref);
                if (uds.Length == 0)
                {
                    Program.Invoke(Program.MainWindow, delegate()
                    {
                        new ThreeButtonDialog(
                           new ThreeButtonDialog.Details(
                               SystemIcons.Error,
                               FriendlyErrorNames.VBDS_MAX_ALLOWED, Messages.DISK_ATTACH)).ShowDialog(Program.MainWindow);
                    });
                    // Give up
                    return;
                }
                string ud = uds[0];

                VBD vbd = new VBD();
                vbd.VDI = new XenRef<VDI>(TheVDI);
                vbd.VM = new XenRef<VM>(TheVM);
                vbd.bootable = ud == "0";
                vbd.device = "";
                vbd.IsOwner = TheVDI.VBDs.Count == 0;
                vbd.empty = false;
                vbd.userdevice = ud;
                vbd.type = vbd_type.Disk;
                vbd.mode = ReadOnlyCheckBox.Checked ? vbd_mode.RO : vbd_mode.RW;
                vbd.unpluggable = true;

                // Try to hot plug the VBD.
                new VbdSaveAndPlugAction(TheVM, vbd, TheVDI.Name, null, false,NewDiskDialog.ShowMustRebootBoxCD,NewDiskDialog.ShowVBDWarningBox).RunAsync();
            });

            Close();
        }

        private void CancelBtn_Click(object sender, EventArgs e)
        {
            Close();
        }
    }

    public class DiskListSrItem : CustomTreeNode
    {
        public enum DisabledReason { None, Broken, NotSeen };

        public SR TheSR;
        public VM TheVM;
        public bool Show = false;
        public DisabledReason Reason;

        public DiskListSrItem(SR sr, VM vm)
            : base(false)
        {
            TheSR = sr;
            TheVM = vm;
            Update();
        }

        private void Update()
        {
            Text = TheSR.NameWithoutHost;
            Image = Images.GetImage16For(TheSR.GetIcon);

            Host affinity = TheVM.Connection.Resolve<Host>(TheVM.affinity);
            Host activeHost = TheVM.Connection.Resolve<Host>(TheVM.resident_on);
            if (TheSR.content_type != SR.Content_Type_ISO && !((affinity != null && !TheSR.CanBeSeenFrom(affinity)) || (activeHost != null && TheVM.power_state == vm_power_state.Running && !TheSR.CanBeSeenFrom(activeHost))  || TheSR.IsBroken(false) || TheSR.PBDs.Count < 1))
            {
                Description = "";
                Enabled = true;
                Show = true;
                Reason = DisabledReason.None;
            }
            else if (((affinity != null && !TheSR.CanBeSeenFrom(affinity)) || (activeHost != null && TheVM.power_state == vm_power_state.Running
                && !TheSR.CanBeSeenFrom(activeHost))) && !TheSR.IsBroken(false) && TheSR.PBDs.Count < 1)
            {
                Description = string.Format(Messages.SR_CANNOT_BE_SEEN, Helpers.GetName(affinity));
                Enabled = false;
                Show = true;
                Reason = DisabledReason.NotSeen;
            }
            else if (TheSR.IsBroken(false) && TheSR.PBDs.Count >= 1)
            {
                Description = Messages.SR_IS_BROKEN;
                Enabled = false;
                Show = true;
                Reason = DisabledReason.Broken;
            }
            else
            {
                Show = false;
            }
        }

        protected override int SameLevelSortOrder(CustomTreeNode other)
        {
            DiskListSrItem otherItem = other as DiskListSrItem;
            if (otherItem == null) //shouldnt ever happen!!!
                return -1;
            int rank = this.SrRank() - otherItem.SrRank();
            if (rank == 0)
                return base.SameLevelSortOrder(other);
            else
                return rank;
        }

        public int SrRank()
        {
            if (Enabled && TheSR.VDIs.Count > 0)
                return 0;
            else
                return 1 + (int)Reason;
        }
    }

    public class DiskListVdiItem : CustomTreeNode, IEquatable<DiskListVdiItem>
    {
        public VDI TheVDI;
        public bool Show = false;
        public bool ForceReadOnly = false;

        public DiskListVdiItem(VDI vdi)
        {
            TheVDI = vdi;
            Update();
        }

        private void Update()
        {
            if (TheVDI.type == vdi_type.crashdump || TheVDI.type == vdi_type.ephemeral || TheVDI.type == vdi_type.suspend)
                Show = false;
            else if ((TheVDI.VBDs.Count > 0 && !TheVDI.sharable))
            {
                bool allRO = true;
                foreach (VBD vbd in TheVDI.Connection.ResolveAll<VBD>(TheVDI.VBDs))
                {
                    if (!vbd.read_only&&vbd.currently_attached)
                    {
                        allRO = false;
                        break;
                    }
                }
                Show = allRO;
                if (Show)
                {
                    ForceReadOnly = true;
                    Text = String.IsNullOrEmpty(TheVDI.Name) ? Messages.NO_NAME : TheVDI.Name;
                    if (!string.IsNullOrEmpty(TheVDI.Description))
                        Description = string.Format(Messages.ATTACHDISK_SIZE_DESCRIPTION, TheVDI.Description, Util.DiskSizeString(TheVDI.virtual_size));
                    else
                        Description = Util.DiskSizeString(TheVDI.virtual_size);
                    Image = Properties.Resources._000_VirtualStorage_h32bit_16;
                }
            }
            else
            {
                Show = true;
                ForceReadOnly = TheVDI.read_only;
                Text = String.IsNullOrEmpty(TheVDI.Name) ? Messages.NO_NAME : TheVDI.Name;
                if (!string.IsNullOrEmpty(TheVDI.Description))
                    Description = string.Format(Messages.ATTACHDISK_SIZE_DESCRIPTION, TheVDI.Description, Util.DiskSizeString(TheVDI.virtual_size));
                else
                    Description = Util.DiskSizeString(TheVDI.virtual_size);
                Image = Properties.Resources._000_VirtualStorage_h32bit_16;
            }
        }

        public bool Equals(DiskListVdiItem other)
        {
            return this.TheVDI.opaque_ref == other.TheVDI.opaque_ref;
        }
    }
}


text:
package ee.shy.core;

import ee.shy.io.Jsonable;
import ee.shy.io.Validated;
import ee.shy.storage.Hash;

import java.util.Objects;

/**
 * Class representing a branch.
 */
public class Branch implements Jsonable, Validated {
    public static final String DEFAULT_NAME = "master";

    /**
     * Branch's commit hash.
     */
    private final Hash commit;

    /**
     * Constructs a branch with given commit hash.
     * @param commit commit hash for branch
     */
    public Branch(Hash commit) {
        this.commit = commit;
        assertValid();
    }

    public Hash getHash() {
        return this.commit;
    }

    @Override
    public void assertValid() {
        Objects.requireNonNull(commit, "branch has no commit");
    }
}


text:
package Paws::ES::DescribeElasticsearchInstanceTypeLimitsResponse;
  use Moose;
  has LimitsByRole => (is => 'ro', isa => 'Paws::ES::LimitsByRole');

  has _request_id => (is => 'ro', isa => 'Str');
1;

### main pod documentation begin ###

=head1 NAME

Paws::ES::DescribeElasticsearchInstanceTypeLimitsResponse

=head1 ATTRIBUTES

=head2 LimitsByRole => L<Paws::ES::LimitsByRole>

=head2 _request_id => Str

=cut


text:
FROM python:2.7
WORKDIR /code
ADD requirements.txt /code/
RUN pip install --upgrade -r requirements.txt
ADD . /code
CMD python /code/app.py


text:
/**
 * Created by Trappola on 02/10/2014.
 */

var myCountdown;
var clockStatus = null;
var countdownTime;
var timeout;
var MILLIS2SEC = 1000;

$(document).ready(mainFunction);

function mainFunction() {
    callForClockAulaStatus();
}

function callForClockAulaStatus(){
    $.ajax({
        url: "/getClockAula",
        dataType: "json",
        success: function (data) {
            if (data.status !== clockStatus){
                clockStatus = data.status;
                switch (clockStatus){
                    case "almostover":
                        break;
                    case "overtime":
                        break;
                    case "start":
                        timeout = data.timeout;
                        createCountdownElement(timeout);
                        break;
                    case "over":
                        finish();
                        break;
                }
            }
            setTimeout(callForClockAulaStatus, 5000);
        },
        error: function () {
            alert("Si è verificato un problema");
        }
    });
}

function createCountdownElement(millisec){
    var second = millisec / MILLIS2SEC;
    $("#spanCountdown").empty();
    console.log(timeoutClassroomClock);
    myCountdown = new Countdown({
            time: timeoutClassroomClock,
            width:200,
            height:25,
            inline:true,
            hideLabels	: true,
            target: "spanCountdown",
            onComplete: function(){
                //alert("time is up");
                $("div[id^='Container_jbeeb']").css("background-color", "red");
            },
            hideLine: true,
            numbers		: 	{
            font 	: "Arial",
                color	: "#FFFFFF",
                bkgd	: "#1E90FF",
                rounded	: 0.15,
                shadow	: {
                x : 0,
                    y : 3,
                    s : 4,
                    c : "#000000",
                    a : 0.4
                }
            },
            labels : {
                font   : "Arial",
                    color  : "#a8a8a8",
                    weight : "normal" // < - no comma on last item!
            },
            rangeHi:"hour"	// <- no comma on last item!
        });
}

function finish(){
    $.ajax({
        url: "/getFinishPage", //this is the right route
        dataType: "json",
        type: "POST",
        success: function (response) { //TODO here I need a switch block to manage different clock status
            window.location.href = response.finishPageUrl;
        },

        error: function () {
            alert("Si è verificato un problema (finish Page)");
        }
    });
}


text:
/**
 * Created by Malindu Warapitiya on 3/15/16.
 */

angular.module('phonebook', [

    //initial & angular modules
    'ui.router',
    'ngAnimate',

    //3rd party modules
    'ui.bootstrap',
    'xeditable',

    //application core modules
    'phonebook.routes',
    'phonebook.controllers',
    'phonebook.api',
    'phonebook.configs'
]);


text:
int main() {
	init_request_handler();
}


text:
/**
 * Created by 大丽丽 on 2017/10/16.
 */
import React ,{ Component } from 'react';
import { Link } from 'react-router-dom';
import "./ContentList.css";

let data = [
    ["English", "J. R. R. Tolkien", "English", "1954-1955", "150 million"],
    ["Math", "Antoine de Saint-Exupéry", "French", "1943", "140 million"],
    ["Chinese", "J. K. Rowling", "English", "1997", "107 million"]
];

type Props = {
    data:array,
    index:string
};

class ContentList extends Component{
    props: Props;
    static defaultProps = {
        data:data
    };
    render(){
        return (

                {this.props.data.map(function( title,index ){
                    return

                                <Link to={"detail:"+title[0]}>

                                    {index}{title}
                                </Link>

                },this)}

        )
    }

    //handleClick (){
    //    window.location.href="/detail";
    //    onClick={this.handleClick}
    //}

}

export default ContentList


text:
from Tkinter import *           # tkinter provides the graphical user interface (GUI)
import RPi.GPIO as GPIO
import time, math

C = 0.38 # uF - Tweek this value around 0.33 to improve accuracy
R1 = 1000 # Ohms
B = 3800.0 # The thermistor constant - change this for a different thermistor
R0 = 1000.0 # The resistance of the thermistor at 25C -change for different thermistor

# Configure the Pi to use the BCM (Broadcom) pin names, rather than the pin positions
GPIO.setmode(GPIO.BCM)

# This project uses a thermistor, a component whose resistance varies with the temperature.
# To measure its resistance, the code records the time it takes for a capacitor to fill
# when supplied by a current passing through the resistor. The lower the resistance the faster
# it fills up.
#
# You can think of a capacitor as a tank of electricity, and as it fills with charge, the voltage
# across it increases. We cannot measure that voltage directly, because the Raspberry Pi
# does not have an analog to digital convertor (ADC or analog input). However, we can time how long it
# takes for the capacitor to fill with charge to the extent that it gets above the 1.65V or so
# that counts as being a high digital input.
#
# For more information on this technique take a look at:
# learn.adafruit.com/basic-resistor-sensor-reading-on-raspberry-pi
# The code here is based on that in the Raspberry Pi Cookbook (Recipes 12.1 to 12.3)

# Pin a charges the capacitor through a fixed 1k resistor and the thermistor in series
# pin b discharges the capacitor through a fixed 1k resistor

a_pin = 18
b_pin = 23
buzzer_pin = 24

GPIO.setup(buzzer_pin, GPIO.OUT)

set_temp = 25           # The temperature above which the buzzer will sound

# The type of capacitors only have an accuracy of +-10% on its stated value and there are
# other components that will not be exactly the value stated on the package
# changing the fiddle_factor will help compensate for this.
# fiddle with the fiddle_factor (keep it close to 1.0) until this project agrees with a
# thermometer you trust.
# To be honest, its never going to be very accurate, as an absolute thermometer,
# but the value of temp should increase when you hold the thermistor between you fingers to
# warm it up.

# empty the capacitor ready to start filling it up
def discharge():
    GPIO.setup(a_pin, GPIO.IN)
    GPIO.setup(b_pin, GPIO.OUT)
    GPIO.output(b_pin, False)
    time.sleep(0.01)

# return the time taken for the voltage on the capacitor to count as a digital input HIGH
# than means around 1.65V
def charge_time():
    GPIO.setup(b_pin, GPIO.IN)
    GPIO.setup(a_pin, GPIO.OUT)
    GPIO.output(a_pin, True)
    t1 = time.time()
    while not GPIO.input(b_pin):
        pass
    t2 = time.time()
    return (t2 - t1) * 1000000 # microseconds

# Take an analog readin as the time taken to charge after first discharging the capacitor
def analog_read():
    discharge()
    t = charge_time()
    discharge()
    return t

# Convert the time taken to charge the cpacitor into a value of resistance
# To reduce errors, do it lots of times and take the average.
def read_resistance():
    n = 10
    total = 0;
    for i in range(0, n):
        total = total + analog_read()
    t = total / float(n)
    T = t * 0.632 * 3.3
    r = (T / C) - R1
    return r

def read_temp_c():
    R = read_resistance()
    t0 = 273.15     # 0 deg C in K
    t25 = t0 + 25.0 # 25 deg C in K
    # Steinhart-Hart equation - Google it
    inv_T = 1/t25 + 1/B * math.log(R/R0)
    T = (1/inv_T - t0)
    return T

# sound the buzzer at a certain pitch (in Hz) for a duration in seconds
def buzz(pitch, duration):
	period = 1.0 / pitch            # period of cycle
	delay = period / 2              # delay half of period (2 delays per cycle)
	cycles = int(duration * pitch)  # total number of cycles needed for duration specified
	for i in range(cycles):         # turn buzzer on and off for number of cycles needed
		GPIO.output(buzzer_pin, True)
		time.sleep(delay)
		GPIO.output(buzzer_pin, False)
		time.sleep(delay)

# group together all of the GUI code into a class called App
class App:

    # this function gets called when the app is created
    def __init__(self, master):
        self.master = master
        frame = Frame(master)
        frame.pack()
        label = Label(frame, text='Temp C', font=("Helvetica", 32))
        label.grid(row=0)
        self.reading_label = Label(frame, text='12.34', font=("Helvetica", 110))
        self.reading_label.grid(row=1)
        self.update_reading()

    # Update the temperature reading
    def update_reading(self):
        temp_c = read_temp_c()
        if temp_c > set_temp:
            buzz(500, 0.3)
        reading_str = "{:.2f}".format(temp_c)
        self.reading_label.configure(text=reading_str)
        self.master.after(500, self.update_reading)

# Set the GUI running, give the window a title, size and position
root = Tk()
root.wm_title('Thermometer')
app = App(root)
root.geometry("400x300+0+0")
try:
    root.mainloop()
finally:
    print("Cleaning up")
    GPIO.cleanup()


text:
#ifndef SIGNAL_H
#define SIGNAL_H

#endif /*SIGNAL_H*/


text:
title: Verifying the VMware Tanzu Greenplum Software Download
---

Describes how to verify Greenplum Database software that you download from VMware Tanzu Network.

VMware generates a SHA256 fingerprint for each Greenplum Database software download available from [VMware Tanzu Network](https://network.pivotal.io/products/pivotal-gpdb). This fingerprint enables you to verify that your downloaded file is unaltered from the original.

After you download a Greenplum Database server or component software package, you can verify the integrity of the software as follows:

1. On VMware Tanzu Network, navigate to the Greenplum Database version and package that you downloaded.

2. On the VMware Tanzu Greenplum _Release Download Files_ page, click the i icon to the right of the Greenplum Database software package that you downloaded.

    This action displays a dialog that contains information about the package file, including the **File** name and the **SHA256** fingerprint.

3. Copy/paste the **SHA256** to a local file, or keep the Tanzu Network browser tab open.

4. On your local host, open a terminal window, navigate to the download directory, and locate the Greenplum package file that you downloaded from Tanzu Network.

5. Compare the downloaded file name with the **File** name specified in the Tanzu Network package information, and verify that they are the same.

6. Identify an OS utility that you can use to locally calculate a file checksum. On CentOS, this utility command is named `sha256sum`.

7. Run the utility to display the checksum of the package file that you downloaded from Tanzu Network. For example, if you downloaded the **Greenplum Database Server** package on CentOS:

    ```
    $ sha256sum greenplum-db-6.18.0-rhel7-x86_64.rpm
    ```

8. If the command checksum output matches the **SHA256** fingerprint specified in the Tanzu Network package information, the file was downloaded intact. You can safely proceed to install the software.


text:
using System;
using System.Runtime.InteropServices;
using System.Text;

/*
using HANDLE = IntPtr、UIntPtr; // Visual C++ では void*
using BYTE = Byte; // Visual C++ では unsigned char
using SHORT = Int16; // Visual C++ では short
using WORD = UInt16; // Visual C++ では unsigned short
using INT = Int32; // Visual C++ では int
using UINT = UInt32; // Visual C++ では unsigned int
using LONG = Int32; // Visual C++ では long
using BOOL = Boolean; // Visual C++ では long
using DWORD = UInt32; // Visual C++ では unsigned long
using ULONG = UInt32; // Visual C++ では unsigned long
using CHAR = Char; // Visual C++ では char
using LPCSTR = String ^ [in], StringBuilder ^ [in, out]; // Visual C++ では char*
using LPCSTR = String; // Visual C++ では const char*
using LPWSTR = String ^ [in], StringBuilder ^ [in, out]; // Visual C++ では wchar_t*
using LPCWSTR = String; // Visual C++ では const wchar_t *
using FLOAT = Single; // Visual C++ では float
using DOUBLE = Double; // Visual C++ では double
*/

namespace Ouranos.RedArmory.Interop
{

    /// <summary>
    /// Windows API をカプセル化して提供します。
    /// </summary>
    internal static class SafeNativeMethods
    {

        public const int STD_INPUT_HANDLE = -10;

        public const int STD_OUTPUT_HANDLE = -11;

        public const int STD_ERROR_HANDLE = -12;

        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("shell32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
        public static extern IntPtr CommandLineToArgvW([MarshalAs(UnmanagedType.LPWStr)] string lpCmdLine, out int pNumArgs);

        [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
        [return: MarshalAs(UnmanagedType.U4)]
        public static extern int GetLongPathName(
            [MarshalAs(UnmanagedType.LPTStr)]
            string lpszShortPath,
            [MarshalAs(UnmanagedType.LPTStr)]
            StringBuilder lpszLongPath,
            [MarshalAs(UnmanagedType.U4)]
            int cchBuffer);

        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("kernel32.dll", SetLastError = true)]
        public static extern IntPtr LocalFree(IntPtr hMem);

        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("kernel32.dll", SetLastError = true)]
        public static extern bool AttachConsole(uint dwProcessId);

        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("kernel32.dll", SetLastError = true)]
        public static extern bool FreeConsole();

        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("kernel32.dll", SetLastError = true)]
        public static extern IntPtr GetStdHandle(int nStdHandle);

        [System.Security.SuppressUnmanagedCodeSecurity]
        [DllImport("kernel32.dll", SetLastError = true)]
        public static extern bool SetStdHandle(int nStdHandle, IntPtr hHandle);

    }

}


text:
__author__    = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Jan-Piet Mens'
__license__   = """Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)"""

import MySQLdb
import sys

# https://mail.python.org/pipermail/tutor/2010-December/080701.html
def add_row(cursor, tablename, rowdict):
    # XXX tablename not sanitized
    # XXX test for allowed keys is case-sensitive

    unknown_keys = None

    # filter out keys that are not column names
    cursor.execute("describe %s" % tablename)
    allowed_keys = set(row[0] for row in cursor.fetchall())
    keys = allowed_keys.intersection(rowdict)

    if len(rowdict) > len(keys):
        unknown_keys = set(rowdict) - allowed_keys

    columns = ", ".join(keys)
    values_template = ", ".join(["%s"] * len(keys))

    sql = "insert into %s (%s) values (%s)" % (
        tablename, columns, values_template)
    values = tuple(rowdict[key] for key in keys)
    cursor.execute(sql, values)

    return unknown_keys

def plugin(srv, item):

    srv.logging.debug("*** MODULE=%s: service=%s, target=%s", __file__, item.service, item.target)

    host    = item.config.get('host', 'localhost')
    port    = item.config.get('port', 3306)
    user    = item.config.get('user')
    passwd  = item.config.get('pass')
    dbname  = item.config.get('dbname')

    try:
        table_name = item.addrs[0].format(**item.data).encode('utf-8')
        fallback_col = item.addrs[1].format(**item.data).encode('utf-8')
    except:
        srv.logging.warn("mysql target incorrectly configured")
        return False

    try:
        conn = MySQLdb.connect(host=host,
                    user=user,
                    passwd=passwd,
                    db=dbname)
        cursor = conn.cursor()
    except Exception, e:
        srv.logging.warn("Cannot connect to mysql: %s" % (str(e)))
        return False

    text = item.message

    # Create new dict for column data. First add fallback column
    # with full payload. Then attempt to use formatted JSON values
    col_data = {
        fallback_col : text
       }

    if item.data is not None:
        for key in item.data.keys():
            try:
                col_data[key] = item.data[key].format(**item.data).encode('utf-8')
            except Exception, e:
                col_data[key] = item.data[key]

    try:
        unknown_keys = add_row(cursor, table_name, col_data)
        if unknown_keys is not None:
            srv.logging.debug("Skipping unused keys %s" % ",".join(unknown_keys))
        conn.commit()
    except Exception, e:
        srv.logging.warn("Cannot add mysql row: %s" % (str(e)))
        cursor.close()
        conn.close()
        return False

    cursor.close()
    conn.close()

    return True


text:
var transformer = require("../transformer");

// Move the first non-empty paragraph (and related elements) to the top of the section.
// This will have the effect of shifting the infobox and/or any images at the top of the page
// below the first paragraph, allowing the user to start reading the page right away.
transformer.register( "moveFirstGoodParagraphUp", function() {
    if ( window.isMainPage ) {
        // don't do anything if this is the main page, since many wikis
        // arrange the main page in a series of tables.
        return;
    }
    var block_0 = document.getElementById( "content_block_0" );
    if ( !block_0 ) {
        return;
    }

    var block_0_children = block_0.childNodes;
    if ( !block_0_children ) {
        return;
    }

    var leadSpan = createLeadSpan(block_0_children);
    block_0.insertBefore( leadSpan, block_0.firstChild );
} );

// Create a lead span to be moved to the top of the page, consisting of the first
// qualifying
 element encountered and any subsequent non-
 elements until
// the next
 is encountered.
//
// Simply moving the first
 element up may result in elements appearing
// between the first paragraph as designated by

 tags and other elements
// (such as an unnumbered list) that may also be intended as part of the first
// display paragraph.  See T111958.
function createLeadSpan( childNodes ) {
    var leadSpan = document.createElement( 'span' );
    var firstGoodParagraphIndex = findFirstGoodParagraphIn( childNodes );

    if ( firstGoodParagraphIndex ) {
        addNode( leadSpan, childNodes[ firstGoodParagraphIndex ] );
        addTrailingNodes(leadSpan, childNodes, firstGoodParagraphIndex + 1 );
    }

    return leadSpan;
}

function findFirstGoodParagraphIn( nodes ) {
    var minParagraphHeight = 24;
    var firstGoodParagraphIndex;
    var i;

    for ( i = 0; i < nodes.length; i++ ) {
        if ( nodes[i].tagName === 'P' ) {
            // Ensure the P being pulled up has at least a couple lines of text.
            // Otherwise silly things like a empty P or P which only contains a
            // BR tag will get pulled up (see articles on "Chemical Reaction" and
            // "Hawaii").
            // Trick for quickly determining element height:
            // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement.offsetHeight
            // http://stackoverflow.com/a/1343350/135557
            if ( nodes[i].offsetHeight < minParagraphHeight ){
                continue;
            }
            firstGoodParagraphIndex = i;
            break;
        }
    }

    return firstGoodParagraphIndex;
}

function addNode( span, node ) {
    span.appendChild( node.parentNode.removeChild( node ) );
}

function addTrailingNodes( span, nodes, startIndex ) {
    for ( var i = startIndex; i < nodes.length; i++ ) {
        if ( nodes[i].tagName === 'P' ) {
            break;
        }
        addNode( span, nodes[i] );
    }
}


text:
<!doctype html>

  <meta charset="UTF-8">
  <title>WebMUD Client</title>
  <link rel="icon" type="image/x-icon" href="/favicon.ico">
  <link rel="stylesheet" href="style.css">
  <link href="https://fonts.googleapis.com/css?family=Artifika" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css?family=EB+Garamond" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lora" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Spectral" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Spectral:200" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Alegreya" rel="stylesheet">

>

      <input class="inputMessage" placeholder="Type here..."/>


text:
<item>
	<title>Ryanair is teasing Easyjet</title>
	<link>http://xdamman.posterous.com/ryanair-is-teasing-easyjet</link>
	<pubDate>Mon Jan 01 18:20:41 -0800 2007</pubDate>

	<dc:creator><![CDATA[Xavier Damman]]></dc:creator>

	<category><![CDATA[Uncategorized]]></category>

	<category domain="category" nicename="uncategorized"><![CDATA[Uncategorized]]></category>

  <guid isPermaLink="false">http://xdamman.posterous.com/ryanair-is-teasing-easyjet</guid>
	<description></description>
	<content:encoded><![CDATA[I've just taken a flight from Charleroi (Brussels) to Madrid with Ryanair.

On the plane, it was written "Bye bye EasyJet" (as shown on this picture I took).
Does anybody has an another explanation than the fact the Ryanair is teasing his competitor EasyJet?

P.S: I tried to take in my hand back a belgian beer (a Bush special Xmas, 12°) just for fun, to check their brand new security rule, and, as expected, they didn't let me enter the plane with it.
Welcome to the 21th century where you are considered as a terrorist (or at least a dangerous person) with a beer in your bag.
Actually there is no need to have a beer, it also works with a bottle of water.
As I did in Heathrow (London) this September. They emptied my bottle of water and refill it after the security gate (because I was complaining 'cause I had to stay about 7 hours in that airport and I was not going to change money to buy a new bottle). Brillant.]]></content:encoded>
	<excerpt:encoded><![CDATA[I've just taken a flight from Charleroi (Brussels) to Madrid with Ryanair. On the plane, it was written "Bye bye EasyJet" (as shown on this picture I took). Does anybody has an another explanation than the fact the Ryanair is teasing his competito...]]></excerpt:encoded>

	<wp:post_date>Mon Jan 01 18:20:41 -0800 2007</wp:post_date>
	<wp:post_date_gmt>Mon Jan 01 18:20:41 -0800 2007</wp:post_date_gmt>
	<wp:comment_status>open</wp:comment_status>
	<wp:ping_status>open</wp:ping_status>
	<wp:post_id>22760744</wp:post_id>
	<wp:post_name>ryanair-is-teasing-easyjet</wp:post_name>
	<wp:status>publish</wp:status>
	<wp:post_parent>0</wp:post_parent>
	<wp:menu_order>0</wp:menu_order>
	<wp:post_type>post</wp:post_type>
	<wp:post_password></wp:post_password>
	<wp:is_sticky>0</wp:is_sticky>

</item>


text:
drop function f1;
drop index i1 ;
drop procedure p1;
drop role r1;
drop schema s1 restrict ;
drop sequence se1 restrict ;
drop synonym sy1;
drop table t1;
drop trigger tr1;
drop type ty1 restrict ;
drop view v1;


text:
/*globals describe, it, beforeEach */
import sinon       from 'sinon';
import should      from 'should';
import express     from 'express';
import staticTheme from '../../../server/middleware/static-theme';

describe('Middleware :: StaticTheme', () => {
  let next;

  beforeEach(() => {
    next = sinon.spy();
  });

  it('should call next if ejs file type', () => {
    const req = {
      path: 'mytemplate.ejs'
    };

    staticTheme(null)(req, null, next);
    next.called.should.be.true();
  });

  it('should call next if md file type', () => {
    const req = {
      path: 'README.md'
    };

    staticTheme(null)(req, null, next);
    next.called.should.be.true();
  });

  it('should call next if json file type', () => {
    const req = {
      path: 'sample.json'
    };

    staticTheme(null)(req, null, next);
    next.called.should.be.true();
  });

  it('should call express.static if valid file type', (done) => {
    const req = {
      path: 'myvalidfile.css',
      app: {
        get: () => { return 'sagedesk'; }
      }
    };

    const sandbox = sinon.sandbox.create();
    const expressStatic = sinon.spy(express, 'static');

    let activeThemeStub = sandbox.spy(req.app, 'get');

    staticTheme(null)(req, null, (reqArg, res, next2) => {
      /*jshint unused:false */
      sandbox.restore();
      next.called.should.be.false();
      activeThemeStub.called.should.be.true();
      expressStatic.called.should.be.true();
      should.exist(expressStatic.args[0][1].maxAge);
      done();
    });
  });

  it('should not error if active theme is missing', (done) => {
    const req = {
      path: 'myvalidfile.css',
      app: {
        get: () => { return undefined; }
      }
    };

    const sandbox = sinon.sandbox.create();

    let activeThemeStub = sandbox.spy(req.app, 'get');

    staticTheme(null)(req, null, (reqArg, res, next2) => {
      /*jshint unused:false */
      sandbox.restore();
      next.called.should.be.false();
      done();
    });
  });
});


text:
package nuist.wcw.model;

import nuist.wcw.Activity.R;
import nuist.wcw.Activity.RunActivity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.InputType;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import android.widget.Toast;

/**
 * 第一次运行ViewPagerIndicator的独立界面
 *
 * @author 晨崴
 *
 */
public class FirstRunFragment extends Fragment {
	private static final String KEY_CONTENT = "TestFragment:Content";

	/**
	 * 静态构造
	 *
	 * @param content
	 *            位置
	 * @param isLast
	 *            是否是最后一个
	 * @return FirstRunFragment类对象实例
	 */
	public static FirstRunFragment newInstance(int content, boolean isLast) {
		FirstRunFragment fragment = new FirstRunFragment();
		fragment.mContent = content;
		fragment.isLast = isLast;
		return fragment;
	}

	private int mContent;
	private boolean isLast = false;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	/**
	 * 创建一个界面,如果是最后一个界面,多加一个用于设置体重的Edit和一个TextView
	 */
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		ImageView img = new ImageView(getActivity());
		img.setBackgroundResource(mContent);
		LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,
				LayoutParams.MATCH_PARENT);
		img.setLayoutParams(params);

		RelativeLayout layout = new RelativeLayout(getActivity());
		layout.setLayoutParams(params);
		layout.setGravity(Gravity.BOTTOM);
		layout.addView(img);

		if (isLast) {
			// 如果是最后一个界面,创建一个TextView和一个EditText
			TextView text = new TextView(getActivity());
			final EditText setHeavy = new EditText(getActivity());

			text.setText(R.string.firstText);
			text.setTextSize(40);
			text.setId(111);
			LayoutParams textParams = new LayoutParams(
					LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
			textParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM,
					RelativeLayout.TRUE);
			textParams.addRule(RelativeLayout.CENTER_HORIZONTAL,
					RelativeLayout.TRUE);
			text.setLayoutParams(textParams);
			text.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					String heavyString = setHeavy.getText().toString();
					try {
						int heavy = Integer.parseInt(heavyString);
						FileUtils.setHeavy(getActivity(), heavy);
						Toast.makeText(getActivity(),
								"体重已成功设置为" + heavy + "kg", Toast.LENGTH_LONG)
								.show();
					} catch (Exception e) {
						Toast.makeText(getActivity(), R.string.setHeavyError,
								Toast.LENGTH_LONG).show();
					} finally {
						Intent intent = new Intent(getActivity(),
								RunActivity.class);
						getActivity().startActivity(intent);
						getActivity().finish();
					}
				}
			});

			setHeavy.setHint(R.string.firstEditHint);
			setHeavy.setInputType(InputType.TYPE_CLASS_NUMBER);
			setHeavy.setEms(10);
			LayoutParams heavyParams = new LayoutParams(
					LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
			heavyParams.addRule(RelativeLayout.CENTER_VERTICAL,
					RelativeLayout.TRUE);
			heavyParams.addRule(RelativeLayout.CENTER_HORIZONTAL,
					RelativeLayout.TRUE);
			setHeavy.setLayoutParams(heavyParams);

			layout.addView(text);
			layout.addView(setHeavy);

		}
		return layout;
	}

	@Override
	public void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		outState.putLong(KEY_CONTENT, mContent);
	}
}


text:
import os
import sys
import httplib
from urlparse import urlparse
import traceback
import json
import xbmc
import xbmcgui
import xbmcplugin
import xbmcaddon
import urllib
import re
import time
import dvtv
from datetime import datetime

params = None
try:
    ###############################################################################
    REMOTE_DBG = False
    # append pydev remote debugger
    if REMOTE_DBG:
        try:
            sys.path.append(os.environ['HOME']+r'/.xbmc/system/python/Lib/pysrc')
            import pydevd
            pydevd.settrace('localhost', port=5678, stdoutToServer=True, stderrToServer=True)
        except ImportError:
            sys.stderr.write("Error: Could not load pysrc!")
            sys.exit(1)
    ###############################################################################
    _addon_ = xbmcaddon.Addon('plugin.video.dvtv')
    # First run
    if not (_addon_.getSetting("settings_init_done") == "true"):
        DEFAULT_SETTING_VALUES = { "send_errors" : "false",
                                   "quality": "720p",
                                   "format": "MP4" }
        for setting in DEFAULT_SETTING_VALUES.keys():
            val = _addon_.getSetting(setting)
            if not val:
                _addon_.setSetting(setting, DEFAULT_SETTING_VALUES[setting])
        _addon_.setSetting("settings_init_done", "true")
    ###############################################################################
    _profile_ = xbmc.translatePath(_addon_.getAddonInfo('profile'))
    setattr(dvtv, 'addon_userdata_path', _profile_)
    _lang_   = _addon_.getLocalizedString
    _scriptname_ = _addon_.getAddonInfo('name')
    _quality_ = _addon_.getSetting('quality')
    _first_error_ = (_addon_.getSetting('first_error') == "true")
    _send_errors_ = (_addon_.getSetting('send_errors') == "true")
    _format_ = 'video/' + _addon_.getSetting('format').lower()
    _icon_ = xbmc.translatePath( os.path.join(_addon_.getAddonInfo('path'), 'icon.png' ) )
    _next_ = xbmc.translatePath( os.path.join(_addon_.getAddonInfo('path'), 'resources/media/next.png' ) )
    _previous_ = xbmc.translatePath( os.path.join(_addon_.getAddonInfo('path'), 'resources/media/previous.png' ) )
    _handle_ = int(sys.argv[1])
    _baseurl_ = sys.argv[0]
    ###############################################################################
    def log(msg, level=xbmc.LOGDEBUG):
        if type(msg).__name__=='unicode':
            msg = msg.encode('utf-8')
        xbmc.log("[%s] %s"%(_scriptname_,msg.__str__()), level)

    def logDbg(msg):
        log(msg,level=xbmc.LOGDEBUG)

    def logErr(msg):
        log(msg,level=xbmc.LOGERROR)
    ###############################################################################

    def mainMenu():
        addDirectoryItem(_lang_(30051), _baseurl_+ "?menu=" + urllib.quote_plus("recommended"))
        addDirectoryItem(_lang_(30052), _baseurl_+ "?menu=" + urllib.quote_plus("latest"))
        addDirectoryItem(_lang_(30106), _baseurl_+ "?keyword=" + urllib.quote_plus(_toString(109800)))
        addDirectoryItem(_lang_(30101), _baseurl_+ "?keyword=" + urllib.quote_plus(_toString(109)))
        addDirectoryItem(_lang_(30102), _baseurl_+ "?keyword=" + urllib.quote_plus(_toString(2464)))
        addDirectoryItem(_lang_(30103), _baseurl_+ "?keyword=" + urllib.quote_plus(_toString(18)))
        addDirectoryItem(_lang_(30104), _baseurl_+ "?keyword=" + urllib.quote_plus(_toString(13)))
        addDirectoryItem(_lang_(30105), _baseurl_+ "?keyword=" + urllib.quote_plus(_toString(349)))
        addDirectoryItem(_lang_(30053), _baseurl_+ "?menu=" + urllib.quote_plus("keywords"))
        xbmcplugin.endOfDirectory(_handle_, updateListing=False)

    def listItems(offset, keyword=None):
        next_url = _baseurl_ + "?menu=" + urllib.quote_plus("latest") + "&offset=" + _toString(offset+30)
        previous_url = _baseurl_ + "?menu=" + urllib.quote_plus("latest") + "&offset=" + _toString(offset-30)
        if keyword:
            previous_url += "&keyword=" + _toString(keyword)
            next_url += "&keyword=" + _toString(keyword)
        if offset > 0:
            addDirectoryItem('[B]<< ' + _lang_(30007) + '[/B]',  previous_url, image=_previous_)
        if keyword:
            _list(dvtv.Keyword(keyword).list(offset))
        else:
            _list(dvtv.list_latest(offset))
        addDirectoryItem('[B]' +_lang_(30006) +' >> [/B]',  next_url, image=_next_)
        xbmcplugin.endOfDirectory(_handle_, updateListing=(offset>0), cacheToDisc=False)

    def _getQualityName(title, mime, quality):
        return re.compile("video/(.*)").search(mime).group(1).upper() + ": " + quality

    def playProgramme(link, skipAutoQuality=False):
        programme = dvtv.Programme(link)
        pl=xbmc.PlayList(1)
        pl.clear()
        for video in programme.playlist():
            if len(programme.playlist()) > 0 and skipAutoQuality:
                addDirectoryItem(video.title, None, isFolder=False)
            li = xbmcgui.ListItem(video.title)
            li.setThumbnailImage(video.image)
            for quality in video.qualities:
                if skipAutoQuality:
                    quality_name = _getQualityName(video.title, quality.mime, quality.quality)
                    addDirectoryItem(label=quality_name, url=quality.url, title=video.title, image=video.image, isFolder=False)
                else:
                    if (quality.quality == _quality_ and quality.mime == _format_):
                        xbmc.PlayList(1).add(quality.url, li)
        if skipAutoQuality:
            xbmcplugin.endOfDirectory(_handle_, updateListing=False,cacheToDisc=False)
        else:
            xbmc.Player().play(pl)

    def _list(programmeList):
        xbmcplugin.setContent(_handle_, 'episodes')
        for programme in programmeList:
            addDirectoryItem(programme.title(), _baseurl_+ "?play=" + urllib.quote_plus(programme.link), programme.description(), programme.title(), programme.date(), image=programme.image(), isFolder=False)

    def addDirectoryItem(label, url, plot=None, title=None, date=None, icon=_icon_, image=None, fanart=None, isFolder=True):
        li = xbmcgui.ListItem(label)
        if not title:
            title = label
        liVideo = {'title': title}
        if plot:
            liVideo['plot'] = plot
        if date:
            dt = datetime.fromtimestamp(time.mktime(time.strptime(date, "%d.%m.%Y")))
            liVideo['premiered'] = dt.strftime("%Y-%m-%d")
        if image:
            li.setThumbnailImage(image)
        li.setIconImage(icon)
        li.setInfo("video", liVideo)
        if not isFolder and url:
            cm = []
            cm.append((_lang_(30013), "XBMC.Container.Update(" + url + "&skip_auto=1)"))
            li.addContextMenuItems(cm)
        xbmcplugin.addDirectoryItem(handle=_handle_, url=url, listitem=li, isFolder=isFolder)

    def listRecommended():
        _list(dvtv.list_recommended())
        xbmcplugin.endOfDirectory(_handle_, updateListing=False, cacheToDisc=False)

    def listKeywords():
        for keyword in dvtv.keywords():
            addDirectoryItem(keyword.name, _baseurl_+ "?keyword=" + urllib.quote_plus(_toString(keyword.keyword_id)))
        xbmcplugin.endOfDirectory(_handle_, updateListing=False,cacheToDisc=False)

    def _toString(text):
        if type(text).__name__=='unicode':
            output = text.encode('utf-8')
        else:
            output = str(text)
        return output

    def _sendError(params, exc_type, exc_value, exc_traceback):
        try:
            conn = httplib.HTTPSConnection('script.google.com')
            req_data = urllib.urlencode({ 'addon' : _scriptname_, 'params' : _toString(params), 'type' : exc_type, 'value' : exc_value, 'traceback' : _toString(traceback.format_exception(exc_type, exc_value, exc_traceback))})
            headers = {"Content-type": "application/x-www-form-urlencoded"}
            conn.request(method='POST', url='/macros/s/AKfycbyZfKhi7A_6QurtOhcan9t1W0Tug-F63_CBUwtfkBkZbR2ysFvt/exec', body=req_data, headers=headers)
            resp = conn.getresponse()
            while resp.status >= 300 and resp.status < 400:
                location = resp.getheader('Location')
                o = urlparse(location, allow_fragments=True)
                host = o.netloc
                conn = httplib.HTTPSConnection(host)
                url = o.path + "?" + o.query
                conn.request(method='GET', url=url)
                resp = conn.getresponse()
            if resp.status >= 200 and resp.status < 300:
                resp_body = resp.read()
                json_body = json.loads(resp_body)
                status = json_body['status']
                if status == 'ok':
                    return True
        except:
            pass
        return False

    def get_params():
            param=[]
            paramstring=sys.argv[2]
            if len(paramstring)>=2:
                    params=sys.argv[2]
                    cleanedparams=params.replace('?','')
                    if (params[len(params)-1]=='/'):
                            params=params[0:len(params)-2]
                    pairsofparams=cleanedparams.split('&')
                    param={}
                    for i in range(len(pairsofparams)):
                            splitparams={}
                            splitparams=pairsofparams[i].split('=')
                            if (len(splitparams))==2:
                                    param[splitparams[0]]=splitparams[1]
            return param
    def assign_params(params):
        for param in params:
            try:
                globals()[param]=urllib.unquote_plus(params[param])
            except:
                pass

    play=None
    keyword=None
    menu=None
    offset=0
    skip_auto=None
    params=get_params()
    assign_params(params)

    if play:
        skip_auto = (skip_auto is not None and skip_auto != "0")
        playProgramme(play, skip_auto)
    elif menu or keyword:
        if menu == "recommended":
            listRecommended()
        elif menu == "keywords":
            listKeywords()
        else:
            listItems(int(offset), keyword)
    else:
        mainMenu()
except Exception as ex:
    exc_type, exc_value, exc_traceback = sys.exc_info()
    xbmcgui.Dialog().notification(_scriptname_, _toString(exc_value), xbmcgui.NOTIFICATION_ERROR)
    if not _first_error_:
        if xbmcgui.Dialog().yesno(_scriptname_, _lang_(30500), _lang_(30501)):
            _addon_.setSetting("send_errors", "true")
            _send_errors_ = (_addon_.getSetting('send_errors') == "true")
        _addon_.setSetting("first_error", "true")
        _first_error_ = (_addon_.getSetting('first_error') == "true")
    if _send_errors_:
        if _sendError(params, exc_type, exc_value, exc_traceback):
            xbmcgui.Dialog().notification(_scriptname_, _lang_(30502), xbmcgui.NOTIFICATION_INFO)
        else:
            xbmcgui.Dialog().notification(_scriptname_, _lang_(30503), xbmcgui.NOTIFICATION_ERROR)


text:
namespace boost {
namespace asio {

inline system_context& system_executor::context() const BOOST_ASIO_NOEXCEPT
{
  return detail::global<system_context>();
}

template <typename Function, typename Allocator>
void system_executor::dispatch(
    BOOST_ASIO_MOVE_ARG(Function) f, const Allocator&) const
{
  typename decay<Function>::type tmp(BOOST_ASIO_MOVE_CAST(Function)(f));
  boost_asio_handler_invoke_helpers::invoke(tmp, tmp);
}

template <typename Function, typename Allocator>
void system_executor::post(
    BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const
{
  typedef typename decay<Function>::type function_type;

  system_context& ctx = detail::global<system_context>();

  // Allocate and construct an operation to wrap the function.
  typedef detail::executor_op<function_type, Allocator> op;
  typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 };
  p.p = new (p.v) op(BOOST_ASIO_MOVE_CAST(Function)(f), a);

  BOOST_ASIO_HANDLER_CREATION((ctx, *p.p,
        "system_executor", &this->context(), 0, "post"));

  ctx.scheduler_.post_immediate_completion(p.p, false);
  p.v = p.p = 0;
}

template <typename Function, typename Allocator>
void system_executor::defer(
    BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const
{
  typedef typename decay<Function>::type function_type;

  system_context& ctx = detail::global<system_context>();

  // Allocate and construct an operation to wrap the function.
  typedef detail::executor_op<function_type, Allocator> op;
  typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 };
  p.p = new (p.v) op(BOOST_ASIO_MOVE_CAST(Function)(f), a);

  BOOST_ASIO_HANDLER_CREATION((ctx, *p.p,
        "system_executor", &this->context(), 0, "defer"));

  ctx.scheduler_.post_immediate_completion(p.p, true);
  p.v = p.p = 0;
}

} // namespace asio
} // namespace boost

#include <boost/asio/detail/pop_options.hpp>

#endif // BOOST_ASIO_IMPL_SYSTEM_EXECUTOR_HPP


text:
package org.apache.pig.impl.logicalLayer;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.pig.data.DataType;
import org.apache.pig.impl.plan.VisitorException;
import org.apache.pig.impl.logicalLayer.schema.Schema;
import org.apache.pig.impl.plan.OperatorKey;
import org.apache.pig.impl.plan.PlanVisitor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class LORegexp extends BinaryExpressionOperator {
    private static final long serialVersionUID = 2L;

    /**
     * The expression and the column to be projected.
     */
    private static Log log = LogFactory.getLog(LORegexp.class);

    /**
     *
     * @param plan
     *            Logical plan this operator is a part of.
     * @param key
     *            Operator key to assign to this node.
     */
    public LORegexp(LogicalPlan plan, OperatorKey key) {
        super(plan, key);
    }

    public ExpressionOperator getOperand() {
        return getLhsOperand();
    }

    public String getRegexp() {
        ExpressionOperator op = getRhsOperand();
        if (!(op instanceof LOConst)) {
            throw new RuntimeException(
                "Regular expression patterns must be a constant.");
        }
        Object o = ((LOConst)op).getValue();
        // better be a string
        if (!(o instanceof String)) {
            throw new RuntimeException(
                "Regular expression patterns must be a string.");
        }

        return (String)o;
    }

    @Override
    public String name() {
        return "Regexp " + mKey.scope + "-" + mKey.id;
    }

    @Override
    public boolean supportsMultipleInputs() {
        return true;
    }

    @Override
    public Schema getSchema() {
        return mSchema;
    }

    @Override
    public Schema.FieldSchema getFieldSchema() throws FrontendException {
        if(!mIsFieldSchemaComputed) {
            mFieldSchema = new Schema.FieldSchema(null, DataType.BOOLEAN);
            mFieldSchema.setParent(getLhsOperand().getFieldSchema().canonicalName, getLhsOperand());
            mFieldSchema.setParent(getRhsOperand().getFieldSchema().canonicalName, getRhsOperand());
            mIsFieldSchemaComputed = true;
        }
        return mFieldSchema;
    }

    @Override
    public void visit(LOVisitor v) throws VisitorException {
        v.visit(this);
    }

}


text:
(function () {
    'use strict';

    angular
        .module('app.core')
        .factory('authentication', authentication);

    authentication.$inject = ['ipCookie'];

    /* @ngInject */
    function authentication(ipCookie) {
        var service = {
            getCookieTokenName: 'spotern-token',
            getCookieTokenValue: '',
            getCookieTokenOption: {
                expires: 1800,
                expirationUnit: 'seconds'
            },
            getTokenType: 'X-Spotern-Token',
            getCookieToken: getCookieToken,
            setCookieToken: setCookieToken,
            delCookieToken: delCookieToken,
            renewCookieToken: renewCookieToken,
            getAccessToken: getAccessToken,
            setAccesToken: setAccesToken,
            delAccessToken: delAccessToken,
            isConnect: isConnect,
            updateTokenLife: updateTokenLife
        };

        return service;

        ////////////////

        function getCookieToken() {
            return ipCookie(service.getCookieTokenName);
        }

        function setCookieToken(token) {
            ipCookie(service.getCookieTokenName, token, service.getCookieTokenOption);
        }

        function delCookieToken() {
            ipCookie.remove(service.getCookieTokenName);
        }

        function renewCookieToken() {
            var tk = ipCookie(service.getCookieTokenName);
            ipCookie(service.getCookieTokenName, tk, service.getCookieTokenOption);
        }

        function getAccessToken() {
            if (service.getCookieTokenValue === '') return service.getCookieToken();
            else return service.getCookieTokenValue;
        }

        function setAccesToken(token) {
            service.getCookieTokenValue = token;
            service.setCookieToken(token);
        }

        function delAccessToken() {
            service.delCookieToken();
            service.getCookieTokenValue = '';
        }

        function isConnect() {
            var myToken = service.getAccessToken();
            return (typeof (myToken) !== 'undefined' && myToken.length > 0);
        }

        function updateTokenLife() {
            var token = ipCookie(service.getCookieTokenName);
            ipCookie.remove(service.getCookieTokenName);
            ipCookie(service.getCookieTokenName, token, service.getCookieTokenOption);
        }

    }
})();


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Upos.ServiceObject.Base.Properties;

namespace Upos.ServiceObject.Base.UposEvents
{
    /// <summary>
    /// #Taken from page 59 on UPOS1.14#
    /// The Service must enqueue events on an internally created and managed queue.
    /// All events are delivered in a first-in, first-out mannger.
    /// (The only exceptions is that a special input error event is delivered early if
    /// some data events are also enqueued. See "Device Input Model" on page 22.)
    /// Events are delivered by an internally created and managed Service thread.
    /// The Service causes event delivery by calling an event firing callback method in the Control, which then delivers the event to the application.
    ///
    /// The Following conditionat cause event delivery to be delayed until the condition is corrected:
    ///     The application has set the property FreezeEvents to true.
    ///     The event type is a Data Event or an input Error Event, but the property DataEventEnabled is false. (See "Device Input Model" on page 22.)
    /// </summary>
    [Obsolete("To be replaced by UposEventDispatcher")]
    public class EventThreadHelper : IDisposable
    {
        public int DataCount { get { return _eventQueue.Count(f => f is DataEventArguments); } }

        private Thread _eventThread;
        private bool _eventsFrozen = false;
        private bool _dataEventEnabled = false;
        private readonly object locker = new object();
        private readonly Queue<EventArguments> _eventQueue = new Queue<EventArguments>();

        private readonly COPOS _oposDevice;
        private readonly IUposProperties _uposProperties;

        public EventThreadHelper(COPOS oposDevice, IUposProperties uposProperties)
        {
            _oposDevice = oposDevice;
            _uposProperties = uposProperties;
            _uposProperties.PropertyChanged += oposDevice_PropertyChanged;
        }

        private void oposDevice_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
                case "DataEventEnabled":
                    lock (locker)
                    {
                        _dataEventEnabled = _uposProperties.ByName.DataEventEnabled;
                        if (_dataEventEnabled && (_eventThread == null || !_eventThread.IsAlive))
                        {
                            _eventThread = new Thread(MonitorOposEventQueue);
                            _eventThread.Start();
                        }
                        Monitor.Pulse(locker);
                    }
                    break;

                case "FreezeEvents":
                    lock (locker)
                    {
                        _eventsFrozen = _uposProperties.ByName.FreezeEvents;
                        Monitor.Pulse(locker);
                    }
                    break;
            }
        }

        /// <summary>
        /// Enqueues an event to be fired. Use only from OPOSBase
        /// </summary>
        /// <param name="dataEvent">The event to enqueue</param>
        internal void EnqueueEvent(EventArguments dataEvent)
        {
            if (!dataEvent.IsImmediate)
            {
                EnqueueItem(dataEvent);
            }
            else
            {
                FireEvent(dataEvent);
            }
        }

        private void EnqueueItem(EventArguments dataEvent)
        {
            lock (locker)
            {
                _eventQueue.Enqueue(dataEvent);
                Monitor.Pulse(locker);
            }
            _uposProperties.FirePropertyChanged("DataCount");
        }

        /// <summary>
        /// Clears both the queues of all events
        /// </summary>
        internal void Clear()
        {
            _eventQueue.Clear();
        }

        public void Dispose()
        {
            if (_eventThread != null && _eventThread.IsAlive)
            {
                _eventsFrozen = false;
                _dataEventEnabled = true;
                EnqueueItem(null);

                _eventThread.Join();
            }
        }

        private void MonitorOposEventQueue()
        {
            while (true)
            {
                EventArguments oposEvent;
                lock (locker)
                {
                    while (_eventQueue.Count == 0 || _eventsFrozen || !_dataEventEnabled)
                    {
                        Monitor.Wait(locker);
                    }
                    oposEvent = _eventQueue.Dequeue();
                }
                if (oposEvent == null) { break; }
                FireEvent(oposEvent);
            }
        }

        private void FireEvent(EventArguments enqueuedEvent)
        {
            if (enqueuedEvent is DataEventArguments arguments)
            {
                _uposProperties.FirePropertyChanged("DataCount");
                _oposDevice.SOData(arguments.Status);
            }
            else if (enqueuedEvent is DirectIOEventArguments directIoEventArguments)
            {
                _oposDevice.SODirectIO(directIoEventArguments.EventNumber, ref directIoEventArguments.NumericData, ref directIoEventArguments.StringData);
            }
            else if (enqueuedEvent is ErrorEventArguments errorEventArguments)
            {
                _oposDevice.SOError((int)errorEventArguments.ResultCode, errorEventArguments.ResultCodeExtended, (int)errorEventArguments.ErrorLocus, ref errorEventArguments.ErrorResponse);
            }
            else if (enqueuedEvent is OutputCompleteEventArguments outputCompleteEventArguments)
            {
                _oposDevice.SOOutputComplete(outputCompleteEventArguments.OutputID);
            }
            else if (enqueuedEvent is StatusUpdateEventArguments statusUpdateEventArguments)
            {
                _oposDevice.SOStatusUpdate(statusUpdateEventArguments.Status);
            }
        }
    }
}


text:
electron-skeleton
===================

# Install:

This takes a minute because it has to download the entire electron binary.

```bash
npm install
```

# Run:

```bash
./run.sh
```

# Clean:

```bash
./run.sh clean
```


text:
/** Notice of modification as required by the LGPL
 *  This file was modified by Gemstone Systems Inc. on
 *  $Date$
 **/
package com.gemstone.org.jgroups.blocks;

import com.gemstone.org.jgroups.ChannelException;

/**
 * This exception is thrown when voting listener cannot vote on the
 * specified decree.
 *
 * @author Roman Rokytskyy (rrokytskyy@acm.org)
 */
public class VoteException extends ChannelException  {
private static final long serialVersionUID = -741925330540432706L;

    public VoteException(String msg) { super(msg); }
}


text:
// Description: Entity Framework Bulk Operations & Utilities (EF Bulk SaveChanges, Insert, Update, Delete, Merge | LINQ Query Cache, Deferred, Filter, IncludeFilter, IncludeOptimize | Audit)
// Website & Documentation: https://github.com/zzzprojects/Entity-Framework-Plus
// Forum & Issues: https://github.com/zzzprojects/EntityFramework-Plus/issues
// License: https://github.com/zzzprojects/EntityFramework-Plus/blob/master/LICENSE
// More projects: http://www.zzzprojects.com/
// Copyright © ZZZ Projects Inc. 2014 - 2016. All rights reserved.

using System.Linq;

namespace Z.EntityFramework.Plus
{
#if QUERY_INCLUDEOPTIMIZED
    internal static partial class QueryFutureExtensions
#else
    public static partial class QueryFutureExtensions
#endif
    {
        /// <summary>
        ///     Defer the execution of the <paramref name="query" /> and batch the query command with other
        ///     future queries. The batch is executed when a future query requires a database round trip.
        /// </summary>
        /// <typeparam name="TResult">The type of the query result.</typeparam>
        /// <param name="query">
        ///     The query to defer the execution of and to add in the batch of future
        ///     queries.
        /// </param>
        /// <returns>
        ///     The QueryFutureValue<TResult,TResult> added to the batch of futures queries.
        /// </returns>
        public static QueryFutureValue<TResult> FutureValue<TResult>(this IQueryable<TResult> query)
        {
            if (!QueryFutureManager.AllowQueryBatch)
            {
                var futureValue = new QueryFutureValue<TResult>(null, null);
                futureValue.GetResultDirectly(query);
                return futureValue;
            }

#if EF5 || EF6
            var objectQuery = query.GetObjectQuery();
            var futureBatch = QueryFutureManager.AddOrGetBatch(objectQuery.Context);
            var futureQuery = new QueryFutureValue<TResult>(futureBatch, objectQuery);
#elif EFCORE
            QueryFutureBatch futureBatch;
            QueryFutureValue<TResult> futureQuery;
            if (query.IsInMemoryQueryContext())
            {
                var context = query.GetInMemoryContext();
                futureBatch = QueryFutureManager.AddOrGetBatch(context);
                futureBatch.IsInMemory = true;
                futureQuery = new QueryFutureValue<TResult>(futureBatch, query);
            }
            else
            {
                var context = query.GetDbContext();
                futureBatch = QueryFutureManager.AddOrGetBatch(context);
                futureQuery = new QueryFutureValue<TResult>(futureBatch, query);
            }
#endif
            futureBatch.Queries.Add(futureQuery);

            return futureQuery;
        }
    }
}


text: <?= $component->getWidget() ?>