text:
package v1beta1

import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

// APIServiceList is a list of APIService objects.
type APIServiceList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

	Items []APIService `json:"items" protobuf:"bytes,2,rep,name=items"`
}

// ServiceReference holds a reference to Service.legacy.k8s.io
type ServiceReference struct {
	// Namespace is the namespace of the service
	Namespace string `json:"namespace,omitempty" protobuf:"bytes,1,opt,name=namespace"`
	// Name is the name of the service
	Name string `json:"name,omitempty" protobuf:"bytes,2,opt,name=name"`
}

// APIServiceSpec contains information for locating and communicating with a server.
// Only https is supported, though you are able to disable certificate verification.
type APIServiceSpec struct {
	// Service is a reference to the service for this API server.  It must communicate
	// on port 443
	// If the Service is nil, that means the handling for the API groupversion is handled locally on this server.
	// The call will simply delegate to the normal handler chain to be fulfilled.
	Service *ServiceReference `json:"service" protobuf:"bytes,1,opt,name=service"`
	// Group is the API group name this server hosts
	Group string `json:"group,omitempty" protobuf:"bytes,2,opt,name=group"`
	// Version is the API version this server hosts.  For example, "v1"
	Version string `json:"version,omitempty" protobuf:"bytes,3,opt,name=version"`

	// InsecureSkipTLSVerify disables TLS certificate verification when communicating with this server.
	// This is strongly discouraged.  You should use the CABundle instead.
	InsecureSkipTLSVerify bool `json:"insecureSkipTLSVerify,omitempty" protobuf:"varint,4,opt,name=insecureSkipTLSVerify"`
	// CABundle is a PEM encoded CA bundle which will be used to validate an API server's serving certificate.
	CABundle []byte `json:"caBundle" protobuf:"bytes,5,opt,name=caBundle"`

	// Priority controls the ordering of this API group in the overall discovery document that gets served.
	// Client tools like `kubectl` use this ordering to derive preference, so this ordering mechanism is important.
	// Values must be between 1 and 1000
	// The primary sort is based on priority, ordered lowest number to highest (10 before 20).
	// The secondary sort is based on the alphabetical comparison of the name of the object.  (v1.bar before v1.foo)
	// We'd recommend something like: *.k8s.io (except extensions) at 100, extensions at 150
	// PaaSes (OpenShift, Deis) are recommended to be in the 200s
	Priority int64 `json:"priority" protobuf:"varint,6,opt,name=priority"`
}

type ConditionStatus string

// These are valid condition statuses. "ConditionTrue" means a resource is in the condition;
// "ConditionFalse" means a resource is not in the condition; "ConditionUnknown" means kubernetes
// can't decide if a resource is in the condition or not. In the future, we could add other
// intermediate conditions, e.g. ConditionDegraded.
const (
	ConditionTrue    ConditionStatus = "True"
	ConditionFalse   ConditionStatus = "False"
	ConditionUnknown ConditionStatus = "Unknown"
)

// APIConditionConditionType is a valid value for APIServiceCondition.Type
type APIServiceConditionType string

const (
	// Available indicates that the service exists and is reachable
	Available APIServiceConditionType = "Available"
)

type APIServiceCondition struct {
	// Type is the type of the condition.
	Type APIServiceConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=APIServiceConditionType"`
	// Status is the status of the condition.
	// Can be True, False, Unknown.
	Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"`
	// Last time the condition transitioned from one status to another.
	// +optional
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
	// Unique, one-word, CamelCase reason for the condition's last transition.
	// +optional
	Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
	// Human-readable message indicating details about last transition.
	// +optional
	Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
}

// APIServiceStatus contains derived information about an API server
type APIServiceStatus struct {
	// Current service state of apiService.
	// +optional
	Conditions []APIServiceCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
}

// +genclient=true
// +nonNamespaced=true

// APIService represents a server for a particular GroupVersion.
// Name must be "version.group".
type APIService struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

	// Spec contains information for locating and communicating with a server
	Spec APIServiceSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
	// Status contains derived information about an API server
	Status APIServiceStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}


text: nuget pack Chronograph.csproj -Build -Properties "Configuration=Release"

redpajama_set_name: RedPajamaGithub


text:
title: "Vasiliy Borulko"
permalink: /alumni/Vasiliy_Borulko
author_profile: false
comments: false
sidebar: false
---


text:
clear

