text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="(C) Copyright 2005" />
<meta name="DC.rights.owner" content="(C) Copyright 2005" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta content="reference" name="DC.Type" />
<meta name="DC.Title" content="ssl=sslMode attribute" />
<meta name="abstract" content="The ssl=sslMode attribute specifies the SSL mode of the client." />
<meta name="description" content="The ssl=sslMode attribute specifies the SSL mode of the client." />
<meta content="ssl=sslMode database connection URL attribute, network client, specifying SSL mode, attributes, ssl" name="DC.subject" />
<meta content="ssl=sslMode database connection URL attribute, network client, specifying SSL mode, attributes, ssl" name="keywords" />
<meta scheme="URI" name="DC.Relation" content="rrefattrib24612.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="rrefattribssl" name="DC.Identifier" />
<meta content="en-us" name="DC.Language" />
<link href="commonltr.css" type="text/css" rel="stylesheet" />
<title>ssl=sslMode attribute</title>

ssl=sslMode attribute

The ssl=sslMode attribute specifies the SSL mode of the
client.

The sslMode can be <samp class="codeph">basic</samp>,
<samp class="codeph">peerAuthentication</samp>, or <samp class="codeph">off</samp> (the default). See
"Configuring SSL/TLS" in the Derby Security Guide for
details.

Combining with other attributes

May be combined with all other attributes.

Example

-- connect to mydb with basic SSL encryption
jdbc:derby://localhost/mydb;ssl=basic

Parent topic: Setting attributes for the database connection URL

redpajama_set_name: RedPajamaGithub


text:
from datetime import datetime
from operator import itemgetter
from urlparse import urlparse
from urllib import unquote_plus
from pyga import utils
from pyga import exceptions

__author__ = "Arun KR (kra3) <the1.arun@gmail.com>"
__license__ = "Simplified BSD"

class Campaign(object):
    '''
    A representation of Campaign

    Properties:
    _type -- See TYPE_* constants, will be mapped to "__utmz" parameter.
    creation_time --  Time of the creation of this campaign, will be mapped to "__utmz" parameter.
    response_count -- Response Count, will be mapped to "__utmz" parameter.
        Is also used to determine whether the campaign is new or repeated,
        which will be mapped to "utmcn" and "utmcr" parameters.
    id -- Campaign ID, a.k.a. "utm_id" query parameter for ga.js
           Will be mapped to "__utmz" parameter.
    source -- Source, a.k.a. "utm_source" query parameter for ga.js.
              Will be mapped to "utmcsr" key in "__utmz" parameter.
    g_click_id -- Google AdWords Click ID, a.k.a. "gclid" query parameter for ga.js.
                  Will be mapped to "utmgclid" key in "__utmz" parameter.
    d_click_id -- DoubleClick (?) Click ID. Will be mapped to "utmdclid" key in "__utmz" parameter.
    name --  Name, a.k.a. "utm_campaign" query parameter for ga.js.
             Will be mapped to "utmccn" key in "__utmz" parameter.
    medium -- Medium, a.k.a. "utm_medium" query parameter for ga.js.
              Will be mapped to "utmcmd" key in "__utmz" parameter.
    term -- Terms/Keywords, a.k.a. "utm_term" query parameter for ga.js.
            Will be mapped to "utmctr" key in "__utmz" parameter.
    content -- Ad Content Description, a.k.a. "utm_content" query parameter for ga.js.
               Will be mapped to "utmcct" key in "__utmz" parameter.

    '''

    TYPE_DIRECT = 'direct'
    TYPE_ORGANIC = 'organic'
    TYPE_REFERRAL = 'referral'

    CAMPAIGN_DELIMITER = '|'

    UTMZ_PARAM_MAP = {
        'utmcid': 'id',
        'utmcsr': 'source',
        'utmgclid': 'g_click_id',
        'utmdclid': 'd_click_id',
        'utmccn': 'name',
        'utmcmd': 'medium',
        'utmctr': 'term',
        'utmcct': 'content',
    }

    def __init__(self, typ):
        self._type = None
        self.creation_time = None
        self.response_count = 0
        self.id = None
        self.source = None
        self.g_click_id = None
        self.d_click_id = None
        self.name = None
        self.medium = None
        self.term = None
        self.content = None

        if typ:
            if typ not in ('direct', 'organic', 'referral'):
                raise ValueError('Campaign type has to be one of the Campaign::TYPE_* constant values.')

            self._type = typ
            if typ == Campaign.TYPE_DIRECT:
                self.name = '(direct)'
                self.source = '(direct)'
                self.medium = '(none)'
            elif typ == Campaign.TYPE_REFERRAL:
                self.name = '(referral)'
                self.medium = 'referral'
            elif typ == Campaign.TYPE_ORGANIC:
                self.name = '(organic)'
                self.medium = 'organic'
            else:
                self._type = None

        self.creation_time = datetime.utcnow()

    def validate(self):
        if not self.source:
            raise exceptions.ValidationError('Campaigns need to have at least the "source" attribute defined.')

    @staticmethod
    def create_from_referrer(url):
        obj = Campaign(Campaign.TYPE_REFERRAL)
        parse_rslt = urlparse(url)
        obj.source = parse_rslt.netloc
        obj.content = parse_rslt.path
        return obj

    def extract_from_utmz(self, utmz):
        parts = utmz.split('.', 4)

        if len(parts) != 5:
            raise ValueError('The given "__utmz" cookie value is invalid.')

        self.creation_time = utils.convert_ga_timestamp(parts[1])
        self.response_count = int(parts[3])
        params = parts[4].split(Campaign.CAMPAIGN_DELIMITER)

        for param in params:
            key, val = param.split('=')

            try:
                setattr(self, self.UTMZ_PARAM_MAP[key], unquote_plus(val))
            except KeyError:
                continue

        return self

class CustomVariable(object):
    '''
    Represent a Custom Variable

    Properties:
    index -- Is the slot, you have 5 slots
    name -- Name given to custom variable
    value -- Value for the variable
    scope -- Scope can be any one of 1, 2 or 3.

    WATCH OUT: It's a known issue that GA will not decode URL-encoded
    characters in custom variable names and values properly, so spaces
    will show up as "%20" in the interface etc. (applicable to name & value)
    http://www.google.com/support/forum/p/Google%20Analytics/thread?tid=2cdb3ec0be32e078

    '''

    SCOPE_VISITOR = 1
    SCOPE_SESSION = 2
    SCOPE_PAGE = 3

    def __init__(self, index=None, name=None, value=None, scope=3):
        self.index = index
        self.name = name
        self.value = value
        self.scope = CustomVariable.SCOPE_PAGE
        if scope:
            self.scope = scope

    def __setattr__(self, name, value):
        if name == 'scope':
            if value and value not in range(1, 4):
                raise ValueError('Custom Variable scope has to be one of the 1,2 or 3')

        if name == 'index':
            # Custom Variables are limited to five slots officially, but there seems to be a
            # trick to allow for more of them which we could investigate at a later time (see
            # http://analyticsimpact.com/2010/05/24/get-more-than-5-custom-variables-in-google-analytics/
            if value and (value < 0 or value > 5):
                raise ValueError('Custom Variable index has to be between 1 and 5.')

        object.__setattr__(self, name, value)

    def validate(self):
        '''
        According to the GA documentation, there is a limit to the combined size of
        name and value of 64 bytes after URL encoding,
        see http://code.google.com/apis/analytics/docs/tracking/gaTrackingCustomVariables.html#varTypes
        and http://xahlee.org/js/google_analytics_tracker_2010-07-01_expanded.js line 563
        This limit was increased to 128 bytes BEFORE encoding with the 2012-01 release of ga.js however,
        see http://code.google.com/apis/analytics/community/gajs_changelog.html
        '''
        if len('%s%s' % (self.name, self.value)) > 128:
            raise exceptions.ValidationError('Custom Variable combined name and value length must not be larger than 128 bytes.')

