text:
#include "spark_wiring_btstack.h"

#ifdef __cplusplus
extern "C" {
#endif

void ble_init(void)
{
    ble.init();
}

void ble_deInit(void)
{
    ble.deInit();
}

void ble_setTimer(btstack_timer_source_t *ts, uint32_t timeout_in_ms)
{
    ble.setTimer(ts, timeout_in_ms);
}

void ble_setTimerHandler(btstack_timer_source_t *ts, void (*process)(btstack_timer_source_t *_ts))
{
    ble.setTimerHandler(ts, process);
}

void ble_addTimer(btstack_timer_source_t *timer)
{
    ble.addTimer(timer);
}
int ble_removeTimer(btstack_timer_source_t *timer)
{
    return ble.removeTimer(timer);
}

uint32_t ble_getTimeMs(void)
{
    return ble.getTimeMs();
}

void ble_debugLogger(bool flag)
{
	ble.debugLogger(flag);
}

void ble_debugError(bool flag)
{
	ble.debugError(flag);
}

void ble_enablePacketLogger(void)
{
	ble.enablePacketLogger();
}

/***************************************************************
 *
 * Gap API
 *
***************************************************************/

void ble_setRandomAddrMode(gap_random_address_type_t random_addr_type)
{
    ble.setRandomAddrMode(random_addr_type);
}

void ble_setRandomAddr(bd_addr_t addr)
{
    ble.setRandomAddr(addr);
}

void ble_setPublicBDAddr(bd_addr_t addr)
{
    ble.setPublicBDAddr(addr);
}

void ble_getLocalBDAddr(bd_addr_t addr)
{
    ble.getLocalBdAddr(addr);
}

void ble_getAddrOfAdvPkt(uint8_t *addr_type, bd_addr_t addr)
{
    ble.getAddrOfAdvertisement(addr_type, addr);
}

void ble_setLocalName(const char *local_name)
{
    ble.setLocalName(local_name);
}

void ble_setAdvParams(advParams_t *adv_params)
{
    ble.setAdvertisementParams(adv_params);
}

void ble_setAdvData(uint16_t size, uint8_t *data)
{
    ble.setAdvertisementData(size, data);
}

void ble_setScanRspData(uint16_t size, uint8_t *data)
{
    ble.setScanResponseData(size, data);
}

void ble_onConnectedCallback(void (*callback)(BLEStatus_t status, uint16_t handle))
{
    ble.onConnectedCallback(callback);
}

void ble_onDisconnectedCallback(void (*callback)(uint16_t handle))
{
    ble.onDisconnectedCallback(callback);
}

void ble_startAdvertising(void)
{
    ble.startAdvertising();
}

void ble_stopAdvertising(void)
{
    ble.stopAdvertising();
}

void ble_disconnect(uint16_t conn_handle)
{
    ble.disconnect(conn_handle);
}

uint8_t ble_connect(bd_addr_t addr, bd_addr_type_t type)
{
    return ble.connect(addr, type);
}

void ble_setConnParams(le_connection_parameter_range_t range)
{
    ble.setConnParams(range);
}

void ble_startScanning(void)
{
    ble.startScanning();
}

void ble_stopScanning(void)
{
    ble.stopScanning();
}

void ble_setScanParams(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window)
{
    ble.setScanParams(scan_type, scan_interval, scan_window);
}

void ble_onScanReportCallback(void (*cb)(advertisementReport_t *advertisement_report))
{
    ble.onScanReportCallback(cb);
}

/***************************************************************
 *
 * Gatt server API
 *
***************************************************************/
void ble_addServiceUUID16(uint16_t uuid)
{
    ble.addService(uuid);
}

void ble_addServiceUUID128(uint8_t *uuid)
{
    ble.addService(uuid);
}

/**
 * @brief Add characteristic.
 *
 * @Note Just has read permit, if need to write,use "addCharacteristicDynamic".
 */
uint16_t ble_addCharacteristicUUID16(uint16_t uuid, uint16_t flags, uint8_t *data, uint16_t data_len)
{
    return ble.addCharacteristic(uuid, flags, data, data_len);
}

uint16_t ble_addCharacteristicUUID128(uint8_t *uuid, uint16_t flags, uint8_t *data, uint16_t data_len)
{
    return ble.addCharacteristic(uuid, flags, data, data_len);
}

uint16_t ble_addCharacteristicDynamicUUID16(uint16_t uuid, uint16_t flags, uint8_t *data, uint16_t data_len)
{
    return ble.addCharacteristicDynamic(uuid, flags, data, data_len);
}

uint16_t ble_addCharacteristicDynamicUUID128(uint8_t *uuid, uint16_t flags, uint8_t *data, uint16_t data_len)
{
    return ble.addCharacteristicDynamic(uuid, flags, data, data_len);
}

void ble_onDataReadCallback(uint16_t (*cb)(uint16_t handle, uint8_t *buffer, uint16_t buffer_size))
{
    ble.onDataReadCallback(cb);
}

void ble_onDataWriteCallback(int (*cb)(uint16_t handle, uint8_t *buffer, uint16_t buffer_size))
{
    ble.onDataWriteCallback(cb);
}

int ble_attServerCanSendPacket(void)
{
    return ble.attServerCanSendPacket();
}

int ble_sendNotify(uint16_t value_handle, uint8_t *value, uint16_t length)
{
    return ble.sendNotify(value_handle, value, length);
}

int ble_sendIndicate(uint16_t value_handle, uint8_t *value, uint16_t length)
{
    return ble.sendIndicate(value_handle, value, length);
}

/***************************************************************
 *
 * Gatt client API
 *
***************************************************************/
void ble_onServiceDiscoveredCallback(void (*cb)(BLEStatus_t status, uint16_t con_handle, gatt_client_service_t *service))
{
	ble.onServiceDiscoveredCallback(cb);
}

void ble_onCharacteristicDiscoveredCallback(void (*cb)(BLEStatus_t status, uint16_t con_handle, gatt_client_characteristic_t *characteristic))
{
	ble.onCharacteristicDiscoveredCallback(cb);
}

void ble_onDescriptorDiscoveredCallback(void (*cb)(BLEStatus_t status, uint16_t con_handle, gatt_client_characteristic_descriptor_t *characteristic))
{
	ble.onDescriptorDiscoveredCallback(cb);
}

void ble_onGattCharacteristicReadCallback(void (*cb)(BLEStatus_t status, uint16_t con_handle, uint16_t value_handle, uint8_t * value, uint16_t length))
{
	ble.onGattCharacteristicReadCallback(cb);
}

void ble_onGattCharacteristicWrittenCallback(void (*cb)(BLEStatus_t status, uint16_t con_handle))
{
	ble.onGattCharacteristicWrittenCallback(cb);
}

void ble_onGattDescriptorReadCallback(void (*cb)(BLEStatus_t status, uint16_t con_handle, uint16_t value_handle, uint8_t * value, uint16_t length))
{
	ble.onGattDescriptorReadCallback(cb);
}

void ble_onGattDescriptorWrittenCallback(void (*cb)(BLEStatus_t status, uint16_t con_handle))
{
	ble.onGattDescriptorWrittenCallback(cb);
}

void ble_onGattWriteClientCharacteristicConfigCallback(void (*cb)(BLEStatus_t status, uint16_t con_handle))
{
	ble.onGattWriteClientCharacteristicConfigCallback(cb);
}

void ble_onGattNotifyUpdateCallback(void (*cb)(BLEStatus_t status, uint16_t con_handle, uint16_t value_handle, uint8_t * value, uint16_t length))
{
	ble.onGattNotifyUpdateCallback(cb);
}

void ble_onGattIndicateUpdateCallback(void (*cb)(BLEStatus_t status, uint16_t con_handle, uint16_t value_handle, uint8_t * value, uint16_t length))
{
	ble.onGattIndicateUpdateCallback(cb);
}

uint8_t ble_discoverPrimaryServices(uint16_t con_handle)
{
	return ble.discoverPrimaryServices(con_handle);
}

uint8_t ble_discoverPrimaryServicesByUUID16(uint16_t con_handle, uint16_t uuid16)
{
	return ble.discoverPrimaryServices(con_handle, uuid16);
}

uint8_t ble_discoverPrimaryServicesByUUID128(uint16_t con_handle, const uint8_t *uuid)
{
	return ble.discoverPrimaryServices(con_handle, uuid);
}

uint8_t ble_discoverCharacteristics(uint16_t con_handle, gatt_client_service_t *service)
{
	return ble.discoverCharacteristics(con_handle, service);
}

uint8_t ble_discoverCharacteristicsForHandleByUUID16(uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid16)
{
	return ble.discoverCharacteristics(con_handle, start_handle, end_handle, uuid16);
}

uint8_t ble_discoverCharacteristicsForHandleByUUID128(uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint8_t *uuid)
{
	return ble.discoverCharacteristics(con_handle, start_handle, end_handle, uuid);
}

uint8_t ble_discoverCharacteristicsForServiceByUUID16(uint16_t con_handle, gatt_client_service_t *service, uint16_t uuid16)
{
	return ble.discoverCharacteristics(con_handle, service, uuid16);
}

uint8_t ble_discoverCharacteristicsForServiceByUUID128(uint16_t con_handle, gatt_client_service_t *service, uint8_t *uuid128)
{
	return ble.discoverCharacteristics(con_handle, service, uuid128);
}

uint8_t ble_discoverCharacteristicDescriptors(uint16_t con_handle, gatt_client_characteristic_t *characteristic)
{
	return ble.discoverCharacteristicDescriptors(con_handle, characteristic);
}

uint8_t ble_readValue(uint16_t con_handle, gatt_client_characteristic_t  *characteristic)
{
	return ble.readValue(con_handle, characteristic);
}

uint8_t ble_readValueUsingHandle(uint16_t con_handle, uint16_t characteristic_value_handle)
{
	return ble.readValue(con_handle, characteristic_value_handle);
}

uint8_t ble_readValueByUUID16(uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid16)
{
	return ble.readValue(con_handle, start_handle, end_handle, uuid16);
}

uint8_t ble_readValueByUUID128(uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint8_t *uuid128)
{
	return ble.readValue(con_handle, start_handle, end_handle, uuid128);
}

uint8_t ble_readLongValue(uint16_t con_handle, gatt_client_characteristic_t *characteristic)
{
	return ble.readLongValue(con_handle, characteristic);
}

uint8_t ble_readLongValueUsingHandle(uint16_t con_handle, uint16_t characteristic_value_handle)
{
	return ble.readLongValue(con_handle, characteristic_value_handle);
}

uint8_t ble_readLongValueWithOffset(uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t offset)
{
	return ble.readLongValueWithOffset(con_handle, characteristic_value_handle, offset);
}

uint8_t ble_writeValueWithoutResponse(uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t *data)
{
	return ble.writeValueWithoutResponse(con_handle, characteristic_value_handle, length, data);
}

uint8_t ble_writeValue(uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t *data)
{
	return ble.writeValue(con_handle, characteristic_value_handle, length, data);
}

uint8_t ble_writeLongValue(uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t *data)
{
	return ble.writeLongValue(con_handle, characteristic_value_handle, length, data);
}

uint8_t ble_writeLongValueWithOffset(uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t offset, uint16_t length, uint8_t *data)
{
	return ble.writeLongValueWithOffset(con_handle, characteristic_value_handle, offset, length, data);
}

uint8_t ble_readDescriptorValue(uint16_t con_handle, gatt_client_characteristic_descriptor_t *descriptor)
{
	return ble.readDescriptorValue(con_handle, descriptor);
}

uint8_t ble_readDescriptorValueUsingHandle(uint16_t con_handle, uint16_t descriptor_handle)
{
	return ble.readDescriptorValue(con_handle, descriptor_handle);
}

uint8_t ble_readLongDescriptorValue(uint16_t con_handle, gatt_client_characteristic_descriptor_t *descriptor)
{
	return ble.readLongDescriptorValue(con_handle, descriptor);
}

uint8_t ble_readLongDescriptorValueUsingHandle(uint16_t con_handle, uint16_t descriptor_handle)
{
	return ble.readLongDescriptorValue(con_handle, descriptor_handle);
}

uint8_t ble_readLongDescriptorValueWithOffset(uint16_t con_handle, uint16_t descriptor_handle, uint16_t offset)
{
	return ble.readLongDescriptorValueWithOffset(con_handle, descriptor_handle, offset);
}

uint8_t ble_writeDescriptorValue(uint16_t con_handle, gatt_client_characteristic_descriptor_t *descriptor, uint16_t length, uint8_t *data)
{
	return ble.writeDescriptorValue(con_handle, descriptor, length, data);
}

uint8_t ble_writeDescriptorValueUsingHandle(uint16_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t *data)
{
	return ble.writeDescriptorValue(con_handle, descriptor_handle, length, data);
}

uint8_t ble_writeLongDescriptorValue(uint16_t con_handle, gatt_client_characteristic_descriptor_t *descriptor, uint16_t length, uint8_t *data)
{
	return ble.writeLongDescriptorValue(con_handle, descriptor, length, data);
}

uint8_t ble_writeLongDescriptorValueUsingHandle(uint16_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t *data)
{
	return ble.writeLongDescriptorValue(con_handle, descriptor_handle, length, data);
}

uint8_t ble_writeLongDescriptorValueWithOffset(uint16_t con_handle, uint16_t descriptor_handle, uint16_t offset, uint16_t length, uint8_t *data)
{
	return ble.writeLongDescriptorValueWithOffset(con_handle, descriptor_handle, offset, length, data);
}

uint8_t ble_writeClientCharsConfigDescritpor(uint16_t con_handle, gatt_client_characteristic_t *characteristic, uint16_t configuration)
{
	return ble.writeClientCharsConfigDescritpor(con_handle, characteristic, configuration);
}

#ifdef __cplusplus
}
#endif


