text:
require 'rubygems'
require 'oauth'
require 'optparse'
require 'ostruct'
require 'stringio'
require 'yaml'

library_files = Dir[File.join(File.dirname(__FILE__), "/twurl/**/*.rb")].sort
library_files.each do |file|
  require file
end

module Twurl
  @options ||= Options.new
  class << self
    attr_accessor :options
  end

  class Exception < ::Exception
  end
end


text:
import unittest

# Redirect stderr to stdout to suppress output in tests
import sys
sys.stderr = sys.stdout

from catkin_pkg.package import Dependency, Export, InvalidPackage, Package, Person, _check_known_attributes

import xml.dom.minidom as dom

from mock import Mock

class PackageTest(unittest.TestCase):

    def get_maintainer(self):
        maint = Mock()
        maint.email = 'foo@bar.com'
        maint.name = 'John Foo'
        return maint

    def get_group_dependency(self, name):
        group = Mock()
        group.name = name
        return group

    def test_init(self):
        maint = self.get_maintainer()
        pack = Package(name='foo',
                       version='0.0.0',
                       maintainers=[maint],
                       licenses=['BSD'])
        self.assertEqual(None, pack.filename)
        self.assertEqual('0.0.0', pack.version)
        self.assertEqual(None, pack.version_compatibility)
        self.assertEqual([], pack.urls)
        self.assertEqual([], pack.authors)
        self.assertEqual([maint], pack.maintainers)
        self.assertEqual(['BSD'], pack.licenses)
        self.assertEqual([], pack.build_depends)
        self.assertEqual([], pack.buildtool_depends)
        self.assertEqual([], pack.run_depends)
        self.assertEqual([], pack.test_depends)
        self.assertEqual([], pack.conflicts)
        self.assertEqual([], pack.replaces)
        self.assertEqual([], pack.exports)
        self.assertEqual([], pack.group_depends)
        self.assertEqual([], pack.member_of_groups)
        pack = Package('foo',
                       name='bar',
                       version='0.0.0',
                       licenses=['BSD'],
                       maintainers=[self.get_maintainer()])
        self.assertEqual('foo', pack.filename)

        self.assertRaises(TypeError, Package, unknownattribute=42)

    def test_init_dependency(self):
        dep = Dependency('foo',
                         version_lt=1,
                         version_lte=2,
                         version_eq=3,
                         version_gte=4,
                         version_gt=5,
                         condition='$foo == 23 and $bar != 42')
        self.assertEquals('foo', dep.name)
        self.assertEquals(1, dep.version_lt)
        self.assertEquals(2, dep.version_lte)
        self.assertEquals(3, dep.version_eq)
        self.assertEquals(4, dep.version_gte)
        self.assertEquals(5, dep.version_gt)
        self.assertFalse(dep.evaluate_condition({'foo': 23, 'bar': 42}))
        self.assertFalse(dep.evaluated_condition)
        self.assertTrue(dep.evaluate_condition({'foo': 23, 'bar': 43}))
        self.assertTrue(dep.evaluated_condition)
        self.assertRaises(TypeError, Dependency, 'foo', unknownattribute=42)

        d = {}
        d[dep] = None
        dep2 = Dependency('foo',
                          version_lt=1,
                          version_lte=2,
                          version_eq=3,
                          version_gte=4,
                          version_gt=5,
                          condition='$foo == 23 and $bar != 42')
        dep2.evaluate_condition({'foo': 23, 'bar': 43})
        d[dep2] = None
        self.assertEquals(len(d), 1)
        dep3 = Dependency('foo',
                          version_lt=1,
                          version_lte=2,
                          version_eq=3,
                          version_gte=4,
                          version_gt=6)
        d[dep3] = None
        self.assertEquals(len(d), 2)

        dep = Dependency('foo', condition='foo > bar and bar < baz')
        self.assertTrue(dep.evaluate_condition({}))

        dep = Dependency('foo', condition='foo <= bar or bar >= baz')
        self.assertFalse(dep.evaluate_condition({}))

    def test_init_kwargs_string(self):
        pack = Package('foo',
                       name='bar',
                       package_format='1',
                       version='0.0.1',
                       version_compatibility='0.0.0',
                       description='pdesc',
                       licenses=['BSD'],
                       maintainers=[self.get_maintainer()])
        self.assertEqual('foo', pack.filename)
        self.assertEqual('bar', pack.name)
        self.assertEqual('1', pack.package_format)
        self.assertEqual('0.0.0', pack.version_compatibility)
        self.assertEqual('0.0.1', pack.version)
        self.assertEqual('pdesc', pack.description)

    def test_init_kwargs_object(self):
        mmain = [self.get_maintainer(), self.get_maintainer()]
        mlis = ['MIT', 'BSD']
        mauth = [self.get_maintainer(), self.get_maintainer()]
        murl = [Mock(), Mock()]
        mbuilddep = [Mock(), Mock()]
        mbuildtooldep = [Mock(), Mock()]
        mrundep = [Mock(), Mock()]
        mtestdep = [Mock(), Mock()]
        mconf = [Mock(), Mock()]
        mrepl = [Mock(), Mock()]
        mexp = [Mock(), Mock()]
        mgroup = [
            self.get_group_dependency('group1'),
            self.get_group_dependency('group2')]
        mmember = ['member1', 'member2']
        pack = Package(package_format='3',
                       name='bar',
                       version='0.0.0',
                       maintainers=mmain,
                       licenses=mlis,
                       urls=murl,
                       authors=mauth,
                       build_depends=mbuilddep,
                       buildtool_depends=mbuildtooldep,
                       run_depends=mrundep,
                       test_depends=mtestdep,
                       conflicts=mconf,
                       replaces=mrepl,
                       group_depends=mgroup,
                       member_of_groups=mmember,
                       exports=mexp)
        self.assertEqual(mmain, pack.maintainers)
        self.assertEqual(mlis, pack.licenses)
        self.assertEqual(murl, pack.urls)
        self.assertEqual(mauth, pack.authors)
        self.assertEqual(mbuilddep, pack.build_depends)
        self.assertEqual(mbuildtooldep, pack.buildtool_depends)
        # since run_depends are getting stores as build_export_depends as well as exec_depends
        # and the dependency objects are being cloned only the double count can be checked for
        self.assertEqual(2 * len(mrundep), len(pack.run_depends))
        self.assertEqual(mtestdep, pack.test_depends)
        self.assertEqual(mconf, pack.conflicts)
        self.assertEqual(mrepl, pack.replaces)
        self.assertEqual(mexp, pack.exports)
        self.assertEqual(mgroup, pack.group_depends)
        self.assertEqual(mmember, pack.member_of_groups)

    def test_validate_package(self):
        maint = self.get_maintainer()
        pack = Package('foo',
                       name='bar_2go',
                       package_format='1',
                       version='0.0.1',
                       description='pdesc',
                       licenses=['BSD'],
                       maintainers=[maint])
        pack.validate()

        # names that should error
        pack.name = 'bar bza'
        self.assertRaises(InvalidPackage, Package.validate, pack)
        pack.name = 'foo%'
        self.assertRaises(InvalidPackage, Package.validate, pack)

        # names that should throw warnings
        pack.name = '2bar'
        warnings = []
        pack.validate(warnings=warnings)
        self.assertIn('naming conventions', warnings[0])

        pack.name = 'bar-bza'
        warnings = []
        pack.validate(warnings=warnings)
        self.assertIn('naming conventions', warnings[0])

        pack.name = 'BAR'
        warnings = []
        pack.validate(warnings=warnings)
        self.assertIn('naming conventions', warnings[0])

        # dashes are permitted for a non-catkin package
        pack.exports.append(Export('build_type', 'other'))
        pack.name = 'bar-bza'
        warnings = []
        pack.validate(warnings=warnings)
        self.assertEquals(warnings, [])
        pack.exports.pop()

        # check authors emails
        pack.name = 'bar'
        auth1 = Mock()
        auth2 = Mock()
        auth2.validate.side_effect = InvalidPackage('foo')
        pack.authors = [auth1, auth2]
        self.assertRaises(InvalidPackage, Package.validate, pack)
        pack.authors = []
        pack.validate()

        # check maintainer required with email
        pack.maintainers = []
        self.assertRaises(InvalidPackage, Package.validate, pack)
        pack.maintainers = [maint]
        maint.email = None
        self.assertRaises(InvalidPackage, Package.validate, pack)
        maint.email = 'foo@bar.com'

        for dep_type in [pack.build_depends, pack.buildtool_depends, pack.build_export_depends, pack.buildtool_export_depends, pack.exec_depends, pack.test_depends, pack.doc_depends]:
            pack.validate()
            depend = Dependency(pack.name)
            dep_type.append(depend)
            self.assertRaises(InvalidPackage, Package.validate, pack)
            dep_type.remove(depend)

    def test_validate_person(self):
        auth1 = Person('foo')
        auth1.email = 'foo@bar.com'
        auth1.validate()
        auth1.email = 'foo-bar@bar.com'
        auth1.validate()
        auth1.email = 'foo+bar@bar.com'
        auth1.validate()

        auth1.email = 'foo[at]bar.com'
        self.assertRaises(InvalidPackage, Person.validate, auth1)
        auth1.email = 'foo bar.com'
        self.assertRaises(InvalidPackage, Person.validate, auth1)
        auth1.email = 'foo<bar.com'
        self.assertRaises(InvalidPackage, Person.validate, auth1)

    def test_check_known_attributes(self):

        def create_node(tag, attrs):
            data = '<%s %s/>' % (tag, ' '.join(('%s="%s"'%p) for p in attrs.items()))
            return dom.parseString(data).firstChild

        try:
            create_node('tag', {'key': 'value'})
        except Exception as e:
            self.fail('create_node() raised %s "%s" unexpectedly!' % (type(e),str(e)))

        self.assertRaisesRegexp(Exception, "unbound prefix: line 1, column 0", create_node,'tag', {'ns:key': 'value'})

        try:
            create_node('tag', {'ns:key': 'value', 'xmlns:ns': 'urn:ns'})
        except Exception as e:
            self.fail('create_node() raised %s "%s" unexpectedly!' % (type(e),str(e)))

        def check(attrs, known, res=[]):
            self.assertEqual(res, _check_known_attributes(create_node('tag', attrs), known))

        expected_err = ['The "tag" tag must not have the following attributes: attr2']

        check({}, [])
        check({}, ['attr'])
        check({'attr': 'value'}, ['attr'])
        check({'attr2': 'value'}, ['attr'], expected_err)

        check({'xmlns': 'urn:ns'}, ['attr'])
        check({'xmlns:ns': 'urn:ns'}, ['attr'])
        check({'xmlns:ns': 'urn:ns', 'ns:attr': 'value'}, ['attr'])
        check({'xmlns:ns': 'urn:ns', 'ns:attr': 'value', 'attr2': 'value'}, ['attr'], expected_err)