class Event(object):
    '''
    Represents an Event
    http://code.google.com/apis/analytics/docs/tracking/eventTrackerOverview.html

    Properties:
    category -- The general event category
    action -- The action for the event
    label -- An optional descriptor for the event
    value -- An optional value associated with the event. You can see your
             event values in the Overview, Categories, and Actions reports,
             where they are listed by event or aggregated across events,
             depending upon your report view.
    noninteraction -- By default, event hits will impact a visitor's bounce rate.
                      By setting this parameter to true, this event hit
                      will not be used in bounce rate calculations.
                      (default False)
    '''

    def __init__(self, category=None, action=None, label=None, value=None, noninteraction=False):
        self.category = category
        self.action = action
        self.label = label
        self.value = value
        self.noninteraction = bool(noninteraction)

        if self.noninteraction and not self.value:
            self.value = 0

    def validate(self):
        if not(self.category and self.action):
            raise exceptions.ValidationError('Events, at least need to have a category and action defined.')

class Item(object):
    '''
    Represents an Item in Transaction

    Properties:
    order_id -- Order ID, will be mapped to "utmtid" parameter
    sku -- Product Code. This is the sku code for a given product, will be mapped to "utmipc" parameter
    name -- Product Name, will be mapped to "utmipn" parameter
    variation -- Variations on an item, will be mapped to "utmiva" parameter
    price -- Unit Price. Value is set to numbers only, will be mapped to "utmipr" parameter
    quantity -- Unit Quantity, will be mapped to "utmiqt" parameter

    '''

    def __init__(self):
        self.order_id = None
        self.sku = None
        self.name = None
        self.variation = None
        self.price = None
        self.quantity = 1

    def validate(self):
        if not self.sku:
            raise exceptions.ValidationError('sku/product is a required parameter')

class Page(object):
    '''
    Contains all parameters needed for tracking a page

    Properties:
    path -- Page request URI, will be mapped to "utmp" parameter
    title -- Page title, will be mapped to "utmdt" parameter
    charset -- Charset encoding, will be mapped to "utmcs" parameter
    referrer -- Referer URL, will be mapped to "utmr" parameter
    load_time -- Page load time in milliseconds, will be encoded into "utme" parameter.

    '''
    REFERRER_INTERNAL = '0'

    def __init__(self, path):
        self.path = None
        self.title = None
        self.charset = None
        self.referrer = None
        self.load_time = None

        if path:
            self.path = path

    def __setattr__(self, name, value):
        if name == 'path':
            if value and value != '':
                if value[0] != '/':
                    raise ValueError('The page path should always start with a slash ("/").')
        elif name == 'load_time':
            if value and not isinstance(value, int):
                raise ValueError('Page load time must be specified in integer milliseconds.')

        object.__setattr__(self, name, value)

class Session(object):
    '''
    You should serialize this object and store it in the user session to keep it
    persistent between requests (similar to the "__umtb" cookie of the GA Javascript client).

    Properties:
    session_id -- A unique per-session ID, will be mapped to "utmhid" parameter
    track_count -- The amount of pageviews that were tracked within this session so far,
                   will be part of the "__utmb" cookie parameter.
                   Will get incremented automatically upon each request
    start_time -- Timestamp of the start of this new session, will be part of the "__utmb" cookie parameter

    '''
    def __init__(self):
        self.session_id = utils.get_32bit_random_num()
        self.track_count = 0
        self.start_time = datetime.utcnow()

    @staticmethod
    def generate_session_id():
        return utils.get_32bit_random_num()

    def extract_from_utmb(self, utmb):
        '''
        Will extract information for the "trackCount" and "startTime"
        properties from the given "__utmb" cookie value.
        '''
        parts = utmb.split('.')
        if len(parts) != 4:
            raise ValueError('The given "__utmb" cookie value is invalid.')

        self.track_count = int(parts[1])
        self.start_time = utils.convert_ga_timestamp(parts[3])

        return self

class SocialInteraction(object):
    '''

    Properties:
    action -- Required. A string representing the social action being tracked,
              will be mapped to "utmsa" parameter
    network -- Required. A string representing the social network being tracked,
               will be mapped to "utmsn" parameter
    target -- Optional. A string representing the URL (or resource) which receives the action.

    '''

    def __init__(self, action=None, network=None, target=None):
        self.action = action
        self.network = network
        self.target = target

    def validate(self):
        if not(self.action and self.network):
            raise exceptions.ValidationError('Social interactions need to have at least the "network" and "action" attributes defined.')

class Transaction(object):
    '''
    Represents parameters for a Transaction call

    Properties:
    order_id -- Order ID, will be mapped to "utmtid" parameter
    affiliation -- Affiliation, Will be mapped to "utmtst" parameter
    total -- Total Cost, will be mapped to "utmtto" parameter
    tax -- Tax Cost, will be mapped to "utmttx" parameter
    shipping -- Shipping Cost, values as for unit and price, will be mapped to "utmtsp" parameter
    city -- Billing City, will be mapped to "utmtci" parameter
    state -- Billing Region, will be mapped to "utmtrg" parameter
    country -- Billing Country, will be mapped to "utmtco" parameter
    items -- @entity.Items in a transaction

    '''
    def __init__(self):
        self.items = []
        self.order_id = None
        self.affiliation = None
        self.total = None
        self.tax = None
        self.shipping = None
        self.city = None
        self.state = None
        self.country = None

    def __setattr__(self, name, value):
        if name == 'order_id':
            for itm in self.items:
                itm.order_id = value
        object.__setattr__(self, name, value)

    def validate(self):
        if len(self.items) == 0:
            raise exceptions.ValidationError('Transaction need to consist of at least one item')

    def add_item(self, item):
        ''' item of type entities.Item '''
        if isinstance(item, Item):
            item.order_id = self.order_id
            self.items.append(item)

