text:
"""Layer to perform online frame-based averaging.
"""

from lingvo import compat as tf
from lingvo.core import base_layer
from lingvo.core import layers as lingvo_layers
from lingvo.core import py_utils

class CumulativeStatisticsLayer(base_layer.BaseLayer):
  """Online layer to calculate cumulative statistics of the input over time."""

  @classmethod
  def Params(cls):
    p = super(CumulativeStatisticsLayer, cls).Params()
    p.name = 'cumulative_statistics_layer'

    p.Define(
        'stats_type', 'PASS_THRU',
        'If <PASS_THRU> then overrides all other options and copies the input '
        'directly to the output. If <MEAN> then calculates the mean statistics.'
        ' If <MEAN_STD> then calculates the mean and standard deviation '
        'statistics.')
    p.Define(
        'use_weighted_frames', False,
        'If True, use a feedforward network to weight the frames for statistics'
        ' accumulation purposes. It is recommended that a sigmoid output is '
        'used so that counts are handled correctly. If False, a simple average '
        'is used. This is only applicable for non-pass-thru configurations.')
    p.Define(
        'features_name', 'encoded',
        'The key in input_batch pointing to the features. The output features '
        'after FProp will be stored with the same name.')
    p.Define(
        'paddings_name', 'padding',
        'The key in input_batch pointing to the paddings. (Paddings are given '
        'as 0 for speech, 1 for non-speech.) The output paddings after FProp '
        'will be stored with the same name.')
    p.Define(
        'input_dim', None, 'Size of the input features to the network. Must be '
        'set to a value greater than 0. It is used for defining/retrieving the '
        'inference states shape.')
    p.Define(
        'epsilon', 1e-4,
        'This is used for 2 reasons. (1) This small value is added to the count'
        ' for each frame as part of the overall frame count statistics. It is '
        'to ensure no division by zero issues. (2) This same value is added to '
        'each variance element in the standard deviation calculation. It is to '
        'ensure that we do not compute the square root of a negative number.')
    p.Define(
        'frame_weight_ffn', lingvo_layers.FeedForwardNet.Params(),
        'The FeedForwardNet params for the frame-weighting layer. This network '
        'is activated when the use_weighted_frames flag is set to True.')

    return p

  def __init__(self, params):
    super().__init__(params)
    p = self.params

    # Check that the statistics type is valid:
    # We are checking that the statistics type is one of the three types
    # because we do not explicitly check for the 'MEAN' statistics type later
    # in the code.
    if p.stats_type not in ['PASS_THRU', 'MEAN', 'MEAN_STD']:
      raise ValueError('The stats_type must be <PASS_THRU>, '
                       '<MEAN>, or <MEAN_STD>.')

    # Check that an input dimension is specified
    if p.input_dim is None and p.stats_type != 'PASS_THRU':
      raise ValueError('The input dimension (input_dim) must be explicitly set '
                       'and specifies the dimensionality of a frame of input '
                       'features. The value must also be greater than 0 (and '
                       'not None).')

    # Create the feedforward layers for the frame-weighting result
    if p.use_weighted_frames:
      self.CreateChild('frame_weight_ffn', p.frame_weight_ffn)

  def zero_state(self, theta, batch_size):
    """Returns the initial state of the current layer.

    Args:
      theta: A NestedMap containing layer weights (unused for this function).
      batch_size: The number of examples (utterances) in the minibatch

    Returns:
      A NestedMap containing the initial state of the sufficient statistics. If
      the statistics type (stats_type) is set to 'PASS_THRU', then an empty
      NestedMap is returned. If the statistics type is set to 'MEAN', then
      the count and sum of X information is returned. If the statistics type is
      set to 'MEAN_STD', then the sum of X squared statistics are included in
      addition to the count and sum of X information. Depending on configuration
      settings, the NestedMap can contain the following keys within the
      NestedMap accumulated_stats:
      - count: tf.zeros([batch_size]), fprop_dtype (default tf.float32)
      - sum_x: tf.zeros([batch_size, input_dim]), fprop_dtype (default
      tf.float32)
      - sum_xx: tf.zeros([batch_size, input_dim]), fprop_dtype (default
      tf.float32)
    """

    p = self.params

    state0 = py_utils.NestedMap()

    # Return the initial state for PASS_THRU mode
    if p.stats_type == 'PASS_THRU':
      return state0

    # Specify the initial state
    state0.accumulated_stats = py_utils.NestedMap()
    state0.accumulated_stats.count = tf.zeros([batch_size], dtype=p.dtype)
    state0.accumulated_stats.sum_x = tf.zeros([batch_size, p.input_dim],
                                              dtype=p.dtype)

    # Add zero state for sum x-squared statistics if requested
    if p.stats_type == 'MEAN_STD':
      state0.accumulated_stats.sum_xx = tf.zeros([batch_size, p.input_dim],
                                                 dtype=p.dtype)

    return state0

  def IsNullState(self, state):
    """Checks if the input state is either None or empty NestedMap."""
    return all(x is None for x in tf.nest.flatten(state))

  def NullState(self):
    """Returns empty NestedMap as null state."""
    return py_utils.NestedMap()

  def FProp(self, theta, in_nmap, state0=None):
    """Generates frame-weighted mean/std-dev statistics from the inputs.

    Args:
      theta: A NestedMap containing layer weights containing the key
        frame_weight_ffn describing the feed-forward network. This key is needed
        only when use_weighted_frames is set to True and stats_type is not
        'PASS_THRU'.
      in_nmap: A NestedMap. Members include:
        - in_map[p.features_name]: Features tensor of shape [len, batch,
          input_dim], tf.float32.
        - in_map[p.paddings_name]: Paddings tensor of shape [len, batch],
          tf.float32.
      state0: A NestedMap containing sufficient statistics for the previous
        state. When not in inference mode state0 should be NullState. When in
        inference mode, state0, in addition to containing state0 information
        from other child layers, should also include the following keys within
        the NestedMap state0.accumulated_stats:
        - count: [batch_size], tf.float32
        - sum_x: [batch_size, input_dim], tf.float32
        - sum_xx: [batch_size, input_dim], tf.float32 The above keys point to
          the sufficient statistics accumulated across all data packets
          excluding the current data packet of features.

    Returns:
      A NestedMap (out_nmap). For the 'PASS_THRU' case, in_nmap is returned. For
      the 'MEAN' and 'MEAN_STD' cases, a NestedMap with the same information and
        structure as in_nmap with the following additional updates:
        out_nmap[p.features_name]: Features tensor of shape [len, batch,
          output_dim], tf.float32. The output_dim is either input_dim or
          2*input_dim depending on whether standard deviation statistics are
          also included.
        out_nmap[p.paddings_name]: Paddings tensor of shape [len, batch],
          tf.float32.
        out_nmap.state: If state0 is NullState, NullState is returned as the
          output state. If state0 is not NullState, then a NestedMap containing
          sufficient statistics of this cumulative statistics layer gets
          returned. When the mode is 'PASS_THRU', the state is an empty
          NestedMap. In other cases, the state includes the frame-based counts,
          sum of X and sum of X-squared (if 'MEAN_STD' information is requested)
          The additional NestedMap keys are included within
          out_nmap.state.accumulated_stats as follows:
          - count: [batch_size], tf.float32
          - sum_x: [batch_size, input_dim], tf.float32
          - sum_xx: [batch_size, input_dim], tf.float32
          For example, to reference the counts, given an output variable,
          out_nmap, the following would be used:
          out_nmap.state.accumulated_stats.count
    """

    p = self.params

    # Return the input if we are using PASS_THRU mode.
    # Note: the state, even though it is empty, is always populated so as to be
    # consistent with the non-PASS_THRU cases.
    if p.stats_type == 'PASS_THRU':
      # Do not mutate the input NestedMap but the state, because of PASS_THRU.
      out_nmap = in_nmap.copy()
      out_nmap.state = self.NullState()
      return out_nmap

    # Get the input data and padding information
    input_features = in_nmap[p.features_name]
    padding = in_nmap[p.paddings_name]

    # Convert padding to frame based flag indicating if it is speech
    effective_frame_weight = tf.cast(1.0 - padding, dtype=p.dtype)

    # If using frame weighted analysis, calculate the sigmoid output and
    # multiply it with the speech/non-speech effective_frame_weight.
    if p.use_weighted_frames:
      # For each speech frame, a single weight value is generated between 0 and
      # 1 (if a sigmoid activation is used). The expected output (after the
      # squeeze function) is a tensor of shape [len, batch] with a tf.float32
      # data type.
      ffn_frame_weight = tf.squeeze(
          self.frame_weight_ffn.FProp(theta.frame_weight_ffn, input_features,
                                      None),
          axis=2)

      effective_frame_weight = effective_frame_weight * ffn_frame_weight

    # Add a small floor for the effective_frame_weight
    effective_frame_weight = effective_frame_weight + p.epsilon

    # Calculate the cumulative count and cumulative sum_x for the current packet
    # of frames
    cumulative_count = tf.math.cumsum(effective_frame_weight, axis=0)
    cumulative_sum_x = tf.math.cumsum(
        input_features * effective_frame_weight[:, :, tf.newaxis], axis=0)

    # If standard deviation statistics are needed, calculate the cumulative
    # sum_xx (sum x-squared) for the current packet of frames
    if p.stats_type == 'MEAN_STD':
      cumulative_sum_xx = tf.math.cumsum(
          input_features * input_features *
          effective_frame_weight[:, :, tf.newaxis],
          axis=0)

    state1 = self.NullState()
    # If we are running in online mode, be sure to add in the total sums from
    # the past packets of features. If in offline mode, there is no state to
    # update.
    if not self.IsNullState(state0):
      # Calculate cumulative sums up to the current point in time. This includes
      # past packets and the current packet of data.
      cumulative_count = cumulative_count + state0.accumulated_stats.count[
          tf.newaxis, :]
      cumulative_sum_x = cumulative_sum_x + state0.accumulated_stats.sum_x[
          tf.newaxis, :, :]

      # Update the internal state by copying across the statistics of the very
      # last frame
      state1.accumulated_stats = py_utils.NestedMap()
      state1.accumulated_stats.count = cumulative_count[-1, :]
      state1.accumulated_stats.sum_x = cumulative_sum_x[-1, :, :]

      # If standard deviation statistics are needed, calculate the cumulative
      # sum_xx (sum x-squared) for the past and the current packet of frames
      if p.stats_type == 'MEAN_STD':
        cumulative_sum_xx = cumulative_sum_xx + state0.accumulated_stats.sum_xx[
            tf.newaxis, :, :]
        state1.accumulated_stats.sum_xx = cumulative_sum_xx[-1, :, :]

    # Calculate the running mean for the current packet of features
    output_features = tf.math.divide(cumulative_sum_x,
                                     cumulative_count[:, :, tf.newaxis])

    # If requested, calculate and append the standard deviation statistics.
    if p.stats_type == 'MEAN_STD':
      cumulative_mean_xx = tf.math.divide(cumulative_sum_xx,
                                          cumulative_count[:, :, tf.newaxis])
      cumulative_std_dev = tf.math.sqrt(cumulative_mean_xx -
                                        output_features * output_features +
                                        p.epsilon)
      output_features = tf.concat((output_features, cumulative_std_dev), axis=2)

    # Return the output
    out_nmap = py_utils.NestedMap()
    out_nmap[p.features_name] = output_features
    out_nmap[p.paddings_name] = padding
    out_nmap.state = state1
    return out_nmap