redpajama_set_name: RedPajamaGithub


text:
package fengyun.redis.twitter.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Post {
	@Id
	@Column
	private Long id;
	@Column
	private String content;
	@Column
	private Long userId;
	@Column
	private Long replyUserId;
	@Column
	private Long replyPostid;
	@Column
	private long time;

	public Long getId() {
		return id;
	}

	private void setId(Long id) {
		this.id = id;
	}

	public String getContent() {
		return content;
	}

	private void setContent(String content) {
		this.content = content;
	}

	public Long getUserId() {
		return userId;
	}

	private void setUserId(Long userId) {
		this.userId = userId;
	}

	public Long getReplyUserId() {
		return replyUserId;
	}

	private void setReplyUserId(Long replyUserId) {
		this.replyUserId = replyUserId;
	}

	public Long getReplyPostid() {
		return replyPostid;
	}

	private void setReplyPostid(Long replyPostid) {
		this.replyPostid = replyPostid;
	}

	public long getTime() {
		return time;
	}

	private void setTime(long time) {
		this.time = time;
	}

	public Post() {
	}

	// Construct a post with replyUserId and replyPostId
	public Post(Long id, String content, Long userId, Long replyToUserId,
			Long topicPost) {
		this.setContent(content);
		this.setId(id);
		this.setUserId(userId);
		this.setReplyPostid(topicPost);
		this.setReplyUserId(replyToUserId);
		this.setTime(new Date().getTime());
	}

	// Construct a post without replyUserId and replyPostId
	public Post(Long id, String content, Long userId) {
		this(id, content, userId, null, null);
	}
}


text:
REGISTER_MODULE_RELOADER(mode_switching_handler, {
    mozc::composer::ModeSwitchingHandler::GetModeSwitchingHandler()->Reload();
  });

namespace mozc {
namespace composer {

ModeSwitchingHandler::ModeSwitchingHandler() {
  Reload();
}

ModeSwitchingHandler::~ModeSwitchingHandler() {}

bool ModeSwitchingHandler::GetModeSwitchingRule(
    const string &key,
    ModeSwitching *display_mode,
    ModeSwitching *input_mode) const {
  if (display_mode == NULL || input_mode == NULL) {
    LOG(ERROR) << "display_mode/input_mode is NULL.";
    return false;
  }

  const map<string, pair<ModeSwitching, ModeSwitching> >::const_iterator it =
      patterns_.find(key);
  if (it != patterns_.end()) {
    *display_mode = it->second.first;
    *input_mode = it->second.second;
    return true;
  }

  if (IsDriveLetter(key)) {
    *display_mode = HALF_ALPHANUMERIC;
    *input_mode = HALF_ALPHANUMERIC;
    return true;
  }

  *display_mode = NO_CHANGE;
  *input_mode = NO_CHANGE;
  return false;
}

bool ModeSwitchingHandler::IsDriveLetter(const string &key) const {
  if (key.size() == 3 &&
      isalpha(key[0]) && key[1] == ':' && key[2] == '\\') {
    return true;
  }
  return false;
}

void ModeSwitchingHandler::AddRule(const string &key,
                                   const ModeSwitching display_mode,
                                   const ModeSwitching input_mode) {
  patterns_.insert(make_pair(key, make_pair(display_mode, input_mode)));
}

void ModeSwitchingHandler::Reload() {
  // Default patterns are fixed right now.
  // AddRule(key, display_mode, input_mode);
  AddRule("google", PREFERRED_ALPHANUMERIC, REVERT_TO_PREVIOUS_MODE);
  AddRule("Google", PREFERRED_ALPHANUMERIC, REVERT_TO_PREVIOUS_MODE);
  AddRule("Chrome", PREFERRED_ALPHANUMERIC, REVERT_TO_PREVIOUS_MODE);
  AddRule("chrome", PREFERRED_ALPHANUMERIC, REVERT_TO_PREVIOUS_MODE);
  AddRule("Android", PREFERRED_ALPHANUMERIC, REVERT_TO_PREVIOUS_MODE);
  AddRule("android", PREFERRED_ALPHANUMERIC, REVERT_TO_PREVIOUS_MODE);
  AddRule("http", HALF_ALPHANUMERIC, HALF_ALPHANUMERIC);
  AddRule("www.", HALF_ALPHANUMERIC, HALF_ALPHANUMERIC);
  AddRule("\\\\", HALF_ALPHANUMERIC, HALF_ALPHANUMERIC);
}

ModeSwitchingHandler *ModeSwitchingHandler::GetModeSwitchingHandler() {
  return Singleton<ModeSwitchingHandler>::get();
}
}  // namespace composer
}  // namespace mozc


text:
SYNONYM

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

#### Published in
Can. J. Bot. 36: 798 (1958)

#### Original name
Cladosporium scopiforme Berk., 1856

### Remarks
null


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
	<item android:visible="true" android:title="@string/expand_all_menu" android:numericShortcut="1" android:enabled="true"
		android:titleCondensed="@string/expand_all_condensed" android:id="@+id/context_menu_expand_all"
		android:alphabeticShortcut="a"></item>
	<item android:titleCondensed="@string/expand_menu_condensed" android:title="@string/expand_menu"
		android:visible="true" android:enabled="true" android:numericShortcut="2" android:alphabeticShortcut="e" android:id="@+id/context_menu_expand_item"></item>
	<item android:visible="true" android:id="@+id/context_menu_collapse" android:title="@string/collapse_all_menu"
		android:alphabeticShortcut="c" android:numericShortcut="3" android:enabled="true" android:titleCondensed="@string/collapse_all_condesed"></item>
    <item android:visible="true" android:id="@+id/context_menu_delete" android:title="@string/delete_menu"
        android:alphabeticShortcut="d" android:numericShortcut="4" android:enabled="true" android:titleCondensed="@string/delete_menu_condensed"></item>
</menu>


text:
use intercom::prelude::*;

com_module! {
    class DoCallback,
    class NullableTests,
}

#[com_interface]
pub trait ICallback
{
    fn callback(&self) -> u32;
}

#[com_class(ICallback)]
#[derive(Default)]
struct DoCallback(u32);

impl ICallback for DoCallback
{
    fn callback(&self) -> u32
    {
        self.0
    }
}

#[com_interface]
pub trait INullableInterface
{
    fn nullable_parameter(&self, itf: Option<&ComItf<dyn ICallback>>) -> u32;

    fn nonnull_parameter(&self, itf: &ComItf<dyn ICallback>) -> ComResult<u32>;

    fn nullable_output(&self, value: u32) -> ComResult<Option<ComRc<dyn ICallback>>>;

    fn nonnull_output(&self, value: u32) -> ComResult<ComRc<dyn ICallback>>;
}

#[com_class(Self, INullableInterface)]
#[derive(Default)]
pub struct NullableTests;

#[com_interface]
impl NullableTests
{
    fn nullable_parameter(&self, v: u32, itf: &ComItf<dyn INullableInterface>) -> ComResult<()>
    {
        let opt = if v == 0 {
            None
        } else {
            Some(ComRc::from(ComBox::new(DoCallback(v))))
        };

        if itf.nullable_parameter(opt.as_deref()) != v {
            Err(ComError::E_FAIL)
        } else {
            Ok(())
        }
    }

    fn nonnull_parameter(&self, v: u32, itf: &ComItf<dyn INullableInterface>) -> ComResult<()>
    {
        let rc = ComRc::from(ComBox::new(DoCallback(v)));

        if itf.nonnull_parameter(&*rc)? != v {
            Err(ComError::E_FAIL)
        } else {
            Ok(())
        }
    }

    fn nullable_output(&self, value: u32, itf: &ComItf<dyn INullableInterface>) -> ComResult<()>
    {
        let cb = itf.nullable_output(value)?;
        match cb {
            None => {
                if value != 0 {
                    Err(ComError::E_INVALIDARG)
                } else {
                    Ok(())
                }
            }
            Some(cb) => {
                if value != 0 && cb.callback() == value {
                    Ok(())
                } else {
                    Err(ComError::E_FAIL)
                }
            }
        }
    }

    fn nonnull_output(&self, value: u32, itf: &ComItf<dyn INullableInterface>) -> ComResult<()>
    {
        let cb = itf.nonnull_output(value)?;
        match cb.callback() == value {
            true => Ok(()),
            false => Err(ComError::E_FAIL),
        }
    }
}

impl INullableInterface for NullableTests
{
    fn nullable_parameter(&self, itf: Option<&ComItf<dyn ICallback>>) -> u32
    {
        if let Some(itf) = itf {
            itf.callback()
        } else {
            0
        }
    }

    fn nonnull_parameter(&self, itf: &ComItf<dyn ICallback>) -> ComResult<u32>
    {
        Ok(itf.callback())
    }

    fn nullable_output(&self, value: u32) -> ComResult<Option<ComRc<dyn ICallback>>>
    {
        match value {
            0 => Ok(None),
            v => Ok(Some(ComRc::from(ComBox::new(DoCallback(v))))),
        }
    }

    fn nonnull_output(&self, value: u32) -> ComResult<ComRc<dyn ICallback>>
    {
        Ok(ComRc::from(ComBox::new(DoCallback(value))))
    }
}


text:
<!-- Copyright 2014 Google Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<polymer-element name="cxx-clause" extends="cxx-section">
  <script>
    (function() {
      function updateTocClauses() {
        this.super();
        var toc = document.querySelector('cxx-toc');
        if (toc) {
          toc.clauses = document.querySelectorAll('cxx-clause');
        }
      }
      Polymer('cxx-clause', {
        // Convenience function at the clause level, which gets called from <cxx-toc>.
        set_clause_num: function(clause_num) {
          this.update_sec_nums(clause_num);
        },

        attached: updateTocClauses,
        detached: updateTocClauses,
      });
    })();
  </script>
</polymer-element>


text:
<?php
/*
 *	Made by Partydragen
 *  http://partydragen.com/
 *
 *  License: MIT
 */

// Initialise the members addon
// We've already checked to see if it's enabled

require('addons/Members/language.php');

// Enabled, add links to navbar
$navbar_array[] = array('members' => $members_language['members']);


text:
package br.ufrn.apoo.garbagego.domain;

import java.util.LinkedList;
import java.util.Queue;

public class Rota {
	private Queue<String> listaDasRuas;

	public Rota() {
		this.listaDasRuas = new LinkedList<>();
	}

	public Queue<String> getListaDasRuas() {
		return listaDasRuas;
	}

	public void setListaDasRuas(Queue<String> listaDasRuas) {
		this.listaDasRuas = listaDasRuas;
	}
}