text:
<#
    DESCRIPTION:
        If server is a Terminal Services Server ensure it has a licence server set.

    REQUIRED-INPUTS:
        None

    DEFAULT-VALUES:
        None

    DEFAULT-STATE:
        Enabled

    RESULTS:
        PASS:
            Terminal services server is licensed
        WARNING:
        FAIL:
            Terminal services server is not licensed
        MANUAL:
        NA:
            Not a terminal services server

    APPLIES:
        Terminal Servers

    REQUIRED-FUNCTIONS:
        Check-IsTerminalServer
#>

Function sys-17-terminal-services-licensed
{
    $result        = newResult
    $result.server = $env:ComputerName
    $result.name   = $script:lang['Name']
    $result.check  = 'sys-17-terminal-services-licensed'

    #... CHECK STARTS HERE ...#

    Try
    {
        If ((Check-IsTerminalServer) -eq $true)
        {
            [System.Collections.ArrayList]$gITMp = @(Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\TermService\Parameters\LicenseServers' -Name 'SpecifiedLicenseServers' -ErrorAction SilentlyContinue)
            If ([string]::IsNullOrEmpty($gITMp) -eq $true)
            {
                $result.result  = $script:lang['Fail']
                $result.message = $script:lang['f001']
            }
            Else
            {
                $result.result  = $script:lang['Pass']
                $result.message = $script:lang['p001']
                $gITMp.SpecifiedLicenseServers | ForEach-Object -Process { $result.data += "$_,#" }
            }
        }
        Else
        {
            $result.result  = $script:lang['Not-Applicable']
            $result.message = $script:lang['n001']
        }
    }
    Catch
    {
        $result.result  = $script:lang['Error']
        $result.message = $script:lang['Script-Error']
        $result.data    = $_.Exception.Message
        Return $result
    }

    Return $result
}

redpajama_set_name: RedPajamaGithub


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

public class ConversationIM : MonoBehaviour
{
    [Tooltip("Mandatory. Drag the Conversations to this list that you want to run.")]
    public List<Conversation> conversation = new List<Conversation>();

    public enum ConversationType
    {
        Conversation
    }

    public void Start() {
        Component[] cmpt = gameObject.GetComponentsInChildren<Conversation>();
        foreach (Conversation c in cmpt)
            conversation.Add(c);
    }

    public void AddConversation(string type) {
        switch (type) {
            case "Conversation":
                GameObject n_conversation = new GameObject();
                n_conversation.name = "Conversation";
                n_conversation.AddComponent<Conversation>();
                n_conversation.AddComponent<JumpManager>();
                n_conversation.AddComponent<EventIM>();
                conversation.Add(n_conversation.GetComponent<Conversation>());
                SetParent(n_conversation);
                break;
        }
    }

    //Invoked when a new event is created.
    public void SetParent(GameObject eventInstance)
    {
        //Makes the GameObject "newParent" the parent of the GameObject.
        eventInstance.transform.parent = gameObject.transform;
    }
}


text:
UP NEXT

{{ vpUpcomingVideo.name }}

      {{ upcomingVideoDisplay.counter }}


text:
<?php

namespace Nether\Object\Struct;

use Nether\Object\Datafilter;
use Nether\Object\Struct\DatafilterItem;

class DatafilterCallable {

	public mixed
	$Func;

	public ?array
	$Argv;

	public function
	__Construct(callable $Func, ?array $Argv=NULL) {

		$this->Func = $Func;
		$this->Argv = $Argv;

		return;
	}

	public function
	__Invoke(mixed $Val, string $Key, Datafilter $Input):
	mixed {

		return ($this->Func)(
			new DatafilterItem($Val, $Key, $Input),
			...($this->Argv ?? [])
		);
	}

	public function
	__DebugInfo():
	array {

		$Output = [];

		if(is_callable($this->Func)) {
			$Output['Func'] = gettype($this->Func);
			$Output['Argv'] = $this->Argv;
		}

		return $Output;
	}

}


text:
"""Network for Cifar10."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os
import numpy as np
import tensorflow.compat.v1 as tf

# TO BE CHANGED, baseroute folder

PATH_MODEL = 'baseroute/models/cifar100/model'
NUM_CLASSES = 100
NUM_TRAIN = 50000
NUM_EVAL = 10000

def variable_on_cpu(name, shape):
  """Helper to create a Variable stored on CPU memory.

  Args:
    name: name of the variable
    shape: list of ints

  Returns:
    Variable Tensor
  """
  with tf.device('/cpu:0'):
    var = tf.get_variable(name, shape, dtype=tf.float32)
  return var

class NetworkCifar(object):
  """Network for CIFAR10 dataset, computing the features."""

  def __init__(self):
    """Initializes the class."""
    self.build_graph()

  def build_graph(self):
    """Builds the neural network graph."""

    # define graph
    self.g = tf.Graph()
    with self.g.as_default():
      self.sess = tf.Session()
      self.x = tf.placeholder(shape=[None, 24, 24, 3], dtype=tf.float32)
      self.y = tf.placeholder(shape=[None, NUM_CLASSES], dtype=tf.float32)

      # conv1
      with tf.variable_scope('conv1') as scope:
        kernel = variable_on_cpu('weights', shape=[5, 5, 3, 64])
        conv = tf.nn.conv2d(self.x, kernel, [1, 1, 1, 1], padding='SAME')
        biases = variable_on_cpu('biases', [64])
        pre_activation = tf.nn.bias_add(conv, biases)
        conv1 = tf.nn.relu(pre_activation, name=scope.name)

      # pool1
      pool1 = tf.nn.max_pool(conv1, ksize=[1, 3, 3, 1], strides=[1, 2, 2, 1],
                             padding='SAME', name='pool1')
      # norm1
      norm1 = tf.nn.lrn(pool1, 4, bias=1.0, alpha=0.001 / 9.0, beta=0.75,
                        name='norm1')

      # conv2
      with tf.variable_scope('conv2') as scope:
        kernel = variable_on_cpu('weights', shape=[5, 5, 64, 64])
        conv = tf.nn.conv2d(norm1, kernel, [1, 1, 1, 1], padding='SAME')
        biases = variable_on_cpu('biases', [64])
        pre_activation = tf.nn.bias_add(conv, biases)
        conv2 = tf.nn.relu(pre_activation, name=scope.name)

      # norm2
      norm2 = tf.nn.lrn(conv2, 4, bias=1.0, alpha=0.001 / 9.0, beta=0.75,
                        name='norm2')
      # pool2
      pool2 = tf.nn.max_pool(norm2, ksize=[1, 3, 3, 1],
                             strides=[1, 2, 2, 1], padding='SAME', name='pool2')

      # local3
      with tf.variable_scope('local3') as scope:
        # Move everything into depth so we can perform a single matrix multiply.
        # images.get_shape().as_list()[0] = batchsize
        # reshape = tf.keras.layers.Flatten()(pool2)
        reshape = tf.reshape(pool2, [tf.shape(self.x)[0], 6*6*64])
        dim = reshape.get_shape()[1].value
        weights = variable_on_cpu('weights', shape=[dim, 384])
        biases = variable_on_cpu('biases', [384])
        local3 = tf.nn.relu(tf.matmul(reshape, weights) + biases,
                            name=scope.name)

      # local4
      with tf.variable_scope('local4') as scope:
        weights = variable_on_cpu('weights', shape=[384, 192])
        biases = variable_on_cpu('biases', [192])
        self.local4 = tf.nn.relu(tf.matmul(local3, weights) + biases,
                                 name=scope.name)

      # linear layer(WX + b),
      # We don't apply softmax here because
      # tf.nn.sparse_softmax_cross_entropy_with_logits
      # accepts the unscaled logits
      # and performs the softmax internally for efficiency.
      with tf.variable_scope('softmax_linear') as scope:
        weights = variable_on_cpu('weights', [192, NUM_CLASSES])
        biases = variable_on_cpu('biases', [NUM_CLASSES])
        self.softmax_linear = tf.add(tf.matmul(self.local4, weights),
                                     biases, name=scope.name)

      print('loading the network ...')
      saver_network = tf.train.Saver()
      # Restores from checkpoint
      saver_network.restore(
          self.sess, os.path.join(PATH_MODEL, 'model.ckpt-100000'))
      print('Graph successfully loaded.')

  def features(self, x):
    """Computes the features of the last but one layer."""
    features = []
    nb_chunks = 100
    q = x.shape[0] // nb_chunks
    r = x.shape[0] % nb_chunks
    for i in np.arange(nb_chunks):
      batch_x = x[i*q:(i+1)*q, :]
      feed_dict = {self.x: batch_x}
      features_v = self.sess.run(self.local4, feed_dict=feed_dict)
      features.append(features_v)
    if r > 0:
      batch_x = x[(100*q):, :]
      feed_dict = {self.x: batch_x}
      features_v = self.sess.run(self.local4, feed_dict=feed_dict)
      features.append(features_v)
    features = np.vstack(tuple(features))
    return features


text:
import React, { PropTypes, Component } from 'react'

export default class Sidebar extends Component{
  static propTypes = {
    indexImg: PropTypes.any.isRequired
  }

  render(){
    const {indexImg} = this.props
    let styles = { backgroundImage: 'url(' + indexImg + ')'}
    return (

Jack Hu

有朋自远方来

不亦乐乎

    )
  }
}


text:
package org.elasticsearch.common.unit;

import org.elasticsearch.ElasticSearchParseException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;

import java.io.IOException;
import java.io.Serializable;

/**
 *
 */
public class ByteSizeValue implements Serializable, Streamable {

    private long size;

    private ByteSizeUnit sizeUnit;

    private ByteSizeValue() {

    }

    public ByteSizeValue(long bytes) {
        this(bytes, ByteSizeUnit.BYTES);
    }

    public ByteSizeValue(long size, ByteSizeUnit sizeUnit) {
        this.size = size;
        this.sizeUnit = sizeUnit;
    }

    public long bytes() {
        return sizeUnit.toBytes(size);
    }

    public long getBytes() {
        return bytes();
    }

    public long kb() {
        return sizeUnit.toKB(size);
    }

    public long getKb() {
        return kb();
    }

    public long mb() {
        return sizeUnit.toMB(size);
    }

    public long getMb() {
        return mb();
    }

    public long gb() {
        return sizeUnit.toGB(size);
    }

    public long getGb() {
        return gb();
    }

    public double kbFrac() {
        return ((double) bytes()) / ByteSizeUnit.C1;
    }

    public double getKbFrac() {
        return kbFrac();
    }

    public double mbFrac() {
        return ((double) bytes()) / ByteSizeUnit.C2;
    }

    public double getMbFrac() {
        return mbFrac();
    }

    public double gbFrac() {
        return ((double) bytes()) / ByteSizeUnit.C3;
    }

    public double getGbFrac() {
        return gbFrac();
    }

    @Override
    public String toString() {
        long bytes = bytes();
        double value = bytes;
        String suffix = "b";
        if (bytes >= ByteSizeUnit.C3) {
            value = gbFrac();
            suffix = "gb";
        } else if (bytes >= ByteSizeUnit.C2) {
            value = mbFrac();
            suffix = "mb";
        } else if (bytes >= ByteSizeUnit.C1) {
            value = kbFrac();
            suffix = "kb";
        }
        return Strings.format1Decimals(value, suffix);
    }

    public static ByteSizeValue parseBytesSizeValue(String sValue) throws ElasticSearchParseException {
        return parseBytesSizeValue(sValue, null);
    }

    public static ByteSizeValue parseBytesSizeValue(String sValue, ByteSizeValue defaultValue) throws ElasticSearchParseException {
        if (sValue == null) {
            return defaultValue;
        }
        long bytes;
        try {
            if (sValue.endsWith("k") || sValue.endsWith("K")) {
                bytes = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * ByteSizeUnit.C1);
            } else if (sValue.endsWith("kb")) {
                bytes = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 2)) * ByteSizeUnit.C1);
            } else if (sValue.endsWith("m") || sValue.endsWith("M")) {
                bytes = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * ByteSizeUnit.C2);
            } else if (sValue.endsWith("mb")) {
                bytes = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 2)) * ByteSizeUnit.C2);
            } else if (sValue.endsWith("g") || sValue.endsWith("G")) {
                bytes = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 1)) * ByteSizeUnit.C3);
            } else if (sValue.endsWith("gb")) {
                bytes = (long) (Double.parseDouble(sValue.substring(0, sValue.length() - 2)) * ByteSizeUnit.C3);
            } else if (sValue.endsWith("b")) {
                bytes = Long.parseLong(sValue.substring(0, sValue.length() - 1));
            } else {
                bytes = Long.parseLong(sValue);
            }
        } catch (NumberFormatException e) {
            throw new ElasticSearchParseException("Failed to parse [" + sValue + "]", e);
        }
        return new ByteSizeValue(bytes, ByteSizeUnit.BYTES);
    }

    public static ByteSizeValue readBytesSizeValue(StreamInput in) throws IOException {
        ByteSizeValue sizeValue = new ByteSizeValue();
        sizeValue.readFrom(in);
        return sizeValue;
    }

    @Override
    public void readFrom(StreamInput in) throws IOException {
        size = in.readVLong();
        sizeUnit = ByteSizeUnit.BYTES;
    }

    @Override
    public void writeTo(StreamOutput out) throws IOException {
        out.writeVLong(bytes());
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ByteSizeValue sizeValue = (ByteSizeValue) o;

        if (size != sizeValue.size) return false;
        if (sizeUnit != sizeValue.sizeUnit) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (size ^ (size >>> 32));
        result = 31 * result + (sizeUnit != null ? sizeUnit.hashCode() : 0);
        return result;
    }
}


text:
package lib

import (
	"fmt"
	"io/ioutil"
	"os"
	"strings"
)

var specChineseReplication = SpecText{
	synopsisText: "bucket的跨区域同步配置管理",

	paramText: "bucket_url [local_xml_file|ruleID] [options]",

	syntaxText: `
    ossuitl replication --method put oss://bucket local_xml_file [options]
    ossuitl replication --method get oss://bucket [options]
    ossuitl replication --method delete oss://bucket ruleID [options]
    ossuitl replication --method get --item location oss://bucket [options]
    ossuitl replication --method get --item progress oss://bucket [ruleID] [options]
`,
	detailHelpText: `
    replication命令通过设置method选项值为put、get、delete,可以设置、查询或者删除bucket的跨区域复制规则;
    此外,当method选项为get时,可通过设置item选项选项值为location、progress,可以查询可复制到的目标bucket
    所在的地域或者bucket的跨区域复制进度信息

用法:
    该命令有五种用法:

    1) ossuitl replication --method put oss://bucket local_xml_file [options]
        这个命令从配置文件local_xml_file中读取跨区域复制的配置,然后设置bucket的跨区域复制规则,
        配置文件是一个xml格式的文件,举例如下

        <?xml version="1.0" encoding="UTF-8"?>
        <ReplicationConfiguration>
           <Rule>
    	        <PrefixSet>
                    <Prefix>prefix_1</Prefix>
                    <Prefix>prefix_2</Prefix>
                </PrefixSet>
                <Action>ALL,PUT</Action>
                <Destination>
                    <Bucket>dest-bucket-name</Bucket>
                    <Location>oss-cn-hangzhou</Location>
                    <TransferType>oss_acc</TransferType>
                </Destination>
                <HistoricalObjectReplication>enabled</HistoricalObjectReplication>
           </Rule>
        </ReplicationConfiguration>

    2) ossuitl replication --method get oss://bucket [options]
        这个命令查询bucket的跨区域复制规则,目前只支持输出到屏幕上

    3) ossuitl replication --method delete oss://bucket ruleId [options]
        这个命令停止bucket的跨区域复制并删除bucket的复制配置

    4) ossuitl replication --method get --item location oss://bucket [options]
        这个命令查询可复制到的目标bucket所在的地域,目前只支持输出到屏幕上

    5) ossuitl replication --method get --item progress oss://bucket [ruleID] [options]
        这个命令查询bucket的跨区域复制进度,如果输入参数ruleID,则查询该ID对应的跨区域复制进度,否则查询bucket所有的跨区域复制进度,目前只支持输出到屏幕上
`,
	sampleText: `
    1) 设置bucket的跨区域复制规则
       ossuitl replication --method put oss://bucket local_xml_file

    2) 查询bucket的跨区域复制规则,结果输出到标准输出
       ossuitl replication --method get oss://bucket

    3) 删除bucket的跨区域复制规则
       ossuitl replication --method delete oss://bucket ruleID

    4) 查询可复制到的目标bucket所在的地域,结果输出到标准输出
       ossuitl replication --method get --item location oss://bucket

    5) 查询bucket所有的跨区域复制进度,结果输出到标准输出
       ossuitl replication --method get --item progress oss://bucket

    6) 查询bucket在指定ruleID下的跨区域复制进度,结果输出到标准输出
       ossuitl replication --method get --item progress oss://bucket ruleID
`,
}

var specEnglishreplication = SpecText{
	synopsisText: "manage bucket's replication configuration",

	paramText: "bucket_url [local_xml_file|ruleID] [options]",

	syntaxText: `
    ossuitl replication --method put oss://bucket local_xml_file [options]
    ossuitl replication --method get oss://bucket [options]
    ossuitl replication --method delete oss://bucket ruleID [options]
    ossuitl replication --method get --item location oss://bucket [options]
    ossuitl replication --method get --item progress oss://bucket [ruleID] [options]
`,
	detailHelpText: `
    replication command can set, get and delete cross region replication rules of
    the oss bucket by setting method option value to put, get and delete; in addition,
    when the method option is get, you can get the region where the target bucket can
    be copied to or the cross region replication progress of the bucket by setting item
    option value to location and progress

Usage:
    There are five usages for this command:

    1) ossuitl replication --method put oss://bucket local_xml_file [options]
        The command sets the cross region replication rules of bucket from local file local_xml_file
        The local_xml_file is xml format,for example

		<?xml version="1.0" encoding="UTF-8"?>
		<ReplicationConfiguration>
		   <Rule>
				<PrefixSet>
					<Prefix>prefix_1</Prefix>
					<Prefix>prefix_2</Prefix>
				</PrefixSet>
				<Action>ALL,PUT</Action>
				<Destination>
					<Bucket>dest-bucket-name</Bucket>
					<Location>oss-cn-hangzhou</Location>
					<TransferType>oss_acc</TransferType>
				</Destination>
				<HistoricalObjectReplication>enabled</HistoricalObjectReplication>
		   </Rule>
		</ReplicationConfiguration>

    2) ossuitl replication --method get oss://bucket [options]
       The command gets the cross region replication rules of bucket
       At present, it only supports output to stdout

    3) ossuitl replication --method delete oss://bucket ruleID
       The command stops the cross region replication of bucket and
	   removes the replication configuration of bucket

    4) ossuitl replication --method get --item location oss://bucket [options]
       The command gets the regions of the target bucket that can be copied to
       At present, it only supports output to stdout

    5) ossuitl replication --method get --item progress oss://bucket [ruleID] [options]
       The command gets the cross region replication progress of bucket
       If you input the parameter ruleID, the cross region replication progress corresponding to the ID will be gotten
       If you don't input the parameter ruleID, all cross region replication progress will be gotten
       At present, it only supports output to stdout
`,
	sampleText: `
    1) put bucket cross region replication rules
       ossuitl replication --method put oss://bucket local_xml_file

    2) get bucket cross region replication rules, output to stdout
       ossuitl replication --method get oss://bucket

    3) delete bucket cross region replication rules
       ossuitl replication --method delete oss://bucket ruleID

    4) get regions where the target bucket can be copied to, output to stdout
       ossuitl replication --method get --item location oss://bucket

    5) get bucket all the cross region replication progress, output to stdout
       ossuitl replication --method get --item progress oss://bucket

    6) get bucket the cross region replication progress with the specified ruleID, output to stdout
       ossuitl replication --method get --item progress oss://bucket ruleID
`,
}

type ReplicationCommand struct {
	command    Command
	bucketName string
}

var replicationCommand = ReplicationCommand{
	command: Command{
		name:        "replication",
		nameAlias:   []string{"replication"},
		minArgc:     1,
		maxArgc:     2,
		specChinese: specChineseReplication,
		specEnglish: specEnglishreplication,
		group:       GroupTypeNormalCommand,
		validOptionNames: []string{
			OptionConfigFile,
			OptionEndpoint,
			OptionAccessKeyID,
			OptionAccessKeySecret,
			OptionSTSToken,
			OptionProxyHost,
			OptionProxyUser,
			OptionProxyPwd,
			OptionLogLevel,
			OptionMode,
			OptionECSRoleName,
			OptionTokenTimeout,
			OptionRamRoleArn,
			OptionRoleSessionName,
			OptionReadTimeout,
			OptionConnectTimeout,
			OptionSTSRegion,
			OptionMethod,
			OptionItem,
			OptionSkipVerfiyCert,
			OptionUserAgent,
		},
	},
}

// function for FormatHelper interface
func (replicationc *ReplicationCommand) formatHelpForWhole() string {
	return replicationc.command.formatHelpForWhole()
}

func (replicationc *ReplicationCommand) formatIndependHelp() string {
	return replicationc.command.formatIndependHelp()
}

// Init simulate inheritance, and polymorphism
func (replicationc *ReplicationCommand) Init(args []string, options OptionMapType) error {
	return replicationc.command.Init(args, options, replicationc)
}

// RunCommand simulate inheritance, and polymorphism
func (replicationc *ReplicationCommand) RunCommand() error {
	strMethod, _ := GetString(OptionMethod, replicationc.command.options)
	strItem, _ := GetString(OptionItem, replicationc.command.options)

	if strMethod == "" {
		return fmt.Errorf("--method value is empty")
	}

	strMethod = strings.ToLower(strMethod)
	if strMethod != "put" && strMethod != "get" && strMethod != "delete" {
		return fmt.Errorf("--method value is not in the optional value:put|get|delete")
	}

	strItem = strings.ToLower(strItem)
	if strMethod == "get" && strItem != "" && strItem != "location" && strItem != "progress" {
		return fmt.Errorf("--item value is not in the optional value:location|progress")
	}

	srcBucketUrL, err := GetCloudUrl(replicationc.command.args[0], "")
	if err != nil {
		return err
	}

	replicationc.bucketName = srcBucketUrL.bucket
	if strMethod == "put" {
		err = replicationc.PutBucketReplication()
	} else if strMethod == "get" {
		if strItem == "" {
			err = replicationc.GetBucketReplication()
		} else if strItem == "location" {
			err = replicationc.GetBucketReplicationLocation()
		} else if strItem == "progress" {
			err = replicationc.GetBucketReplicationProgress()
		}
	} else if strMethod == "delete" {
		err = replicationc.DeleteBucketReplication()
	}
	return err
}

func (replicationc *ReplicationCommand) PutBucketReplication() error {
	if len(replicationc.command.args) < 2 {
		return fmt.Errorf("put bucket replication need at least 2 parameters,the local xml file is empty")
	}

	xmlFile := replicationc.command.args[1]
	fileInfo, err := os.Stat(xmlFile)
	if err != nil {
		return err
	}

	if fileInfo.IsDir() {
		return fmt.Errorf("%s is dir,not the expected file", xmlFile)
	}

	if fileInfo.Size() == 0 {
		return fmt.Errorf("%s is empty file", xmlFile)
	}

	// parsing the xml file
	file, err := os.Open(xmlFile)
	if err != nil {
		return err
	}
	defer file.Close()
	text, err := ioutil.ReadAll(file)
	if err != nil {
		return err
	}

	client, err := replicationc.command.ossClient(replicationc.bucketName)
	if err != nil {
		return err
	}
	return client.PutBucketReplication(replicationc.bucketName, string(text))
}

func (replicationc *ReplicationCommand) GetBucketReplication() error {
	client, err := replicationc.command.ossClient(replicationc.bucketName)
	if err != nil {
		return err
	}
	data, err := client.GetBucketReplication(replicationc.bucketName)
	if err == nil {
		fmt.Printf("%s\n", data)
	}
	return err
}

func (replicationc *ReplicationCommand) DeleteBucketReplication() error {
	if len(replicationc.command.args) < 2 {
		return fmt.Errorf("delete bucket replication need at least 2 parameters,the rule ID is empty")
	}

	ruleID := replicationc.command.args[1]
	client, err := replicationc.command.ossClient(replicationc.bucketName)
	if err != nil {
		return err
	}
	return client.DeleteBucketReplication(replicationc.bucketName, ruleID)
}

func (replicationc *ReplicationCommand) GetBucketReplicationLocation() error {
	client, err := replicationc.command.ossClient(replicationc.bucketName)
	if err != nil {
		return err
	}

	data, err := client.GetBucketReplicationLocation(replicationc.bucketName)
	if err == nil {
		fmt.Printf("%s\n", data)
	}
	return err
}

func (replicationc *ReplicationCommand) GetBucketReplicationProgress() error {
	ruleID := ""

	if len(replicationc.command.args) >= 2 {
		ruleID = replicationc.command.args[1]
	}

	client, err := replicationc.command.ossClient(replicationc.bucketName)
	if err != nil {
		return err
	}

	data, err := client.GetBucketReplicationProgress(replicationc.bucketName, ruleID)
	if err == nil {
		fmt.Printf("%s\n", data)
	}
	return err
}


text:
import pandas as pd
import numpy as np
from sklearn.cross_validation import KFold
import xgboost as xgb
from datetime import datetime
from copy import deepcopy

class KLabelFolds():
    def __init__(self, labels, n_folds=3):
        self.labels = labels
        self.n_folds = n_folds

    def __iter__(self):
        try:
            unique_labels = self.labels.unique()
        except:
            unique_labels = np.unique(self.labels)
        cv = KFold(len(unique_labels), self.n_folds)
        for train, test in cv:
            test_labels = unique_labels[test]
            try:
                test_mask = self.labels.isin(test_labels)
            except:
                test_mask = np.in1d(self.labels, test_labels)
            train_mask = np.logical_not(test_mask)
            yield (np.where(train_mask)[0], np.where(test_mask)[0])

    def __len__(self):
        return self.n_folds

def ensemble_cv(lst, data, labels, scoring=None, cv=None, test=None):
    try:
        if round(sum([e[0] for e in lst]), 3) == 1.0:
            weights = True
        else:
            weights = False
            print('WARNING: weights dont add up to 100%, using equal weights')
    except:
        weights = None

    if type(cv) != type(None):
        print('model ensemble crossval ...')
        scores = []
        counter = 1
        t0 = datetime.now()
        for train_ix, test_ix in cv:
            t1 = datetime.now()
            y_pred = []
            X_train, y_train = data.loc[train_ix, :], labels.loc[train_ix]
            X_test, y_test = data.loc[test_ix, :], labels.loc[test_ix]

            for elem in lst:
                if weights == True:
                    weight, model = elem
                elif weights == False:
                    weight, model = 1/len(lst), elem[1]
                elif weights == None:
                    weight, model = 1/len(lst), elem
                model.fit(X_train, y_train)
                y_pred.append(model.predict(X_test) * weight)

            y_pred = pd.concat([pd.Series(i) for i in y_pred], axis=1).sum(axis=1)
            try:
                score = scoring._score_func(y_test, y_pred)
            except AttributeError:
                score = scoring(y_test, y_pred)
            scores.append(score)
            print('Job: {}/{} - Score: {:.4f} - Runtime last: {:.1f} min, total: {:.1f} min'.format(counter, len(cv), score, (datetime.now()-t1).total_seconds()/60, (datetime.now()-t0).total_seconds()/60))
            counter += 1
        return np.array(scores)
    elif type(test) != type(None):
        t0 = datetime.now()
        counter = 1
        print('model ensemble prediction ...')
        preds = []
        for elem in lst:
            t1 = datetime.now()
            if weights == True:
                weight, model = elem
            elif weights == False:
                weight, model = 1/len(lst), elem[1]
            elif weights == None:
                weight, model = 1/len(lst), elem
            model.fit(data, labels)
            preds.append(model.predict(test) * weight)
            print('Job: {} of {} - Runtime last: {:.1f} min, total: {:.1f} min'.format(counter, len(lst), (datetime.now()-t1).total_seconds()/60, (datetime.now()-t0).total_seconds()/60))
            counter += 1
        return pd.concat([pd.Series(i).astype(float) for i in preds], axis=1).sum(axis=1)
    else:
        raise AttributeError('specify either cv or test to run ensemble_cv')


text:
package org.joda.time;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
 * This class is a Junit unit test for Hours.
 *
 * @author Stephen Colebourne
 */
public class TestHours extends TestCase {
    // Test in 2002/03 as time zones are more well known
    // (before the late 90's they were all over the place)
    private static final DateTimeZone PARIS = DateTimeZone.forID("Europe/Paris");

    public static void main(String[] args) {
        junit.textui.TestRunner.run(suite());
    }

    public static TestSuite suite() {
        return new TestSuite(TestHours.class);
    }

    public TestHours(String name) {
        super(name);
    }

    @Override
    protected void setUp() throws Exception {
    }

    @Override
    protected void tearDown() throws Exception {
    }

    //-----------------------------------------------------------------------
    public void testConstants() {
        assertEquals(0, Hours.ZERO.getHours());
        assertEquals(1, Hours.ONE.getHours());
        assertEquals(2, Hours.TWO.getHours());
        assertEquals(3, Hours.THREE.getHours());
        assertEquals(4, Hours.FOUR.getHours());
        assertEquals(5, Hours.FIVE.getHours());
        assertEquals(6, Hours.SIX.getHours());
        assertEquals(7, Hours.SEVEN.getHours());
        assertEquals(8, Hours.EIGHT.getHours());
        assertEquals(Integer.MAX_VALUE, Hours.MAX_VALUE.getHours());
        assertEquals(Integer.MIN_VALUE, Hours.MIN_VALUE.getHours());
    }

    //-----------------------------------------------------------------------
    public void testFactory_hours_int() {
        assertSame(Hours.ZERO, Hours.hours(0));
        assertSame(Hours.ONE, Hours.hours(1));
        assertSame(Hours.TWO, Hours.hours(2));
        assertSame(Hours.THREE, Hours.hours(3));
        assertSame(Hours.FOUR, Hours.hours(4));
        assertSame(Hours.FIVE, Hours.hours(5));
        assertSame(Hours.SIX, Hours.hours(6));
        assertSame(Hours.SEVEN, Hours.hours(7));
        assertSame(Hours.EIGHT, Hours.hours(8));
        assertSame(Hours.MAX_VALUE, Hours.hours(Integer.MAX_VALUE));
        assertSame(Hours.MIN_VALUE, Hours.hours(Integer.MIN_VALUE));
        assertEquals(-1, Hours.hours(-1).getHours());
        assertEquals(9, Hours.hours(9).getHours());
    }

    //-----------------------------------------------------------------------
    public void testFactory_hoursBetween_RInstant() {
        DateTime start = new DateTime(2006, 6, 9, 12, 0, 0, 0, PARIS);
        DateTime end1 = new DateTime(2006, 6, 9, 15, 0, 0, 0, PARIS);
        DateTime end2 = new DateTime(2006, 6, 9, 18, 0, 0, 0, PARIS);

        assertEquals(3, Hours.hoursBetween(start, end1).getHours());
        assertEquals(0, Hours.hoursBetween(start, start).getHours());
        assertEquals(0, Hours.hoursBetween(end1, end1).getHours());
        assertEquals(-3, Hours.hoursBetween(end1, start).getHours());
        assertEquals(6, Hours.hoursBetween(start, end2).getHours());
    }

    public void testFactory_hoursBetween_RPartial() {
        LocalTime start = new LocalTime(12, 0);
        LocalTime end1 = new LocalTime(15, 0);
        @SuppressWarnings("deprecation")
        TimeOfDay end2 = new TimeOfDay(18, 0);

        assertEquals(3, Hours.hoursBetween(start, end1).getHours());
        assertEquals(0, Hours.hoursBetween(start, start).getHours());
        assertEquals(0, Hours.hoursBetween(end1, end1).getHours());
        assertEquals(-3, Hours.hoursBetween(end1, start).getHours());
        assertEquals(6, Hours.hoursBetween(start, end2).getHours());
    }

    public void testFactory_hoursIn_RInterval() {
        DateTime start = new DateTime(2006, 6, 9, 12, 0, 0, 0, PARIS);
        DateTime end1 = new DateTime(2006, 6, 9, 15, 0, 0, 0, PARIS);
        DateTime end2 = new DateTime(2006, 6, 9, 18, 0, 0, 0, PARIS);

        assertEquals(0, Hours.hoursIn((ReadableInterval) null).getHours());
        assertEquals(3, Hours.hoursIn(new Interval(start, end1)).getHours());
        assertEquals(0, Hours.hoursIn(new Interval(start, start)).getHours());
        assertEquals(0, Hours.hoursIn(new Interval(end1, end1)).getHours());
        assertEquals(6, Hours.hoursIn(new Interval(start, end2)).getHours());
    }

    public void testFactory_standardHoursIn_RPeriod() {
        assertEquals(0, Hours.standardHoursIn((ReadablePeriod) null).getHours());
        assertEquals(0, Hours.standardHoursIn(Period.ZERO).getHours());
        assertEquals(1, Hours.standardHoursIn(new Period(0, 0, 0, 0, 1, 0, 0, 0)).getHours());
        assertEquals(123, Hours.standardHoursIn(Period.hours(123)).getHours());
        assertEquals(-987, Hours.standardHoursIn(Period.hours(-987)).getHours());
        assertEquals(1, Hours.standardHoursIn(Period.minutes(119)).getHours());
        assertEquals(2, Hours.standardHoursIn(Period.minutes(120)).getHours());
        assertEquals(2, Hours.standardHoursIn(Period.minutes(121)).getHours());
        assertEquals(48, Hours.standardHoursIn(Period.days(2)).getHours());
        try {
            Hours.standardHoursIn(Period.months(1));
            fail();
        } catch (IllegalArgumentException ex) {
            // expected
        }
    }

    public void testFactory_parseHours_String() {
        assertEquals(0, Hours.parseHours((String) null).getHours());
        assertEquals(0, Hours.parseHours("PT0H").getHours());
        assertEquals(1, Hours.parseHours("PT1H").getHours());
        assertEquals(-3, Hours.parseHours("PT-3H").getHours());
        assertEquals(2, Hours.parseHours("P0Y0M0DT2H").getHours());
        assertEquals(2, Hours.parseHours("PT2H0M").getHours());
        try {
            Hours.parseHours("P1Y1D");
            fail();
        } catch (IllegalArgumentException ex) {
            // expected
        }
        try {
            Hours.parseHours("P1DT1H");
            fail();
        } catch (IllegalArgumentException ex) {
            // expected
        }
    }

    //-----------------------------------------------------------------------
    public void testGetMethods() {
        Hours test = Hours.hours(20);
        assertEquals(20, test.getHours());
    }

    public void testGetFieldType() {
        Hours test = Hours.hours(20);
        assertEquals(DurationFieldType.hours(), test.getFieldType());
    }

    public void testGetPeriodType() {
        Hours test = Hours.hours(20);
        assertEquals(PeriodType.hours(), test.getPeriodType());
    }

    //-----------------------------------------------------------------------
    public void testIsGreaterThan() {
        assertEquals(true, Hours.THREE.isGreaterThan(Hours.TWO));
        assertEquals(false, Hours.THREE.isGreaterThan(Hours.THREE));
        assertEquals(false, Hours.TWO.isGreaterThan(Hours.THREE));
        assertEquals(true, Hours.ONE.isGreaterThan(null));
        assertEquals(false, Hours.hours(-1).isGreaterThan(null));
    }

    public void testIsLessThan() {
        assertEquals(false, Hours.THREE.isLessThan(Hours.TWO));
        assertEquals(false, Hours.THREE.isLessThan(Hours.THREE));
        assertEquals(true, Hours.TWO.isLessThan(Hours.THREE));
        assertEquals(false, Hours.ONE.isLessThan(null));
        assertEquals(true, Hours.hours(-1).isLessThan(null));
    }

    //-----------------------------------------------------------------------
    public void testToString() {
        Hours test = Hours.hours(20);
        assertEquals("PT20H", test.toString());

        test = Hours.hours(-20);
        assertEquals("PT-20H", test.toString());
    }

    //-----------------------------------------------------------------------
    public void testSerialization() throws Exception {
        Hours test = Hours.SEVEN;

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(test);
        oos.close();
        byte[] bytes = baos.toByteArray();

        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
        ObjectInputStream ois = new ObjectInputStream(bais);
        Hours result = (Hours) ois.readObject();
        ois.close();

        assertSame(test, result);
    }

    //-----------------------------------------------------------------------
    public void testToStandardWeeks() {
        Hours test = Hours.hours(24 * 7 * 2);
        Weeks expected = Weeks.weeks(2);
        assertEquals(expected, test.toStandardWeeks());
    }

    public void testToStandardDays() {
        Hours test = Hours.hours(24 * 2);
        Days expected = Days.days(2);
        assertEquals(expected, test.toStandardDays());
    }

    public void testToStandardMinutes() {
        Hours test = Hours.hours(3);
        Minutes expected = Minutes.minutes(3 * 60);
        assertEquals(expected, test.toStandardMinutes());

        try {
            Hours.MAX_VALUE.toStandardMinutes();
            fail();
        } catch (ArithmeticException ex) {
            // expected
        }
    }

    public void testToStandardSeconds() {
        Hours test = Hours.hours(3);
        Seconds expected = Seconds.seconds(3 * 60 * 60);
        assertEquals(expected, test.toStandardSeconds());

        try {
            Hours.MAX_VALUE.toStandardSeconds();
            fail();
        } catch (ArithmeticException ex) {
            // expected
        }
    }

    public void testToStandardDuration() {
        Hours test = Hours.hours(20);
        Duration expected = new Duration(20L * DateTimeConstants.MILLIS_PER_HOUR);
        assertEquals(expected, test.toStandardDuration());

        expected = new Duration(((long) Integer.MAX_VALUE) * DateTimeConstants.MILLIS_PER_HOUR);
        assertEquals(expected, Hours.MAX_VALUE.toStandardDuration());
    }

    //-----------------------------------------------------------------------
    public void testPlus_int() {
        Hours test2 = Hours.hours(2);
        Hours result = test2.plus(3);
        assertEquals(2, test2.getHours());
        assertEquals(5, result.getHours());

        assertEquals(1, Hours.ONE.plus(0).getHours());

        try {
            Hours.MAX_VALUE.plus(1);
            fail();
        } catch (ArithmeticException ex) {
            // expected
        }
    }

    public void testPlus_Hours() {
        Hours test2 = Hours.hours(2);
        Hours test3 = Hours.hours(3);
        Hours result = test2.plus(test3);
        assertEquals(2, test2.getHours());
        assertEquals(3, test3.getHours());
        assertEquals(5, result.getHours());

        assertEquals(1, Hours.ONE.plus(Hours.ZERO).getHours());
        assertEquals(1, Hours.ONE.plus((Hours) null).getHours());

        try {
            Hours.MAX_VALUE.plus(Hours.ONE);
            fail();
        } catch (ArithmeticException ex) {
            // expected
        }
    }

    public void testMinus_int() {
        Hours test2 = Hours.hours(2);
        Hours result = test2.minus(3);
        assertEquals(2, test2.getHours());
        assertEquals(-1, result.getHours());

        assertEquals(1, Hours.ONE.minus(0).getHours());

        try {
            Hours.MIN_VALUE.minus(1);
            fail();
        } catch (ArithmeticException ex) {
            // expected
        }
    }

    public void testMinus_Hours() {
        Hours test2 = Hours.hours(2);
        Hours test3 = Hours.hours(3);
        Hours result = test2.minus(test3);
        assertEquals(2, test2.getHours());
        assertEquals(3, test3.getHours());
        assertEquals(-1, result.getHours());

        assertEquals(1, Hours.ONE.minus(Hours.ZERO).getHours());
        assertEquals(1, Hours.ONE.minus((Hours) null).getHours());

        try {
            Hours.MIN_VALUE.minus(Hours.ONE);
            fail();
        } catch (ArithmeticException ex) {
            // expected
        }
    }

    public void testMultipliedBy_int() {
        Hours test = Hours.hours(2);
        assertEquals(6, test.multipliedBy(3).getHours());
        assertEquals(2, test.getHours());
        assertEquals(-6, test.multipliedBy(-3).getHours());
        assertSame(test, test.multipliedBy(1));

        Hours halfMax = Hours.hours(Integer.MAX_VALUE / 2 + 1);
        try {
            halfMax.multipliedBy(2);
            fail();
        } catch (ArithmeticException ex) {
            // expected
        }
    }

    public void testDividedBy_int() {
        Hours test = Hours.hours(12);
        assertEquals(6, test.dividedBy(2).getHours());
        assertEquals(12, test.getHours());
        assertEquals(4, test.dividedBy(3).getHours());
        assertEquals(3, test.dividedBy(4).getHours());
        assertEquals(2, test.dividedBy(5).getHours());
        assertEquals(2, test.dividedBy(6).getHours());
        assertSame(test, test.dividedBy(1));

        try {
            Hours.ONE.dividedBy(0);
            fail();
        } catch (ArithmeticException ex) {
            // expected
        }
    }

    public void testNegated() {
        Hours test = Hours.hours(12);
        assertEquals(-12, test.negated().getHours());
        assertEquals(12, test.getHours());

        try {
            Hours.MIN_VALUE.negated();
            fail();
        } catch (ArithmeticException ex) {
            // expected
        }
    }

    //-----------------------------------------------------------------------
    public void testAddToLocalDate() {
        Hours test = Hours.hours(26);
        LocalDateTime date = new LocalDateTime(2006, 6, 1, 0, 0, 0, 0);
        LocalDateTime expected = new LocalDateTime(2006, 6, 2, 2, 0, 0, 0);
        assertEquals(expected, date.plus(test));
    }

}


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="Tires Hunt App with CodeIgniter 3 + AngularJS">
		<meta name="author" content="Nathan Fan">

		<title>Nathan Demo Tires Hunt App with CodeIgniter + AngularJS</title>

		<link href="<?php echo base_url('../assets/css/bootstrap.min.css') ?>" rel="stylesheet">

Tires Hunt App

Select tab below to search tires by using Vehicle/Size.

Tires Hunt App

				<uib-tabset>
					<uib-tab ng-repeat="tab in tabs" heading="{{tab.title}}" active="tab.active" disable="tab.disabled">

			    	</uib-tab>
				</uib-tabset>

© <?php echo date('Y')?> Nathan Fan Powered by CTKPRO


text:
<!DOCTYPE html>

    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="language" content="en" />
        <link href="./assets/caf9c96c/css/bootstrap.css" rel="stylesheet">
<link href="./assets/dbe19bdd/solarized_light.css" rel="stylesheet">
<link href="./assets/3baaa47c/style.css" rel="stylesheet">

    <title>User, app\models\User - Gkri API</title>

<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#w142-collapse">Toggle navigation

</button>Gkri API

Class reference

Guide

    <input id="searchbox" type="text" class="form-control" placeholder="Search">

app\assets
AppAsset

app\commands
LimpiarController

app\controllers
FollowsController
MessagesController
PostsController
SiteController

app\controllers\comments
DefaultController

app\controllers\user
ProfileController
RecoveryController
SettingsController

app\models
Categoria
CommentModel
CommentVoto
Follow
Message
MessageForm
Notificacion
Post
Profile
RecoveryForm
RegistrationForm
SettingsForm
UploadAvatarForm
UploadPostForm
User
Voto
VotoComentario

app\models\enums
NotificationType

Class app\models\User

    All Classes
                | Methods

    <colgroup>
        <col class="col-name" />
        <col class="col-value" />
    </colgroup>

Inheritance	app\models\User »
dektrium\user\models\User

Clase modelo User que hereda del yii2-user para sobreescribir y/o añadir algunas funcionalidades

Public Methods

Hide inherited methods

<colgroup>
    <col class="col-method" />
    <col class="col-description" />
    <col class="col-defined" />
</colgroup>

  Method	Description	Defined By

        getAvatar()
        Obtiene la ruta del avatar del usuario
        app\models\User

        getComentarios()
        Obtiene los comentarios que ha creado el usuario
        app\models\User

        getComentariosVotados()
        Obtiene los comentarios que ha votado el usuario
        app\models\User

        getConversaciones()
        Obtiene las conversaciones del usuario
        app\models\User

        getEnviados()
        Obtiene los mensajes enviados
        app\models\User

        getModeraciones()
        Obtiene los posts moderador por el usuario
        app\models\User

        getNotificaciones()
        Obtiene las notificaciones del usuario
        app\models\User

        getPostPendiente()
        Obtiene los posts pendientes
        app\models\User

        getPosts()
        Obtiene los posts que ha creado el usuario
        app\models\User

        getPostsAceptados()
        Obtiene los posts aprobados
        app\models\User

        getPostsVotados()
        Obtiene los posts votados
        app\models\User

        getPostsVotadosPositivos()
        Obtiene los posts que estan votados positivos
        app\models\User

        getRecibidos()
        Obtiene los mensajes recibidos
        app\models\User

        getSeguidores()
        Obtiene los follows de los usuarios que te estan siguiendo
        app\models\User

        getSeguidoresUser()
        Obtiene los usuarios que te estan siguiendo
        app\models\User

        getSiguiendo()
        Obtiene los follows de los usuarios que estas siguiendo
        app\models\User

        getSiguiendoUser()
        Obtiene los usuarios que estas siguiendo
        app\models\User

        getUsername()
        Obtiene el nombre de usuario
        app\models\User

        getVotos()
        Obtiene los votos realizados sobre los posts
        app\models\User

        getVotosComentarios()
        Obtiene los votos sobre los comentarios
        app\models\User

Method Details

        getAvatar()

            public                                    method

Obtiene la ruta del avatar del usuario

public string getAvatar ( )

        getComentarios()

            public                                    method

Obtiene los comentarios que ha creado el usuario

public \yii\db\ActiveQuery getComentarios ( )

        getComentariosVotados()

            public                                    method

Obtiene los comentarios que ha votado el usuario

public \yii\db\ActiveQuery getComentariosVotados ( )

        getConversaciones()

            public                                    method

Obtiene las conversaciones del usuario

public \yii\db\ActiveQuery getConversaciones ( )

        getEnviados()

            public                                    method

Obtiene los mensajes enviados

public \yii\db\ActiveQuery getEnviados ( )

        getModeraciones()

            public                                    method

Obtiene los posts moderador por el usuario

public \yii\db\ActiveQuery getModeraciones ( )

        getNotificaciones()

            public                                    method

Obtiene las notificaciones del usuario

public \yii\db\ActiveQuery getNotificaciones ( )

        getPostPendiente()

            public                                    method

Obtiene los posts pendientes

public \yii\db\ActiveQuery getPostPendiente ( )

        getPosts()

            public                                    method

Obtiene los posts que ha creado el usuario

public \yii\db\ActiveQuery getPosts ( )

        getPostsAceptados()

            public                                    method

Obtiene los posts aprobados

public \yii\db\ActiveQuery getPostsAceptados ( )

        getPostsVotados()

            public                                    method

Obtiene los posts votados

public \yii\db\ActiveQuery getPostsVotados ( )

        getPostsVotadosPositivos()

            public                                    method

Obtiene los posts que estan votados positivos

public \yii\db\ActiveQuery getPostsVotadosPositivos ( )

        getRecibidos()

            public                                    method

Obtiene los mensajes recibidos

public \yii\db\ActiveQuery getRecibidos ( )

        getSeguidores()

            public                                    method

Obtiene los follows de los usuarios que te estan siguiendo

public \yii\db\ActiveQuery getSeguidores ( )

        getSeguidoresUser()

            public                                    method

Obtiene los usuarios que te estan siguiendo

public \yii\db\ActiveQuery getSeguidoresUser ( )

        getSiguiendo()

            public                                    method

Obtiene los follows de los usuarios que estas siguiendo

public \yii\db\ActiveQuery getSiguiendo ( )

        getSiguiendoUser()

            public                                    method

Obtiene los usuarios que estas siguiendo

public \yii\db\ActiveQuery getSiguiendoUser ( )

        getUsername()

            public                                    method

Obtiene el nombre de usuario

public string getUsername ( )

        getVotos()

            public                                    method

Obtiene los votos realizados sobre los posts

public \yii\db\ActiveQuery getVotos ( )

        getVotosComentarios()

            public                                    method

Obtiene los votos sobre los comentarios

public \yii\db\ActiveQuery getVotosComentarios ( )

Page generated on Mon, 12 Jun 2017 11:16:42 +0000

    Powered by Yii Framework


text:
irc
===

is an F# irc client library currently in the prototype stage, I'm looking to keep it as functionally pure as possible while making it easy to use


text:
package eu.hangar.sk.module;

import org.lwjgl.input.Keyboard;

import eu.hangar.sk.event.EventManager;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

public class Module {

    private String name = getClass().getAnnotation(ModInfo.class).name();

    private String discrption = getClass().getAnnotation(ModInfo.class).description();

    private Catergoy catergoy = getClass().getAnnotation(ModInfo.class).category();

    private int bind = getClass().getAnnotation(ModInfo.class).bind();

    private boolean state;

    /**
     * Category
     */
    public enum Catergoy {
        SALT(0xff33cc), HAXS(0xff33cc), GUI(0xff33cc);

        public int color;

        Catergoy(int color) {

            this.color = color;
        }
    }

    /**
     * Module information @ModInfo
     */
    @Retention(RetentionPolicy.RUNTIME)
    public @interface ModInfo {

        String name();

        String description();

        Catergoy category();

        int bind();

    }

    public String getName() {

        return name;
    }

    public void setName(String name) {

        this.name = name;
    }

    public String getDiscrption() {

        return discrption;
    }

    public void setDiscrption(String discrption) {

        this.discrption = discrption;
    }

    public Catergoy getCatergoy() {

        return catergoy;
    }

    public void setCatergoy(Catergoy catergoy) {

        this.catergoy = catergoy;
    }

    public int getBind() {

        return bind;
    }

    public void setBind(int bind) {

        this.bind = bind;
    }

    public boolean getState() {

        return state;
    }

    public void setState(boolean state) {

        onToggle();

        if (state) {
            onEnable();
            this.state = true;
            EventManager.register(this);
        } else {
            onDisable();
            this.state = false;
            EventManager.unregister(this);
        }

        //Save the module

    }

    public void onDisable() {

    }

    public void onEnable() {

    }

    public void onToggle() {

    }

    public void toggle() {

        setState(!this.getState());
    }

    public final boolean isCategory(Catergoy catergoy) {

        if (catergoy == this.catergoy)
            return true;
        return false;
    }

    public String getKeyName() {

        return getBind() == -1 ? "-1" : Keyboard.getKeyName(getBind());
    }

}


text:
package OpenXPKI::Server::Workflow::Condition::Smartcard::AuthIdValid;

use strict;
use warnings;
use base qw( Workflow::Condition );
use Workflow::Exception qw( condition_error configuration_error );
use OpenXPKI::Server::Context qw( CTX );
use OpenXPKI::Debug;

use English;

use Data::Dumper;

sub evaluate {

    my ( $self, $workflow ) = @_;
    my $context = $workflow->context();

    my $auth1 = lc( $context->param('auth1_mail') || '' );
    my $auth2 = lc( $context->param('auth2_mail') || '' );
    my $owner = lc( $context->param('owner_mail') || '' );
    ##! 16: 'start'
    ##! 128: 'auth1_mail  = ' . $auth1
    ##! 128: 'auth2_mail  = ' . $auth2
    ##! 128: 'owner_mail  = ' . $owner

    if ( ( not $auth1 ) or ( not $auth2 ) ) {
        condition_error('I18N_OPENXPKI_SERVER_WORKFLOW_CONDITION_AUTH_NOT_SET');
        return -1;
    }
    elsif ( ( $auth1 eq $owner ) or ( $auth2 eq $owner ) ) {
        condition_error(
            'I18N_OPENXPKI_SERVER_WORKFLOW_CONDITION_AUTH_IS_OWNER');
        return -1;
    }
    elsif ( $auth1 eq $auth2 ) {
        condition_error(
            'I18N_OPENXPKI_SERVER_WORKFLOW_CONDITION_AUTHS_NOT_UNIQUE');
        return -1;
    }

     CTX('log')->application()->debug("AuthId checked.");

    return 1;
}

1;

__END__

=head1 NAME

OpenXPKI::Server::Workflow::Condition::Smartcard::AuthIdValid

=head1 SYNOPSIS

<action name="do_something">
  <condition name="sc_auth_ids_valid"
             class="OpenXPKI::Server::Workflow::Condition::Smartcard::AuthIdValid">
  </condition>
</action>

=head1 DESCRIPTION

Checks whether the authorizing persons mail addresses exisit, if they are unique
and not equal to the owner.