class Visitor(object):
    '''
    You should serialize this object and store it in the user database to keep it
    persistent for the same user permanently (similar to the "__umta" cookie of
    the GA Javascript client).

    Properties:
    unique_id -- Unique user ID, will be part of the "__utma" cookie parameter
    first_visit_time -- Time of the very first visit of this user, will be part of the "__utma" cookie parameter
    previous_visit_time -- Time of the previous visit of this user, will be part of the "__utma" cookie parameter
    current_visit_time -- Time of the current visit of this user, will be part of the "__utma" cookie parameter
    visit_count -- Amount of total visits by this user, will be part of the "__utma" cookie parameter
    ip_address -- IP Address of the end user, will be mapped to "utmip" parameter and "X-Forwarded-For" request header
    user_agent -- User agent string of the end user, will be mapped to "User-Agent" request header
    locale -- Locale string (country part optional) will be mapped to "utmul" parameter
    flash_version -- Visitor's Flash version, will be maped to "utmfl" parameter
    java_enabled -- Visitor's Java support, will be mapped to "utmje" parameter
    screen_colour_depth -- Visitor's screen color depth, will be mapped to "utmsc" parameter
    screen_resolution -- Visitor's screen resolution, will be mapped to "utmsr" parameter
    '''
    def __init__(self):
        now = datetime.utcnow()

        self.unique_id = None
        self.first_visit_time = now
        self.previous_visit_time = now
        self.current_visit_time = now
        self.visit_count = 1
        self.ip_address = None
        self.user_agent = None
        self.locale = None
        self.flash_version = None
        self.java_enabled = None
        self.screen_colour_depth = None
        self.screen_resolution = None

    def __setattr__(self, name, value):
        if name == 'unique_id':
            if value and value < 0 or value > 0x7fffffff:
                raise ValueError('Visitor unique ID has to be a 32-bit integer between 0 and 0x7fffffff')
        object.__setattr__(self, name, value)

    def __getattribute__(self, name):
        if name == 'unique_id':
            tmp = object.__getattribute__(self, name)
            if tmp is None:
                self.unique_id = self.generate_unique_id()
        return object.__getattribute__(self, name)

    def __getstate__(self):
        state = self.__dict__
        if state.get('user_agent') is None:
            state['unique_id'] = self.generate_unique_id()

        return state

    def extract_from_utma(self, utma):
        '''
        Will extract information for the "unique_id", "first_visit_time", "previous_visit_time",
        "current_visit_time" and "visit_count" properties from the given "__utma" cookie value.
        '''
        parts = utma.split('.')
        if len(parts) != 6:
            raise ValueError('The given "__utma" cookie value is invalid.')

        self.unique_id = int(parts[1])
        self.first_visit_time = utils.convert_ga_timestamp(parts[2])
        self.previous_visit_time = utils.convert_ga_timestamp(parts[3])
        self.current_visit_time = utils.convert_ga_timestamp(parts[4])
        self.visit_count = int(parts[5])

        return self

    def extract_from_server_meta(self, meta):
        '''
        Will extract information for the "ip_address", "user_agent" and "locale"
        properties from the given WSGI REQUEST META variable or equivalent.
        '''
        if 'REMOTE_ADDR' in meta and meta['REMOTE_ADDR']:
            ip = None
            for key in ('HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR'):
                if key in meta and not ip:
                    ips = meta.get(key, '').split(',')
                    ip = ips[len(ips) - 1].strip()
                    if not utils.is_valid_ip(ip):
                        ip = ''
                    if utils.is_private_ip(ip):
                        ip = ''
            if ip:
                self.ip_address = ip

        if 'HTTP_USER_AGENT' in meta and meta['HTTP_USER_AGENT']:
            self.user_agent = meta['HTTP_USER_AGENT']

        if 'HTTP_ACCEPT_LANGUAGE' in meta and meta['HTTP_ACCEPT_LANGUAGE']:
            user_locals = []
            matched_locales = utils.validate_locale(meta['HTTP_ACCEPT_LANGUAGE'])
            if matched_locales:
                lang_lst = map((lambda x: x.replace('-', '_')), (i[1] for i in matched_locales))
                quality_lst = map((lambda x: x and x or 1), (float(i[4] and i[4] or '0') for i in matched_locales))
                lang_quality_map = map((lambda x, y: (x, y)), lang_lst, quality_lst)
                user_locals = [x[0] for x in sorted(lang_quality_map, key=itemgetter(1), reverse=True)]

            if user_locals:
                self.locale = user_locals[0]

        return self

    def generate_hash(self):
        '''Generates a hashed value from user-specific properties.'''
        tmpstr = "%s%s%s" % (self.user_agent, self.screen_resolution, self.screen_colour_depth)
        return utils.generate_hash(tmpstr)

    def generate_unique_id(self):
        '''Generates a unique user ID from the current user-specific properties.'''
        return ((utils.get_32bit_random_num() ^ self.generate_hash()) & 0x7fffffff)

    def add_session(self, session):
        '''
        Updates the "previousVisitTime", "currentVisitTime" and "visitCount"
        fields based on the given session object.
        '''
        start_time = session.start_time
        if start_time != self.current_visit_time:
            self.previous_visit_time = self.current_visit_time
            self.current_visit_time = start_time
            self.visit_count = self.visit_count + 1


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="">
  <meta name="author" content="">
  <title>PostIt</title>

  <link href="./public/css/app.css" rel="stylesheet">

 POSTiT

        You Dont Have to Shout, Just PostIt

QUICK START

Create an Account

Create a Message Board

Add Members to Board

Just PostIt

        <button class="btn small-capsule half-capsuleL primary-color">Sign Up</button>
        <button class="btn small-capsule half-capsuleR info-color">Sign In</button>

        Forgot Password

        <form id="SignUpForm">

            Email
            <input type="email" class="form-control" id="email_signup" placeholder="Your email goes here">

          <button type="submit" class="btn btn primary-color capsule-full">Submit</button> I’m already a member
        </form>


text:
require 'jellyfish/test'

describe Jellyfish do
  after do
    Muack.verify
  end

  app = Class.new{
    include Jellyfish
    handle(StandardError){ |env| 0 }
  }.new

  exp = RuntimeError.new

  would "no RuntimeError: can't add a new key into hash during iteration" do
    # make static ancestors so that we could stub it
    ancestors = RuntimeError.ancestors
    stub(RuntimeError).ancestors{ancestors}
    flip = true
    stub(ancestors).index(anything).peek_return do |i|
      if flip
        flip = false
        sleep 0.0001
      end
      i
    end

    2.times.map{
      Thread.new do
        app.send(:best_handler, exp).call({}).should.eq 0
      end
    }.each(&:join)

    flip.should.eq false
  end
end


text:
#define SHARED_SPACE_FOR_SHARED_CONDITION_VARIABLE_ALLOCATOR "shared_space_for_shared_condition_variable_allocator"

CLSharedConditionVariableImpl::CLSharedConditionVariableImpl()
{
	m_nItemSize = sizeof(SLSharedConditionVariableItem);
	m_strSharedSpaceName = SHARED_SPACE_FOR_SHARED_CONDITION_VARIABLE_ALLOCATOR;
}

CLSharedConditionVariableImpl::~CLSharedConditionVariableImpl()
{
}