text:
package com.android.selendroid;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebDriver;

import io.selendroid.common.SelendroidCapabilities;

public class UiSelendroidClient {
	private String sn = "";
	private int port = 0;
	private String app = "";
	private WebDriver driver = null;

	public UiSelendroidClient(String app, String sn, int port){
		this.sn = sn;
		this.port = port;
		this.app = app;
	}

	//"com.eg.android.AlipayGphoneRC:8.6.0.032901"
	//"com.eg.android.AlipayGphone.AlipayLogin"
	public boolean setup(String serial, String pkgName, String actName, String version) throws Exception{
		SelendroidCapabilities capa = new SelendroidCapabilities(pkgName+":"+version);
		capa.setLaunchActivity(actName);
		capa.setSerial(serial);
		driver = new RemoteWebDriver(capa);
		return true;
	}

	public void switchTo(String content) {
		this.driver.switchTo().window(content);
	}

	public String getPageSource() {
		return this.driver.getPageSource();
	}

	public WebElement findElement(String xPath) {
		System.out.println("xpath:" + xPath);
		return this.driver.findElement(By.xpath(xPath));
	}

	public boolean sendKeys(String xPath, String str) {
		WebElement element3 = this.driver.findElement(By.xpath(xPath));
		element3.sendKeys(str);
		return true;
	}

	public void quit() {
		if(this.driver != null)
			this.driver.quit();
	}
}


text:
"""
===============================================================================

The code for all get methods

===============================================================================

"""
from numpy import dot
from pydlm.core._dlm import _dlm

class _dlmGet(_dlm):
    """ The class containing all get methods for dlm class.

    Methods:
        _getComponent: get the component if it is in dlm
        _getLatentState: get the latent state for a given component
        _getLatentCov: get the latent covariance for a given component
        _getComponentMean: get the mean of a given component
        _getComponentVar: get the variance of a given component
    """

    # function to get the corresponding latent state
    def _getLatentState(self, name, filterType, start, end):
        """ Get the latent states of a given component.

        Args:
            name: the name of the component.
            filterType: the type of the latent states to be returned.
                        could be "forwardFilter", "backwardSmoother" or
                        "predict".
            start: the start date for the latent states to be returned.
            end: the end date to be returned.

        Returns:
            A list of latent states.
        """
        end += 1
        indx = self.builder.componentIndex[name]
        patten = lambda x: x if x is None else x[indx[0]:(indx[1] + 1), 0]

        if filterType == 'forwardFilter':
            return list(map(patten, self.result.filteredState[start:end]))
        elif filterType == 'backwardSmoother':
            return list(map(patten, self.result.smoothedState[start:end]))
        elif filterType == 'predict':
            return list(map(patten, self.result.predictedState[start:end]))
        else:
            raise NameError('Incorrect filter type')

    # function to get the corresponding latent covariance
    def _getLatentCov(self, name, filterType, start, end):
        """ Get the latent covariance of a given component.

        Args:
            name: the name of the component.
            filterType: the type of the latent covariance to be returned.
                        could be "forwardFilter", "backwardSmoother" or
                        "predict".
            start: the start date for the latent covariance to be returned.
            end: the end date to be returned.

        Returns:
            A list of latent covariance.
        """
        end += 1
        indx = self.builder.componentIndex[name]
        patten = lambda x: x if x is None \
                 else x[indx[0]:(indx[1] + 1), indx[0]:(indx[1] + 1)]

        if filterType == 'forwardFilter':
            return list(map(patten, self.result.filteredCov[start:end]))
        elif filterType == 'backwardSmoother':
            return list(map(patten, self.result.smoothedCov[start:end]))
        elif filterType == 'predict':
            return list(map(patten, self.result.predictedCov[start:end]))
        else:
            raise NameError('Incorrect filter type')

    # function to get the component mean
    def _getComponentMean(self, name, filterType, start, end):
        """ Get the mean of a given component.

        Args:
            name: the name of the component.
            filterType: the type of the mean to be returned.
                        could be "forwardFilter", "backwardSmoother" or
                        "predict".
            start: the start date for the mean to be returned.
            end: the end date to be returned.

        Returns:
            A list of mean.
        """
        end += 1
        comp = self._fetchComponent(name)
        componentState = self._getLatentState(name=name,
                                              filterType=filterType,
                                              start=start, end=end)
        result = []
        for k, i in enumerate(range(start, end)):
            if name in self.builder.dynamicComponents:
                comp.updateEvaluation(i)
            elif name in self.builder.automaticComponents:
                comp.updateEvaluation(i, self.padded_data)
            result.append(dot(comp.evaluation,
                              componentState[k]).tolist()[0][0])
        return result

    # function to get the component variance
    def _getComponentVar(self, name, filterType, start, end):
        """ Get the variance of a given component.

        Args:
            name: the name of the component.
            filterType: the type of the variance to be returned.
                        could be "forwardFilter", "backwardSmoother" or
                        "predict".
            start: the start date for the variance to be returned.
            end: the end date to be returned.

        Returns:
            A list of variance.
        """
        end += 1
        comp = self._fetchComponent(name)
        componentCov = self._getLatentCov(name=name,
                                          filterType=filterType,
                                          start=start, end=end)
        result = []
        for k, i in enumerate(range(start, end)):
            if name in self.builder.dynamicComponents:
                comp.updateEvaluation(i)
            elif name in self.builder.automaticComponents:
                comp.updateEvaluation(i, self.padded_data)
            result.append(dot(
                dot(comp.evaluation,
                    componentCov[k]), comp.evaluation.T).tolist()[0][0])
        return result


text:
package de.uniulm.omi.cloudiator.visor.sensors;

import com.sun.management.OperatingSystemMXBean;
import de.uniulm.omi.cloudiator.visor.monitoring.*;

import java.lang.management.ManagementFactory;

/**
 * A probe for measuring the CPU usage in % on the given machine.
 */
public class CpuUsageSensor extends AbstractSensor {

    private OperatingSystemMXBean osBean;

    @Override protected Measurement getMeasurement(MonitorContext monitorContext)
        throws MeasurementNotAvailableException {

        double systemCpuLoad = osBean.getSystemCpuLoad();
        double systemCpuLoadPercentage = systemCpuLoad * 100;

        if (systemCpuLoad < 0) {
            throw new MeasurementNotAvailableException("Received negative value");
        }

        return new MeasurementImpl(System.currentTimeMillis(), systemCpuLoadPercentage);
    }

    @Override protected void initialize() throws SensorInitializationException {
        super.initialize();
        osBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class);
    }
}


text:
<ion-navbar *navbar>
  <ion-title>
    Add item
  </ion-title>
 <ion-buttons end>
  <button (click)="saveItem()">
    <ion-icon name="checkmark"></ion-icon>
    </button>
  </ion-buttons>
</ion-navbar>

<ion-content>
  <ion-list>
    <ion-input stacked-label>
      <ion-label>Title</ion-label>
      <input type="text" [(ngModel)]="newItem.title">
    </ion-input>
    <ion-input stacked-label>
      <ion-label>Description</ion-label>
      <textarea [(ngModel)]="newItem.description"></textarea>
    </ion-input>
  </ion-list>
</ion-content>


text:
#include "stack.h"

/* Initializes a stack */
int initStack(Stack *stack, void (*destroy) (void *data)) {
	if (stack == NULL) {
		errno = EINVAL;
		return -1;
	}

	stack->size = 0;
	stack->head = NULL;
	stack->destroy = destroy;

	return 0;
}

/* Adds a StackElement to the top of the stack */
int push(Stack *stack, void *data) {
	if (stack == NULL || data == NULL) {
		errno = EINVAL;
		return -1;
	}

	/* Creates the new top element */
	StackElement *newElmnt = (StackElement *) malloc(sizeof(StackElement));
	if (newElmnt == NULL) {
		errno = ENOMEM;
		return -2;
	}

	newElmnt->data = data;
	newElmnt->next = stack->head;
	stack->head = newElmnt;

	stack->size++;

	return 0;
}

/* Removes a StackElement from the top of the stack */
int pop(Stack *stack, void **data) {
	if (stack == NULL || stack->size == 0) {
		errno = EINVAL;
		return -1;
	}

	StackElement *rem = stack->head;
	stack->head = rem->next;

	*data = rem->data;
	free(rem);

	stack->size--;

	return 0;
}

/* Destroys the stack
 *	Attention: If you use MemPool then after destroyStack you must call freeMemory()
 */
void destroyStack(Stack *stack) {
	if (stack == NULL) {
		errno = EINVAL;
		return;
	}

	void *data;

	while (stack->size > 0) {
		if ( pop(stack, &data) == 0 && stack->destroy != NULL)
			stack->destroy(data);
	}

	memset(stack, 0, sizeof(stack));
}


text:
#include "client.h"

#include <event2/event.h>
#include <event2/buffer.h>
#include <event2/bufferevent.h>
#include <event2/listener.h>

#include "ed2k_proto.h"
#include "server.h"
#include "packet.h"
#include "log.h"
#include "db.h"

struct shared_file_entry {
    /* key */
    unsigned char hash[ED2K_HASH_SIZE];
    /* makes this structure hashable */
    UT_hash_handle hh;
};

static uint32_t get_next_lowid(void)
{
    uint32_t old_id, new_id;

    do {
        old_id = atomic_load(&g_srv.lowid_counter);
        new_id = old_id + 1;
        if (new_id > MAX_LOWID)
            new_id = 1;
    } while (!atomic_compare_exchange_strong(&g_srv.lowid_counter, &old_id, new_id));

    return new_id;
}

struct client *client_new(void)
{
    struct client *clnt = (struct client *) calloc(1, sizeof(*clnt));

    if (atomic_fetch_add(&g_srv.user_count, 1) + 1 >= g_srv.cfg->max_clients) {
        evconnlistener_disable(g_srv.tcp_listener);
    }

    token_bucket_init(&clnt->limit_offer, g_srv.cfg->max_offers_limit);
    token_bucket_init(&clnt->limit_search, g_srv.cfg->max_searches_limit);

    return clnt;
}