echo "Starting redis server..."
redis-server /etc/redis.conf
sleep 2

echo "Starting Sinatra..."
ruby app.rb


text:
import os
import sys
import json
import tornado
import subprocess
import tornado.web
from tornado.process import Subprocess

class LogMonitor(object):
    def __init__(self):
        self.sockets = {}
        filename = "./output.log"
        file_2 = './err.log'
        self.proc = Subprocess(["tail", "-f", filename, "-n", "0"],
                               stdout=Subprocess.STREAM,
                               bufsize=1)
        self.proc2 = Subprocess(["tail", "-f", file_2, "-n", "0"],
                               stdout=Subprocess.STREAM,
                               bufsize=1)
        self.proc.set_exit_callback(self._close)
        self.proc.stdout.read_until("\n", self.write_output)
        self.proc2.set_exit_callback(self._close)
        self.proc2.stdout.read_until("\n", self.write_err)

    @tornado.gen.coroutine
    def _close(self, *args, **kwargs):
        self.proc.proc.terminate()
        self.proc.proc.wait()
        self.proc2.proc.terminate()
        self.proc2.proc.wait()

    @tornado.gen.coroutine
    def add_listener(self, _id, sock):
        self.sockets[_id] = sock

    @tornado.gen.coroutine
    def remove_listener(self, _id):
        del self.sockets[_id]

    @tornado.gen.coroutine
    def write_output(self, data):
        msg = json.dumps({'type':'out', 'msg':data.strip()})
        for _id in self.sockets:
            self.sockets[_id].notify(msg)
        self.proc.stdout.read_until("\n", self.write_output)

    @tornado.gen.coroutine
    def write_err(self, data):
        msg = json.dumps({'type':'err', 'msg':data.strip()})
        for _id in self.sockets:
            self.sockets[_id].notify(msg)
        self.proc2.stdout.read_until("\n", self.write_err)