CLStatus CLSharedConditionVariableImpl::InitializeSharedObject(SLSharedObjectHead *pObject)
{
	SLSharedConditionVariableItem *pCondItem = (SLSharedConditionVariableItem *)pObject;

	pthread_condattr_t attr;
	int r = pthread_condattr_init(&attr);
	if(r != 0)
	{
		CLLogger::WriteLogMsg("In CLSharedConditionVariableImpl::InitializeSharedObject(), pthread_condattr_init error", r);
		return CLStatus(-1, r);
	}

	r = pthread_condattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
	if(r != 0)
	{
		CLLogger::WriteLogMsg("In CLSharedConditionVariableImpl::InitializeSharedObject(), pthread_condattr_setpshared error", r);

		pthread_condattr_destroy(&attr);

		return CLStatus(-1, r);
	}

	r = pthread_cond_init(&(pCondItem->cond), &attr);
	if(r != 0)
	{
		CLLogger::WriteLogMsg("In CLSharedConditionVariableImpl::InitializeSharedObject(), pthread_cond_init error", r);

		pthread_condattr_destroy(&attr);

		return CLStatus(-1, r);
	}

	r = pthread_condattr_destroy(&attr);
	if(r != 0)
	{
		CLLogger::WriteLogMsg("In CLSharedConditionVariableImpl::InitializeSharedObject(), pthread_condattr_destroy error", r);
		return CLStatus(-1, r);
	}

	return CLStatus(0, 0);
}

CLStatus CLSharedConditionVariableImpl::DestroySharedObject(SLSharedObjectHead *pObject)
{
	SLSharedConditionVariableItem *pCondItem = (SLSharedConditionVariableItem *)pObject;

	int r = pthread_cond_destroy(&(pCondItem->cond));
	if(r != 0)
	{
		CLLogger::WriteLogMsg("In CLSharedConditionVariableImpl::DestroySharedObject(), pthread_cond_destroy error", r);
		return CLStatus(-1, r);
	}

	return CLStatus(0, 0);
}


text:
package gov.cdc.epiinfo;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

public class Permissions extends AppCompatActivity {

    public static final int WRITE_EXTERNAL_STORAGE = 1;
    public static final int GPS = 2;
    public static final int CAMERA = 3;
    public static final int RECORD_AUDIO = 4;

    private int CurrentPermission;

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

        CurrentPermission = getIntent().getExtras().getInt("PermissionType");

        setContentView(R.layout.permissions);
        Button btnSet = findViewById(R.id.btnSet);
        TextView lblMessage = findViewById(R.id.lblMessage);
        TextView lblTitle = findViewById(R.id.lblTitle);

        switch (CurrentPermission)
        {
            case WRITE_EXTERNAL_STORAGE:
                lblTitle.setText(getString(R.string.request_storage));
                lblMessage.setText(getString(R.string.storage_desc));
                break;
            case GPS:
                lblTitle.setText(getString(R.string.request_location));
                lblMessage.setText(getString(R.string.location_desc));
                break;
            case RECORD_AUDIO:
                lblTitle.setText(getString(R.string.request_mic));
                lblMessage.setText(getString(R.string.mic_desc));
                break;
            case CAMERA:
                lblTitle.setText(getString(R.string.request_camera));
                lblMessage.setText(getString(R.string.camera_desc));
                break;
        }

        btnSet.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {

                switch (CurrentPermission)
                {
                    case WRITE_EXTERNAL_STORAGE:
                        checkStoragePermissions();
                        break;
                    case GPS:
                        checkGPSPermissions();
                        break;
                    case RECORD_AUDIO:
                        checkAudioPermissions();
                        break;
                    case CAMERA:
                        checkCameraPermissions();
                        break;
                }

            }
        });
    }

    @Override
    public void onRequestPermissionsResult(int requestCode,
                                           String[] permissions, int[] grantResults) {
        switch (requestCode) {
            case WRITE_EXTERNAL_STORAGE:
                // If request is cancelled, the result arrays are empty.
                if (grantResults.length > 0
                        && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                    // permission was granted, yay! Do the
                    // contacts-related task you need to do.
                    Intent p = new Intent(this, Permissions.class);
                    p.putExtra("PermissionType", Permissions.GPS);
                    startActivity(p);
                    this.finish();
                } else {
                    this.finish();
                }
                break;
            case GPS:
                if (grantResults.length > 0
                        && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                    // permission was granted, yay! Do the
                    // contacts-related task you need to do.
                    Intent p = new Intent(this, Permissions.class);
                    p.putExtra("PermissionType", Permissions.CAMERA);
                    startActivity(p);
                    this.finish();
                } else {
                    this.finish();
                }
                break;
            case CAMERA:
                if (grantResults.length > 0
                        && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                    // permission was granted, yay! Do the
                    // contacts-related task you need to do.
                    Intent p = new Intent(this, Permissions.class);
                    p.putExtra("PermissionType", Permissions.RECORD_AUDIO);
                    startActivity(p);
                    this.finish();
                } else {
                    this.finish();
                }
                break;
            case RECORD_AUDIO:
                if (grantResults.length > 0
                        && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                    // permission was granted, yay! Do the
                    // contacts-related task you need to do.
                    this.finish();
                } else {
                    this.finish();
                }
                break;

        }
    }

    private void checkStoragePermissions() {
        if (ContextCompat.checkSelfPermission(this,
                android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
                != PackageManager.PERMISSION_GRANTED) {

            ActivityCompat.requestPermissions(this,
                        new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE},
                        WRITE_EXTERNAL_STORAGE);

        } else {
            Intent permissions = new Intent(this, Permissions.class);
            permissions.putExtra("PermissionType",Permissions.GPS);
            startActivity(permissions);
            this.finish();
        }
    }

    private void checkGPSPermissions() {
        if (ContextCompat.checkSelfPermission(this,
                Manifest.permission.ACCESS_FINE_LOCATION)
                != PackageManager.PERMISSION_GRANTED) {

            ActivityCompat.requestPermissions(this,
                    new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
                    GPS);

        } else {
            Intent permissions = new Intent(this, Permissions.class);
            permissions.putExtra("PermissionType",Permissions.CAMERA);
            startActivity(permissions);
            this.finish();
        }
    }

    private void checkAudioPermissions() {
        if (ContextCompat.checkSelfPermission(this,
                Manifest.permission.RECORD_AUDIO)
                != PackageManager.PERMISSION_GRANTED) {

            ActivityCompat.requestPermissions(this,
                    new String[]{Manifest.permission.RECORD_AUDIO},
                    RECORD_AUDIO);

        } else {
            this.finish();
        }
    }

    private void checkCameraPermissions() {
        if (ContextCompat.checkSelfPermission(this,
                Manifest.permission.CAMERA)
                != PackageManager.PERMISSION_GRANTED) {

            ActivityCompat.requestPermissions(this,
                    new String[]{Manifest.permission.CAMERA},
                    CAMERA);

        } else {
            Intent permissions = new Intent(this, Permissions.class);
            permissions.putExtra("PermissionType",Permissions.RECORD_AUDIO);
            startActivity(permissions);
            this.finish();
        }
    }

}


text:
#include "OpenGLES.h"
using namespace Platform;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;

OpenGLES::OpenGLES() :
    mEglDisplay(EGL_NO_DISPLAY),
    mEglContext(EGL_NO_CONTEXT),
    mEglConfig(nullptr)
{
    Initialize();
}

OpenGLES::~OpenGLES()
{
    Cleanup();
}