void client_delete(struct client *clnt)
{
    uint32_t old_val = 0;

    if (atomic_compare_exchange_strong(&clnt->deleted, &old_val, 1)) {
        // disable all events
        if (clnt->bev)
            bufferevent_disable(clnt->bev, EV_READ | EV_WRITE);
        if (clnt->bev_pc)
            bufferevent_disable(clnt->bev_pc, EV_READ | EV_WRITE);
        if (clnt->evtimer_status_notify)
            event_del(clnt->evtimer_status_notify);
        if (clnt->evtimer_portcheck)
            event_del(clnt->evtimer_portcheck);

        // delete all events
        if (clnt->evtimer_status_notify) {
            event_free(clnt->evtimer_status_notify);
            clnt->evtimer_status_notify = NULL;
        }
        if (clnt->evtimer_portcheck) {
            event_free(clnt->evtimer_portcheck);
            clnt->evtimer_portcheck = NULL;
        }
        if (clnt->bev_pc) {
            bufferevent_free(clnt->bev_pc);
            clnt->bev_pc = NULL;
        }
        if (clnt->bev) {
            bufferevent_free(clnt->bev);
            clnt->bev = NULL;
        }

        ED2KD_LOGDBG("client removed (%s:%d)", clnt->dbg.ip_str, clnt->port);

        if (clnt->file_count) {
            db_remove_source(clnt);
            atomic_fetch_sub(&g_srv.file_count, clnt->file_count);
            clnt->file_count = 0;
        }

        struct shared_file_entry *she, *she_tmp;
        HASH_ITER(hh, clnt->shared_files, she, she_tmp) {
            HASH_DEL(clnt->shared_files, she);
            free(she);
        }

        if (atomic_fetch_sub(&g_srv.user_count, 1) - 1 < g_srv.cfg->max_clients) {
            evconnlistener_enable(g_srv.tcp_listener);
        }
    }

    if (0 == atomic_load(&clnt->ref_cnt)) {
        free(clnt);
    }
}

void client_search_files(struct client *clnt, struct search_node *search_tree)
{
    size_t count = MAX_SEARCH_FILES;
    struct evbuffer *buf = evbuffer_new();
    struct packet_search_result data;

    data.hdr.proto = PROTO_EDONKEY;
    //data.length = 0;
    data.opcode = OP_SEARCHRESULT;
    //data.files_count = 0;
    evbuffer_add(buf, &data, sizeof(data));

    if (db_search_files(search_tree, buf, &count)) {
        struct packet_search_result *ph = (struct packet_search_result *) evbuffer_pullup(buf, sizeof(*ph));
        ph->hdr.length = evbuffer_get_length(buf) - sizeof(ph->hdr);
        ph->files_count = count;

        bufferevent_write_buffer(clnt->bev, buf);
    }

    evbuffer_free(buf);
}

void client_get_sources(struct client *clnt, const unsigned char *hash)
{
    struct file_source sources[MAX_FOUND_SOURCES];
    uint8_t src_count = ARRAY_SIZE(sources);

    if (db_get_sources(hash, sources, &src_count))
        send_found_sources(clnt->bev, hash, sources, src_count);
}

void client_portcheck_start(struct client *clnt)
{
    struct sockaddr_in client_sa;

    memset(&client_sa, 0, sizeof(client_sa));
    client_sa.sin_family = AF_INET;
    client_sa.sin_addr.s_addr = clnt->ip;
    client_sa.sin_port = htons(clnt->port);

    clnt->bev_pc = bufferevent_socket_new(g_srv.evbase_tcp, -1, BEV_OPT_CLOSE_ON_FREE | BEV_OPT_THREADSAFE);
    bufferevent_setcb(clnt->bev_pc, portcheck_read_cb, NULL, portcheck_event_cb, clnt);

    if (bufferevent_socket_connect(clnt->bev_pc, (struct sockaddr *) &client_sa, sizeof(client_sa)) < 0) {
        bufferevent_free(clnt->bev_pc);
        clnt->bev_pc = NULL;
        client_portcheck_finish(clnt, PORTCHECK_FAILED);
    } else {
        clnt->evtimer_portcheck = evtimer_new(g_srv.evbase_tcp, portcheck_timeout_cb, clnt);
        evtimer_add(clnt->evtimer_portcheck, g_srv.portcheck_timeout_tv);
    }
}

void client_portcheck_finish(struct client *clnt, enum portcheck_result result)
{
    if (clnt->bev_pc) {
        bufferevent_free(clnt->bev_pc);
        clnt->bev_pc = NULL;
    }
    if (clnt->evtimer_portcheck) {
        event_free(clnt->evtimer_portcheck);
        clnt->evtimer_portcheck = NULL;
    }
    clnt->portcheck_finished = 1;
    clnt->lowid = (PORTCHECK_SUCCESS != result);

    if (clnt->lowid) {
        static const char msg[] = "WARNING: You have a lowid. Please review your network config and/or your settings.";
        send_server_message(clnt->bev, msg, sizeof(msg) - 1);
        ED2KD_LOGDBG("port check failed (%s:%d)", clnt->dbg.ip_str, clnt->port);
    }

    if (clnt->lowid) {
        if (g_srv.cfg->allow_lowid) {
            clnt->id = get_next_lowid();
            clnt->port = 0;
        } else {
            client_delete(clnt);
            return;
        }
    } else {
        clnt->id = clnt->ip;
    }

    send_id_change(clnt->bev, clnt->id);

    clnt->evtimer_status_notify = evtimer_new(g_srv.evbase_tcp, server_status_notify_cb, clnt);
    event_add(clnt->evtimer_status_notify, g_srv.status_notify_tv);
}

void client_share_files(struct client *clnt, struct pub_file *files, size_t count)
{
    size_t i, real_count = 0;
    struct pub_file *f = files;

    if (clnt->file_count > g_srv.cfg->max_files_per_client) {
        static const char msg[] = "WARNING: You reached shared files limit";
        send_server_message(clnt->bev, msg, sizeof(msg) - 1);
        return;
    }

    if (atomic_load(&g_srv.file_count) > g_srv.cfg->max_files) {
        static const char msg[] = "WARNING: Server reached shared files limit";
        send_server_message(clnt->bev, msg, sizeof(msg) - 1);
        return;
    }

    for (i = 0; i < count; ++i) {
        struct shared_file_entry *she = NULL;
        HASH_FIND(hh, clnt->shared_files, f->hash, sizeof(f->hash), she);
        if (!she) {
            she = (struct shared_file_entry *) malloc(sizeof(*she));
            memcpy(she->hash, f->hash, sizeof(she->hash));
            HASH_ADD(hh, clnt->shared_files, hash, sizeof(she->hash), she);
            real_count++;
        } else {
            /* mark as invalid */
            f->name_len = 0;
        }

        f++;
    }

    if (db_share_files(files, count, clnt)) {
        ED2KD_LOGDBG("client %u: published %u files, %u duplicates", clnt->id, count, count - real_count);
        clnt->file_count += real_count;
        atomic_fetch_add(&g_srv.file_count, real_count);
    }
}


text:
#include <gl/openglshader.h>
#include <gl/GLSLHelper.h>

using namespace motorcar;

//OpenGLShader::OpenGLShader(std::string &vertexShader, std::string &fragmentShader)
//{
//    compileShaderFromStrings(vertexShader, fragmentShader);
//}

//static const char* shader_path = MOTORCAR_SHADER_PATH;
#define STRINGIZE(x) #x
#define STRINGIZE_VALUE_OF(x) STRINGIZE(x)

OpenGLShader::OpenGLShader(std::string vertexShaderFileName, std::string fragmentShaderFileName)
{
    std::string shaderDirPath = STRINGIZE_VALUE_OF(MOTORCAR_SHADER_PATH);
    shaderDirPath += "/";
    std::cout << "shader path: " << STRINGIZE_VALUE_OF(MOTORCAR_SHADER_PATH) << std::endl;
    std::ifstream vertexShaderStream(shaderDirPath + vertexShaderFileName), fragmentShaderStream(shaderDirPath + fragmentShaderFileName) ;
    std::string vertexShader, fragmentShader;

    //intitialize
    vertexShaderStream.seekg(0, std::ios::end);
    vertexShader.reserve(vertexShaderStream.tellg());
    vertexShaderStream.seekg(0, std::ios::beg);

    fragmentShaderStream.seekg(0, std::ios::end);
    fragmentShader.reserve(fragmentShaderStream.tellg());
    fragmentShaderStream.seekg(0, std::ios::beg);

    vertexShader.assign((std::istreambuf_iterator<char>(vertexShaderStream)),
                     std::istreambuf_iterator<char>());

    fragmentShader.assign((std::istreambuf_iterator<char>(fragmentShaderStream)),
                     std::istreambuf_iterator<char>());

    //std::cout << vertexShader << std::endl << fragmentShader << std::endl;

    vertexShaderStream.close();
    fragmentShaderStream.close();

    m_handle = compileShaderFromStrings(vertexShader, fragmentShader);

}

GLuint OpenGLShader::handle() const
{
    return m_handle;
}