text:
package com.example.stevelu.lifecycle;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class Page2Activity extends AppCompatActivity implements View.OnClickListener {

    private TextView btnBack, btnBackPressed;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_page2);

        btnBack = (TextView) findViewById(R.id.btnBack);
        btnBackPressed = (TextView) findViewById(R.id.btnBackPress);
        btnBack.setOnClickListener(this);
        btnBackPressed.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {

        switch (v.getId()) {
            case R.id.btnBack:

                Intent intent = new Intent();
                intent.setClass(this, MainActivity.class);
                startActivity(intent);
                finish();

                break;
            case R.id.btnBackPress:

                onBackPressed();

                break;
            default:
                break;
        }

    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Interface org.apache.edgent.connectors.serial.SerialPort (Edgent v0.4.0)</title>
<meta name="date" content="2016-07-26">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Interface
org.apache.edgent.connectors.serial.SerialPort

Packages that use SerialPort

Package
Description

org.apache.edgent.connectors.serial

Serial port connector API.

Uses of SerialPort in org.apache.edgent.connectors.serial

Method parameters in org.apache.edgent.connectors.serial with type arguments of type SerialPort

Modifier and Type
Method and Description

<T> Supplier<T>
SerialDevice.getSource(Function<SerialPort,T> driver)

Create a function that can be used to source a
 stream from a serial port device.

void
SerialDevice.setInitializer(Consumer<SerialPort> initializer)

Set the initialization function for this port.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Apache Edgent (incubating)

Prev

Next

Frames

No Frames

All Classes

Copyright © 2016 The Apache Software Foundation. All Rights Reserved - 54ea8ac-20160726-1240


text:
module ActsAsMethodCacheable
  VERSION = "0.1.2"
end


text:
namespace VisionsInCode.Foundation.Realtime.Repositories
{
  using System.Threading.Tasks;
  using Microsoft.AspNet.SignalR.Hubs;
  using MongoDB.Driver;
  using VisionsInCode.Foundation.Realtime.Infrastructure;
  using VisionsInCode.Foundation.Realtime.Models;

  public interface IRealtimeVisitorRepository
  {
    IMongoCollection<RealtimeVisitor> Collection();
    Task<RealtimeVisitor> Get(IHubContextService hubContextService);
    Task<RealtimeVisitor> Get(string id);
    Task<RealtimeVisitor> Create(IHubContextService hubContextService, VisitorDataContainer visitorDataContainer);
    Task<RealtimeVisitor> Update(RealtimeVisitor realTimeVisitor);
    Task<bool> Delete(string id);

    Task<bool> AddConnection(IHubContextService hubContextService);
    Task<bool> RemoveConnection(IHubContextService hubContextService);

    Task<bool> UpdateMetaData(IHubContextService hubContextService, VisitorDataContainer metaDataContainer);

    Task<bool> UpdateGeoLocation(IHubContextService hubContextService, GeoCoordinate? geoCoordinate);
    Task<bool> UpdateGeoLocationOnConnection(IHubContextService hubContextService, int indexOfRealtimeConnection, GeoCoordinate? geoCoordinate);
  }
}


text:
<?php

class HTMLParagraph extends HTMLElement
{
	const TAG = "p";

	public static function element()
	{
		return parent::init();
	}

}


text:
"""Accesses the google.pubsub.v1 Publisher API."""

import collections
import json
import os
import pkg_resources
import platform

from google.gax import api_callable
from google.gax import config
from google.gax import path_template
import google.gax

from google.cloud.proto.pubsub.v1 import pubsub_pb2
from google.iam.v1 import iam_policy_pb2
from google.iam.v1 import policy_pb2

_PageDesc = google.gax.PageDescriptor

class PublisherClient(object):
    """
    The service that an application uses to manipulate topics, and to send
    messages to a topic.
    """

    SERVICE_ADDRESS = 'pubsub.googleapis.com'
    """The default address of the service."""

    DEFAULT_SERVICE_PORT = 443
    """The default port of the service."""

    _PAGE_DESCRIPTORS = {
        'list_topics':
        _PageDesc('page_token', 'next_page_token', 'topics'),
        'list_topic_subscriptions':
        _PageDesc('page_token', 'next_page_token', 'subscriptions')
    }

    # The scopes needed to make gRPC calls to all of the methods defined in
    # this service
    _ALL_SCOPES = ('https://www.googleapis.com/auth/cloud-platform',
                   'https://www.googleapis.com/auth/pubsub', )

    _PROJECT_PATH_TEMPLATE = path_template.PathTemplate('projects/{project}')
    _TOPIC_PATH_TEMPLATE = path_template.PathTemplate(
        'projects/{project}/topics/{topic}')

    @classmethod
    def project_path(cls, project):
        """Returns a fully-qualified project resource name string."""
        return cls._PROJECT_PATH_TEMPLATE.render({
            'project': project,
        })

    @classmethod
    def topic_path(cls, project, topic):
        """Returns a fully-qualified topic resource name string."""
        return cls._TOPIC_PATH_TEMPLATE.render({
            'project': project,
            'topic': topic,
        })

    @classmethod
    def match_project_from_project_name(cls, project_name):
        """Parses the project from a project resource.

        Args:
          project_name (string): A fully-qualified path representing a project
            resource.

        Returns:
          A string representing the project.
        """
        return cls._PROJECT_PATH_TEMPLATE.match(project_name).get('project')

    @classmethod
    def match_project_from_topic_name(cls, topic_name):
        """Parses the project from a topic resource.

        Args:
          topic_name (string): A fully-qualified path representing a topic
            resource.

        Returns:
          A string representing the project.
        """
        return cls._TOPIC_PATH_TEMPLATE.match(topic_name).get('project')

    @classmethod
    def match_topic_from_topic_name(cls, topic_name):
        """Parses the topic from a topic resource.

        Args:
          topic_name (string): A fully-qualified path representing a topic
            resource.

        Returns:
          A string representing the topic.
        """
        return cls._TOPIC_PATH_TEMPLATE.match(topic_name).get('topic')

    def __init__(self,
                 service_path=SERVICE_ADDRESS,
                 port=DEFAULT_SERVICE_PORT,
                 channel=None,
                 credentials=None,
                 ssl_credentials=None,
                 scopes=None,
                 client_config=None,
                 app_name=None,
                 app_version='',
                 lib_name=None,
                 lib_version='',
                 metrics_headers=()):
        """Constructor.

        Args:
          service_path (string): The domain name of the API remote host.
          port (int): The port on which to connect to the remote host.
          channel (:class:`grpc.Channel`): A ``Channel`` instance through
            which to make calls.
          credentials (object): The authorization credentials to attach to
            requests. These credentials identify this application to the
            service.
          ssl_credentials (:class:`grpc.ChannelCredentials`): A
            ``ChannelCredentials`` instance for use with an SSL-enabled
            channel.
          scopes (list[string]): A list of OAuth2 scopes to attach to requests.
          client_config (dict):
            A dictionary for call options for each method. See
            :func:`google.gax.construct_settings` for the structure of
            this data. Falls back to the default config if not specified
            or the specified config is missing data points.
          app_name (string): The name of the application calling
            the service. Recommended for analytics purposes.
          app_version (string): The version of the application calling
            the service. Recommended for analytics purposes.
          lib_name (string): The API library software used for calling
            the service. (Unless you are writing an API client itself,
            leave this as default.)
          lib_version (string): The API library software version used
            for calling the service. (Unless you are writing an API client
            itself, leave this as default.)
          metrics_headers (dict): A dictionary of values for tracking
            client library metrics. Ultimately serializes to a string
            (e.g. 'foo/1.2.3 bar/3.14.1'). This argument should be
            considered private.

        Returns:
          A PublisherClient object.
        """
        # Unless the calling application specifically requested
        # OAuth scopes, request everything.
        if scopes is None:
            scopes = self._ALL_SCOPES

        # Initialize an empty client config, if none is set.
        if client_config is None:
            client_config = {}

        # Initialize metrics_headers as an ordered dictionary
        # (cuts down on cardinality of the resulting string slightly).
        metrics_headers = collections.OrderedDict(metrics_headers)
        metrics_headers['gl-python'] = platform.python_version()

        # The library may or may not be set, depending on what is
        # calling this client. Newer client libraries set the library name
        # and version.
        if lib_name:
            metrics_headers[lib_name] = lib_version

        # Finally, track the GAPIC package version.
        metrics_headers['gapic'] = pkg_resources.get_distribution(
            'gapic-google-cloud-pubsub-v1', ).version

        # Load the configuration defaults.
        default_client_config = json.loads(
            pkg_resources.resource_string(
                __name__, 'publisher_client_config.json').decode())
        defaults = api_callable.construct_settings(
            'google.pubsub.v1.Publisher',
            default_client_config,
            client_config,
            config.STATUS_CODE_NAMES,
            metrics_headers=metrics_headers,
            page_descriptors=self._PAGE_DESCRIPTORS, )
        self.iam_policy_stub = config.create_stub(
            iam_policy_pb2.IAMPolicyStub,
            channel=channel,
            service_path=service_path,
            service_port=port,
            credentials=credentials,
            scopes=scopes,
            ssl_credentials=ssl_credentials)
        self.publisher_stub = config.create_stub(
            pubsub_pb2.PublisherStub,
            channel=channel,
            service_path=service_path,
            service_port=port,
            credentials=credentials,
            scopes=scopes,
            ssl_credentials=ssl_credentials)

        self._create_topic = api_callable.create_api_call(
            self.publisher_stub.CreateTopic, settings=defaults['create_topic'])
        self._publish = api_callable.create_api_call(
            self.publisher_stub.Publish, settings=defaults['publish'])
        self._get_topic = api_callable.create_api_call(
            self.publisher_stub.GetTopic, settings=defaults['get_topic'])
        self._list_topics = api_callable.create_api_call(
            self.publisher_stub.ListTopics, settings=defaults['list_topics'])
        self._list_topic_subscriptions = api_callable.create_api_call(
            self.publisher_stub.ListTopicSubscriptions,
            settings=defaults['list_topic_subscriptions'])
        self._delete_topic = api_callable.create_api_call(
            self.publisher_stub.DeleteTopic, settings=defaults['delete_topic'])
        self._set_iam_policy = api_callable.create_api_call(
            self.iam_policy_stub.SetIamPolicy,
            settings=defaults['set_iam_policy'])
        self._get_iam_policy = api_callable.create_api_call(
            self.iam_policy_stub.GetIamPolicy,
            settings=defaults['get_iam_policy'])
        self._test_iam_permissions = api_callable.create_api_call(
            self.iam_policy_stub.TestIamPermissions,
            settings=defaults['test_iam_permissions'])

    # Service calls
    def create_topic(self, name, options=None):
        """
        Creates the given topic with the given name.

        Example:
          >>> from google.cloud.gapic.pubsub.v1 import publisher_client
          >>> client = publisher_client.PublisherClient()
          >>> name = client.topic_path('[PROJECT]', '[TOPIC]')
          >>> response = client.create_topic(name)

        Args:
          name (string): The name of the topic. It must have the format
            ``\"projects/{project}/topics/{topic}\"``. ``{topic}`` must start with a letter,
            and contain only letters (``[A-Za-z]``), numbers (``[0-9]``), dashes (``-``),
            underscores (``_``), periods (``.``), tildes (``~``), plus (``+``) or percent
            signs (``%``). It must be between 3 and 255 characters in length, and it
            must not start with ``\"goog\"``.
          options (:class:`google.gax.CallOptions`): Overrides the default
            settings for this call, e.g, timeout, retries etc.

        Returns:
          A :class:`google.cloud.proto.pubsub.v1.pubsub_pb2.Topic` instance.

        Raises:
          :exc:`google.gax.errors.GaxError` if the RPC is aborted.
          :exc:`ValueError` if the parameters are invalid.
        """
        # Create the request object.
        request = pubsub_pb2.Topic(name=name)
        return self._create_topic(request, options)

    def publish(self, topic, messages, options=None):
        """
        Adds one or more messages to the topic. Returns ``NOT_FOUND`` if the topic
        does not exist. The message payload must not be empty; it must contain
        either a non-empty data field, or at least one attribute.

        Example:
          >>> from google.cloud.gapic.pubsub.v1 import publisher_client
          >>> from google.cloud.proto.pubsub.v1 import pubsub_pb2
          >>> client = publisher_client.PublisherClient()
          >>> topic = client.topic_path('[PROJECT]', '[TOPIC]')
          >>> data = b''
          >>> messages_element = pubsub_pb2.PubsubMessage(data)
          >>> messages = [messages_element]
          >>> response = client.publish(topic, messages)

        Args:
          topic (string): The messages in the request will be published on this topic.
            Format is ``projects/{project}/topics/{topic}``.
          messages (list[:class:`google.cloud.proto.pubsub.v1.pubsub_pb2.PubsubMessage`]): The messages to publish.
          options (:class:`google.gax.CallOptions`): Overrides the default
            settings for this call, e.g, timeout, retries etc.

        Returns:
          A :class:`google.cloud.proto.pubsub.v1.pubsub_pb2.PublishResponse` instance.

        Raises:
          :exc:`google.gax.errors.GaxError` if the RPC is aborted.
          :exc:`ValueError` if the parameters are invalid.
        """
        # Create the request object.
        request = pubsub_pb2.PublishRequest(topic=topic, messages=messages)
        return self._publish(request, options)

    def get_topic(self, topic, options=None):
        """
        Gets the configuration of a topic.

        Example:
          >>> from google.cloud.gapic.pubsub.v1 import publisher_client
          >>> client = publisher_client.PublisherClient()
          >>> topic = client.topic_path('[PROJECT]', '[TOPIC]')
          >>> response = client.get_topic(topic)

        Args:
          topic (string): The name of the topic to get.
            Format is ``projects/{project}/topics/{topic}``.
          options (:class:`google.gax.CallOptions`): Overrides the default
            settings for this call, e.g, timeout, retries etc.

        Returns:
          A :class:`google.cloud.proto.pubsub.v1.pubsub_pb2.Topic` instance.

        Raises:
          :exc:`google.gax.errors.GaxError` if the RPC is aborted.
          :exc:`ValueError` if the parameters are invalid.
        """
        # Create the request object.
        request = pubsub_pb2.GetTopicRequest(topic=topic)
        return self._get_topic(request, options)

    def list_topics(self, project, page_size=None, options=None):
        """
        Lists matching topics.

        Example:
          >>> from google.cloud.gapic.pubsub.v1 import publisher_client
          >>> from google.gax import CallOptions, INITIAL_PAGE
          >>> client = publisher_client.PublisherClient()
          >>> project = client.project_path('[PROJECT]')
          >>>
          >>> # Iterate over all results
          >>> for element in client.list_topics(project):
          >>>     # process element
          >>>     pass
          >>>
          >>> # Or iterate over results one page at a time
          >>> for page in client.list_topics(project, options=CallOptions(page_token=INITIAL_PAGE)):
          >>>     for element in page:
          >>>         # process element
          >>>         pass

        Args:
          project (string): The name of the cloud project that topics belong to.
            Format is ``projects/{project}``.
          page_size (int): The maximum number of resources contained in the
            underlying API response. If page streaming is performed per-
            resource, this parameter does not affect the return value. If page
            streaming is performed per-page, this determines the maximum number
            of resources in a page.
          options (:class:`google.gax.CallOptions`): Overrides the default
            settings for this call, e.g, timeout, retries etc.

        Returns:
          A :class:`google.gax.PageIterator` instance. By default, this
          is an iterable of :class:`google.cloud.proto.pubsub.v1.pubsub_pb2.Topic` instances.
          This object can also be configured to iterate over the pages
          of the response through the `CallOptions` parameter.

        Raises:
          :exc:`google.gax.errors.GaxError` if the RPC is aborted.
          :exc:`ValueError` if the parameters are invalid.
        """
        # Create the request object.
        request = pubsub_pb2.ListTopicsRequest(
            project=project, page_size=page_size)
        return self._list_topics(request, options)

    def list_topic_subscriptions(self, topic, page_size=None, options=None):
        """
        Lists the name of the subscriptions for this topic.

        Example:
          >>> from google.cloud.gapic.pubsub.v1 import publisher_client
          >>> from google.gax import CallOptions, INITIAL_PAGE
          >>> client = publisher_client.PublisherClient()
          >>> topic = client.topic_path('[PROJECT]', '[TOPIC]')
          >>>
          >>> # Iterate over all results
          >>> for element in client.list_topic_subscriptions(topic):
          >>>     # process element
          >>>     pass
          >>>
          >>> # Or iterate over results one page at a time
          >>> for page in client.list_topic_subscriptions(topic, options=CallOptions(page_token=INITIAL_PAGE)):
          >>>     for element in page:
          >>>         # process element
          >>>         pass

        Args:
          topic (string): The name of the topic that subscriptions are attached to.
            Format is ``projects/{project}/topics/{topic}``.
          page_size (int): The maximum number of resources contained in the
            underlying API response. If page streaming is performed per-
            resource, this parameter does not affect the return value. If page
            streaming is performed per-page, this determines the maximum number
            of resources in a page.
          options (:class:`google.gax.CallOptions`): Overrides the default
            settings for this call, e.g, timeout, retries etc.

        Returns:
          A :class:`google.gax.PageIterator` instance. By default, this
          is an iterable of string instances.
          This object can also be configured to iterate over the pages
          of the response through the `CallOptions` parameter.

        Raises:
          :exc:`google.gax.errors.GaxError` if the RPC is aborted.
          :exc:`ValueError` if the parameters are invalid.
        """
        # Create the request object.
        request = pubsub_pb2.ListTopicSubscriptionsRequest(
            topic=topic, page_size=page_size)
        return self._list_topic_subscriptions(request, options)

    def delete_topic(self, topic, options=None):
        """
        Deletes the topic with the given name. Returns ``NOT_FOUND`` if the topic
        does not exist. After a topic is deleted, a new topic may be created with
        the same name; this is an entirely new topic with none of the old
        configuration or subscriptions. Existing subscriptions to this topic are
        not deleted, but their ``topic`` field is set to ``_deleted-topic_``.

        Example:
          >>> from google.cloud.gapic.pubsub.v1 import publisher_client
          >>> client = publisher_client.PublisherClient()
          >>> topic = client.topic_path('[PROJECT]', '[TOPIC]')
          >>> client.delete_topic(topic)

        Args:
          topic (string): Name of the topic to delete.
            Format is ``projects/{project}/topics/{topic}``.
          options (:class:`google.gax.CallOptions`): Overrides the default
            settings for this call, e.g, timeout, retries etc.

        Raises:
          :exc:`google.gax.errors.GaxError` if the RPC is aborted.
          :exc:`ValueError` if the parameters are invalid.
        """
        # Create the request object.
        request = pubsub_pb2.DeleteTopicRequest(topic=topic)
        self._delete_topic(request, options)

    def set_iam_policy(self, resource, policy, options=None):
        """
        Sets the access control policy on the specified resource. Replaces any
        existing policy.

        Example:
          >>> from google.cloud.gapic.pubsub.v1 import publisher_client
          >>> from google.iam.v1 import policy_pb2
          >>> client = publisher_client.PublisherClient()
          >>> resource = client.topic_path('[PROJECT]', '[TOPIC]')
          >>> policy = policy_pb2.Policy()
          >>> response = client.set_iam_policy(resource, policy)

        Args:
          resource (string): REQUIRED: The resource for which the policy is being specified.
            ``resource`` is usually specified as a path. For example, a Project
            resource is specified as ``projects/{project}``.
          policy (:class:`google.iam.v1.policy_pb2.Policy`): REQUIRED: The complete policy to be applied to the ``resource``. The size of
            the policy is limited to a few 10s of KB. An empty policy is a
            valid policy but certain Cloud Platform services (such as Projects)
            might reject them.
          options (:class:`google.gax.CallOptions`): Overrides the default
            settings for this call, e.g, timeout, retries etc.

        Returns:
          A :class:`google.iam.v1.policy_pb2.Policy` instance.

        Raises:
          :exc:`google.gax.errors.GaxError` if the RPC is aborted.
          :exc:`ValueError` if the parameters are invalid.
        """
        # Create the request object.
        request = iam_policy_pb2.SetIamPolicyRequest(
            resource=resource, policy=policy)
        return self._set_iam_policy(request, options)

    def get_iam_policy(self, resource, options=None):
        """
        Gets the access control policy for a resource.
        Returns an empty policy if the resource exists and does not have a policy
        set.

        Example:
          >>> from google.cloud.gapic.pubsub.v1 import publisher_client
          >>> client = publisher_client.PublisherClient()
          >>> resource = client.topic_path('[PROJECT]', '[TOPIC]')
          >>> response = client.get_iam_policy(resource)

        Args:
          resource (string): REQUIRED: The resource for which the policy is being requested.
            ``resource`` is usually specified as a path. For example, a Project
            resource is specified as ``projects/{project}``.
          options (:class:`google.gax.CallOptions`): Overrides the default
            settings for this call, e.g, timeout, retries etc.

        Returns:
          A :class:`google.iam.v1.policy_pb2.Policy` instance.

        Raises:
          :exc:`google.gax.errors.GaxError` if the RPC is aborted.
          :exc:`ValueError` if the parameters are invalid.
        """
        # Create the request object.
        request = iam_policy_pb2.GetIamPolicyRequest(resource=resource)
        return self._get_iam_policy(request, options)

    def test_iam_permissions(self, resource, permissions, options=None):
        """
        Returns permissions that a caller has on the specified resource.
        If the resource does not exist, this will return an empty set of
        permissions, not a NOT_FOUND error.

        Example:
          >>> from google.cloud.gapic.pubsub.v1 import publisher_client
          >>> client = publisher_client.PublisherClient()
          >>> resource = client.topic_path('[PROJECT]', '[TOPIC]')
          >>> permissions = []
          >>> response = client.test_iam_permissions(resource, permissions)

        Args:
          resource (string): REQUIRED: The resource for which the policy detail is being requested.
            ``resource`` is usually specified as a path. For example, a Project
            resource is specified as ``projects/{project}``.
          permissions (list[string]): The set of permissions to check for the ``resource``. Permissions with
            wildcards (such as '*' or 'storage.*') are not allowed. For more
            information see
            `IAM Overview <https://cloud.google.com/iam/docs/overview#permissions>`_.
          options (:class:`google.gax.CallOptions`): Overrides the default
            settings for this call, e.g, timeout, retries etc.

        Returns:
          A :class:`google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse` instance.

        Raises:
          :exc:`google.gax.errors.GaxError` if the RPC is aborted.
          :exc:`ValueError` if the parameters are invalid.
        """
        # Create the request object.
        request = iam_policy_pb2.TestIamPermissionsRequest(
            resource=resource, permissions=permissions)
        return self._test_iam_permissions(request, options)


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

namespace Aphysoft.Share
{
    public static class Rnd
    {
        [ThreadStatic]
        private static System.Random random;

        private static System.Random Seed
        {
            get { return random ?? (random = new System.Random(unchecked(Environment.TickCount * 31 + Thread.CurrentThread.ManagedThreadId))); }
        }

        public static int Int()
        {

            return Seed.Next();
        }

        public static int Natural()
        {
            return Seed.Next(0, int.MaxValue);
        }

        public static int Int(int maxValue)
        {
            return Seed.Next(maxValue);
        }

        public static int Int(int minValue, int maxValue)
        {
            return Seed.Next(minValue, maxValue);
        }

        public static double Double()
        {
            return Seed.NextDouble();
        }

        public static void Bytes(byte[] buffer)
        {
            Seed.NextBytes(buffer);
        }
    }
}


text:
require 'concurrent/ivar'
require 'concurrent/utility/timer'
require 'concurrent/executor/safe_task_executor'

module Concurrent

  class ScheduledTask < IVar

    attr_reader :schedule_time

    def initialize(intended_time, opts = {}, &block)
      raise ArgumentError.new('no block given') unless block_given?
      TimerSet.calculate_schedule_time(intended_time) # raises exceptons

      super(NO_VALUE, opts)

      self.observers = CopyOnNotifyObserverSet.new
      @intended_time = intended_time
      @state         = :unscheduled
      @task          = block
      @executor      = OptionsParser::get_executor_from(opts) || Concurrent.configuration.global_operation_pool
    end

    # @since 0.5.0
    def execute
      if compare_and_set_state(:pending, :unscheduled)
        @schedule_time = TimerSet.calculate_schedule_time(@intended_time)
        Concurrent::timer(@schedule_time.to_f - Time.now.to_f) { @executor.post &method(:process_task) }
        self
      end
    end

    # @since 0.5.0
    def self.execute(intended_time, opts = {}, &block)
      return ScheduledTask.new(intended_time, opts, &block).execute
    end

    def cancelled?
      state == :cancelled
    end

    def in_progress?
      state == :in_progress
    end

    def cancel
      if_state(:unscheduled, :pending) do
        @state = :cancelled
        event.set
        true
      end
    end
    alias_method :stop, :cancel

    def add_observer(*args, &block)
      if_state(:unscheduled, :pending, :in_progress) do
        observers.add_observer(*args, &block)
      end
    end

    protected :set, :fail, :complete

    private

    def process_task
      if compare_and_set_state(:in_progress, :pending)
        success, val, reason = SafeTaskExecutor.new(@task).execute

        mutex.synchronize do
          set_state(success, val, reason)
          event.set
        end

        time = Time.now
        observers.notify_and_delete_observers { [time, self.value, reason] }
      end
    end
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/login_bg2">

        <LinearLayout
            android:id="@+id/login_ll"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:gravity="center_horizontal"
            android:orientation="vertical">

            <com.tyq.jiemian.ui.widget.DeletableEditText
                android:id="@+id/login_username_et"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/ic_username"
                android:drawablePadding="6dp"
                android:drawableRight="@drawable/ic_edit_text_delete"
                android:ems="12"
                android:hint="用户名"
                android:inputType="text"
                android:padding="6dp"
                android:singleLine="true"
                android:textColor="@color/black"
                android:textColorHint="@color/grey"
                android:textSize="18sp" />

            <com.tyq.jiemian.ui.widget.DeletableEditText
                android:id="@+id/login_password_et"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/ic_password"
                android:drawablePadding="6dp"
                android:drawableRight="@drawable/ic_edit_text_delete"
                android:ems="12"
                android:hint="密码"
                android:inputType="textPassword"
                android:padding="6dp"
                android:singleLine="true"
                android:textColor="@color/white"
                android:textColorHint="@color/grey"
                android:textSize="18sp" />

            <Button
                android:id="@+id/login_btn"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="8dp"
                android:layout_marginRight="8dp"
                android:layout_marginTop="16dp"
                android:background="@drawable/app_btn_selector"
                android:text="登录"
                android:textColor="@color/white"
                android:textSize="18sp" />

        </LinearLayout>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_above="@id/login_ll"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="16dp"
            android:text="@string/app_name"
            android:textColor="@color/white"
            android:textSize="22sp" />

        <Button
            android:id="@+id/register_btn"
            style="?android:buttonBarButtonStyle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/login_ll"
            android:layout_centerHorizontal="true"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:text="注册帐号"
            android:textColor="@color/colorPrimary"
            android:textSize="18sp" />

    </RelativeLayout>

</layout>


text:
def calc():
    heads = input("heads(m): ")
    feet = input("feet(n): ")

    try:
        heads = int(heads)
        feet = int(feet)
    except ValueError:
        print("invalid input")
        return

    temp = feet - 2 * heads
    if heads < 0 or feet < 0 or temp < 0 or temp % 2 != 0:
        print("invalid input")
        return

    rabbits = temp / 2
    cocks = heads - rabbits
    print("cocks %d rabbits %d" % (cocks, rabbits))

if __name__ == '__main__':
    calc()