void OpenGLES::Initialize()
{
    const EGLint configAttributes[] =
    {
        EGL_RED_SIZE, 8,
        EGL_GREEN_SIZE, 8,
        EGL_BLUE_SIZE, 8,
        EGL_ALPHA_SIZE, 8,
        EGL_DEPTH_SIZE, 8,
        EGL_STENCIL_SIZE, 8,
        EGL_NONE
    };

    const EGLint contextAttributes[] =
    {
        EGL_CONTEXT_CLIENT_VERSION, 2,
        EGL_NONE
    };

    const EGLint defaultDisplayAttributes[] =
    {
        // These are the default display attributes, used to request ANGLE's D3D11 renderer.
        // eglInitialize will only succeed with these attributes if the hardware supports D3D11 Feature Level 10_0+.
        EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,

        // EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER is an optimization that can have large performance benefits on mobile devices.
        // Its syntax is subject to change, though. Please update your Visual Studio templates if you experience compilation issues with it.
        EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE,

        // EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE is an option that enables ANGLE to automatically call
        // the IDXGIDevice3::Trim method on behalf of the application when it gets suspended.
        // Calling IDXGIDevice3::Trim when an application is suspended is a Windows Store application certification requirement.
        EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE,
        EGL_NONE,
    };

    const EGLint fl9_3DisplayAttributes[] =
    {
        // These can be used to request ANGLE's D3D11 renderer, with D3D11 Feature Level 9_3.
        // These attributes are used if the call to eglInitialize fails with the default display attributes.
        EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
        EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, 9,
        EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, 3,
        EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE,
        EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE,
        EGL_NONE,
    };

    const EGLint warpDisplayAttributes[] =
    {
        // These attributes can be used to request D3D11 WARP.
        // They are used if eglInitialize fails with both the default display attributes and the 9_3 display attributes.
        EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
        EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE,
        EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE,
        EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE,
        EGL_NONE,
    };

    EGLConfig config = NULL;

    // eglGetPlatformDisplayEXT is an alternative to eglGetDisplay. It allows us to pass in display attributes, used to configure D3D11.
    PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplayEXT"));
    if (!eglGetPlatformDisplayEXT)
    {
        throw Exception::CreateException(E_FAIL, L"Failed to get function eglGetPlatformDisplayEXT");
    }

    //
    // To initialize the display, we make three sets of calls to eglGetPlatformDisplayEXT and eglInitialize, with varying
    // parameters passed to eglGetPlatformDisplayEXT:
    // 1) The first calls uses "defaultDisplayAttributes" as a parameter. This corresponds to D3D11 Feature Level 10_0+.
    // 2) If eglInitialize fails for step 1 (e.g. because 10_0+ isn't supported by the default GPU), then we try again
    //    using "fl9_3DisplayAttributes". This corresponds to D3D11 Feature Level 9_3.
    // 3) If eglInitialize fails for step 2 (e.g. because 9_3+ isn't supported by the default GPU), then we try again
    //    using "warpDisplayAttributes".  This corresponds to D3D11 Feature Level 11_0 on WARP, a D3D11 software rasterizer.
    //

    // This tries to initialize EGL to D3D11 Feature Level 10_0+. See above comment for details.
    mEglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, defaultDisplayAttributes);
    if (mEglDisplay == EGL_NO_DISPLAY)
    {
        throw Exception::CreateException(E_FAIL, L"Failed to get EGL display");
    }

    if (eglInitialize(mEglDisplay, NULL, NULL) == EGL_FALSE)
    {
        // This tries to initialize EGL to D3D11 Feature Level 9_3, if 10_0+ is unavailable (e.g. on some mobile devices).
        mEglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, fl9_3DisplayAttributes);
        if (mEglDisplay == EGL_NO_DISPLAY)
        {
            throw Exception::CreateException(E_FAIL, L"Failed to get EGL display");
        }

        if (eglInitialize(mEglDisplay, NULL, NULL) == EGL_FALSE)
        {
            // This initializes EGL to D3D11 Feature Level 11_0 on WARP, if 9_3+ is unavailable on the default GPU.
            mEglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, warpDisplayAttributes);
            if (mEglDisplay == EGL_NO_DISPLAY)
            {
                throw Exception::CreateException(E_FAIL, L"Failed to get EGL display");
            }

            if (eglInitialize(mEglDisplay, NULL, NULL) == EGL_FALSE)
            {
                // If all of the calls to eglInitialize returned EGL_FALSE then an error has occurred.
                throw Exception::CreateException(E_FAIL, L"Failed to initialize EGL");
            }
        }
    }

    EGLint numConfigs = 0;
    if ((eglChooseConfig(mEglDisplay, configAttributes, &mEglConfig, 1, &numConfigs) == EGL_FALSE) || (numConfigs == 0))
    {
        throw Exception::CreateException(E_FAIL, L"Failed to choose first EGLConfig");
    }

    mEglContext = eglCreateContext(mEglDisplay, mEglConfig, EGL_NO_CONTEXT, contextAttributes);
    if (mEglContext == EGL_NO_CONTEXT)
    {
        throw Exception::CreateException(E_FAIL, L"Failed to create EGL context");
    }
}

void OpenGLES::Cleanup()
{
    if (mEglDisplay != EGL_NO_DISPLAY && mEglContext != EGL_NO_CONTEXT)
    {
        eglDestroyContext(mEglDisplay, mEglContext);
        mEglContext = EGL_NO_CONTEXT;
    }

    if (mEglDisplay != EGL_NO_DISPLAY)
    {
        eglTerminate(mEglDisplay);
        mEglDisplay = EGL_NO_DISPLAY;
    }
}

void OpenGLES::Reset()
{
    Cleanup();
    Initialize();
}

EGLSurface OpenGLES::CreateSurface(SwapChainPanel^ panel, const Size* renderSurfaceSize, const float* resolutionScale)
{
    if (!panel)
    {
        throw Exception::CreateException(E_INVALIDARG, L"SwapChainPanel parameter is invalid");
    }

    if (renderSurfaceSize != nullptr && resolutionScale != nullptr)
    {
        throw Exception::CreateException(E_INVALIDARG, L"A size and a scale can't both be specified");
    }

    EGLSurface surface = EGL_NO_SURFACE;

    const EGLint surfaceAttributes[] =
    {
        // EGL_ANGLE_SURFACE_RENDER_TO_BACK_BUFFER is part of the same optimization as EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER (see above).
        // If you have compilation issues with it then please update your Visual Studio templates.
        EGL_ANGLE_SURFACE_RENDER_TO_BACK_BUFFER, EGL_TRUE,
        EGL_NONE
    };

    // Create a PropertySet and initialize with the EGLNativeWindowType.
    PropertySet^ surfaceCreationProperties = ref new PropertySet();
    surfaceCreationProperties->Insert(ref new String(EGLNativeWindowTypeProperty), panel);

    // If a render surface size is specified, add it to the surface creation properties
    if (renderSurfaceSize != nullptr)
    {
        surfaceCreationProperties->Insert(ref new String(EGLRenderSurfaceSizeProperty), PropertyValue::CreateSize(*renderSurfaceSize));
    }

    // If a resolution scale is specified, add it to the surface creation properties
    if (resolutionScale != nullptr)
    {
        surfaceCreationProperties->Insert(ref new String(EGLRenderResolutionScaleProperty), PropertyValue::CreateSingle(*resolutionScale));
    }

    surface = eglCreateWindowSurface(mEglDisplay, mEglConfig, reinterpret_cast<IInspectable*>(surfaceCreationProperties), surfaceAttributes);
    if (surface == EGL_NO_SURFACE)
    {
        throw Exception::CreateException(E_FAIL, L"Failed to create EGL surface");
    }

    return surface;
}