GLuint OpenGLShader::compileShaderFromStrings(std::string &vertexShader, std::string &fragmentShader)
{
    GLuint VS; //handles to vert shader object
    GLuint FS; //handles to frag shader object
    GLint vCompiled, fCompiled, linked; //status of shader

    //create a program object and attach the compiled shader
    m_handle = glCreateProgram();

    if(vertexShader.length() > 0){

        VS = glCreateShader(GL_VERTEX_SHADER);
        const char *vs_c_str = vertexShader.c_str();
        glShaderSource(VS, 1, &vs_c_str, NULL);
        //compile shader and print log
        glCompileShader(VS);
        /* check shader status requires helper functions */
        printOpenGLError();
        glGetShaderiv(VS, GL_COMPILE_STATUS, &vCompiled);
        printShaderInfoLog(VS);

        if (!vCompiled) {
                std::cerr << "Error compiling vertex shader:\n" << std::endl;
                return 0;
        }
        glAttachShader(m_handle, VS);
    }

    if(fragmentShader.length() > 0){

        FS = glCreateShader(GL_FRAGMENT_SHADER);
        const char *fs_c_str = fragmentShader.c_str();
        glShaderSource(FS, 1, &fs_c_str, NULL);
        //compile shader and print log
        glCompileShader(FS);
        /* check shader status requires helper functions */
        printOpenGLError();
        glGetShaderiv(FS, GL_COMPILE_STATUS, &fCompiled);
        printShaderInfoLog(FS);

        if (!fCompiled) {
                std::cerr << "Error compiling fragment shader:\n" << std::endl;
                return 0;
        }
        glAttachShader(m_handle, FS);

    }

    glLinkProgram(m_handle);
    /* check shader status requires helper functions */
    printOpenGLError();
    glGetProgramiv(m_handle, GL_LINK_STATUS, &linked);
    if (!linked) {
      std::cerr << "Error linking shader: " << m_handle << "\n" << std::endl;
      return 0;
    }

    //printProgramInfoLog(m_handle);

    return m_handle;
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Univer.WorkflowLight.Definition;
using Univer.WorkflowLight.Execution;

namespace Univer.WorkflowLight.UnitTest.Restart
{
    public class SimpleWorkflowDefinition : WorkflowDefinition
    {
        [WorkflowTransition("Start", ToState = typeof(SimpleWorkingState), Type = WorkflowTransitionType.FromStart)]
        public static void StartWorking(ProcessInstance processInstance)
        {
        }

        [WorkflowTransition("Stop", FromState = typeof(SimpleWorkingState), Type = WorkflowTransitionType.ToCompleted)]
        public static void StopWorking(ProcessInstance processInstance)
        {
        }

        [WorkflowTransition("Restart", FromState = typeof(WorkflowCompletedState), ToState = typeof(SimpleWorkingState))]
        public static void RestartWorking(ProcessInstance processInstance)
        {
        }
    }
}


text:
from __future__ import unicode_literals
import urlparse

from scrapy import Spider
from scrapy import Request
from scrapy.selector import Selector

from tiki_article_scraper.items import Article

class ArticleSpider(Spider):
    name = "articles"

    # To be flexible and somewhat reusable, we'll pass the url prefix
    # (domain, etc., preceding the tiki article index) in a spider argument
    # instead of hard coding allowed_domains and start_urls.
    def __init__(self, url_prefix=None, *args, **kwargs):
        super(ArticleSpider, self).__init__(*args, **kwargs)
        self.start_urls = ["%s/tiki-view_articles.php" % url_prefix,]

        prefix_componets = urlparse.urlparse(url_prefix)
        self.allowed_domains = [prefix_componets.hostname,]

    def parse(self, response):
        """Crawl article index pages.

        From the index page, for each article extract it's topic first
        because in this old version, there is no text information about the
        topic in the article page.  On index pages, it's contained in the alt
        attribute of article/topic image, but alt is empty on the article page.

        After that, follow the "Read more" link and get the other article
        fields.

        """
        for i, a in enumerate(response.xpath(
                "//div[@class='articletrailer']/descendant::a[@class='trailer'][1]/@href")):
            article = Article()

            # If the image is not the default topic image, it will not have
            # an appropriate selector, so we use it's div.
            article["category"] = response.xpath(
                    "//div[@class='articleheading']/descendant::img/@alt").extract()[i]

            article_url = response.urljoin(a.extract())
            request = Request(article_url, callback=self.parse_article)
            request.meta["article"] = article

            yield request

    def parse_article(self, response):
        article = response.meta["article"]

        # We'll be using a regex for pub_time so we can't use selector
        # response shortcuts.
        sel = Selector(response=response)

        # TW adds a newline at the beginning of the title, so strip the string.
        article["title"] = sel.xpath(
                "//span[@class='titlea']/text()").extract_first().strip()

        # Publication date and time is grouped in a span together with the
        # number of times the article was accessed.  Therefore, use a regex to
        # extract just the date and time.  Matches eg.:
        # "04. July 2015. [17:16:00 UTC]"
        article["pub_time"] = sel.re(r"\d{2}\. \w+ \d{4}\. \[\d{2}:\d{2}:\d{2} UTC\]")[0]

        article["body"] = sel.xpath("//div[@class='articlebody']").extract_first()

        yield article


text:
package cfg

import (
	"bytes"
	"fmt"
	"strings"
	"text/template"

	cliPath "github.com/kelda/kelda/cli/path"
	"github.com/kelda/kelda/db"
	"github.com/kelda/kelda/version"

	log "github.com/sirupsen/logrus"
)

// Allow mocking out for the unit tests.
var image = version.Image

// Ubuntu generates a cloud config file for the Ubuntu operating system with the
// corresponding `version`.
func Ubuntu(m db.Machine, inboundPublic string) string {
	t := template.Must(template.New("cloudConfig").Parse(cfgTemplate))

	var cloudConfigBytes bytes.Buffer
	err := t.Execute(&cloudConfigBytes, struct {
		KeldaImage string
		SSHKeys    string
		LogLevel   string
		MinionOpts string
		KeldaHome  string
	}{
		KeldaImage: image,
		SSHKeys:    strings.Join(m.SSHKeys, "\n"),
		LogLevel:   log.GetLevel().String(),
		MinionOpts: minionOptions(m.Role, inboundPublic),
		KeldaHome:  cliPath.MinionHome,
	})
	if err != nil {
		panic(err)
	}

	return cloudConfigBytes.String()
}

func minionOptions(role db.Role, inboundPublic string) string {
	options := fmt.Sprintf("--role %q", role)

	if inboundPublic != "" {
		options += fmt.Sprintf(" --inbound-pub-intf %q", inboundPublic)
	}
	return options
}


text:
namespace DriverSolutions.ModuleFinance
{
    partial class XF_InvoicesSelector
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
            this.CompanyID = new DevExpress.XtraEditors.CheckedComboBoxEdit();
            this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
            this.LocationID = new DevExpress.XtraEditors.CheckedComboBoxEdit();
            this.DateFrom = new DevExpress.XtraEditors.DateEdit();
            this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
            this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
            this.DateTo = new DevExpress.XtraEditors.DateEdit();
            this.btnCancel = new DevExpress.XtraEditors.SimpleButton();
            this.btnOK = new DevExpress.XtraEditors.SimpleButton();
            ((System.ComponentModel.ISupportInitialize)(this.CompanyID.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.LocationID.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.DateFrom.Properties.CalendarTimeProperties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.DateFrom.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.DateTo.Properties.CalendarTimeProperties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.DateTo.Properties)).BeginInit();
            this.SuspendLayout();
            //
            // labelControl1
            //
            this.labelControl1.Location = new System.Drawing.Point(12, 12);
            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new System.Drawing.Size(56, 13);
            this.labelControl1.TabIndex = 0;
            this.labelControl1.Text = "Companies:";
            //
            // CompanyID
            //
            this.CompanyID.Location = new System.Drawing.Point(77, 9);
            this.CompanyID.Name = "CompanyID";
            this.CompanyID.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.CompanyID.Properties.DisplayMember = "Display";
            this.CompanyID.Properties.ValueMember = "Value";
            this.CompanyID.Size = new System.Drawing.Size(189, 20);
            this.CompanyID.TabIndex = 1;
            //
            // labelControl2
            //
            this.labelControl2.Location = new System.Drawing.Point(12, 38);
            this.labelControl2.Name = "labelControl2";
            this.labelControl2.Size = new System.Drawing.Size(49, 13);
            this.labelControl2.TabIndex = 2;
            this.labelControl2.Text = "Locations:";
            //
            // LocationID
            //
            this.LocationID.Location = new System.Drawing.Point(77, 35);
            this.LocationID.Name = "LocationID";
            this.LocationID.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.LocationID.Properties.DisplayMember = "Display";
            this.LocationID.Properties.ValueMember = "Value";
            this.LocationID.Size = new System.Drawing.Size(189, 20);
            this.LocationID.TabIndex = 3;
            //
            // DateFrom
            //
            this.DateFrom.EditValue = null;
            this.DateFrom.Location = new System.Drawing.Point(77, 61);
            this.DateFrom.Name = "DateFrom";
            this.DateFrom.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.DateFrom.Properties.CalendarTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.DateFrom.Size = new System.Drawing.Size(189, 20);
            this.DateFrom.TabIndex = 4;
            //
            // labelControl3
            //
            this.labelControl3.Location = new System.Drawing.Point(12, 64);
            this.labelControl3.Name = "labelControl3";
            this.labelControl3.Size = new System.Drawing.Size(59, 13);
            this.labelControl3.TabIndex = 5;
            this.labelControl3.Text = "Period from:";
            //
            // labelControl4
            //
            this.labelControl4.Location = new System.Drawing.Point(12, 90);
            this.labelControl4.Name = "labelControl4";
            this.labelControl4.Size = new System.Drawing.Size(47, 13);
            this.labelControl4.TabIndex = 6;
            this.labelControl4.Text = "Period to:";
            //
            // DateTo
            //
            this.DateTo.EditValue = null;
            this.DateTo.Location = new System.Drawing.Point(77, 87);
            this.DateTo.Name = "DateTo";
            this.DateTo.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.DateTo.Properties.CalendarTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.DateTo.Size = new System.Drawing.Size(189, 20);
            this.DateTo.TabIndex = 7;
            //
            // btnCancel
            //
            this.btnCancel.Location = new System.Drawing.Point(154, 113);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new System.Drawing.Size(112, 45);
            this.btnCancel.TabIndex = 8;
            this.btnCancel.Text = "Cancel";
            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
            //
            // btnOK
            //
            this.btnOK.Location = new System.Drawing.Point(12, 113);
            this.btnOK.Name = "btnOK";
            this.btnOK.Size = new System.Drawing.Size(112, 45);
            this.btnOK.TabIndex = 9;
            this.btnOK.Text = "OK";
            this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
            //
            // XF_InvoicesSelector
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(277, 174);
            this.Controls.Add(this.btnOK);
            this.Controls.Add(this.btnCancel);
            this.Controls.Add(this.DateTo);
            this.Controls.Add(this.labelControl4);
            this.Controls.Add(this.labelControl3);
            this.Controls.Add(this.DateFrom);
            this.Controls.Add(this.LocationID);
            this.Controls.Add(this.labelControl2);
            this.Controls.Add(this.CompanyID);
            this.Controls.Add(this.labelControl1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
            this.Name = "XF_InvoicesSelector";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Invoice parameters";
            ((System.ComponentModel.ISupportInitialize)(this.CompanyID.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.LocationID.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.DateFrom.Properties.CalendarTimeProperties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.DateFrom.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.DateTo.Properties.CalendarTimeProperties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.DateTo.Properties)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private DevExpress.XtraEditors.LabelControl labelControl1;
        private DevExpress.XtraEditors.CheckedComboBoxEdit CompanyID;
        private DevExpress.XtraEditors.LabelControl labelControl2;
        private DevExpress.XtraEditors.CheckedComboBoxEdit LocationID;
        private DevExpress.XtraEditors.DateEdit DateFrom;
        private DevExpress.XtraEditors.LabelControl labelControl3;
        private DevExpress.XtraEditors.LabelControl labelControl4;
        private DevExpress.XtraEditors.DateEdit DateTo;
        private DevExpress.XtraEditors.SimpleButton btnCancel;
        private DevExpress.XtraEditors.SimpleButton btnOK;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:background="?attr/colorPrimary"
    android:id="@+id/toolbar"
    android:layout_height="?attr/actionBarSize"
    android:layout_width="match_parent"
    app:layout_scrollFlags="scroll|enterAlways"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

    <TextView
        android:layout_gravity="center"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="@string/nus_bus"
        android:textColor="@android:color/white"
        android:textSize="18sp"
        android:textStyle="bold" />
</android.support.v7.widget.Toolbar>


text:
using System;
using System.Diagnostics;

namespace Microsoft.CodeAnalysis
{
    internal static class ReflectionTypeExtensions
    {
        // Replaces a missing 4.5 method.
        internal static Type GetTypeInfo(this Type type)
        {
            return type;
        }
    }

    /// <summary>
    /// Required by <see cref="SymbolDisplayPartKind"/>.
    /// </summary>
    internal static class IErrorTypeSymbol
    {
    }

    /// <summary>
    /// Required by <see cref="Microsoft.CodeAnalysis.FailFast"/>
    /// </summary>
    internal static class Environment
    {
        public static void FailFast(string message)
        {
            System.Environment.FailFast(message);
        }

        public static void FailFast(string message, Exception exception)
        {
            System.Environment.FailFast(exception.ToString());
        }

        public static string NewLine { get { return System.Environment.NewLine; } }
    }
}

namespace System.Runtime.CompilerServices
{
    [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
    // To allow this dll to use extension methods even though we are targeting CLR v2, re-define ExtensionAttribute
    internal class ExtensionAttribute : Attribute
    {
    }

    /// <summary>
    /// This satisfies a cref on <see cref="Microsoft.CodeAnalysis.WellKnownMemberNames"/>.
    /// </summary>
    internal interface INotifyCompletion
    {
        void OnCompleted();
    }
}

namespace System.Text
{
    internal static class StringBuilderExtensions
    {
        public static void Clear(this StringBuilder builder)
        {
            builder.Length = 0; // Matches the real definition.
        }
    }
}


text:
/**
 * @module baseDate
 */
import { Calendar } from '../calendar';

const pad = function (num: number, size: number): string {
  const s = `000000000${num}`;
  return s.substr(s.length - size);
};

export interface Naksatra {
  readonly saka: string;
  readonly enMalayalam: string;
  readonly mlMalayalam: string;
}

export interface MasaName {
  readonly saka: string;
  readonly saura: string;
  readonly enMalayalam: string;
  readonly mlMalayalam: string;
}

interface MasaNameList {
  [key: number]: MasaName;
}

const masaNames: MasaNameList = {
  [0]  : { saka : 'Caitra    ', saura : 'Mesa      ', enMalayalam : 'Chingam   ', mlMalayalam : 'ചിങ്ങം' },
  [1]  : { saka : 'Vaisakha  ', saura : 'Vrsa      ', enMalayalam : 'Kanni     ', mlMalayalam : 'കന്നി' },
  [2]  : { saka : 'Jyaistha  ', saura : 'Mithuna   ', enMalayalam : 'Thulam    ', mlMalayalam : 'തുലാം' },
  [3]  : { saka : 'Asadha    ', saura : 'Karkata   ', enMalayalam : 'Vrischikam', mlMalayalam : 'വൃശ്ചികം' },
  [4]  : { saka : 'Sravana   ', saura : 'Simha     ', enMalayalam : 'Dhanu     ', mlMalayalam : 'ധനു' },
  [5]  : { saka : 'Bhadrapada', saura : 'Kanya     ', enMalayalam : 'Makaram   ', mlMalayalam : 'മകരം' },
  [6]  : { saka : 'Asvina    ', saura : 'Tula      ', enMalayalam : 'Kumbham   ', mlMalayalam : 'കുംഭം' },
  [7]  : { saka : 'Karttika  ', saura : 'Vrscika   ', enMalayalam : 'Meenam    ', mlMalayalam : 'മീനം' },
  [8]  : { saka : 'Margasirsa', saura : 'Dhanus    ', enMalayalam : 'Medam     ', mlMalayalam : 'മേടം' },
  [9]  : { saka : 'Pausa     ', saura : 'Makara    ', enMalayalam : 'Idavam    ', mlMalayalam : 'ഇടവം' },
  [10] : { saka : 'Magha     ', saura : 'Kumbha    ', enMalayalam : 'Mithunam  ', mlMalayalam : 'മിഥുനം' },
  [11] : { saka : 'Phalguna  ', saura : 'Mina      ', enMalayalam : 'Karkitakam', mlMalayalam : 'കർക്കടകം' }
};

/**
 * Serves as the base class for both the {@link JulianDate} and
 * {@link KollavarshamDate} classes.
 *
 *  **INTERNAL/PRIVATE**
 *
 * @class BaseDate
 * @constructor
 * @param year {Number}
 * @param month {Number}
 * @param day {Number}
 */
export abstract class BaseDate {

  /**
   * The year corresponding to this instance of the date.
   *
   * @property year
   * @type {Number}
   */
  year: number;

  /**
   * The month corresponding to this instance of the date.
   *
   * @property month
   * @type {Number}
   */
  month: number;

  /**
   * The date corresponding to this instance of the date.
   *
   * @property date
   * @type {Number}
   */
  date: number;

  /**
   * The gregorian date corresponding to this instance of the date. **Set separately after an instance is created**
   *
   * @property gregorianDate
   * @type {Date}
   */
  gregorianDate: Date;

  /**
   * The `Julian Day` corresponding to this instance of the date. **Set separately after an instance is created**
   * Julian day is the continuous count of days since the beginning of the Julian Period used primarily by astronomers.
   *
   * _Source_: https://en.wikipedia.org/wiki/Julian_day
   *
   * @property julianDay
   * @type {Number}
   */
  julianDay: number;

  /**
   * The `Ahargana` corresponding to this instance of the date. **Set separately after an instance is created**
   *
   * In Sanskrit `ahoratra` means one full day and `gana` means count.
   * Hence, the Ahargana on any given day stands for the number of lunar days that have elapsed starting from an epoch.
   *
   * _Source_: http://cs.annauniv.edu/insight/Reading%20Materials/astro/sharptime/ahargana.htm
   *
   * @property ahargana
   * @type {Number}
   */
  ahargana: number;

  /**
   * The `Saura Masa` (Solar Calendar Month) for this instance of the date. **Set separately after an instance is created**
   *
   * @property sauraMasa
   * @type {Number}
   */
  sauraMasa: number;

  /**
   * The `Saura Divasa` (Solar Calendar Day) for this instance of the date. **Set separately after an instance is created**
   *
   * @property sauraDivasa
   * @type {Number}
   */
  sauraDivasa: number;

  /**
   * The `Naksatra` (Star) for this instance of the date. **Set separately after an instance is created**
   *
   * @property naksatra
   * @type { { saka: String, enMalayalam: string, mlMalayalam: string } }
   */
  private _naksatra: Naksatra = Calendar.naksatras[-1];

  protected constructor(year = 0, month = 0, date = 0) {
    this.year = year;
    this.month = month;
    this.date = date;
    this.gregorianDate = new Date();
    this.julianDay = -1;
    this.ahargana = -1;
    this.sauraMasa = -1;
    this.sauraDivasa = -1;
  }

  get naksatra(): Naksatra {
    return this._naksatra; // eslint-disable-line no-underscore-dangle
  }

  set naksatra(val: Naksatra) {
    this._naksatra = val; // eslint-disable-line no-underscore-dangle
  }

  /**
   * Returns the Saura Masa name for the current instance of date.
   *
   * @property sauraMasaName
   * @type {string}
   */
  get sauraMasaName(): string {
    return BaseDate.getMasaName(this.sauraMasa).saura;
  }

  /**
   * Returns the weekday (in English) for the current instance of date.
   *
   * @property weekdayName
   * @type {string}
   */
  get weekdayName(): string {
    return Calendar.julianDayToWeekday(this.julianDay).en;
  }

  /**
   * Returns the weekday (in Malayalam) for the current instance of date.
   *
   * @property mlWeekdayName
   * @type {string}
   */
  get mlWeekdayName(): string {
    return Calendar.julianDayToWeekday(this.julianDay).ml;
  }

  /**
   * Converts the Date to a nicely formatted string with year, month and date
   *
   * @method toString
   * @for BaseDate
   * @type {string}
   */
  toString(): string {
    return `${pad(this.year, 4)} ${pad(this.month, 2)} ${pad(this.date, 2)}`;
  }

  /**
   * Returns the month names object that has Saka, Saura and Kollavarsham (English & Malayalam) month names for the specified index `masaNumber`
   *
   * @method getMasaName
   * @for BaseDate
   * @param masaNumber {Number}
   * @returns { {saka : {string}, saura : {string}, enMalayalam : {string}, mlMalayalam : {string} } }
   */
  static getMasaName(masaNumber: number): MasaName {
    return masaNames[masaNumber];
  }

}


text:
paragraph

{::something}
anotherthing
{:/something}

{::something/}
paragraph


text:
'use strict';
/**
 * @ngdoc function
 * @name mesFrontendApp.controller:shiftSettingService
 * @description
 * # shiftSettingService
 * Controller of the mesFrontendApp
 */
 var app = angular.module('mesFrontendApp');

app.service("shiftSettingService", ['$http','$window','$q',function($http,$window,$q) {
	/*同步獲取班別清單*/
	 this.getAllShifts = function (pageNumber) {
		  var deferred = $q.defer();
 	  $http
 	  .get( $window.defultUrl +"/shift/getAllShifts/"+pageNumber)
 	  .success(function(data, status, headers, config) {
 	        deferred.resolve(data);
 	      })
 	  .error(function(data, status, headers, config) {
 		    console.log("連線異常,請洽系統管理員:shiftSettingService.getAllShifts");
 	        deferred.reject(data);
 	    });
			return deferred.promise;
	 }

	 /*班別正式新增於資料庫*/
	 this.addShiftData = function (data) {
		 var deferred = $q.defer();
    	  $http
    	  .post( $window.defultUrl +"/shift/addShiftData",data)
    	  .success(function(data, status, headers, config) {

    	        deferred.resolve(data);
    	      })
    	  .error(function(data, status, headers, config) {
    		    console.log("連線異常,請洽系統管理員:shiftSettingService.addShiftData");
    	        deferred.reject(data);
    	    });
			return deferred.promise;
     }

	 /*班別正式更新於資料庫*/
	 this.editShiftData = function (data) {
		 var deferred = $q.defer();
    	  $http
    	  .put( $window.defultUrl +"/shift/editShiftData",data)
    	  .success(function(data, status, headers, config) {

    	        deferred.resolve(data);
    	      })
    	  .error(function(data, status, headers, config) {
    		    console.log("連線異常,請洽系統管理員:shiftSettingService.editShiftData");
    	        deferred.reject(data);
    	    });
			return deferred.promise;
     }
}])


text:
ACCEPTED

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

#### Published in
Nuovo Giorn. Bot. Ital. 8: 189 (1876)

#### Original name
Cercospora beticola Sacc., 1876

### Remarks
null


text:
@interface RTLViewController ()

@property (weak, nonatomic) IBOutlet UISegmentedControl *segmentedControl;

@end

@implementation RTLViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self.segmentedControl setSelectedSegmentLocalizedIndex:0];
    NSLog(@"%@", [self.segmentedControl titleForSegmentAtLocalizedIndex:1]);
}

@end


text:
GDG DevFest Ukraine 2016 has been announced! The 5th edition of the biggest conference about Google technologies in Ukraine will take on **September 9-10** in an ancient city of Lviv.

That means that it is time to open [call for talk submissions](http://bit.ly/df16-c4p). If you are passionate about your work and want to share your experience with the biggest tech audience in Ukraine, you knocked on the right door.

**Last year DevFest broke all expectations** of the audience, speakers, and even our ones. With **92% of satisfied attendees**, we can claim that GDG DevFest Ukraine 2015 was a great success.

"Devfest Ukraine 2015 was one of the best conferences I've been to. I'm really glad, that I've had a chance to meet great people there, and I would like to thank all organisers of this awesome event."

- Jakub Škvára, DevFest '15 Speaker

To keep up this year, we decided to focus on the content. **We're looking for speakers like you**, who are ready to rock the stage and deliver the best talk or workshop in the field.

  <paper-button class="primary style-scope header-content x-scope paper-button-0" raised="" role="button" tabindex="0" animated="" aria-disabled="false" elevation="1">Submit a proposal</paper-button>

### Why is it cool to be a speaker?

Well, do you know a better way to attend the conference? Here are our top 3 reasons to [submit a proposal](http://bit.ly/df16-c4p).

1. **It is good for your career.** By being a speaker, you are proving your level of expertise to a potential business partners or employers.
2. **It is good for the company you're working for.** Any presentation delivered by an employee adds credibility to a company's public image.
3. **Unique networking.** Being a speaker means you'll have unique chance to network with other speakers - the best experts in the industry.

"I got really impressed with everything... DevFest Ukraine 2015 was a BLAST. … Speakers devoted to bringing great content, and the extra conference activities helped us to become more united as community and friends."

Juarez Filho, DevFest '15 Speaker

### Themes and topics – what do we expect?

Our team prepared set of interesting topics in but if you have any cool idea you want to share not from this list, feel free to submit it as well.

#### Android
* New features in N (multi-window, notifications, Java 8)
* Kotlin
* RxJava
* Data Binding
* Testing and Architecture best practices (MVP, MVVP, Clean Architecture)

#### Web
* Progressive Web Apps
* Polymer
* Service Workers
* Physical Web
* RAIL

#### Cloud
* Machine Learning (TensorFlow, Vision API, Speech API, etc.)
* Big Data (PubSub, BigQuery, Dataflow)
* Firebase
* Kubernetes

**Call for Papers will stay open until July 3, 2016.** Don't miss out :)

  <paper-button class="primary style-scope header-content x-scope paper-button-0" raised="" role="button" tabindex="0" animated="" aria-disabled="false" elevation="1">Submit a proposal</paper-button>

**Please note:** There is no guarantee that a submission will be put onto the conference agenda! The program committee picks the most interesting talk proposals and informs the selected submitters until July 17, 2016.

Any questions? Email organizers at [devfest@gdg.org.ua](mailto:devfest@gdg.org.ua)


text:
============
MultivacDDNS
============

.. list-table::
    :stub-columns: 1

    * - docs
      - |docs|
    * - tests
      - | |travis| |appveyor|
        | |codecov|
    * - package
      - |version| |downloads|

.. |docs| image:: https://readthedocs.org/projects/multivac-ddns/badge/?style=flat
    :target: https://readthedocs.org/projects/multivac-ddns
    :alt: Documentation Status

.. |travis| image:: http://img.shields.io/travis/diegorocha/multivac-ddns/master.svg?style=flat&label=Travis
    :alt: Travis-CI Build Status
    :target: https://travis-ci.org/diegorocha/multivac-ddns

.. |appveyor| image:: https://img.shields.io/appveyor/ci/diegorocha/multivac-ddns/master.svg?style=flat&label=AppVeyor
    :alt: AppVeyor Build Status
    :target: https://ci.appveyor.com/project/diegorocha/multivac-ddns

.. |codecov| image:: http://img.shields.io/codecov/c/github/diegorocha/multivac-ddns/master.svg?style=flat&label=Codecov
    :alt: Coverage Status
    :target: https://codecov.io/github/diegorocha/multivac-ddns

.. |version| image:: http://img.shields.io/pypi/v/MultivacDDNS.svg?style=flat
    :alt: PyPI Package latest release
    :target: https://pypi.python.org/pypi/MultivacDDNS

.. |downloads| image:: http://img.shields.io/pypi/dm/MultivacDDNS.svg?style=flat
    :alt: PyPI Package monthly downloads
    :target: https://pypi.python.org/pypi/MultivacDDNS

A package/script to update a record on digitalocean dns to provide a ddns.

* Free software: BSD license

Installation
============

::

    pip install MultivacDDNS

Documentation
=============

https://multivac-ddns.readthedocs.org/

Development
===========

To run the all tests run::

    tox


text:
class AddGrantCascades < ActiveRecord::Migration
  TABLES = %w{
    coverage_types_grants
    grants_reason_types
    other_payments
    people
  }

  def remove_and_add(cascade = true)
    on_delete = cascade ? :cascade : :restrict

    TABLES.each do |t|
      remove_foreign_key(t, :grants)
      add_foreign_key(t, :grants, on_delete: on_delete)
    end
  end

  def up
    remove_and_add

    remove_foreign_key(:incomes, :people)
    add_foreign_key(:incomes, :people, on_delete: :cascade)
  end

  def down
    remove_and_add(false)

    remove_foreign_key(:incomes, :people)
    add_foreign_key(:incomes, :people)
  end
end


text:
import logging
from threading import Lock

from lbryum.hashing import Hash, hash_encode
from lbryum.transaction import Transaction
from lbryum.util import ThreadJob

log = logging.getLogger(__name__)

class Synchronizer(ThreadJob):
    '''The synchronizer keeps the wallet up-to-date with its set of
    addresses and their transactions.  It subscribes over the network
    to wallet addresses, gets the wallet to generate new addresses
    when necessary, requests the transaction history of any addresses
    we don't have the full history of, and requests binary transaction
    data of any transactions the wallet doesn't have.

    External interface: __init__() and add() member functions.
    '''

    def __init__(self, wallet, network):
        self.wallet = wallet
        self.network = network
        self.new_addresses = set()
        # Entries are (tx_hash, tx_height) tuples
        self.requested_tx = set()
        self.requested_histories = {}
        self.requested_addrs = set()
        self.lock = Lock()
        self.initialize()

    def parse_response(self, response):
        if response.get('error'):
            self.print_error("response error:", response)
            return None, None
        return response['params'], response['result']

    def is_up_to_date(self):
        return (not self.requested_tx and not self.requested_histories
                and not self.requested_addrs)

    def release(self):
        self.network.unsubscribe(self.addr_subscription_response)

    def add(self, address):
        '''This can be called from the proxy.'''
        with self.lock:
            self.new_addresses.add(address)

    def subscribe_to_addresses(self, addresses):
        if addresses:
            self.requested_addrs |= addresses
            msgs = map(lambda addr: ('blockchain.address.subscribe', [addr]),
                       addresses)
            self.network.send(msgs, self.addr_subscription_response)

    def addr_subscription_response(self, response):

        params, result = self.parse_response(response)
        if not params:
            return
        addr = params[0]
        history = self.wallet.get_address_history(addr)
        if self.wallet.get_status(history) != result:
            if self.requested_histories.get(addr) is None:
                self.requested_histories[addr] = result
                self.network.send([('blockchain.address.get_history', [addr])],
                                  self.addr_history_response)

        # remove addr from list only after it is added to requested_histories
        if addr in self.requested_addrs:  # Notifications won't be in
            self.requested_addrs.remove(addr)

    def addr_history_response(self, response):
        params, result = self.parse_response(response)
        if not params:
            return
        addr = params[0]
        if addr not in self.requested_histories:
            self.print_error("Received unsolicited or already processed address history", addr, result)
            return
        server_status = self.requested_histories[addr]
        hashes = set(map(lambda item: item['tx_hash'], result))
        hist = map(lambda item: (item['tx_hash'], item['height']), result)
        # Note if the server hasn't been patched to sort the items properly
        if hist != sorted(hist, key=lambda x: x[1]):
            self.network.interface.print_error("serving improperly sorted address histories")
        # Check that txids are unique
        if len(hashes) != len(result):
            self.print_error("error: server history has non-unique txids: %s" % addr)
        # Check that the status corresponds to what was announced
        elif self.wallet.get_status(hist) != server_status:
            self.print_error("error: status mismatch: %s" % addr)
        else:
            # Store received history
            self.wallet.receive_history_callback(addr, hist)
            # Request transactions we don't have
            self.request_missing_txs(hist)
        # Remove request; this allows up_to_date to be True
        self.requested_histories.pop(addr)

    def get_tx_response_callback(self, tx_hash, tx_height):
        txid, height = tx_hash, tx_height

        def tx_response(response):
            params, result = self.parse_response(response)
            if not params:
                log.warning("failed to get %s", txid)
                self.requested_tx.remove((txid, height))
                return
            tx_hash, tx_height = params
            assert tx_hash == hash_encode(Hash(result.decode('hex')))
            tx = Transaction(result)
            try:
                tx.deserialize()
            except Exception:
                log.info("cannot deserialize transaction, skipping: %s", tx_hash)
                return
            self.wallet.receive_tx_callback(tx_hash, tx, tx_height)
            self.requested_tx.remove((tx_hash, tx_height))
            log.info("received tx %s height: %d bytes: %d", tx_hash, tx_height, len(tx.raw))
            # callbacks
            self.network.trigger_callback('new_transaction', tx)
            if not self.requested_tx:
                self.network.trigger_callback('updated')

        return tx_response

    def request_missing_txs(self, hist):
        # "hist" is a list of [tx_hash, tx_height] lists
        missing = set()
        for tx_hash, tx_height in hist:
            if self.wallet.transactions.get(tx_hash) is None:
                missing.add((tx_hash, tx_height))
        missing -= self.requested_tx
        if missing:
            for (tx_hash, tx_height) in missing:
                self.network.send([('blockchain.transaction.get', (tx_hash, tx_height))],
                                  self.get_tx_response_callback(tx_hash, tx_height))
            self.requested_tx |= missing

    def initialize(self):
        '''Check the initial state of the wallet.  Subscribe to all its
        addresses, and request any transactions in its address history
        we don't have.
        '''
        for history in self.wallet.history.values():
            # Old lbryum servers returned ['*'] when all history for
            # the address was pruned.  This no longer happens but may
            # remain in old wallets.
            if history == ['*']:
                continue
            self.request_missing_txs(history)

        if self.requested_tx:
            log.warning("missing tx: %s", self.requested_tx)
        self.subscribe_to_addresses(set(self.wallet.addresses(True)))

    def run(self):
        '''Called from the network proxy thread main loop.'''
        # 1. Create new addresses
        self.wallet.synchronize()

        # 2. Subscribe to new addresses
        with self.lock:
            addresses = self.new_addresses
            self.new_addresses = set()
        self.subscribe_to_addresses(addresses)

        # 3. Detect if situation has changed
        up_to_date = self.is_up_to_date()
        if up_to_date != self.wallet.is_up_to_date():
            self.wallet.set_up_to_date(up_to_date)
            self.network.trigger_callback('updated')


text:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!--
Copyright (C) 2009 Teleca Poland Sp. z o.o. <android@teleca.com>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
    <string name="popular_this_week">popular this week</string>
    <string name="app_name">Jamendo</string>
    <string name="player_name">Jamendo Player</string>
    <string name="settings">Settings</string>
    <string name="about">About</string>
    <string name="album">Album</string>
    <string name="artist">Artist</string>
    <string name="playlist">Playlist</string>
    <string name="playlist_small">playlist</string>
    <string name="player">Player</string>
    <string name="album_small">album</string>
    <string name="search">Search</string>
    <string name="albums">Albums</string>
    <string name="my_library">My Library</string>
    <string name="browse_jamendo">Browse Jamendo</string>
    <string name="discography">discography</string>
    <string name="remove">Remove</string>
    <string name="download">Download</string>
    <string name="delete">Delete</string>
    <string name="save">Save</string>
    <string name="load">Load</string>
    <string name="neew">New</string>
    <string name="move">Move</string>
    <string name="added_to_playlist">Added to the playlist</string>
    <string name="favorites">Favorites</string>
    <string name="radio">Radio</string>
    <string name="playlists">Playlists</string>
    <string name="most_listened">Most listened</string>
    <string name="open">Open</string>
    <string name="review">Review</string>
    <string name="tracks">Tracks</string>
    <string name="radio_hint">Radio id or name</string>
    <string name="search_hint">Jamendo Search</string>
    <string name="loading_news">Loading data...</string>
    <string name="loading">Loading...</string>
    <string name="add_to_favs">Added to favorites</string>
    <string name="top100_fail">Failed getting top 100 track :\'(</string>
    <string name="license">Album License</string>
    <string name="donate">Donate</string>
    <string name="all_languages">All languages</string>
    <string name="loading_top100">Loading most listened...</string>
    <string name="retry">Retry</string>
    <string name="connection_fail">Connection failed</string>
    <string name="add">Add</string>
    <string name="lyrics">Lyrics</string>
    <string name="no_lyrics">Lyrics unavailable</string>
    <string name="about_note">(c) Teleca Poland sp. z o.o. 2009-2011</string>
    <string name="about_address">Teleca Poland Sp. z o.o.\n6 Kasprzaka Street\n90-083 Lodz, Poland</string>
    <string name="about_link">android@teleca.com</string>
    <string name="about_contact">Questions, bug reports or any feedback</string>
    <string name="about_teleca">About Teleca</string>
    <string name="about_jamendo">About Jamendo</string>
    <string name="sd_card_insert">SD Card not mounted</string>
    <string name="added_down">Added to downloads...</string>
    <string name="downloaded">Downloaded</string>
    <string name="download_album">Download</string>
    <string name="send">Send</string>
    <string name="phone_hint">Phone number</string>
    <string name="song_recommendation">Song recommendation</string>
    <string name="recommendation_sent">Recommendation sent</string>
    <string name="webpage">Web page</string>
    <string name="artist_fail">Failed getting artist data :\'(</string>
    <string name="artist_loading">Loading artist data...</string>
    <string name="adding_to_playlist">Adding album to playlist...</string>
    <string name="adding_to_playlist_fail">Failed adding album to playlist :\'(</string>
    <string name="album_fail">Failed getting album data :\'(</string>
    <string name="album_loading">Loading album data...</string>
    <string name="items">items</string>
    <string name="share">Share</string>
    <string name="searching">Searching...</string>
    <string name="search_fail">Search fail :\'(</string>
    <string name="no_results">No results found</string>
    <string name="search_list_hint">Type your search query above</string>
    <string name="no_playlists">Type playlist name above and click \'New\'
	</string>
    <string name="no_tracks">This playlist does not contains any tracks yet
	</string>
    <string name="no_items">No items</string>
    <string name="cancel">Cancel</string>
    <string name="apply">Apply</string>
    <string name="no_album">No Album</string>
    <string name="no_artist">No Artist</string>
    <string name="long_press_playlist">Long press to add to a playlist</string>
    <string name="overwrite_playlist_q">Overwrite playlist?</string>
    <string name="delete_playlist_q">Delete playlist?</string>
    <string name="download_track_q">Download track?</string>
    <string name="download_album_q">Download album?</string>
    <string name="ok">OK</string>
    <string name="terms_of_use">Jamendo Player accesses to the music catalog of JAMENDO.\n\nJAMENDO is an online platform that distributes musical works under Creative Commons licenses.\n\nPlease read these Terms and Conditions of Use carefully: By using JAMENDO and by becoming a member of JAMENDO, you commit to comply with them in all respects.</string>
    <string name="terms_button">Open Terms and Conditions of Use in the Browser</string>
    <string name="sms_fail">SMS fail :\'(</string>
    <string name="playlist_exists">Playlist already exists</string>
    <string name="credits">Credits</string>
    <string name="maintainers">Development team</string>
    <string name="home">Home</string>
    <string name="loading_playlist">Loading playlist data...</string>
    <string name="loading_playlist_fail">Failed loading playlist data :\'(</string>
    <string name="stream_error">Unable to open stream for this track :\'(</string>
    <string name="loading_fail">Loading fail :\'(</string>
    <string name="add_to_playlist">Add to playlist</string>
    <string name="add_to_favorites">Add to favorites</string>
    <string name="starred_albums_empty">The list of your starred albums is empty. This functionality is read-only as currently Jamendo Web API does not support authentication. \n\nIn order to add an album to this list press \'love\' button while on the jamendo.com web site.</string>
    <string name="better_res">1.300.jpg</string>
    <string name="loading_recomended_radios">Loading recomended radios</string>
    <string name="failed_recomended_radios">Loading recomended radios failed</string>
    <string name="play">Play</string>
    <string name="gestures_preference_title">Gestures</string>
    <string name="gestures_preference_summary">Preferences related to gestures support</string>
    <string name="gestures_support">Gestures enabled</string>
    <string name="gestures_support_summary">Enables gestures support in Jamendo</string>
    <string name="scrobbler_app">Scrobbling application</string>
    <string name="scrobbler_lastfm_official">Last.FM Official scrobbler</string>
    <string name="scrobbler_simplefm">Simple Last.FM Scrobbler</string>
    <string name="scrobbling_enabled">Enable scrobbling?</string>
    <string name="scrobbler_app_summary">Choose scrobbling application</string>
    <string name="tutorial_welcome">This tutorial screen contains a few tips you might find useful so check it out!</string>
    <string name="tutorial_title">Welcome to Jamendo Player!</string>
    <string name="tutorial_gesture_next">Next song</string>
    <string name="tutorial_gesture_prev">Previous song</string>
    <string name="tutorial_gesture_playpause">Play/Pause song</string>
    <string name="tutorial_gesture_stop">Stop song</string>
    <string name="tutorial_gestures">Gestures:</string>
    <string name="tutorial_toggle_firstrun">Skip this next time</string>
    <string name="tutorial_shufflerepeat">Shuffle/Repeat:</string>
    <string name="tutorial_shufflerepeat_playlist">Touch album art to show all controls and also to reveal new shuffle/repeat toggle buttons</string>
    <string name="tutorial_close">Press [BACK] to close this screen</string>
    <string name="preference_reset_title">Reset settings</string>
    <string name="preference_firstrun_reset_title">Reset welcome screen</string>
    <string name="preference_firstrun_reset_summary">Show welcome screen on next program start</string>
</resources>


text:
from dataclasses import dataclass

@dataclass
class UnitCargo:
    ice: int = 0
    ore: int = 0
    water: int = 0
    metal: int = 0


text:
docker-compose-ubuntu-vagrant-example
=====================================

a Vagrantfile example for running docker-compose on Ubuntu 14.04

## License

MIT


text:
using System;
using System.Linq;
using System.Reflection;

namespace DropCore.Module
{
    public class ModuleTypeManagerImpl : IModuleTypeManager
    {
        public Type GetEntryPointType(Assembly assembly)
        {
            return assembly.ExportedTypes.FirstOrDefault(t => t.GetInterface(nameof(IModule)) != null);
        }
    }
}


text:
export {};
export {};
//# sourceMappingURL=conflict-handling.d.js.map


text:
using System;

namespace ShippoTesting {

    // Class exists as placeholder, not testable with current API
    public class RefundTest {
        public RefundTest() {}
    }
}


text:
// SAXNotRecognizedException.java - unrecognized feature or value.
// http://www.saxproject.org
// Written by David Megginson
// NO WARRANTY!  This class is in the Public Domain.
// $Id$
using System;
using java = biz.ritter.javapi;

namespace org.xml.sax
{

    /**
     * Exception class for an unrecognized identifier.
     *
     *

     * This module, both source code and documentation, is in the
     * Public Domain, and comes with NO WARRANTY.
     * See http://www.saxproject.org
     * for further information.
     *

     *
     *
An XMLReader will throw this exception when it finds an
     * unrecognized feature or property identifier; SAX applications and
     * extensions may use this class for other, similar purposes.

     *
     * @since SAX 2.0
     * @author David Megginson
     * @version 2.0.1 (sax2r2)
     * @see org.xml.sax.SAXNotSupportedException
     */
    public class SAXNotRecognizedException : SAXException
    {

        /**
         * Default constructor.
         */
        public SAXNotRecognizedException()
            : base()
        {
        }

        /**
         * Construct a new exception with the given message.
         *
         * @param message The text message of the exception.
         */
        public SAXNotRecognizedException(String message)
            : base(message)
        {
        }

    }

    // end of SAXNotRecognizedException.java
}


text:
using Xunit;
using Should;

namespace AutoMapper.UnitTests.Bug
{
    public class NullableEnums : AutoMapperSpecBase
    {
        public class Src { public EnumType? A { get; set; } }
        public class Dst { public EnumType? A { get; set; } }

        public enum EnumType { One, Two }

        protected override void Establish_context()
        {
            Mapper.CreateMap<Src, Dst>();
        }

        [Fact]
        public void TestNullableEnum()
        {
            var d = Mapper.Map(new Src { A = null }, new Dst { A = EnumType.One });

            d.A.ShouldBeNull();
        }
    }
}