text:
using System.Globalization;
using Xunit;

namespace Soltys.ChangeCase.Tests
{
    public class TitleCaseTests
    {

        [Fact]
        public void SingleWordTest()
        {
            TestTitleCase("test", "Test");
            TestTitleCase("TEST", "Test");
        }

        [Fact]
        public void RegularSentenceTest()
        {
            TestTitleCase("test string", "Test String");
            TestTitleCase("Test String", "Test String");
        }

        [Fact]
        public void NonAlphanumericSeparatorTest()
        {
            TestTitleCase("dot.case", "Dot Case");
            TestTitleCase("path/case", "Path Case");
        }

        [Fact]
        public void PascalCasedStringsTest()
        {
            TestTitleCase("TestString", "Test String");
            TestTitleCase("TestString1_2_3", "Test String 1 2 3");
        }

        [Fact]
        public void CamelCasedStringsTest()
        {
            TestTitleCase("testString", "Test String");
        }

        [Fact]
        public void NonAsciiSupportTest()
        {
            TestTitleCase("éxample", "Éxample");
        }

        private void TestTitleCase(string input, string expected)
        {
            var actual = input.TitleCase();
            Assert.Equal(expected, actual);
        }

        [Fact]
        public void TurkishTest()
        {
            string actual = "STRING".TitleCase(CultureInfo.CreateSpecificCulture("tr"));
            Assert.Equal("Strıng", actual);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

// Declare app level module which depends on filters, and services
angular.module('devnull',
  ['devnull.filters',
  'devnull.services',
  'devnull.directives',
  'devnull.controllers']
);


text:
package org.apache.commons.collections4.set;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.NavigableSet;
import java.util.Set;
import java.util.TreeSet;

import junit.framework.Test;

import org.apache.commons.collections4.BulkTest;

/**
 * Extension of {@link AbstractNavigableSetTest} for exercising the
 * {@link UnmodifiableNavigableSet} implementation.
 *
 * @since 4.1
 * @version $Id: UnmodifiableNavigableSetTest.java 1686855 2015-06-22 13:00:27Z tn $
 */
public class UnmodifiableNavigableSetTest<E> extends AbstractNavigableSetTest<E> {
    protected UnmodifiableNavigableSet<E> set = null;
    protected ArrayList<E> array = null;

    public UnmodifiableNavigableSetTest(final String testName) {
        super(testName);
    }

    public static Test suite() {
        return BulkTest.makeSuite(UnmodifiableNavigableSetTest.class);
    }

    //-------------------------------------------------------------------
    @Override
    public NavigableSet<E> makeObject() {
        return UnmodifiableNavigableSet.unmodifiableNavigableSet(new TreeSet<E>());
    }

    @Override
    public UnmodifiableNavigableSet<E> makeFullCollection() {
        final TreeSet<E> set = new TreeSet<E>();
        set.addAll(Arrays.asList(getFullElements()));
        return (UnmodifiableNavigableSet<E>) UnmodifiableNavigableSet.unmodifiableNavigableSet(set);
    }

    @Override
    public boolean isAddSupported() {
        return false;
    }

    @Override
    public boolean isRemoveSupported() {
        return false;
    }

    //--------------------------------------------------------------------
    @SuppressWarnings("unchecked")
    protected void setupSet() {
        set = makeFullCollection();
        array = new ArrayList<E>();
        array.add((E) Integer.valueOf(1));
    }

    /**
     * Verify that base set and subsets are not modifiable
     */
    @SuppressWarnings("unchecked")
    public void testUnmodifiable() {
        setupSet();
        verifyUnmodifiable(set);
        verifyUnmodifiable(set.descendingSet());
        verifyUnmodifiable(set.headSet((E) Integer.valueOf(1)));
        verifyUnmodifiable(set.headSet((E) Integer.valueOf(1), true));
        verifyUnmodifiable(set.tailSet((E) Integer.valueOf(1)));
        verifyUnmodifiable(set.tailSet((E) Integer.valueOf(1), false));
        verifyUnmodifiable(set.subSet((E) Integer.valueOf(1), (E) Integer.valueOf(3)));
        verifyUnmodifiable(set.subSet((E) Integer.valueOf(1), false, (E) Integer.valueOf(3), false));
        verifyUnmodifiable(set.subSet((E) Integer.valueOf(1), true, (E) Integer.valueOf(3), true));
    }

    public void testDecorateFactory() {
        final NavigableSet<E> set = makeFullCollection();
        assertSame(set, UnmodifiableNavigableSet.unmodifiableNavigableSet(set));

        try {
            UnmodifiableNavigableSet.unmodifiableNavigableSet(null);
            fail();
        } catch (final NullPointerException ex) {}
    }

    /**
     * Verifies that a set is not modifiable
     */
    @SuppressWarnings("unchecked")
    public void verifyUnmodifiable(final Set<E> set) {
        try {
            set.add((E) "value");
            fail("Expecting UnsupportedOperationException.");
        } catch (final UnsupportedOperationException e) {
            // expected
        }
        try {
            set.addAll(new TreeSet<E>());
            fail("Expecting UnsupportedOperationException.");
        } catch (final UnsupportedOperationException e) {
            // expected
        }
        try {
            set.clear();
            fail("Expecting UnsupportedOperationException.");
        } catch (final UnsupportedOperationException e) {
            // expected
        }
        try {
            set.remove("x");
            fail("Expecting UnsupportedOperationException.");
        } catch (final UnsupportedOperationException e) {
            // expected
        }
        try {
            set.removeAll(array);
            fail("Expecting UnsupportedOperationException.");
        } catch (final UnsupportedOperationException e) {
            // expected
        }
        try {
            set.retainAll(array);
            fail("Expecting UnsupportedOperationException.");
        } catch (final UnsupportedOperationException e) {
            // expected
        }
    }

    public void testComparator() {
        setupSet();
        final Comparator<? super E> c = set.comparator();
        assertTrue("natural order, so comparator should be null", c == null);
    }

    //-----------------------------------------------------------------------

    @Override
    public String getCompatibilityVersion() {
        return "4.1";
    }

//    public void testCreate() throws Exception {
//        resetEmpty();
//        writeExternalFormToDisk((java.io.Serializable) getCollection(), "src/test/resources/data/test/UnmodifiableNavigableSet.emptyCollection.version4.1.obj");
//        resetFull();
//        writeExternalFormToDisk((java.io.Serializable) getCollection(), "src/test/resources/data/test/UnmodifiableNavigableSet.fullCollection.version4.1.obj");
//    }

}


text:
package org.uberfire.client.authz;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.uberfire.security.authz.Permission;
import org.uberfire.security.authz.PermissionManager;
import org.uberfire.security.impl.authz.DefaultPermissionManager;
import org.uberfire.workbench.model.ActivityResourceType;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

@RunWith(MockitoJUnitRunner.class)
public class PerspectivePermissionTest {

    PermissionManager permissionManager;

    @Before
    public void setUp() {
        permissionManager = new DefaultPermissionManager();
    }

    @Test
    public void testPermissionCreation() {
        Permission readPermission = permissionManager.createPermission(ActivityResourceType.PERSPECTIVE, PerspectiveAction.READ, true);
        Permission updatePermission = permissionManager.createPermission(ActivityResourceType.PERSPECTIVE, PerspectiveAction.UPDATE, true);
        Permission deletePermission = permissionManager.createPermission(ActivityResourceType.PERSPECTIVE, PerspectiveAction.DELETE, true);
        Permission createPermission = permissionManager.createPermission(ActivityResourceType.PERSPECTIVE, PerspectiveAction.CREATE, true);

        assertEquals(readPermission.getName(), "perspective.read");
        assertEquals(updatePermission.getName(), "perspective.update");
        assertEquals(deletePermission.getName(), "perspective.delete");
        assertEquals(createPermission.getName(), "perspective.create");
    }
}


text:
<?php
/**
 * DO NOT EDIT THIS FILE!
 *
 * This file was automatically generated from external sources.
 *
 * Any manual change here will be lost the next time the SDK
 * is updated. You've been warned!
 */

namespace DTS\eBaySDK\Test\MerchantData\Types;

use DTS\eBaySDK\MerchantData\Types\XMLRequesterCredentialsType;

class XMLRequesterCredentialsTypeTest extends \PHPUnit_Framework_TestCase
{
    private $obj;

    protected function setUp()
    {
        $this->obj = new XMLRequesterCredentialsType();
    }

    public function testCanBeCreated()
    {
        $this->assertInstanceOf('\DTS\eBaySDK\MerchantData\Types\XMLRequesterCredentialsType', $this->obj);
    }

    public function testExtendsBaseType()
    {
        $this->assertInstanceOf('\DTS\eBaySDK\Types\BaseType', $this->obj);
    }
}


text:
import React from 'react';
import {
    View,
	StyleSheet,
    Navigator,
	TouchableOpacity,
	TouchableHighlight,
	TouchableNativeFeedback,
	Text,
	StatusBar,
	Dimensions,
	ScrollView,
	ToastAndroid,
	RefreshControl,
	Linking,
	BackAndroid,
	InteractionManager,
	Image
} from 'react-native';
import Calendar from './Calendar';
import News from './News';
import Netinfo from './Netinfo';
import Approval from './Approval';
import Operation from './Operation';
import RNFS from 'react-native-fs';
import Token from './Token';
import Icon from 'react-native-vector-icons/Ionicons';
import Personal from './Personal';
export default class Home extends React.Component {

	constructor(props) {
        super(props);
		this.state = {
		  statust:false,
		  id: '',
		  output:'',
		  uid:'',
		  datas:[],
		  imgs:[],
		  loaded: false,
		  isLoadMore:false,
		  p:1,
		  data:'',
		  data_a:'',
		  data_b:'',
		  isReach:false,
		  isRefreshing:false,
		  isNull:0,
		  isNull_a:0,
		  isNull_b:0,
	  };
    }

	componentDidMount() {

	       this.fetchData('' + data.data.domain + '/index.php?app=Home&m=AuditApi&a=getAudit&uid='+data.data.uid+'&cid='+data.data.cid+'&access_token=' + data.data.token + '');
           this.fetchData_a('' + data.data.domain + '/index.php?app=Home&m=AuditApi&a=getAudit&uid='+data.data.uid+'&cid='+data.data.cid+'&access_token=' + data.data.token + '');
           this.fetchData_b('' + data.data.domain + '/index.php?app=Home&m=AuditApi&a=getAudit&uid='+data.data.uid+'&cid='+data.data.cid+'&access_token=' + data.data.token + '');
           this.fetchUpdate('http://www.linksame.com/phone/update.php');

    }

	toQueryString(obj) {
		return obj ? Object.keys(obj).sort().map(function (key) {
			var val = obj[key];
			if (Array.isArray(val)) {
				return val.sort().map(function (val2) {
					return encodeURIComponent(key) + '=' + encodeURIComponent(val2);
				}).join('&');
			}

			return encodeURIComponent(key) + '=' + encodeURIComponent(val);
		}).join('&') : '';
	}

	fetchUpdate(url){
		fetch(url)
		  .then((response) => response.json())
		  .then((responseData) => {
               if(responseData.cache == '2.0.5'){
				   this.setState({statust:false,})
			   }else{
				   this.setState({statust:true,})
			   }
		  })
		  .catch((error) => {

		  });
	}

	fetchData(url) {
		var that=this;

		fetch(url, {
				  method: 'POST',
				  headers: {
					'Content-Type': 'application/x-www-form-urlencoded',
				  },
				  body: this.toQueryString({
					'type': 1,
					'status': -1,
				  })
				})
				.then(function (response) {
                    return response.json();
				})
				.then(function (result) {

					  that.setState({
						   isNull:result.count,
						   isRefreshing:false,
                           data:null,
					  })
                      if(result.count>0){
						that.setState({
						   data:result.data[0].content,
						   isRefreshing:false,
					    })
					  }
				})
				.catch((error) => {
							that.setState({
								   isRefreshing:false,
							   })
							   ToastAndroid.show('加载失败,请下拉刷新', ToastAndroid.SHORT);
						  });
	}

	fetchData_a(url) {
		var that=this;
		fetch(url, {
				  method: 'POST',
				  headers: {
					'Content-Type': 'application/x-www-form-urlencoded',
				  },
				  body: this.toQueryString({
					'type': 3,
					'status': 0,
				  })
				})
				.then(function (response) {
                    return response.json();
				})
				.then(function (result) {

					  that.setState({
						   isNull_a:result.count,
						   data_a:null,
						   isRefreshing:false,
					  })
                      if(result.count>0){
						that.setState({
						   data_a:result.data[0].content,
						   isRefreshing:false,
					    })
					  }
				})
	}

	fetchData_b(url) {
		var that=this;
		fetch(url, {
				  method: 'POST',
				  headers: {
					'Content-Type': 'application/x-www-form-urlencoded',
				  },
				  body: this.toQueryString({
					'type': 2,
					'status': 0,
				  })
				})
				.then(function (response) {
                    return response.json();
				})
				.then(function (result) {

					  that.setState({
						   isNull_b:result.count,
						   data_b:null,
						   isRefreshing:false,
					  })
                      if(result.count>0){
						that.setState({
						   data_b:result.data[0].content,
						   isRefreshing:false,
					    })
					  }
				})
	}

	_pressButton() {
        var { navigator } = this.props;
        if(navigator) {
			InteractionManager.runAfterInteractions(() => {
            navigator.push({
                name: 'Calendar',
                component: Calendar,
            })
			})
        }
    }

	_newButton(){
		let _this = this;
		var { navigator } = this.props;
        if(navigator) {
			InteractionManager.runAfterInteractions(() => {
            navigator.push({
                name: 'News',
                component: News,
			    params: {
                    getUser: function(user) {
                        _this.setState({
                            user: user
                        })
						if(user == true){
							_this.fetchData('' + data.data.domain + '/index.php?app=Home&m=AuditApi&a=getAudit&uid='+data.data.uid+'&cid='+data.data.cid+'&access_token=' + data.data.token + '');;
						}

                    }
                }
            })
			})
        }
	}

	_AppButton(){
		let _this = this;
		var { navigator } = this.props;
        if(navigator) {
			InteractionManager.runAfterInteractions(() => {
            navigator.push({
                name: 'Approval',
                component: Approval,
				params: {
                    getUser: function(user) {
						if(user == true){
							_this.fetchData_a('' + data.data.domain + '/index.php?app=Home&m=AuditApi&a=getAudit&uid='+data.data.uid+'&cid='+data.data.cid+'&access_token=' + data.data.token + '');
						}

                    }
                }
            })
			})
        }
	}

	_OperationButton(){
		let _this = this;
		var { navigator } = this.props;
        if(navigator) {
			InteractionManager.runAfterInteractions(() => {
            navigator.push({
                name: 'Operation',
                component: Operation,
				params: {
                    getUser: function(user) {
						if(user == true){
							_this.fetchData_b('' + data.data.domain + '/index.php?app=Home&m=AuditApi&a=getAudit&uid='+data.data.uid+'&cid='+data.data.cid+'&access_token=' + data.data.token + '');
						}

                    }
                }
            })
			})
        }
	}

	_cancer(){
		this.setState({
			statust:false,
		})
	}

	_yes(){
		this.setState({
			statust:false,
		})
		Linking.canOpenURL('http://www.linksame.com/phone/android/Linksame.apk').then(supported => {
				   if (supported) {
					   Linking.openURL('http://www.linksame.com/phone/android/Linksame.apk');
				   } else {

				   }
				})
	}

	render() {
        return (
		  <View style={{flex:1}}>
		   <View style={styles.card}>
			  <View style={{flex:1,alignItems:'center',justifyContent:'center',}}>
				<View style={{justifyContent:'center',flexDirection:'row',alignItems:'center'}}>
							<Text allowFontScaling={false} adjustsFontSizeToFit={false} style={{color:'white',fontSize:18}}>{data.data.companyName}</Text>
				</View>
			  </View>
			</View>
			<Netinfo  {...this.props}/>
		   <ScrollView style={{flex:1,flexDirection:'column',}}
		     refreshControl={
              <RefreshControl
                refreshing={this.state.isRefreshing}
                onRefresh={this._onRefresh.bind(this) }
                colors={['#ff0000', '#00ff00', '#0000ff','#3ad564']}
				progressBackgroundColor="#ffffff"
                />
            }
		   >
					   <View  style={{flex:1,flexDirection:'row',alignItems:'center', backgroundColor:'#fff',}}>
					       <TouchableOpacity
						         activeOpacity={0.8}
                                 onPress={this._newButton.bind(this)}

								 style={{flex:1,flexDirection:'row',alignItems:'center',backgroundColor:'#000', }}>
						     <View style={{flex:1,flexDirection:'row',alignItems:'center',backgroundColor:'#fff',paddingLeft:10,}}>
							   <View style={{width: 50, height: 50,borderRadius:25,backgroundColor:'#1ADA9A',alignItems:'center', justifyContent:'center'}}>
						           <Image source={require('./imgs/xiaox.png')} style={{width: 30, height: 30,}} />
							   </View>
							   <View style={{marginLeft:10,flex:1,flexDirection:'row',borderBottomWidth:0.5, borderColor:'#ccc', height: 70,paddingTop:2,paddingBottom:10, }}>
								   <View style={{flex:1,flexDirection:'column', height: 70,paddingTop:8,paddingBottom:10, }}>
									  <Text allowFontScaling={false} adjustsFontSizeToFit={false} style={{ fontSize:18,color:'#666'}}>消息</Text>
									  {this.state.data ? <Text allowFontScaling={false} adjustsFontSizeToFit={false} numberOfLines={1} style={{ fontSize:13,paddingTop:6,flex:1,overflow:'hidden',}}>{this.state.data}</Text> : <Text style={{color:'#ccc'}}></Text>}
								   </View>
								   <View style={{width:50,height:50,alignItems:'center',justifyContent:'center'}}>
									 <View style={{backgroundColor:'#F53B5C',borderRadius:18,}}>
										 {this.state.isNull>0 ? <Text allowFontScaling={false} adjustsFontSizeToFit={false} style={{color:'#ffffff',paddingTop:1,paddingBottom:1,paddingLeft:6,paddingRight:6,fontSize:12,}}>{this.state.isNull}</Text> : <Text></Text>}
									 </View>
								   </View>
							   </View>
							 </View>
						   </TouchableOpacity  >

					   </View>
					   <View  style={{flex:1,flexDirection:'row',alignItems:'center', backgroundColor:'#fff',}}>
					       <TouchableOpacity
						         activeOpacity={0.8}
                                 onPress={this._AppButton.bind(this)}
								 style={{flex:1,flexDirection:'row',alignItems:'center',backgroundColor:'#000', }}>
						     <View style={{flex:1,flexDirection:'row',alignItems:'center',backgroundColor:'#fff',paddingLeft:10,}}>
						        <View style={{width: 50, height: 50,borderRadius:25,backgroundColor:'#35DCEF',alignItems:'center', justifyContent:'center'}}>
						           <Image source={require('./imgs/sp.png')} style={{width: 30, height: 30,}} />
							   </View>
                                 <View style={{marginLeft:10,flex:1,flexDirection:'row',borderBottomWidth:0.5, borderColor:'#ccc', height: 70,paddingTop:2,paddingBottom:10, }}>
								   <View style={{flex:1,flexDirection:'column', height: 70,paddingTop:8,paddingBottom:10, }}>
									  <Text allowFontScaling={false} adjustsFontSizeToFit={false} style={{ fontSize:18,color:'#666'}}>办公审批</Text>
									  {this.state.data_a ? <Text numberOfLines={1} allowFontScaling={false} adjustsFontSizeToFit={false} style={{ fontSize:13,paddingTop:6,flex:1,overflow:'hidden',}}>{this.state.data_a}</Text> : <Text style={{color:'#ccc'}}></Text>}
								   </View>
								   <View style={{width:50,height:50,alignItems:'center',justifyContent:'center'}}>
									 <View style={{backgroundColor:'#F53B5C',borderRadius:18,}}>
									  {this.state.isNull_a>0 ? <Text allowFontScaling={false} adjustsFontSizeToFit={false} style={{color:'#ffffff',paddingTop:1,paddingBottom:1,paddingLeft:6,paddingRight:6,fontSize:12,}}>{this.state.isNull_a}</Text> : <Text></Text>}
									 </View>
								   </View>
							   </View>

							 </View>
						   </TouchableOpacity  >
					   </View>
					   <View  style={{flex:1,flexDirection:'row',alignItems:'center', backgroundColor:'#fff',}}>
					       <TouchableOpacity
						          activeOpacity={0.8}
                                  onPress={this._OperationButton.bind(this)}

								 style={{flex:1,flexDirection:'row',alignItems:'center',backgroundColor:'#000', }}>
						     <View style={{flex:1,flexDirection:'row',alignItems:'center',backgroundColor:'#fff',paddingLeft:10,}}>
						       <View style={{width: 50, height: 50,borderRadius:25,backgroundColor:'#718DC1',alignItems:'center', justifyContent:'center'}}>
						           <Image source={require('./imgs/sp1.png')} style={{width: 30, height: 30,}} />
							   </View>
							   <View style={{marginLeft:10,flex:1,flexDirection:'row',borderBottomWidth:0.5, borderColor:'#ccc', height: 70,paddingTop:2,paddingBottom:10, }}>
								   <View style={{flex:1,flexDirection:'column', height: 70,paddingTop:8,paddingBottom:10, }}>
									  <Text allowFontScaling={false} adjustsFontSizeToFit={false} style={{ fontSize:18,color:'#666'}}>业务审批</Text>
									  {this.state.data_b ? <Text allowFontScaling={false} adjustsFontSizeToFit={false} numberOfLines={1} style={{ fontSize:13,paddingTop:6,flex:1,overflow:'hidden',}}>{this.state.data_b}</Text> : <Text style={{color:'#ccc'}}></Text>}
								   </View>
								   <View style={{width:50,height:50,alignItems:'center',justifyContent:'center'}}>
									 <View style={{backgroundColor:'#F53B5C',borderRadius:18,}}>
									  {this.state.isNull_b>0 ? <Text allowFontScaling={false} adjustsFontSizeToFit={false} style={{color:'#ffffff',paddingTop:1,paddingBottom:1,paddingLeft:6,paddingRight:6,fontSize:12,}}>{this.state.isNull_b}</Text> : <Text></Text>}
									 </View>
								   </View>
							   </View>
							 </View>
						   </TouchableOpacity  >
					   </View>
					   <View  style={{flex:1,flexDirection:'row',alignItems:'center', backgroundColor:'#fff',}}>
					       <TouchableOpacity
						         activeOpacity={0.8}
                                 onPress={this._pressButton.bind(this)}

								 style={{flex:1,flexDirection:'row',alignItems:'center',backgroundColor:'#000', }}>
						     <View style={{flex:1,flexDirection:'row',alignItems:'center',backgroundColor:'#fff',paddingLeft:10,}}>
						       <View style={{width: 50, height: 50,borderRadius:25,backgroundColor:'#978BC3',alignItems:'center', justifyContent:'center'}}>
						           <Image source={require('./imgs/rc.png')} style={{width: 30, height: 30,}} />
							   </View>
							  <View style={{marginLeft:10,flex:1,flexDirection:'column',borderBottomWidth:0.5, borderColor:'#ccc', height: 70,paddingTop:10,paddingBottom:10, }}>
							      <Text allowFontScaling={false} adjustsFontSizeToFit={false} style={{ fontSize:18,color:'#666'}}>日程</Text>
								  <Text style={{ fontSize:13,paddingTop:6,}}> </Text>
							   </View>
							 </View>
						   </TouchableOpacity  >
					   </View>

					</ScrollView>
                       {this.state.statust ? <View style={{backgroundColor:'rgba(119, 119, 119, 0.51)',position:'absolute',width:(Dimensions.get('window').width),height:(Dimensions.get('window').height),top:0,left:0}}><View style={{position:'absolute',backgroundColor:'#fff',width:260,height:150,top:(Dimensions.get('window').height-270)/2,left:(Dimensions.get('window').width-260)/2,borderRadius:5,overflow:'hidden'}}>
					 <View  style={{height:40,alignItems:'center',justifyContent:'center',flexDirection:'row', }}>
					 <Text allowFontScaling={false} adjustsFontSizeToFit={false} style={{fontSize:18,color:'#000'}}>操作</Text>
					 </View>
					 <View style={{flex:1,justifyContent:'center',alignItems:'center',borderBottomWidth:1,borderColor:'#ececec'}}>
						 <Text allowFontScaling={false} adjustsFontSizeToFit={false} style={{fontSize:16,}}>检测到新版本,立即下载?{this.state.output}</Text>
					 </View>
					 <View style={{flexDirection:'row',justifyContent:'space-between',height:50,backgroundColor:'#ececec',borderBottomLeftRadius:5,borderBottomRightRadius:5}}>
						<TouchableOpacity onPress={this._cancer.bind(this)} style={{flex:1,alignItems:'center',justifyContent:'center',borderBottomLeftRadius:5,backgroundColor:'#fff'}}>
						 <View ><Text allowFontScaling={false} adjustsFontSizeToFit={false} style={{color:'#666',fontSize:16}}>取消</Text></View>
						</TouchableOpacity>
						<TouchableOpacity onPress={this._yes.bind(this)} style={{flex:1, alignItems:'center',justifyContent:'center', borderBottomRightRadius:5,marginLeft:1,backgroundColor:'#fff'}}>
						 <View><Text allowFontScaling={false} adjustsFontSizeToFit={false} style={{color:'#4385f4',fontSize:16}}>确定</Text></View>
						</TouchableOpacity>
					 </View>
			 </View></View> : null}
					</View>
		)
	}

	_onRefresh() {
		 this.setState({
			   isRefreshing:true,
		  })

		   this.fetchData('' + data.data.domain + '/index.php?app=Home&m=AuditApi&a=getAudit&uid='+data.data.uid+'&cid='+data.data.cid+'&access_token=' + data.data.token + '');
           this.fetchData_a('' + data.data.domain + '/index.php?app=Home&m=AuditApi&a=getAudit&uid='+data.data.uid+'&cid='+data.data.cid+'&access_token=' + data.data.token + '');
           this.fetchData_b('' + data.data.domain + '/index.php?app=Home&m=AuditApi&a=getAudit&uid='+data.data.uid+'&cid='+data.data.cid+'&access_token=' + data.data.token + '');

	  }

}
const styles = StyleSheet.create({
  tabView: {
    flex: 1,
    flexDirection: 'column',
	backgroundColor:'#fafafa',
  },
  card: {
    height:45,
	backgroundColor:'#4385f4',
	flexDirection:'row'
  },
  default: {
    height: 37,
    borderWidth: 0,
    borderColor: 'rgba(0,0,0,0.55)',
    flex: 1,
    fontSize: 13,

  },
});


text:
<?php

namespace Tekkl\Bundle\MediaBundle\Service;

use Doctrine\ORM\EntityManagerInterface;
use Tekkl\Bundle\MediaBundle\Entity\Media;
use Tekkl\Bundle\MediaBundle\Struct;
use Tekkl\Bundle\MediaBundle\Gateway\MediaGatewayInterface;
use Tekkl\Bundle\MediaBundle\Model\MediaInterface;
use Tekkl\Bundle\MediaBundle\Service\Filesystem\FilesystemInterface;
use Tekkl\Bundle\MediaBundle\Service\ThumbnailManagerInterface;

class MediaService {
	public function __construct(
		EntityManagerInterface $em,
		MediaGatewayInterface $mediaGateway,
		FilesystemInterface $filesystem,
		ThumbnailManagerInterface $thumbnailManager
	){
		$this->em = $em;
		$this->mediaGateway = $mediaGateway;
		$this->filesystem = $filesystem;
		$this->thumbnailManager = $thumbnailManager;
	}
	public function getMediaById($id){
		return $this->mediaGateway->getMediaById($id);
	}
	public function deleteMedia(MediaInterface $media){
		$repo = $this->em->getRepository(Media::class);
		$media = $repo->findOneById($media->getId());

		$this->deleteThumbnails($media);
		if($this->filesystem->has($media->getPath(), $media->getPathStrategy())){
			$this->filesystem->delete($media->getPath(), $media->getPathStrategy());
		}

		$this->em->remove($media);
		$this->em->flush();
	}
	public function deleteThumbnails(Media $media){
		if($media->getType() !== Media::TYPE_IMAGE) return;
		if(!$media->getDirectory() || !$media->getDirectory()->getSettings()) return;

		$sizes = $media->getDirectory()->getSettings()->getThumbnailSize();
		if(!$sizes) return;
		$thumbnails = $this->thumbnailManager->getMediaThumbnails($media->getPath(), $sizes);

		foreach($thumbnails as $thumbnail){
			if($this->filesystem->has($thumbnail['source'], $media->getPathStrategy())){
				$this->filesystem->delete($thumbnail['source'], $media->getPathStrategy());
			}
			if($this->filesystem->has($thumbnail['hdpiSource'], $media->getPathStrategy())){
				$this->filesystem->delete($thumbnail['hdpiSource'], $media->getPathStrategy());
			}
		}
	}
}


text:
<?
IncludeModuleLangFile(__FILE__);
Class slobel_socialicons extends CModule
{
	const MODULE_ID = 'slobel.socialicons';
	var $MODULE_ID = 'slobel.socialicons';
	var $MODULE_VERSION;
	var $MODULE_VERSION_DATE;
	var $MODULE_NAME;
	var $MODULE_DESCRIPTION;
	var $MODULE_CSS;
	var $strError = '';

	function __construct()
	{
		$arModuleVersion = array();
		include(dirname(__FILE__)."/version.php");
		$this->MODULE_VERSION = $arModuleVersion["VERSION"];
		$this->MODULE_VERSION_DATE = $arModuleVersion["VERSION_DATE"];
		$this->MODULE_NAME = GetMessage("slobel.socialicons_MODULE_NAME");
		$this->MODULE_DESCRIPTION = GetMessage("slobel.socialicons_MODULE_DESC");

		$this->PARTNER_NAME = GetMessage("slobel.socialicons_PARTNER_NAME");
		$this->PARTNER_URI = GetMessage("slobel.socialicons_PARTNER_URI");
	}

	function InstallDB($arParams = array())
	{
		RegisterModuleDependences('main', 'OnBuildGlobalMenu', self::MODULE_ID, 'CSlobelSocialicons', 'OnBuildGlobalMenu');
		return true;
	}

	function UnInstallDB($arParams = array())
	{
		UnRegisterModuleDependences('main', 'OnBuildGlobalMenu', self::MODULE_ID, 'CSlobelSocialicons', 'OnBuildGlobalMenu');
		return true;
	}

	function InstallEvents()
	{
		return true;
	}

	function UnInstallEvents()
	{
		return true;
	}

	function InstallFiles($arParams = array())
	{
		if (is_dir($p = $_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/'.self::MODULE_ID.'/admin'))
		{
			if ($dir = opendir($p))
			{
				while (false !== $item = readdir($dir))
				{
					if ($item == '..' || $item == '.' || $item == 'menu.php')
						continue;
					file_put_contents($file = $_SERVER['DOCUMENT_ROOT'].'/bitrix/admin/'.self::MODULE_ID.'_'.$item,
					'<'.'? require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/'.self::MODULE_ID.'/admin/'.$item.'");?'.'>');
				}
				closedir($dir);
			}
		}
		if (is_dir($p = $_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/'.self::MODULE_ID.'/install/components'))
		{
			if ($dir = opendir($p))
			{
				while (false !== $item = readdir($dir))
				{
					if ($item == '..' || $item == '.')
						continue;
					CopyDirFiles($p.'/'.$item, $_SERVER['DOCUMENT_ROOT'].'/bitrix/components/'.$item, $ReWrite = True, $Recursive = True);
				}
				closedir($dir);
			}
		}
		return true;
	}

	function UnInstallFiles()
	{
		if (is_dir($p = $_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/'.self::MODULE_ID.'/admin'))
		{
			if ($dir = opendir($p))
			{
				while (false !== $item = readdir($dir))
				{
					if ($item == '..' || $item == '.')
						continue;
					unlink($_SERVER['DOCUMENT_ROOT'].'/bitrix/admin/'.self::MODULE_ID.'_'.$item);
				}
				closedir($dir);
			}
		}
		if (is_dir($p = $_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/'.self::MODULE_ID.'/install/components'))
		{
			if ($dir = opendir($p))
			{
				while (false !== $item = readdir($dir))
				{
					if ($item == '..' || $item == '.' || !is_dir($p0 = $p.'/'.$item))
						continue;

					$dir0 = opendir($p0);
					while (false !== $item0 = readdir($dir0))
					{
						if ($item0 == '..' || $item0 == '.')
							continue;
						DeleteDirFilesEx('/bitrix/components/'.$item.'/'.$item0);
					}
					closedir($dir0);
				}
				closedir($dir);
			}
		}
		return true;
	}

	function DoInstall()
	{
		global $APPLICATION;
		$this->InstallFiles();
		$this->InstallDB();
		RegisterModule(self::MODULE_ID);
	}

	function DoUninstall()
	{
		global $APPLICATION;
		UnRegisterModule(self::MODULE_ID);
		$this->UnInstallDB();
		$this->UnInstallFiles();
	}
}
?>


text:
game.TitleScreen = me.ScreenObject.extend({
	/**
	 *  action to perform on state change
	 */
	onResetEvent: function() {
		me.game.world.addChild(new me.Sprite(0, 0, me.loader.getImage("title-screen")), -10); // TODO

                me.input.bindKey(me.input.KEY.ENTER, "start");

                me.game.world.addChild(new (me.Renderable.extend({
                    init: function(){
                        this._super(me.Renderable, "init", [510, 30, me.game.viewport.width, me.game.viewport.height]);
                        this.font = new me.Font("Arial", 46,  "white");
                    },
                    draw: function(renderer){

                        this.font.draw(renderer.getContext(), 'Press "Enter" to play', 325, 530);
                    }
                })));
                this.handler = me.event.subscribe(me.event.KEYDOWN, function(action, keyCode, edge){
                        if(action === "start"){
                            me.state.change(me.state.PLAY);
                        }
                    });
        },

	/**
	 *  action to perform when leaving this screen (state change)
	 */
	onDestroyEvent: function() {
		me.input.unbindKey(me.input.KEY.ENTER); // TODO
                me.event.unsubscribe(this.handler);
	}
});


text:
// Copyright (c) 2014 MediaMiser Ltd. All rights reserved.
package com.mediamiser.resource;

import javax.annotation.security.RolesAllowed;
import javax.json.Json;
import javax.json.JsonArray;
import javax.json.JsonArrayBuilder;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
 * Web APIs to manipulate Topics.
 *
 * @author Chris Fournier <chris.fournier@mediamiser.com>
 */
@Path("/experimental/topics")
@RolesAllowed("user")
public class Topics {

	public static final int TOPIC_COUNT = 10;

	@GET
	@Produces(MediaType.APPLICATION_JSON)
	public JsonArray get() throws Exception {
		final JsonArrayBuilder topics = Json.createArrayBuilder();

		for (int i = 0; i < TOPIC_COUNT; i++) {
			topics.add(Json.createObjectBuilder().add("id", "topic" + Integer.toString(i)).build());
		}

		return topics.build();
	}

}


text:
package me.jonathansmith.overhauled.api.archetype.game_object;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

import me.jonathansmith.overhauled.api.OverhauledAPI;

/**
 * Created by Jonathan Charles Smith on 26/10/15.
 *
 * Template class for blocks that need to be aware of one or multiple states
 */
public abstract class MetadataBlockObject extends BlockObject implements IStateAwareObjectModelMesherHelper {

    protected final HashMap<Integer, String> meta_map = new HashMap<>();

    private final List<IProperty> properties;

    public MetadataBlockObject(Material materialIn, String stateIndependentName, IProperty property) {
        this(materialIn, stateIndependentName, Arrays.asList(new IProperty[]{property}));
    }

    public MetadataBlockObject(Material materialIn, String stateIndependentName, List<IProperty> properties) {
        super(materialIn, stateIndependentName);

        this.properties = properties;

        OverhauledAPI.getNexusProvider().getGameObjectNexus().registerGameObject(this);
    }

    public List<IProperty> getProperties() {
        return properties;
    }

    @Override
    public abstract BlockState createBlockState();

    @Override
    public abstract IBlockState getActualState(IBlockState currentState, IBlockAccess worldAccess, BlockPos position);

    @Override
    public abstract void getSubBlocks(Item item, CreativeTabs tab, List subItemsList);

    @Override
    public abstract int getDamageValue(World world, BlockPos position);

    @Override
    public abstract IBlockState getStateFromMeta(int meta);

    @Override
    public abstract int getMetaFromState(IBlockState state);

    @Override
    public abstract int damageDropped(IBlockState state);
}