void OpenGLES::GetSurfaceDimensions(const EGLSurface surface, EGLint* width, EGLint* height)
{
    eglQuerySurface(mEglDisplay, surface, EGL_WIDTH, width);
    eglQuerySurface(mEglDisplay, surface, EGL_HEIGHT, height);
}

void OpenGLES::DestroySurface(const EGLSurface surface)
{
    if (mEglDisplay != EGL_NO_DISPLAY && surface != EGL_NO_SURFACE)
    {
        eglDestroySurface(mEglDisplay, surface);
    }
}

void OpenGLES::MakeCurrent(const EGLSurface surface)
{
    if (eglMakeCurrent(mEglDisplay, surface, surface, mEglContext) == EGL_FALSE)
    {
        throw Exception::CreateException(E_FAIL, L"Failed to make EGLSurface current");
    }
}

EGLBoolean OpenGLES::SwapBuffers(const EGLSurface surface)
{
    return (eglSwapBuffers(mEglDisplay, surface));
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>mx.com.sidlors</groupId>
		<artifactId>neural-network</artifactId>
		<version>0.0.1-SNAPSHOT</version>
	</parent>
	<artifactId>Chapter2</artifactId>
	<packaging>jar</packaging>
</project>


text:
package com.vlath.beheexplorer.utils;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Environment;
import android.support.v7.app.AlertDialog;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.vlath.beheexplorer.R;

import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;

/**
 * Created by todo on 06.02.2017.
 */
public class FileChooser   {
    ListView list;
    AlertDialog.Builder builder;
    ArrayList<String> mArrayList = new ArrayList<>();
    ArrayAdapter<String> adt;
    String path = Environment.getExternalStorageDirectory().getAbsolutePath();
    String dirPath;
    FilenameFilter filter;
    Dialog dialog;
    private static String[] mFileList;
    private  File mPath = new File(path);

    private static final int DIALOG_LOAD_FILE = 1000;

    private  void loadDirList() {
        try {
            mPath.mkdirs();
        } catch (SecurityException e) {

        }
        if (mPath.exists()) {
            filter = new FilenameFilter() {
            @Override
            public boolean accept(File dir, String filename) {
                    File sel = new File(dir, filename);
                    return sel.isDirectory();
                }

            };
            mFileList = mPath.list(filter);
        } else {
            mFileList = new String[0];
        }
    }
    private  void loadFileList() {
        try {
            mPath.mkdirs();
        } catch (SecurityException e) {

        }
        if (mPath.exists()) {
            filter = new FilenameFilter() {
                @Override
                public boolean accept(File dir, String filename) {
                    File sel = new File(dir, filename);
                    return true;
                }

            };
            mFileList = mPath.list(filter);
        } else {
            mFileList = new String[0];
        }
    }
    public void showDirectoryDialog(final Context context) {
        loadDirList();
        for (String s : mFileList) {
            mArrayList.add(s);
        }
        adt = new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, mArrayList);
        list = new ListView(context);
        list.setAdapter(adt);
        list.setDivider(null);
        list.setDividerHeight(0);
        list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                   File file = new File(path);
                  if(mArrayList.get(i) == "..."){
                      path = file.getParent();
                      if(path == null){
                      }
                      else {
                          mPath = new File(path);
                          loadDirList();
                          mArrayList.clear();
                          for (String s : mFileList) {
                              mArrayList.add(s);
                          }
                          mArrayList.add(0, "...");
                          adt.notifyDataSetChanged();
                          dirPath = path;
                      }
                  }
                  else {
                      path += "/" + mArrayList.get(i);
                      file = new File(path);
                      if (file.isDirectory()) {
                          mFileList = file.list(filter);
                          mArrayList.clear();
                          mArrayList.add(0, "...");
                          for (String s : mFileList) {
                              mArrayList.add(s);
                          }
                          adt.notifyDataSetChanged();
                      }
                  }

                }
        });
        Dialog dialog = null;
        builder = new AlertDialog.Builder(context);
        builder.setTitle(context.getString(R.string.choose));
        if (mFileList == null) {
            dialog = builder.create();
        }
        builder.setView(list);
        builder.setPositiveButton(context.getString(R.string.select), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                dirPath = path;
                File fil = new File(dirPath,"behe-explorer.backup");
                ExportUtils.writeToFile(fil,builder.getContext());
            }
        });
        builder.show();
        adt.notifyDataSetChanged();
    }
    public void showFileDialog(final Context context) {
        loadFileList();
        for (String s : mFileList) {
            mArrayList.add(s);
        }

        builder = new AlertDialog.Builder(context);
        builder.setTitle(context.getString(R.string.choose));
        adt = new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, mArrayList);
        list = new ListView(context);
        list.setAdapter(adt);
        list.setDivider(null);
        list.setDividerHeight(0);
        list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                File file = new File(path);
                if(mArrayList.get(i) == "..."){
                    path = file.getParent();
                    if(path == null){
                    }
                    else {
                        mPath = new File(path);
                        loadFileList();
                        mArrayList.clear();
                        for (String s : mFileList) {
                            mArrayList.add(s);
                        }
                        mArrayList.add(0, "...");
                        adt.notifyDataSetChanged();
                        dirPath = path;
                    }
                }
                else {
                    path += "/" + mArrayList.get(i);
                    file = new File(path);
                    if (file.isDirectory()) {
                        mFileList = file.list();
                        mArrayList.clear();
                        mArrayList.add(0, "...");
                        for (String s : mFileList) {
                            mArrayList.add(s);
                        }
                        adt.notifyDataSetChanged();
                    }
                    else{
                        File fil = new File(path);
                        ExportUtils.readFromFile(fil,builder.getContext());
                        dialog.dismiss();
                    }
                }

            }
        });

        builder.setView(list);
        dialog = builder.create();
        dialog.show();
        adt.notifyDataSetChanged();
    }

}


text:
<?php

namespace League\OAuth2\Server\Util;

/**
 * SecureKey class
 */
class SecureKey
{
    /**
     * Generate a new unique code
     * @param  integer $len Length of the generated code
     * @return string
     */
    public static function make($len = 40)
    {
        // We generate twice as many bytes here because we want to ensure we have
        // enough after we base64 encode it to get the length we need because we
        // take out the "/", "+", and "=" characters.
        $bytes = openssl_random_pseudo_bytes($len * 2, $strong);

        // We want to stop execution if the key fails because, well, that is bad.
        if ($bytes === false || $strong === false) {
            // @codeCoverageIgnoreStart
            throw new \Exception('Error Generating Key');
            // @codeCoverageIgnoreEnd
        }

        return substr(str_replace(array('/', '+', '='), '', base64_encode($bytes)), 0, $len);
    }
}


text:
"""Coordinate data for powerview devices."""
from __future__ import annotations

from collections.abc import Iterable
from typing import Any

from aiopvapi.helpers.constants import ATTR_ID

from homeassistant.core import callback

@callback
def async_map_data_by_id(data: Iterable[dict[str | int, Any]]):
    """Return a dict with the key being the id for a list of entries."""
    return {entry[ATTR_ID]: entry for entry in data}


text:
package jo.sm.plugins.ship.replace;

import jo.sm.data.BlockTypes;
import jo.sm.ui.act.plugin.Description;

@Description(displayName="Replace Colors", shortDescription="Do a selective replace of colors")
public class ReplaceParameters
{
	@Description(displayName="Replace this")
    private short   mColor1;
	@Description(displayName="With this")
    private short   mColor2;

    public ReplaceParameters()
    {
        mColor1 = BlockTypes.HULL_COLOR_BLACK_ID;
        mColor2 = BlockTypes.HULL_COLOR_WHITE_ID;
    }

    public short getColor1()
    {
        return mColor1;
    }
    public void setColor1(short color1)
    {
        mColor1 = color1;
    }
    public short getColor2()
    {
        return mColor2;
    }
    public void setColor2(short color2)
    {
        mColor2 = color2;
    }
}


text:
'use strict';

import * as angular from 'angular';
import _ from 'lodash';

import { SERVER_GROUP_WRITER } from '@spinnaker/core';

export const GOOGLE_SERVERGROUP_DETAILS_RESIZE_RESIZECAPACITY_COMPONENT =
  'spinnaker.google.serverGroup.details.resize.capacity.component';
export const name = GOOGLE_SERVERGROUP_DETAILS_RESIZE_RESIZECAPACITY_COMPONENT; // for backwards compatibility
angular
  .module(GOOGLE_SERVERGROUP_DETAILS_RESIZE_RESIZECAPACITY_COMPONENT, [SERVER_GROUP_WRITER])
  .component('gceResizeCapacity', {
    bindings: {
      command: '=',
      application: '=',
      serverGroup: '=',
      formMethods: '=',
    },
    templateUrl: require('./resizeCapacity.component.html'),
    controller: [
      '$scope',
      'serverGroupWriter',
      function ($scope, serverGroupWriter) {
        this.command.newSize = null;

        angular.extend(this.formMethods, {
          formIsValid: () => _.every([this.command.newSize !== null, $scope.resizeCapacityForm.$valid]),
          submitMethod: () => {
            return serverGroupWriter.resizeServerGroup(this.serverGroup, this.application, {
              capacity: { min: this.command.newSize, max: this.command.newSize, desired: this.command.newSize },
              serverGroupName: this.serverGroup.name,
              targetSize: this.command.newSize,
              region: this.serverGroup.region,
              interestingHealthProviderNames: this.command.interestingHealthProviderNames,
              reason: this.command.reason,
            });
          },
        });
      },
    ],
  });


text:
declare module 'date-fns/each_day' {
  import {eachDay} from 'date-fns'
  export = eachDay
}


text:
package com.flashcard.repository

import com.flashcard.Store

case class CreateTable[A](sql: String, a: A) extends Store[A]


text:
/* ** GENEREATED FILE - DO NOT MODIFY ** */
package com.wilutions.mslib.msforms;
import com.wilutions.com.*;

/**
 * ReturnInteger.
 *
 */
@CoClass(guid="{82B02373-B5BC-11CF-810F-00A0C9030074}")
public class ReturnInteger extends Dispatch implements IReturnInteger {
  static boolean __typelib__loaded = __TypeLib.load();
  @DeclDISPID(0)  public void setValue(final Integer value) throws ComException {
    assert(value != null);
    this._dispatchCall(0,"Value", DISPATCH_PROPERTYPUT,value);
  }
  @DeclDISPID(0)  public Integer getValue() throws ComException {
    final Object obj = this._dispatchCall(0,"Value", DISPATCH_PROPERTYGET,null);
    if (obj == null) return null;
    return (Integer)obj;
  }
  public ReturnInteger() throws ComException {
    super("{82B02373-B5BC-11CF-810F-00A0C9030074}", "{82B02370-B5BC-11CF-810F-00A0C9030074}");
  }
  protected ReturnInteger(long ndisp) {
    super(ndisp);
  }
  public String toString() {
    return "[ReturnInteger" + super.toString() + "]";
  }
}


text:
Barometer myBarometer;
float temperature;
unsigned long duration;
unsigned long starttime;
unsigned long sampletime_ms = 3000;
unsigned long lowpulseoccupancy = 0;
float ratio = 0;
float concentration = 0;
int counter = 0;

void setup()
{
  LTask.begin();
  LWiFi.begin();
    pinMode(8,INPUT);

  Serial.begin(9600);
  myBarometer.init();

  // keep retrying until connected to AP
  Serial.println("Connecting to AP");
  while (0 == LWiFi.connect(WIFI_AP, LWiFiLoginInfo(WIFI_AUTH, WIFI_PASSWORD)))
  {
    delay(1000);
  }
}

void loop()
{
   temperature = myBarometer.bmp085GetTemperature(myBarometer.bmp085ReadUT()); //Get the temperature, bmp085ReadUT MUST be called first
     duration = pulseIn(8, LOW);
  lowpulseoccupancy = lowpulseoccupancy+duration;
 ratio = lowpulseoccupancy/1000;  // Integer percentage 0=>100
    concentration = 1.1*pow(ratio,3)-3.8*pow(ratio,2)+520*ratio+0.62;
  save_value(String(analogRead(A0)), String(temperature), String(concentration), String(analogRead(A2)));
  delay(500);

}

void save_value(String value, String a, String dust, String crow){

  Serial.println("Sending value to Ubidots...");
  LWiFiClient c;
  while (!c.connect(URL, 80))
  {
    Serial.println("Retrying to connect...");
    delay(100);
  }

  String data = "{\"value\":"+ value + "}";
  String thisLength = String(data.length());

  // Build HTTP POST request
  c.print("POST /api/v1.6/variables/");
  c.print(VARIABLEID);
  c.print("/values?token=");
  c.print(TOKEN);
  c.println(" HTTP/1.1");
  c.println("Content-Type: application/json");
  c.println("Content-Length: " + thisLength);
  c.print("Host: ");
  c.println(URL);
  c.print("\n" + data);
  c.print(char(26));

  data = "{\"value\":"+ a + "}";
  thisLength = String(data.length());

  // Build HTTP POST request
  c.print("POST /api/v1.6/variables/");
  c.print(VARIABLEID1);
  c.print("/values?token=");
  c.print(TOKEN);
  c.println(" HTTP/1.1");
  c.println("Content-Type: application/json");
  c.println("Content-Length: " + thisLength);
  c.print("Host: ");
  c.println(URL);
  c.print("\n" + data);
  c.print(char(26));
  //////////////////////////////////////////////////////////
   data = "{\"value\":"+ crow + "}";
  thisLength = String(data.length());

  // Build HTTP POST request
  c.print("POST /api/v1.6/variables/");
  c.print(VARIABLEID3);
  c.print("/values?token=");
  c.print(TOKEN);
  c.println(" HTTP/1.1");
  c.println("Content-Type: application/json");
  c.println("Content-Length: " + thisLength);
  c.print("Host: ");
  c.println(URL);
  c.print("\n" + data);
  c.print(char(26));
///////////////////////////////////////////////////////////////////

 data = "{\"value\":"+ dust + "}";
  thisLength = String(data.length());

  // Build HTTP POST request
  c.print("POST /api/v1.6/variables/");
  c.print(VARIABLEID2);
  c.print("/values?token=");
  c.print(TOKEN);
  c.println(" HTTP/1.1");
  c.println("Content-Type: application/json");
  c.println("Content-Length: " + thisLength);
  c.print("Host: ");
  c.println(URL);
  c.print("\n" + data);
  c.print(char(26));

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

  // read server response

  while (c){
    Serial.print((char)c.read());
  }

  c.stop();

}


text:
package com.example.accelerometersensortest;

import android.app.Activity;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

public class MainActivity extends Activity {

	private SensorManager sensorManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        sensorManager  = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
        Sensor sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
        sensorManager.registerListener(listener, sensor, SensorManager.SENSOR_DELAY_NORMAL);
    }

    @Override
	protected void onDestroy() {
		super.onDestroy();
		if (sensorManager != null) {
			sensorManager.unregisterListener(listener);
		}
	}

    private SensorEventListener listener = new SensorEventListener() {

		@Override
		public void onSensorChanged(SensorEvent event) {
			float xValue = Math.abs(event.values[0]);
			float yValue = Math.abs(event.values[1]);
			float zValue = Math.abs(event.values[2]);
			if (xValue > 15 || yValue > 15 || zValue > 15) {
				//ÈÏΪÓû§Ò¡¶¯ÁËÊÖ»ú
				Toast.makeText(MainActivity.this, "Ò¡Ò»Ò¡", Toast.LENGTH_SHORT).show();
			}
		}

		@Override
		public void onAccuracyChanged(Sensor sensor, int accuracy) {
		}
	};

	@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}


text:
var App;

var loginHandleError = function(error,params){
	//Handle Error
};

var loginHandleSuccess = function(response,params){
	App.LOG("App.API.User login success!");
	App.API.Transactions.syncTransactions(0);
};

var afterLogin = function(response, params){
	App.API.handleResponse("login",response,params,loginHandleError,loginHandleSuccess);
};

exports.login = function(){

	var payload = {
		userID:App.Models.User.getMyID()
	};

	 App.API.send({
        method : "POST",
        path : "/login",
        data : payload,
        callback : afterLogin
    });
};

exports.initialize = function(app){
	App = app;
};


text:
package com.yhamano.co4a5;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import com.yhamano.co4a5.music.Chord;
import com.yhamano.co4a5.music.Circle;
import com.yhamano.co4a5.music.Degree;
import com.yhamano.co4a5.music.Note;

public class PrintChords {

	public static void main(String args[]) {

		File dstFile = null;
		try {
			dstFile = new File(args[0]);
		} catch (Exception e){
			e.printStackTrace();
			System.err.println("args[0]: dstenation file path.");
			return;
		}

        Circle circleOf4ths = new Circle(Circle.FOURTH);
		Chord c_C = new Chord("C", Note.C, new Degree[]{Degree.P1st, Degree.M3rd, Degree.P5th});
		BufferedImage dstImg = circleOf4ths.draw(c_C);
		try {
			ImageIO.write(dstImg, "png", dstFile);
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}


text:
<!DOCTYPE html>

    <title>分类管理</title>
    <link href="{{.static_serve}}/assets/mui/css/latest/page_style.css?v={{.version}}" rel="stylesheet" type="text/css" />
    <link href="{{.static_serve}}/css/partner/partner.css" rel="stylesheet" type="text/css" />

* 分类名称:

            <input type="hidden" field="Id" value="0" />
            <input type="hidden" field="ParentId" value="0"/>
            <input type="text" field="Name" class="ui-validate ui-box" required="true" />

* 上级分类:

            <select class="ui-validate ui-box" field="ParentId">
                <option value="0">一根目录一</option>
                {{.cate_opts}}
            </select>

* 是否启用:

            <input type="radio" name="Enabled" field="Enabled" value="true" id="State1" checked="checked"/>启用
            <input type="radio" name="Enabled" field="Enabled" value="false" id="State2"/>停用

* 排序:

            <input class="ui-validate ui-box" field="OrderIndex" required="true" isnumber="true" style="width:30px" value="0"/>
            * 排序数字,越小排列越靠前

* 分类描述:

            <textarea field="Description" class="ui-validate ui-box tb_normal" length="[0,150]" style="height:80px"></textarea>

            保存
            重置<input type="reset" value="reset" />


text:
import * as React from 'react';
import { StandardProps } from '..';

export interface InputBaseProps
  extends StandardProps<
    React.HTMLAttributes<HTMLDivElement>,
    InputBaseClassKey,
    'onChange' | 'onKeyUp' | 'onKeyDown' | 'onBlur' | 'onFocus' | 'defaultValue'
  > {
  autoComplete?: string;
  autoFocus?: boolean;
  color?: 'primary' | 'secondary';
  defaultValue?: unknown;
  disabled?: boolean;
  endAdornment?: React.ReactNode;
  error?: boolean;
  fullWidth?: boolean;
  id?: string;
  inputComponent?: React.ElementType<InputBaseComponentProps>;
  inputProps?: InputBaseComponentProps;
  inputRef?: React.Ref<any>;
  margin?: 'dense' | 'none';
  multiline?: boolean;
  name?: string;
  placeholder?: string;
  readOnly?: boolean;
  required?: boolean;
  renderPrefix?: (state: {
    disabled?: boolean;
    error?: boolean;
    filled?: boolean;
    focused?: boolean;
    margin?: 'dense' | 'none' | 'normal';
    required?: boolean;
    startAdornment?: React.ReactNode;
  }) => React.ReactNode;
  rows?: string | number;
  rowsMax?: string | number;
  rowsMin?: string | number;
  startAdornment?: React.ReactNode;
  type?: string;
  value?: unknown;
  /**
   * `onChange`, `onKeyUp`, `onKeyDown`, `onBlur`, `onFocus` are applied to the inner `InputComponent`,
   * which by default is an input or textarea. Since these handlers differ from the
   * ones inherited by `React.HTMLAttributes<HTMLDivElement>` we need to omit them.
   */
  onChange?: React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;
  onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement | HTMLInputElement>;
  onKeyUp?: React.KeyboardEventHandler<HTMLTextAreaElement | HTMLInputElement>;
  onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
  onFocus?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
}

export interface InputBaseComponentProps
  extends React.HTMLAttributes<HTMLInputElement | HTMLTextAreaElement> {
  // Accommodate arbitrary additional props coming from the `inputProps` prop
  [arbitrary: string]: any;
}

export type InputBaseClassKey =
  | 'root'
  | 'formControl'
  | 'focused'
  | 'disabled'
  | 'adornedEnd'
  | 'adornedStart'
  | 'error'
  | 'marginDense'
  | 'multiline'
  | 'fullWidth'
  | 'colorSecondary'
  | 'input'
  | 'inputMarginDense'
  | 'inputMultiline'
  | 'inputTypeSearch'
  | 'inputAdornedStart'
  | 'inputAdornedEnd'
  | 'inputHiddenLabel';

declare const InputBase: React.ComponentType<InputBaseProps>;

export default InputBase;