text:
namespace BingWallpaper
{
    partial class MainForm
    {
        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.SuspendLayout();
            //
            // MainForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(197, 0);
            this.Margin = new System.Windows.Forms.Padding(4);
            this.Name = "MainForm";
            this.Text = "Form1";
            this.ResumeLayout(false);

        }

        #endregion
    }
}


text:
package com.haohaohu.cachemanage.util;

import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.security.KeyPairGeneratorSpec;
import android.security.keystore.KeyGenParameterSpec;
import android.security.keystore.KeyProperties;

import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.KeyPairGenerator;
import java.security.KeyStore;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Locale;

import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.security.auth.x500.X500Principal;

import kotlin.text.Charsets;
import mohapps.modified.java.util.Base64;

/**
 * KeyStore 帮助类 用来缓存密钥,防止破解
 * {转自 https://gist.github.com/alphamu/cf44b2783fb2fd81cc53aca91276d481}
 *
 * @author haohao on 2017/8/24 10:37
 * @version v1.0
 */
public class KeyStoreHelper {
    private static final String TAG = "KeyStoreHelper";

    /**
     * Creates a public and private key and stores it using the Android Key
     * Store, so that only this application will be able to access the keys.
     */
    public static void createKeys(Context context, String alias) {
        if (!isSigningKey(alias)) {
            if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
                createKeysM(context, alias, false);
            } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
                createKeysN(alias, false);
            } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
                createKeysJBMR2(context, alias);
            }
        }
    }
    //this is for API <=23 only
    private static void setLocale(Context context, Locale locale) {
        Resources resources = context.getResources();
        Configuration configuration = resources.getConfiguration();
        configuration.setLocale(locale);
        configuration.setLayoutDirection(locale);
        resources.updateConfiguration(configuration, resources.getDisplayMetrics());
    }
    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
    private static void createKeysJBMR2(Context context, String alias)
    {
        try {
            Calendar start = new GregorianCalendar();
            Calendar end = new GregorianCalendar();
            end.add(Calendar.YEAR, 30);
            Locale initialLocale = context.getResources().getConfiguration().locale;
            setLocale(context, Locale.ENGLISH);
            KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(SecurityConstants.KEY_ALGORITHM_RSA,
                    SecurityConstants.KEYSTORE_PROVIDER_ANDROID_KEYSTORE);
            keyPairGenerator.initialize(new KeyPairGeneratorSpec.Builder(context)
                    // You'll use the alias later to retrieve the key. It's a key
                    // for the key!
                    .setAlias(alias)
                    .setSubject(new X500Principal("CN=" + alias))
                    .setSerialNumber(BigInteger.valueOf(Math.abs(alias.hashCode())))
                    // Date range of validity for the generated pair.
                    .setStartDate(start.getTime())
                    .setEndDate(end.getTime())
                    .build());
            keyPairGenerator.generateKeyPair();
            setLocale(context, initialLocale);
            getSecretKeyJBMR2(context, alias);
        }
        catch (Exception e){
            throw new RuntimeException(e);
        }
    }
    @TargetApi(Build.VERSION_CODES.M)
    private static void createKeysM(Context context, String alias, boolean requireAuth) {
        try {
            //workaround to avoid crash on API 23 when app locale is Arabic, Persian,...
            //https://issuetracker.google.com/issues/37095309
            //https://stackoverflow.com/a/46602170/6305235
            Locale initialLocale = context.getResources().getConfiguration().locale;
            setLocale(context, Locale.ENGLISH);
            KeyGenerator keyGenerator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, SecurityConstants.KEYSTORE_PROVIDER_ANDROID_KEYSTORE);
            keyGenerator.init(new KeyGenParameterSpec.Builder(alias,
                    KeyProperties.PURPOSE_ENCRYPT
                            | KeyProperties.PURPOSE_DECRYPT)
                    .setKeySize(256)
                    .setBlockModes(KeyProperties.BLOCK_MODE_CBC)
                    .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7)
                    // Only permit the private key to be used if the user authenticated
                    // within the last five minutes.
                    .setUserAuthenticationRequired(requireAuth)
                    .build());
            keyGenerator.generateKey();
            setLocale(context, initialLocale);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    @TargetApi(Build.VERSION_CODES.N)
    private static void createKeysN(String alias, boolean requireAuth) {
        try {
            KeyGenerator keyGenerator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, SecurityConstants.KEYSTORE_PROVIDER_ANDROID_KEYSTORE);
            keyGenerator.init(new KeyGenParameterSpec.Builder(alias,
                    KeyProperties.PURPOSE_ENCRYPT
                            | KeyProperties.PURPOSE_DECRYPT)
                    .setKeySize(256)
                    .setBlockModes(KeyProperties.BLOCK_MODE_CBC)
                    .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7)
                    // Only permit the private key to be used if the user authenticated
                    // within the last five minutes.
                    .setUserAuthenticationRequired(requireAuth)
                    .build());
            keyGenerator.generateKey();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * JBMR2+ If Key with the default alias exists, returns true, else false.
     * on pre-JBMR2 returns true always.
     */
    private static boolean isSigningKey(String alias) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
            try {
                KeyStore keyStore =
                        KeyStore.getInstance(SecurityConstants.KEYSTORE_PROVIDER_ANDROID_KEYSTORE);
                keyStore.load(null);
                return keyStore.containsAlias(alias);
            } catch (Exception e) {
                return false;
            }
        } else {
            return false;
        }
    }

    /**
     * Returns the private key signature on JBMR2+ or else null.
     */
    public static String getSigningKey(String alias) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
            KeyStore.PrivateKeyEntry keyEntry = getPrivateKeyEntry(alias);
            if (keyEntry == null) {
                return null;
            }
            Certificate cert = keyEntry.getCertificate();
            if (cert == null) {
                return null;
            }
            try {
                return Base64.getEncoder().encodeToString(cert.getEncoded());
            } catch (CertificateEncodingException e) {
                e.printStackTrace();
                return null;
            }
        } else {
            return null;
        }
    }

    private static KeyStore.PrivateKeyEntry getPrivateKeyEntry(String alias) {
        try {
            KeyStore ks =
                    KeyStore.getInstance(SecurityConstants.KEYSTORE_PROVIDER_ANDROID_KEYSTORE);
            ks.load(null);
            KeyStore.Entry entry = ks.getEntry(alias, null);

            if (entry == null) {
                return null;
            }

            if (!(entry instanceof KeyStore.PrivateKeyEntry)) {
                return null;
            }
            return (KeyStore.PrivateKeyEntry) entry;
        } catch (Exception e) {
            return null;
        }
    }
    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
    private static SecretKey getSecretKeyJBMR2(Context context, String alias) {
        SharedPreferences pref = context.getSharedPreferences(SecurityConstants.ENCRYPTION, Context.MODE_PRIVATE);
        String aesKey = pref.getString(SecurityConstants.AES_KEY, "");
        if (aesKey.equals("")) {
            try {
                KeyGenerator keygen = KeyGenerator.getInstance(SecurityConstants.KEY_ALGORITHM_AES);
                keygen.init(128);
                SecretKey secretKey = keygen.generateKey();
                SharedPreferences.Editor editor = pref.edit();
                editor.putString(SecurityConstants.AES_KEY, encryptKey(alias, new String(secretKey.getEncoded(), Charsets.ISO_8859_1)));
                editor.apply();
                return secretKey;
            } catch (NoSuchAlgorithmException e) {
                e.printStackTrace();
            }
        } else {
            return new SecretKeySpec(decryptKey(alias, aesKey).getBytes(Charsets.ISO_8859_1), 0, 16, SecurityConstants.KEY_ALGORITHM_AES);
        }
        return null;
    }
    @TargetApi(Build.VERSION_CODES.M)
    private static SecretKey getSecretKeyM(String alias) {
        try {
            KeyStore ks =
                    KeyStore.getInstance(SecurityConstants.KEYSTORE_PROVIDER_ANDROID_KEYSTORE);
            ks.load(null);
            KeyStore.Entry entry = ks.getEntry(alias, null);

            if (entry == null) {
                return null;
            }

            if (!(entry instanceof KeyStore.SecretKeyEntry)) {
                return null;
            }
            return ((KeyStore.SecretKeyEntry) entry).getSecretKey();
        } catch (Exception e) {
            return null;
        }
    }

    private static String encryptKey(String alias, String aesKey) {
        try {
            KeyStore.PrivateKeyEntry keyEntry = getPrivateKeyEntry(alias);
            if (keyEntry == null) {
                return "";
            }
            PublicKey publicKey = keyEntry.getCertificate().getPublicKey();
            Cipher cipher = getCipherRSA();
            cipher.init(Cipher.ENCRYPT_MODE, publicKey);
            return Base64.getEncoder().encodeToString(cipher.doFinal(aesKey.getBytes(StandardCharsets.UTF_8)));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    private static String decryptKey(String alias, String aesKeyCipher) {
        try {
            KeyStore.PrivateKeyEntry keyEntry = getPrivateKeyEntry(alias);
            if (keyEntry == null) {
                return "";
            }
            PrivateKey privateKey = keyEntry.getPrivateKey();
            Cipher cipher = getCipherRSA();
            cipher.init(Cipher.DECRYPT_MODE, privateKey);
            return new String(cipher.doFinal(Base64.getDecoder().decode(aesKeyCipher.getBytes(StandardCharsets.UTF_8))));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    public static String encrypt(Context context, String alias, String plainText) {
        try {
            SecretKey secretKey = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)?getSecretKeyM(alias):getSecretKeyJBMR2(context, alias);
            if (secretKey == null) {
                return "";
            }
            Cipher cipher = getCipherAES();
            cipher.init(Cipher.ENCRYPT_MODE, secretKey);
            byte[] plainTextBytes = plainText.getBytes(StandardCharsets.UTF_8);
            byte[] encryptedTextBytes = cipher.doFinal(plainTextBytes);
            IvParameterSpec ivParams = cipher.getParameters().getParameterSpec(IvParameterSpec.class);
            byte[] iv = ivParams.getIV();
            byte[] cb = new byte[iv.length + encryptedTextBytes.length];
            for (int i = 0; i < cb.length; ++i) {
                cb[i] = i < iv.length ? iv[i] : encryptedTextBytes[i - iv.length];
            }
            return Base64.getEncoder().encodeToString(cb);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }

    public static String decrypt(Context context, String alias, String savedText) {
        try {
            SecretKey secretKey = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)?getSecretKeyM(alias):getSecretKeyJBMR2(context, alias);
            if (secretKey == null) {
                return "";
            }
            Cipher cipher = getCipherAES();
            byte[] savedTextBytes = Base64.getDecoder().decode(savedText.getBytes(StandardCharsets.UTF_8));
            byte[] iv = new byte[16];
            byte[] encryptedTextBytes = new byte[savedTextBytes.length - iv.length];
            for (int i = 0; i < savedTextBytes.length; i++) {
                if (i < iv.length) {
                    iv[i] = savedTextBytes[i];
                } else {
                    encryptedTextBytes[i-iv.length] = savedTextBytes[i];
                }
            }
            IvParameterSpec ivParams = new IvParameterSpec(iv);
            cipher.init(Cipher.DECRYPT_MODE, secretKey, ivParams);
            return new String(cipher.doFinal(encryptedTextBytes));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    private static Cipher getCipherRSA() throws NoSuchPaddingException, NoSuchAlgorithmException {
            return Cipher.getInstance(String.format("%s/%s/%s", SecurityConstants.KEY_ALGORITHM_RSA,
                    SecurityConstants.BLOCK_MODE_ECB, SecurityConstants.ENCRYPTION_PADDING_RSA_PKCS1));
    }
    private static Cipher getCipherAES() throws NoSuchPaddingException, NoSuchAlgorithmException {
            return Cipher.getInstance(String.format("%s/%s/%s", SecurityConstants.KEY_ALGORITHM_AES,
                    SecurityConstants.BLOCK_MODE_CBC, SecurityConstants.ENCRYPTION_PADDING_PKCS7));
    }

    public interface SecurityConstants {
        String KEYSTORE_PROVIDER_ANDROID_KEYSTORE = "AndroidKeyStore";

        public static final String KEY_ALGORITHM_RSA = "RSA";
        public static final String KEY_ALGORITHM_EC = "EC";
        public static final String KEY_ALGORITHM_AES = "AES";

        public static final String ENCRYPTION_PADDING_NONE = "NoPadding";
        public static final String ENCRYPTION_PADDING_PKCS7 = "PKCS7Padding";
        public static final String ENCRYPTION_PADDING_RSA_PKCS1 = "PKCS1Padding";
        public static final String ENCRYPTION_PADDING_RSA_OAEP = "OAEPPadding";

        public static final String BLOCK_MODE_ECB = "ECB";
        public static final String BLOCK_MODE_CBC = "CBC";
        public static final String BLOCK_MODE_CTR = "CTR";
        public static final String BLOCK_MODE_GCM = "GCM";

        public static final String ENCRYPTION = "ENCRIPTION";
        public static final String AES_KEY = "AES_KEY";

        String SIGNATURE_SHA256withRSA = "SHA256withRSA";
        String SIGNATURE_SHA512withRSA = "SHA512withRSA";
    }
}

redpajama_set_name: RedPajamaGithub


text:
require 'highline'
require 'yaml'

require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib hitch author]))
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib hitch ui]))

module Hitch

  VERSION = '1.0.2'

  def self.print_info
    if Hitch.pairing? && STDOUT.tty?
      Hitch::UI.highline.say("#{Hitch.git_author_name} <#{Hitch.git_author_email}>")
    end
  end

  def self.export(pairs)
    Hitch.current_pair = pairs
    write_export_file
    print_info
  end

  def self.expire_command(time)
    %Q(sleep #{to_seconds(time)} && #{Hitch.bin_path} --unhitch&)
  end

  def self.unhitch
    Hitch.current_pair = []
    write_export_file
  end

  def self.author_command
    if Hitch.pairing?
      "export GIT_AUTHOR_NAME='#{Hitch.git_author_name}' GIT_AUTHOR_EMAIL='#{Hitch.git_author_email}'"
    else
      "unset GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL"
    end
  end

  def self.group_email
    config[:group_email] ||= Hitch::UI.prompt_for_group_email
  end

  def self.group_email=(email)
    config[:group_email] = email
    write_file
  end

  def self.current_pair
    config[:current_pair] ||= []
  end

  def self.current_pair=(pairs)
    config[:current_pair] = []
    pairs.each do |author|
      if Hitch::Author.find(author)
        config[:current_pair] << author
      else
        if Hitch::UI.prompt_for_pair(author)
          config[:current_pair] << author
        end
      end
    end
    write_file
  end

  def self.git_author_name
    devs = current_pair.sort.map {|pair| Hitch::Author.find(pair)}
    case devs.length
    when 1, 2
      devs.join(" and ")
    else
      "#{devs[0...-1].join(', ')}, and #{devs[-1]}"
    end
  end

  def self.git_author_email
    "#{group_prefix}+#{current_pair.sort.join('+')}@#{group_domain}"
  end

  def self.group_prefix
    group_email.split('@').first
  end

  def self.group_domain
    group_email.split('@').last
  end

  def self.setup_path
    File.join(File.dirname(__FILE__), 'hitch', 'hitch.sh')
  end

  def self.print_setup_path
    puts setup_path
  end

  def self.setup
    Hitch::UI.highline.say(File.read(setup_path))
  end

  def self.write_file
    File.open(hitchrc, File::CREAT|File::TRUNC|File::RDWR, 0644) do |out|
      YAML.dump(config, out)
    end
  end

  private

  def self.config
    @config ||= get_config
  end

  def self.get_config
    if File.exists?(hitchrc)
      yamlized = YAML::load_file(hitchrc)
      return yamlized if yamlized.kind_of?(Hash)
    end
    return {}
  end

  def self.hitchrc
    File.expand_path('~/.hitchrc')
  end

  def self.hitch_export_authors
    File.expand_path('~/.hitch_export_authors')
  end

  def self.bin_path
    %x[which hitch].chomp
  end

  def self.pairing?
    current_pair.any?
  end

  def self.to_seconds(value)
    value = value.to_s.gsub(/[^\d]/, '').to_i
    unless value.zero?
      value * 60 * 60
    else
      raise StandardError
    end
  end

  def self.write_export_file
    File.open(hitch_export_authors, 'w'){|f| f.write(author_command) }
  end

end


text:
package com.github.rozidan.springboot.modelmapper;

import org.junit.Test;
import org.modelmapper.ModelMapper;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;

/**
 * Tests the registration of {@link org.modelmapper.ModelMapper}.
 *
 * @author Idan Rozenfeld
 */
public class ModelMapperFactoryBeanTest {

    @Test
    public void shouldInstantiateModelMapper() throws Exception {
        final ModelMapperFactoryBean factoryBean = new ModelMapperFactoryBean();
        final ModelMapper modelMapper = factoryBean.getObject();
        assertThat(modelMapper, is(notNullValue()));
    }
}


text:
#import <Foundation/Foundation.h>
#if TARGET_OS_IPHONE
  #import "DDXML.h"
#endif

@class XMPPStream;

enum XMPPHandleAuthResponse
{
	XMPP_AUTH_FAIL,     // Authentication failed.
	                    // The delegate will be informed via xmppStream:didNotAuthenticate:

	XMPP_AUTH_SUCCESS,  // Authentication succeeded.
	                    // The delegate will be informed via xmppStreamDidAuthenticate:

	XMPP_AUTH_CONTINUE, // The authentication process is still ongoing.

};
typedef enum XMPPHandleAuthResponse XMPPHandleAuthResponse;

@protocol XMPPSASLAuthentication <NSObject>
@required

/**
 * Returns the associated mechanism name.
 *
 * An xmpp server sends a list of supported authentication mechanisms during the xmpp handshake.
 * The list looks something like this:
 *
 * <stream:features>
 *    <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
 *       <mechanism>DIGEST-MD5</mechanism>
 *       <mechanism>X-FACEBOOK-PLATFORM</mechanism>
 *       <mechanism>X-YOUR-CUSTOM-AUTH-SCHEME</mechanism>
 *    </mechanisms>
 * </stream:features>
 *
 * The mechanismName returned should match the value inside the <mechanism>HERE</mechanism>.
**/
+ (NSString *)mechanismName;

/**
 * Standard init method.
 *
 * The XMPPStream class natively supports the standard authentication scheme (auth with password).
 * If that method is used, then xmppStream will automatically create an authentication instance via this method.
 * Which authentication class it chooses is based on the configured authentication priorities,
 * and the auth mechanisms supported by the server.
 *
 * Not all authentication mechanisms will use this init method.
 * For example:
 *  - they require an appId and authToken
 *  - they require a userName (not related to JID), privilegeLevel, and password
 *  - they require an eyeScan and voiceFingerprint
 *
 * In this case, the authentication mechanism class should provide it's own custom init method.
 * However it should still implement this method, and then use the start method to notify of errors.
**/
- (id)initWithStream:(XMPPStream *)stream password:(NSString *)password;

/**
 * Attempts to start the authentication process.
 * The auth mechanism should send whatever stanzas are needed to begin the authentication process.
 *
 * If it isn't possible to start the authentication process (perhaps due to missing information),
 * this method should return NO and set an appropriate error message.
 * For example: "X-Custom-Platform authentication requires authToken"
 * Otherwise this method should return YES.
 *
 * This method is called by automatically XMPPStream (via the authenticate: method).
 * You should NOT invoke this method manually.
**/
- (BOOL)start:(NSError **)errPtr;

/**
 * After the authentication process has started, all incoming xmpp stanzas are routed to this method.
 * The authentication mechanism should process the stanza as appropriate, and return the coresponding result.
 * If the authentication is not yet complete, it should return XMPP_AUTH_CONTINUE,
 * meaning the xmpp stream will continue to forward all incoming xmpp stanzas to this method.
 *
 * This method is called by automatically XMPPStream (via the authenticate: method).
 * You should NOT invoke this method manually.
**/
- (XMPPHandleAuthResponse)handleAuth:(NSXMLElement *)auth;

@optional

/**
 * Optionally implement this method to override the default behavior.
 * The default value is YES.
**/
- (BOOL)shouldResendOpeningNegotiationAfterSuccessfulAuthentication;

@end


text:
package org.openni;

import java.util.List;

/**
 *

 * The SensorInfo class encapsulates all info related to a specific sensor in a specific device.

 * A {@link Device} object holds a SensorInfo object for each sensor it contains.

 * A {@link VideoStream} object holds one SensorInfo object, describing the sensor used to produce
 * that stream.
 *

 *
 *

 * A given SensorInfo object will contain the type of the sensor (Depth, IR or Color), and a list of
 * all video modes that the sensor can support. Each available video mode will have a single
 * VideoMode object that can be queried to get the details of that mode.
 *

 *
 *

 * SensorInfo objects should be the only source of VideoMode objects for the vast majority of
 * application programs.
 *

 *
 *

 * Application programs will never directly instantiate objects of type SensorInfo. In fact, no
 * public constructors are provided. SensorInfo objects should be obtained either from a Device or
 * {@link VideoStream}, and in turn be used to provide available video modes for that sensor.
 *

 */
public class SensorInfo {
	/**
	 * Provides the sensor type of the sensor this object is associated with.
	 *
	 * @return Type of the sensor.
	 */
	public SensorType getSensorType() {
		return mSensorType;
	}

	/**
	 * Provides a list of video modes that this sensor can support. This function is the recommended
	 * method to be used by applications to obtain {@link VideoMode} objects.
	 *
	 * @return Reference to an array of {@link VideoMode} objects, one for each supported video mode.
	 */
	public final List<VideoMode> getSupportedVideoModes() {
		return mVideoModes;
	}

	private SensorInfo(int sensorType, List<VideoMode> videoModes) {
		this.mSensorType = SensorType.fromNative(sensorType);
		this.mVideoModes = videoModes;
	}

	private final SensorType mSensorType;
	private final List<VideoMode> mVideoModes;
}


text:
/*
 * WSO2 API Manager - Publisher API
 * This specifies a **RESTful API** for WSO2 **API Manager** - Publisher.  Please see [full swagger definition](https://raw.githubusercontent.com/wso2/carbon-apimgt/v6.0.4/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher/src/main/resources/publisher-api.yaml) of the API which is written using [swagger 2.0](http://swagger.io/) specification.
 *
 * OpenAPI spec version: 0.10.0
 * Contact: architecture@wso2.com
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.wso2.carbon.apimgt.rest.integration.tests.api;

import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.wso2.carbon.apimgt.rest.integration.tests.ApiException;
import org.wso2.carbon.apimgt.rest.integration.tests.model.*;
import org.testng.annotations.Test;

import java.util.ArrayList;

/**
 * API tests for APICollectionApi
 */
public class APICollectionApiIT {

    private final APICollectionApi api = new APICollectionApi();
    private static String apiID;

    /**
     * Retrieve/Search APIs
     *

     * This operation provides you a list of available APIs qualifying under a given search condition.  Each retrieved API is represented with a minimal amount of attributes. If you want to get complete details of an API, you need to use **Get details of an API** operation.
     *
     * @throws ApiException if the Api call fails
     */
    @Test(dependsOnMethods = "apisPostTest", enabled = true)
    public void apisGetTest() throws ApiException {
        Integer limit = 10;
        Integer offset = 2;
        String query = null;
        String accept = null;
        String ifNoneMatch = null;
        APIList response = api.apisGet(limit, offset, query, accept, ifNoneMatch);
        Assert.assertEquals(response.getList().get(0).getName(), "API-117", "API name mismatch");
    }

    /**
     * Check given API attibute name is already exist
     *

     * Using this operation, you can check a given API context is already used. You need to provide the context name you want to check.
     *
     * @throws ApiException if the Api call fails
     */
    @Test(dependsOnMethods = "apisPostTest", enabled = true)
    public void apisHeadTest() throws ApiException {
        String query = "name:API-117";
        String accept = null;
        String ifNoneMatch = null;
        api.apisHead(query, accept, ifNoneMatch);

        // TODO: test validations (will thrown API Not Found exception if not available)
    }

    /**
     * Check for error if given API attribute does not exist
     *

     * TODO: Check if this is required (NO IHMO)
     *
     * @throws ApiException
     */
    @Test(dependsOnMethods = "apisHeadTest", expectedExceptions = ApiException.class)
    public void apisHeadFailureTest() throws ApiException {
        String query = "name:DoesNotExist";
        String accept = null;
        String ifNoneMatch = null;
        api.apisHead(query, accept, ifNoneMatch);
    }

    /**
     * Create a new API
     *

     * This operation can be used to create a new API specifying the details of the API in the payload. The new API will be in `CREATED` state.  There is a special capability for a user who has `APIM Admin` permission such that he can create APIs on behalf of other users. For that he can to specify `\"provider\" : \"some_other_user\"` in the payload so that the API's creator will be shown as `some_other_user` in the UI.
     *
     * @throws ApiException if the Api call fails
     */
    @Test(enabled = true)
    public void apisPostTest() throws ApiException {
        API body = new API();
        String contentType = "application/json";
        if (body != null) {
            body.setApiDefinition("{ \t\"paths\": { \t\t\"/order\": { \t\t\t\"post\": { \t\t\t\t\"x-auth-type\": " +
                    "\"Application & Application User\", \t\t\t\t\"x-throttling-tier\": \"Unlimited\", \t\t\t\t\"description\":" +
                    " \"Create a new Order\", \t\t\t\t\"parameters\": [{ \t\t\t\t\t\"schema\": { \t\t\t\t\t\t\"$ref\"" +
                    ": \"#/definitions/Order\" \t\t\t\t\t}, \t\t\t\t\t\"description\": \"Order object that needs to be added\"," +
                    " \t\t\t\t\t\"name\": \"body\", \t\t\t\t\t\"required\": true, \t\t\t\t\t\"in\": \"body\" \t\t\t\t}]," +
                    " \t\t\t\t\"responses\": { \t\t\t\t\t\"201\": { \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Location\"" +
                    ": { \t\t\t\t\t\t\t\t\"description\": \"The URL of the newly created resource.\", \t\t\t\t\t\t\t\t\"type" +
                    "\": \"string\" \t\t\t\t\t\t\t} \t\t\t\t\t\t}, \t\t\t\t\t\t\"schema\": { \t\t\t\t\t\t\t\"$ref\":" +
                    " \"#/definitions/Order\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"description\": \"Created.\" \t\t\t\t\t} " +
                    "\t\t\t\t} \t\t\t} \t\t}, \t\t\"/menu\": { \t\t\t\"get\": { \t\t\t\t\"x-auth-type\": " +
                    "\"Application & Application User\", \t\t\t\t\"x-throttling-tier\": \"Unlimited\", " +
                    "\t\t\t\t\"description\": \"Return a list of available menu items\", \t\t\t\t\"parameters\":" +
                    " [], \t\t\t\t\"responses\": { \t\t\t\t\t\"200\": { \t\t\t\t\t\t\"headers\": {}, \t\t\t\t\t\t\"schema\":" +
                    " { \t\t\t\t\t\t\t\"title\": \"Menu\", \t\t\t\t\t\t\t\"properties\": { \t\t\t\t\t\t\t\t\"list\": " +
                    "{ \t\t\t\t\t\t\t\t\t\"items\": { \t\t\t\t\t\t\t\t\t\t\"$ref\": \"#/definitions/MenuItem\" " +
                    "\t\t\t\t\t\t\t\t\t}, \t\t\t\t\t\t\t\t\t\"type\": \"array\" \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t}, " +
                    "\t\t\t\t\t\t\t\"type\": \"object\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"description\": \"OK.\" \t\t\t\t\t} " +
                    "\t\t\t\t} \t\t\t} \t\t} \t}, \t\"schemes\": [\"https\"], \t\"produces\": [\"application/json\"]," +
                    " \t\"swagger\": \"2.0\", \t\"definitions\": { \t\t\"MenuItem\": { \t\t\t\"title\": \"Pizza menu Item\", " +
                    "\t\t\t\"properties\": { \t\t\t\t\"price\": { \t\t\t\t\t\"type\": \"string\" \t\t\t\t}, \t\t\t\t\"description\":" +
                    " { \t\t\t\t\t\"type\": \"string\" \t\t\t\t}, \t\t\t\t\"name\": { \t\t\t\t\t\"type\": \"string\" \t\t\t\t}," +
                    " \t\t\t\t\"image\": { \t\t\t\t\t\"type\": \"string\" \t\t\t\t} \t\t\t}, \t\t\t\"required\": [\"name\"] \t\t}," +
                    " \t\t\"Order\": { \t\t\t\"title\": \"Pizza Order\", \t\t\t\"properties\": { \t\t\t\t\"customerName\": " +
                    "{ \t\t\t\t\t\"type\": \"string\" \t\t\t\t}, \t\t\t\t\"delivered\": { \t\t\t\t\t\"type\":" +
                    " \"boolean\" \t\t\t\t}, \t\t\t\t\"address\": { \t\t\t\t\t\"type\": \"string\" \t\t\t\t}," +
                    " \t\t\t\t\"pizzaType\": { \t\t\t\t\t\"type\": \"string\" \t\t\t\t}, \t\t\t\t\"creditCardNumber\":" +
                    " { \t\t\t\t\t\"type\": \"string\" \t\t\t\t}, \t\t\t\t\"quantity\": { \t\t\t\t\t\"type\": \"number\" \t\t\t\t}, " +
                    "\t\t\t\t\"orderId\": { \t\t\t\t\t\"type\": \"integer\" \t\t\t\t} \t\t\t}, \t\t\t\"required\": " +
                    "[\"orderId\"] \t\t } \t}, \t\"consumes\": [\"application/json\"], \t\"info\": { \t\t\"title\": " +
                    "\"PizzaShackAPI\", \t\t\"description\":" +
                    " \"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\n\", \t\t\"license\": " +
                    "{ \t\t\t\"name\": \"Apache 2.0\", \t\t\t\"url\": \"http://www.apache.org/licenses/LICENSE-2.0.html\" \t\t}, " +
                    "\t\t\"contact\": { \t\t\t\"email\": \"architecture@pizzashack.com\", \t\t\t\"name\": \"John Doe\", " +
                    "\t\t\t\"url\": \"http://www.pizzashack.com\" \t\t}, \t\t\"version\": \"1.0.0\" \t} }");
        }
        body.setName("API-117");
        body.setContext("API-117");
        body.setVersion("111");
        body.setProvider("admin");
        body.setLifeCycleStatus("CREATED");
        body.setTransport(new ArrayList<String>() {{
            add("http");
        }});
        body.setCacheTimeout(100);
        body.setPolicies(new ArrayList<String>() {{
            add("Unlimited");
        }});
        body.setVisibility(API.VisibilityEnum.PUBLIC);
        body.setTags(new ArrayList<String>());
        body.setMaxTps(new APIMaxTps());
        body.setVisibleRoles(new ArrayList<String>());
        body.setVisibleTenants(new ArrayList<String>());
        body.setEndpointSecurity(new APIEndpointSecurity());
        body.setSequences(new ArrayList<Sequence>());
        body.setBusinessInformation(new APIBusinessInformation());
        body.setCorsConfiguration(new APICorsConfiguration());
        API response = api.apisPost(body, contentType);
        this.apiID = response.getId();
        Assert.assertTrue(true);
    }

    @AfterClass
    public void afterClass() throws ApiException {
        APIIndividualApi apiClient = new APIIndividualApi();

        APIList response = api.apisGet(1, 1, null, null, null);

        String apiId = response.getList().get(0).getId();
        String ifMatch = null;
        String ifUnmodifiedSince = null;
        apiClient.apisApiIdDelete(apiId, ifMatch, ifUnmodifiedSince);
    }

}


text:
Tiddle provides Devise strategy for token authentication in API-only Ruby on Rails applications. Its main feature is **support for multiple tokens per user**.

Tiddle is lightweight and non-configurable. It does what it has to do and leaves some manual implementation to you.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'tiddle'
```

And then execute:

    $ bundle

## Usage

1) Add ```:token_authenticatable``` inside your Devise-enabled model:

```ruby
class User < ActiveRecord::Base
  devise :database_authenticatable, :registerable,
         :recoverable, :trackable, :validatable,
         :token_authenticatable
end
```

2) Generate the model which stores authentication tokens. The model name is not important, but the Devise-enabled model should have association called ```authentication_tokens```.

```
rails g model AuthenticationToken body:string:index user:references last_used_at:datetime expires_in:integer ip_address:string user_agent:string
```

```ruby
class User < ActiveRecord::Base
  has_many :authentication_tokens
end
```

```body```, ```last_used_at```, ```ip_address``` and ```user_agent``` fields are required.

3) Customize ```Devise::SessionsController```. You need to create and return token in ```#create``` and expire the token in ```#destroy```.

```ruby
class Users::SessionsController < Devise::SessionsController

  def create
    user = warden.authenticate!(auth_options)
    token = Tiddle.create_and_return_token(user, request)
    render json: { authentication_token: token }
  end

  def destroy
    Tiddle.expire_token(current_user, request) if current_user
    render json: {}
  end

  private

    # this is invoked before destroy and we have to override it
    def verify_signed_out_user
    end
end
```

4) Require authentication for some controller:

```ruby
class PostsController < ApplicationController
  before_action :authenticate_user!

  def index
    render json: Post.all
  end
end
```

5) Send ```X-USER-EMAIL``` and ```X-USER-TOKEN``` as headers of every request which requires authentication.

You can read more in a blog post dedicated to Tiddle - https://blog.sundaycoding.com/blog/2015/04/04/token-authentication-with-tiddle/

## Note on Rails session

The safest solution in API-only application is not to rely on Rails session at all and disable it. Put this line in your ```application.rb```:

```ruby
config.middleware.delete ActionDispatch::Session::CookieStore
```

More: https://blog.sundaycoding.com/blog/2015/04/04/token-authentication-with-tiddle/#rails-session

## Using field other than email

Change ```config.authentication_keys``` in Devise intitializer and Tiddle will use this value.

## Security

Usually it makes sense to remove user's tokens after a password change. Depending on the project and on your taste, this can be done using various methods like running `user.authentication_tokens.destroy_all` after the password change or with an `after_save` callback in your model which runs `authentication_tokens.destroy_all if encrypted_password_changed?`.

In case of a security breach, remove all existing tokens.

Tokens are expiring after certain period of inactivity. This behavior is optional. If you want your token to expire, create it passing `expires_in` option:

```ruby
token = Tiddle.create_and_return_token(user, request, expires_in: 1.month)
```


text:
"""
Tests for the udiskie.cache module.
"""

import unittest
import time

from udiskie.cache import PasswordCache

class TestDev:

    def __init__(self, id_uuid):
        self.id_uuid = id_uuid

class TestPasswordCache(unittest.TestCase):

    """
    Tests for the udiskie.cache.PasswordCache class.
    """

    # NOTE: The device names are different in each test so that they do not
    # interfere accidentally.

    def test_timeout(self):
        """The cached password expires after the specified timeout."""
        device = TestDev('ALPHA')
        password = '{<}hëllo ωορλδ!{>}'
        cache = PasswordCache(1)
        cache[device] = password
        self.assertEqual(cache[device], password.encode('utf-8'))
        time.sleep(1.5)
        with self.assertRaises(KeyError):
            cache[device]

    def test_touch(self):
        """Key access refreshes the timeout."""
        device = TestDev('BETA')
        password = '{<}hëllo ωορλδ!{>}'
        cache = PasswordCache(3)
        cache[device] = password
        time.sleep(2)
        self.assertEqual(cache[device], password.encode('utf-8'))
        time.sleep(2)
        self.assertEqual(cache[device], password.encode('utf-8'))
        time.sleep(4)
        with self.assertRaises(KeyError):
            cache[device]

    def test_revoke(self):
        """A key can be deleted manually."""
        device = TestDev('GAMMA')
        password = '{<}hëllo ωορλδ!{>}'
        cache = PasswordCache(0)
        cache[device] = password
        self.assertEqual(cache[device], password.encode('utf-8'))
        del cache[device]
        with self.assertRaises(KeyError):
            cache[device]

    def test_update(self):
        device = TestDev('DELTA')
        password = '{<}hëllo ωορλδ!{>}'
        cache = PasswordCache(0)
        cache[device] = password
        self.assertEqual(cache[device], password.encode('utf-8'))
        cache[device] = password * 2
        self.assertEqual(cache[device], password.encode('utf-8')*2)
        del cache[device]
        with self.assertRaises(KeyError):
            cache[device]

if __name__ == '__main__':
    unittest.main()


text:
package de.hpi.visio.data;

import org.xmappr.RootElement;
import org.xmappr.Text;

/**
 * Class for xmappr - xml to java mapping. Label: In oryx according to the
 * stencil this properties key is: title, name, condition, expression,...
 *
 * @author Thamsen
 */
@RootElement("Text")
public class Label {

	@Text
	public String text;

	public Label() {
		text = "";
	}

	public String getLabel() {
		return this.text;
	}

	public void setLabel(String label) {
		text = label;
	}

}


text:
using System.Text.Json;
using Azure.Core;

namespace Azure.ResourceManager.AppConfiguration.Models
{
    public partial class AppConfigurationStorePatch : IUtf8JsonSerializable
    {
        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
        {
            writer.WriteStartObject();
            if (Optional.IsDefined(Identity))
            {
                writer.WritePropertyName("identity");
                JsonSerializer.Serialize(writer, Identity);
            }
            if (Optional.IsDefined(Sku))
            {
                writer.WritePropertyName("sku");
                writer.WriteObjectValue(Sku);
            }
            if (Optional.IsCollectionDefined(Tags))
            {
                writer.WritePropertyName("tags");
                writer.WriteStartObject();
                foreach (var item in Tags)
                {
                    writer.WritePropertyName(item.Key);
                    writer.WriteStringValue(item.Value);
                }
                writer.WriteEndObject();
            }
            writer.WritePropertyName("properties");
            writer.WriteStartObject();
            if (Optional.IsDefined(Encryption))
            {
                writer.WritePropertyName("encryption");
                writer.WriteObjectValue(Encryption);
            }
            if (Optional.IsDefined(DisableLocalAuth))
            {
                writer.WritePropertyName("disableLocalAuth");
                writer.WriteBooleanValue(DisableLocalAuth.Value);
            }
            if (Optional.IsDefined(PublicNetworkAccess))
            {
                writer.WritePropertyName("publicNetworkAccess");
                writer.WriteStringValue(PublicNetworkAccess.Value.ToString());
            }
            if (Optional.IsDefined(EnablePurgeProtection))
            {
                writer.WritePropertyName("enablePurgeProtection");
                writer.WriteBooleanValue(EnablePurgeProtection.Value);
            }
            writer.WriteEndObject();
            writer.WriteEndObject();
        }
    }
}


text:
//
//  LabelCustomization.h
//  CardinalEMVCoSDK
//
//  Copyright © 2018 Cardinal Commerce. All rights reserved.
//

#import "Customization.h"

/**
 * The LabelCustomization class provides methods for the 3DS Requestor App to pass label customization parameters to the 3DS SDK.
 */
@interface LabelCustomization : Customization

/**
 * @property headingTextColor Colour code in Hex format. For example, the colour code can be "#999999".
 */
@property (nonatomic, strong) NSString* headingTextColor;

/**
 * @property headingTextFontName Font type for the heading label text.
 */
@property (nonatomic, strong) NSString* headingTextFontName;

/**
 * @property headingTextFontSize Font size for the heading label text.
 */
@property int headingTextFontSize;

@end


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='RatingTestModel',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('rating2_votes', models.PositiveIntegerField(blank=True, default=0, editable=False)),
                ('rating2_score', models.IntegerField(blank=True, default=0, editable=False)),
                ('rating_votes', models.PositiveIntegerField(blank=True, default=0, editable=False)),
                ('rating_score', models.IntegerField(blank=True, default=0, editable=False)),
            ],
        ),
    ]


text:
class BaseProvider:
    def __init__(self):
        pass

    def get_fd(self, path):
        pass


text:
package com.tiny.demo.firstlinecode.storage.litepal;

import org.litepal.crud.DataSupport;

/**
 * Created by 87959 on 2017/5/6.
 */

public class Book extends DataSupport{
    private int id;
    private String author;
    private double price;
    private int pages;
    private String name;
    private String press;

    public String getPress() {
        return press;
    }

    public void setPress(String press) {
        this.press = press;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getPages() {
        return pages;
    }

    public void setPages(int pages) {
        this.pages = pages;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Book{" +
                "id=" + id +
                ", author='" + author + '\'' +
                ", price=" + price +
                ", pages=" + pages +
                ", name='" + name + '\'' +
                ", press='" + press + '\'' +
                '}';
    }
}


text:
<?php
namespace PhpUnitConversion\Unit\Time;

class NanoSecond extends Second
{
    const FACTOR = 1E-9;

    const SYMBOL = 'ns';
    const LABEL = 'nanosecond';
}


text:
import pytest

from dvc.cli import parse_args
from dvc.command.git_hook import CmdPostCheckout, CmdPreCommit, CmdPrePush

@pytest.mark.parametrize(
    "hook, cls",
    [
        ("pre-commit", CmdPreCommit),
        ("post-checkout", CmdPostCheckout),
        ("pre-push", CmdPrePush),
    ],
)
def test_out_of_repo(tmp_dir, hook, cls, mocker):
    cli_args = parse_args(["git-hook", hook])
    assert cli_args.func == cls
    cmd = cli_args.func(cli_args)
    mock_main = mocker.patch("dvc.main.main")
    assert cmd.run() == 0
    assert not mock_main.called


text:
namespace Azure.ResourceManager.Network.Models
{
    /// <summary> Describes the settings for producing output into a log analytics workspace. </summary>
    public partial class ConnectionMonitorWorkspaceSettings
    {
        /// <summary> Initializes a new instance of ConnectionMonitorWorkspaceSettings. </summary>
        public ConnectionMonitorWorkspaceSettings()
        {
        }

        /// <summary> Initializes a new instance of ConnectionMonitorWorkspaceSettings. </summary>
        /// <param name="workspaceResourceId"> Log analytics workspace resource ID. </param>
        internal ConnectionMonitorWorkspaceSettings(string workspaceResourceId)
        {
            WorkspaceResourceId = workspaceResourceId;
        }

        /// <summary> Log analytics workspace resource ID. </summary>
        public string WorkspaceResourceId { get; set; }
    }
}


text:
/*
 This example code is in public domain.

 This example code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */

/*
 This example shows how to write the status to a digital pin.

 In this example, it will write to the BLINK_PIN_1 and switch the status between
 HIGH and LOW alternately every 1 second.
 */

#include "vmtype.h"
#include "vmboard.h"
#include "vmsystem.h"
#include "vmlog.h"
#include "vmdcl.h"
#include "vmdcl_gpio.h"
#include "vmthread.h"
#include "ResID.h"
#include "grove_led_bar.h"

void gpio_output_demo_handle_sysevt(VMINT message, VMINT param);

/* Entry point */
void vm_main(void) {
	/* Registers system event handler */
	vm_pmng_register_system_event_callback(gpio_output_demo_handle_sysevt);
}

VMINT32 gpio_output_demo_blinking_thread(VM_THREAD_HANDLE thread_handle,
		void* user_data) {
	vm_log_info("gpio_output_demo_blinking_thread - Start.");

	unsigned int i, j;
	led_bar_state_t state = { };
	while (1) {
		for (i = 0; i < 10; i++) {
			for (j = 0; j < 63; j++) {
				state.brightness[i] += 2;
				led_bar_set_state(&state);
			}
			vm_thread_sleep(100);
		}
		for (i = 0; i < 10; i++) {
			for (j = 0; j < 63; j++) {
				state.brightness[i] -= 2;
				led_bar_set_state(&state);
			}
			vm_thread_sleep(100);
		}
	}

	return 0;
}

void gpio_output_demo_handle_sysevt(VMINT message, VMINT param) {
	switch (message) {
	case VM_EVENT_CREATE:
		vm_log_info("Sample of GPIO output - Start.");
		/* Creates a sub-thread for blinking the pin BLINK_PIN_1 with the priority of 255. */
		vm_thread_create(gpio_output_demo_blinking_thread, NULL, 255);

		break;

	case VM_EVENT_QUIT:
		vm_log_info("Sample of GPIO output - End.");
		break;
	}
}


text:
angular.module('fileInput', ['fileReader'])
.directive('fileInput', ['$parse', function($parse) {
    return {
        restrict:'EA',
        link: function(scope, element, attrs) {
            var modelGet = $parse(attrs.fileInput);
            var modelSet = modelGet.assign;
            var onChange = $parse(attrs.onChange);

            var updateModel = function () {
                scope.$apply(function () {
                    modelSet(scope, element[0].files[0]);
                    onChange(scope);
                });
            };
            element.bind('change', updateModel);
        }
    };
}]);


text:
class CanvasView : public QWidget
{
    Q_OBJECT
public:
    CanvasView(QWidget *parent = 0);
    void paintEvent(QPaintEvent *event);
    void keyPressEvent(QKeyEvent *event);
    void mousePressEvent(QMouseEvent * event);
    void mouseMoveEvent(QMouseEvent *event);
    void snap(QPainter* painter);
signals:
    void shapeChanged(int newItem);
    void messageChanged(bool show, std::string from, std::string to, int type);
private:
    bool show;
    bool canSnap;
    std::string snap1;
    std::string snap2;
    bool showHandles;
    int state;
    int item;
    QPoint begin;
    QPoint end;
    static const int height = 410;
    static const int width = 670;
    Model* mymodel;
};

#endif // CANVASVIEW_H


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  #%L
  jambeth-persistence-test
  %%
  Copyright (C) 2017 Koch Softwaredevelopment
  %%
  Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

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

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

<or-mappings xmlns="http://schema.kochdev.com/ambeth/ambeth_orm_2_0">

	<link-mappings>
		<independent-link alias="Material-MaterialGroup" />
		<independent-link alias="Material-Unit" />
	</link-mappings>

	<entity-mappings>

		<entity class="com.koch.ambeth.model.Material">
			<attributes>
				<basic name="Name" />
				<relation name="MaterialGroup" link="Material-MaterialGroup" />
				<relation name="Unit" link="Material-Unit" />
			</attributes>
		</entity>

		<entity class="com.koch.ambeth.model.MaterialGroup">
			<attributes>
				<basic name="Name" />
			</attributes>
		</entity>

		<entity class="com.koch.ambeth.model.Unit">
			<attributes>
				<basic name="Name" />
			</attributes>
		</entity>
	</entity-mappings>
</or-mappings>


text:
"""
Certificate generation module.
"""

from OpenSSL import crypto

TYPE_RSA = crypto.TYPE_RSA
TYPE_DSA = crypto.TYPE_DSA

def createKeyPair(type, bits):
    """
    Create a public/private key pair.

    Arguments: type - Key type, must be one of TYPE_RSA and TYPE_DSA
               bits - Number of bits to use in the key
    Returns:   The public/private key pair in a PKey object
    """
    pkey = crypto.PKey()
    pkey.generate_key(type, bits)
    return pkey

def createCertRequest(pkey, digest="md5", **name):
    """
    Create a certificate request.

    Arguments: pkey   - The key to associate with the request
               digest - Digestion method to use for signing, default is md5
               **name - The name of the subject of the request, possible
                        arguments are:
                          C     - Country name
                          ST    - State or province name
                          L     - Locality name
                          O     - Organization name
                          OU    - Organizational unit name
                          CN    - Common name
                          emailAddress - E-mail address
    Returns:   The certificate request in an X509Req object
    """
    req = crypto.X509Req()
    subj = req.get_subject()

    for (key,value) in name.items():
        setattr(subj, key, value)

    req.set_pubkey(pkey)
    req.sign(pkey, digest)
    return req

def createCertificate(req, (issuerCert, issuerKey), serial, (notBefore, notAfter), digest="md5"):
    """
    Generate a certificate given a certificate request.

    Arguments: req        - Certificate reqeust to use
               issuerCert - The certificate of the issuer
               issuerKey  - The private key of the issuer
               serial     - Serial number for the certificate
               notBefore  - Timestamp (relative to now) when the certificate
                            starts being valid
               notAfter   - Timestamp (relative to now) when the certificate
                            stops being valid
               digest     - Digest method to use for signing, default is md5
    Returns:   The signed certificate in an X509 object
    """
    cert = crypto.X509()
    cert.set_serial_number(serial)
    cert.gmtime_adj_notBefore(notBefore)
    cert.gmtime_adj_notAfter(notAfter)
    cert.set_issuer(issuerCert.get_subject())
    cert.set_subject(req.get_subject())
    cert.set_pubkey(req.get_pubkey())
    cert.sign(issuerKey, digest)
    return cert


text:
package com.bt4vt.repository;

import android.content.SharedPreferences;

import com.bt4vt.repository.domain.Stop;
import com.firebase.client.AuthData;
import com.firebase.client.Firebase;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doReturn;

/**
 * Tests the {@link FirebaseService}.
 *
 * @author Ben Sechrist
 */
@RunWith(MockitoJUnitRunner.class)
public class FirebaseServiceTest {

  @Mock
  private SharedPreferences preferences;

  @Mock
  private Firebase firebase;

  @Mock
  private AuthData authData;

  @InjectMocks
  private FirebaseService service;

  @Before
  public void setup() throws Exception {
    doReturn(authData).when(firebase).getAuth();
    doReturn(firebase).when(firebase).child(anyString());

    service.firebase = firebase;
    service.init();
  }

  @Test
  public void testFavoriteStops() throws Exception {
    Stop stop = new Stop();
    assertFalse(service.isFavorited(stop));
    service.addFavorite(stop);
    assertTrue(service.isFavorited(stop));
    service.removeFavorite(stop);
    assertFalse(service.isFavorited(stop));
  }
}


text:
import unittest

from mixbox.vendor.six import u

from cybox.objects.win_memory_page_region_object import WinMemoryPageRegion

from cybox.compat import long
from cybox.test.common.hash_test import EMPTY_MD5
from cybox.test.common.extracted_features_test import TestExtractedFeatures
from cybox.test.objects import ObjectTestCase

class TestWinMemoryPageRegion(ObjectTestCase, unittest.TestCase):
    object_type = "WindowsMemoryPageRegionObjectType"
    klass = WinMemoryPageRegion

    _full_dict = {
        'is_injected': True,
        'is_mapped': False,
        'is_protected': True,
        'is_volatile': False,
        'name': u("A page region"),
        'memory_source': u("A source"),
        'region_size': long(10000),
        'block_type': u("A block type"),
        'region_start_address': u("1234abcde"),
        'region_end_address': u("1234abdde"),
        'allocation_base_address': u("1234abbbe"),
        'type': u("A type"),
        'allocation_protect': u("allocate protection"),
        'state': u("A state"),
        'protect': u("protection"),
        'extracted_features': TestExtractedFeatures._full_dict,
        'hashes': [
            {'type': u("MD5"), 'simple_hash_value': EMPTY_MD5}
        ],
        'xsi:type': object_type,
    }

if __name__ == "__main__":
    unittest.main()


text:
// =====================================================================
//  This file is part of the Microsoft Dynamics CRM SDK code samples.
//
//  Copyright (C) Microsoft Corporation.  All rights reserved.
//
//  This source code is intended only as a supplement to Microsoft
//  Development Tools and/or on-line documentation.  See these other
//  materials for detailed information regarding Microsoft code samples.
//
//  THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//  PARTICULAR PURPOSE.
// =====================================================================

//<snippetPostUrl>
using System;
using System.Activities;
using System.IO;
using System.Net;
using System.Text;

// These namespaces are found in the Microsoft.Xrm.Sdk.dll assembly
// located in the SDK\bin folder of the SDK download.
using Microsoft.Xrm.Sdk;

// These namespaces are found in the Microsoft.Xrm.Sdk.Workflow.dll assembly
// located in the SDK\bin folder of the SDK download.
using Microsoft.Xrm.Sdk.Workflow;

namespace Microsoft.Crm.Sdk.Samples
{
    /// <summary>
    /// Posts data in a url.
    /// Input arguments:
    ///   "URL". Type: String. Is the URL to which you will be posting data.
    ///   "Account Name". Type: String. Is part of the data to post.
    ///   "Account Num". Type: String. Is part of the data to post.
    /// Output argument:
    ///   None.
    /// </summary>
    public sealed partial class PostUrl : CodeActivity
    {
        /// <summary>
        /// NOTE: When you add this activity to a workflow, you must set the following properties:
        ///
        /// URL - manually add the URL to which you will be posting data.  For example: http://myserver.com/ReceivePostURL.aspx
        ///		 See this sample's companion file 'ReceivePostURL.aspx' for an example of how the receiving page might look.
        ///
        /// AccountName - populate this property with the Account's 'name' attribute.
        ///
        /// AccountNum - populate this property with the Account's 'account number' attribute.
        /// </summary>
        protected override void Execute(CodeActivityContext executionContext)
        {
            IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory =
                executionContext.GetExtension<IOrganizationServiceFactory>();
            IOrganizationService service =
                serviceFactory.CreateOrganizationService(context.UserId);

            // Build data that will be posted to a URL
            string postData = "Name=" + this.AccountName.Get(executionContext) + "&AccountNum=" + this.AccountNum.Get(executionContext);

            // Encode the data
            ASCIIEncoding encoding = new ASCIIEncoding();
            byte[] encodedPostData = encoding.GetBytes(postData);

            // Create a request object for posting our data to a URL
            Uri uri = new Uri(this.URL.Get(executionContext));
            HttpWebRequest urlRequest = (HttpWebRequest)WebRequest.Create(uri);
            urlRequest.Method = "POST";
            urlRequest.ContentLength = encodedPostData.Length;
            urlRequest.ContentType = "application/x-www-form-urlencoded";

            // Add the encoded data to the request
            using (Stream formWriter = urlRequest.GetRequestStream())
            {
                formWriter.Write(encodedPostData, 0, encodedPostData.Length);
            }

            // Post the data to the URL
            HttpWebResponse urlResponse = (HttpWebResponse)urlRequest.GetResponse();
        }

        // Define Input/Output Arguments
        [Input("URL")]
        [Default("http://localhost:9999/ReceivePostURL.aspx")]
        public InArgument<string> URL { get; set; }

        [Input("Account Name")]
        public InArgument<string> AccountName { get; set; }

        [Input("Account Num")]
        public InArgument<string> AccountNum { get; set; }
    }

}
//</snippetPostUrl>


text:
package com.ocdsoft.bacta.swg.shared.localization;

/**
 * Created by crush on 11/21/2015.
 */
public class LocalizationManager {
    public String getLocalizedStringValue(final StringId stringId) {
        return "";
    }
}


text:
/**
 * jQuery.timers - Timer abstractions for jQuery
 * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
 * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
 * Date: 2009/10/16
 *
 * @author Blair Mitchelmore
 * @version 1.2
 *
 **/

jQuery.fn.extend({
	everyTime: function(interval, label, fn, times) {
		return this.each(function() {
			jQuery.timer.add(this, interval, label, fn, times);
		});
	},
	oneTime: function(interval, label, fn) {
		return this.each(function() {
			jQuery.timer.add(this, interval, label, fn, 1);
		});
	},
	stopTime: function(label, fn) {
		return this.each(function() {
			jQuery.timer.remove(this, label, fn);
		});
	}
});

jQuery.extend({
	timer: {
		global: [],
		guid: 1,
		dataKey: "jQuery.timer",
		regex: /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,
		powers: {
			// Yeah this is major overkill...
			'ms': 1,
			'cs': 10,
			'ds': 100,
			's': 1000,
			'das': 10000,
			'hs': 100000,
			'ks': 1000000
		},
		timeParse: function(value) {
			if (value == undefined || value == null)
				return null;
			var result = this.regex.exec(jQuery.trim(value.toString()));
			if (result[2]) {
				var num = parseFloat(result[1]);
				var mult = this.powers[result[2]] || 1;
				return num * mult;
			} else {
				return value;
			}
		},
		add: function(element, interval, label, fn, times) {
			var counter = 0;

			if (jQuery.isFunction(label)) {
				if (!times)
					times = fn;
				fn = label;
				label = interval;
			}

			interval = jQuery.timer.timeParse(interval);

			if (typeof interval != 'number' || isNaN(interval) || interval < 0)
				return;

			if (typeof times != 'number' || isNaN(times) || times < 0)
				times = 0;

			times = times || 0;

			var timers = jQuery.data(element, this.dataKey) || jQuery.data(element, this.dataKey, {});

			if (!timers[label])
				timers[label] = {};

			fn.timerID = fn.timerID || this.guid++;

			var handler = function() {
				if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
					jQuery.timer.remove(element, label, fn);
			};

			handler.timerID = fn.timerID;

			if (!timers[label][fn.timerID])
				timers[label][fn.timerID] = window.setInterval(handler,interval);

			this.global.push( element );

		},
		remove: function(element, label, fn) {
			var timers = jQuery.data(element, this.dataKey), ret;

			if ( timers ) {

				if (!label) {
					for ( label in timers )
						this.remove(element, label, fn);
				} else if ( timers[label] ) {
					if ( fn ) {
						if ( fn.timerID ) {
							window.clearInterval(timers[label][fn.timerID]);
							delete timers[label][fn.timerID];
						}
					} else {
						for ( var fn in timers[label] ) {
							window.clearInterval(timers[label][fn]);
							delete timers[label][fn];
						}
					}

					for ( ret in timers[label] ) break;
					if ( !ret ) {
						ret = null;
						delete timers[label];
					}
				}

				for ( ret in timers ) break;
				if ( !ret )
					jQuery.removeData(element, this.dataKey);
			}
		}
	}
});

jQuery(window).bind("unload", function() {
	jQuery.each(jQuery.timer.global, function(index, item) {
		jQuery.timer.remove(item);
	});
});
;
/* Toggles the Menu if it's hidden */
(function ($) {
$(document).ready(function() {

  $("#mobile-osu-top-hat a:eq(0)").prepend('
');
  $("#mobile-osu-top-hat a:eq(1)").prepend('
');
  $("#mobile-osu-top-hat a:eq(2)").prepend('
');
  $("#mobile-osu-top-hat a:eq(3)").prepend('
');
  $("#mobile-osu-top-hat a:eq(4)").prepend('
');

  $("#toggle-mobile-menu").click(function() {

    if ($("#mobile-menu").is(":hidden")) {
      $("#mobile-menu").show("slow");

    } else {
      $("#mobile-menu").slideUp();
    }
  });

});
}(jQuery));;


text:
<?php
namespace mostertb\PhpJhbOpenBios;

use mostertb\PhpJhbOpenBios\bios\AbstractBio;
use mostertb\PhpJhbOpenBios\bios\BradMostertBio;
use mostertb\PhpJhbOpenBios\bios\ColinODellBio;
use mostertb\PhpJhbOpenBios\bios\JohnathanDellBio;
use mostertb\PhpJhbOpenBios\bios\JoshHaringtonBio;
use mostertb\PhpJhbOpenBios\bios\LeePelserBio;
use mostertb\PhpJhbOpenBios\bios\LukeTruterBio;
use mostertb\PhpJhbOpenBios\bios\RoscoevanWykBio;
use mostertb\PhpJhbOpenBios\bios\SacheenDhanjieBio;
use mostertb\PhpJhbOpenBios\bios\SarelvdWaltBio;

class Kernel
{

    /**
     * @var AbstractBio[]
     */
    private $bios;

    /**
     * Kernel constructor.
     */
    public function __construct()
    {
        $this->bios = array(
            new BradMostertBio(),
            new JohnathanDellBio(),
            new JoshHaringtonBio(),
            new SarelvdWaltBio(),
            new SacheenDhanjieBio(),
            new RoscoevanWykBio(),
            new LeePelserBio(),
            new LukeTruterBio(),
            new ColinODellBio(),
        );
    }

    /**
     * @return AbstractBio[]
     */
    public function getBios()
    {
        return $this->bios;
    }
}


text:
    <input type="radio" name="radiobuttons-{{name}}"
        value="{{value}}"
        ng-model="model"
        class="umb-form-check__input" />

    {{text}}


text:
from optparse import make_option

from django.conf import settings
from django.core.management.base import BaseCommand

from pillowtop.models import DjangoPillowCheckpoint

class Command(BaseCommand):
    """
    One off command to migrate pillow checkpoints after ES upgrade.
    """
    help = "Migrate the esupgrade checkpoints"

    option_list = BaseCommand.option_list + (
        make_option(
            '--check',
            action='store_true',
            dest='check',
            default=False,
            help="Just print the changes",
        ),
        make_option(
            '--undo',
            action='store_true',
            dest='undo',
            default=False,
            help="Undo the changes",
        ),
    )

    def handle(self, *args, **options):
        check = options['check']
        undo = options['undo']

        upgrade_checkpoints = DjangoPillowCheckpoint.objects.filter(checkpoint_id__endswith='esupgrade')
        for upgrade_cp in upgrade_checkpoints:
            prefix, _ = upgrade_cp.checkpoint_id.rsplit('.', 1)
            current_cp_id = '{}.{}'.format(prefix, settings.PILLOWTOP_MACHINE_ID)
            try:
                current_cp = DjangoPillowCheckpoint.objects.get(checkpoint_id=current_cp_id)
            except DjangoPillowCheckpoint.DoesNotExist:
                print('Matching checkpoint not found: {}'.format(upgrade_cp.checkpoint_id))
            else:
                if undo:
                    self.undo(current_cp, check)
                else:
                    self.migrate(upgrade_cp, current_cp, check)

    @staticmethod
    def migrate(upgrade_cp, current_cp, check):
        print('Copying sequence from: {} -> {}'.format(
            upgrade_cp.checkpoint_id, current_cp.checkpoint_id
        ))
        if check:
            print('Old seq: {}'.format(current_cp.sequence))
            print('New seq: {}'.format(upgrade_cp.sequence))
        else:
            current_cp.old_sequence = current_cp.sequence
            current_cp.sequence = upgrade_cp.sequence
            current_cp.save()

    @staticmethod
    def undo(current_cp, check):
        if not current_cp.old_sequence:
            print('Unable to revert empty to old sequence: {}'.format(current_cp.checkpoint_id))
            return

        print('Reverting to old sequence for: {}'.format(current_cp.checkpoint_id))
        if check:
            print('Old seq: {}'.format(current_cp.sequence))
            print('New seq: {}'.format(current_cp.old_sequence))
        else:
            current_cp.sequence = current_cp.old_sequence
            current_cp.old_sequence = None
            current_cp.save()


text:
namespace Azure.ResourceManager.SecurityInsights.Models
{
    /// <summary> Publisher or creator of the content item. </summary>
    public partial class MetadataAuthor
    {
        /// <summary> Initializes a new instance of MetadataAuthor. </summary>
        public MetadataAuthor()
        {
        }

        /// <summary> Initializes a new instance of MetadataAuthor. </summary>
        /// <param name="name"> Name of the author. Company or person. </param>
        /// <param name="email"> Email of author contact. </param>
        /// <param name="link"> Link for author/vendor page. </param>
        internal MetadataAuthor(string name, string email, string link)
        {
            Name = name;
            Email = email;
            Link = link;
        }

        /// <summary> Name of the author. Company or person. </summary>
        public string Name { get; set; }
        /// <summary> Email of author contact. </summary>
        public string Email { get; set; }
        /// <summary> Link for author/vendor page. </summary>
        public string Link { get; set; }
    }
}


text:
PATH=/bin:/usr/bin

TRDIR="/usr/local/transmission"
TREXE="$TRDIR/bin/transmission-daemon"
TRVAR="$TRDIR/var"
TRPID="$TRVAR/transmission.pid"
TRCFG="/usr/local/etc/transmission.cfg"
RUNAS="transmission"

start_daemon ()
{
    # Launch transmission in the background.
    su $RUNAS -s /bin/sh -c "$TREXE -g $TRVAR -x $TRPID"

    # Wait until transmission is ready (race condition here).
    counter=5
    while [ $counter -gt 0 ]
    do
        daemon_status && break
        let counter=counter-1
        sleep 1
    done
}

stop_daemon ()
{
    # Kill transmission.
    kill `cat $TRPID`

    # Wait until transmission is really dead (may take some time).
    counter=20
    while [ $counter -gt 0 ]
    do
        daemon_status || break
        let counter=counter-1
        sleep 1
    done
}

reload_daemon ()
{
    kill -s HUP `cat $TRPID`
}

daemon_status ()
{
    if [ -f $TRPID ]
    then
        if [ -d /proc/`cat $TRPID` ]
        then
            return 0
        else
            # PID file exists, but no process has this PID.
            rm $TRPID
    	fi
    fi
    return 1
}

run_in_console ()
{
    su $RUNAS -s /bin/sh -c "$TREXE -g $TRVAR -f"
}

do_settings ()
{
    su $RUNAS -s /bin/sh -c "$TREXE -g $TRVAR -d 2> $TRVAR/new.settings.json"
    mv $TRVAR/new.settings.json $TRVAR/settings.json
}

# Load the transmission config file if it exists
if [ -e $TRCFG ]
then
    . $TRCFG
fi

case $1 in
    start)
        if daemon_status
        then
            echo Transmission daemon already running
            exit 0
        else
            echo Starting Transmission daemon...
            start_daemon
            exit $?
        fi
        ;;
    stop)
        echo Stopping Transmission daemon...
        stop_daemon
        exit 0
        ;;
    restart)
        stop_daemon
        start_daemon
        exit $?
        ;;
    reload)
        if daemon_status
        then
           reload_daemon
        fi
        exit $?
        ;;
    status)
        if daemon_status
        then
            echo Running
            exit 0
        else
            echo Not running
            exit 1
        fi
        ;;
    log)
        echo $LOGFILE
        exit 0
        ;;
    console)
        run_in_console
        exit $?
        ;;
    settings)
        do_settings
        exit $?
        ;;
    *)
        exit 1
        ;;
esac


text:
namespace GymFitnessOlympic.View.UserControls.QuanLy
{
    partial class QLGoiTap
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

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

        #region Component Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
            this.dgrGoiTap = new CEMS.Controls.Commons.DataGridViewEx();
            this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.cbbGYM = new System.Windows.Forms.ComboBox();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.cbbPhong1 = new System.Windows.Forms.ComboBox();
            this.lblChucNang = new System.Windows.Forms.Label();
            this.btnXoa = new DevExpress.XtraEditors.SimpleButton();
            this.btnSua = new DevExpress.XtraEditors.SimpleButton();
            this.btnThem = new DevExpress.XtraEditors.SimpleButton();
            ((System.ComponentModel.ISupportInitialize)(this.dgrGoiTap)).BeginInit();
            this.SuspendLayout();
            //
            // dgrGoiTap
            //
            this.dgrGoiTap.AllowUserToAddRows = false;
            this.dgrGoiTap.AllowUserToDeleteRows = false;
            this.dgrGoiTap.AllowUserToOrderColumns = true;
            this.dgrGoiTap.AllowUserToResizeColumns = false;
            this.dgrGoiTap.AllowUserToResizeRows = false;
            dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(247)))), ((int)(((byte)(253)))));
            this.dgrGoiTap.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
            this.dgrGoiTap.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.dgrGoiTap.BackgroundColor = System.Drawing.Color.WhiteSmoke;
            this.dgrGoiTap.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.dgrGoiTap.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(231)))), ((int)(((byte)(253)))));
            dataGridViewCellStyle2.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
            dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(212)))), ((int)(((byte)(252)))));
            dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
            this.dgrGoiTap.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
            this.dgrGoiTap.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dgrGoiTap.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.Column1,
            this.Column3,
            this.Column4,
            this.Column2});
            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window;
            dataGridViewCellStyle3.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText;
            dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(221)))), ((int)(((byte)(252)))));
            dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
            this.dgrGoiTap.DefaultCellStyle = dataGridViewCellStyle3;
            this.dgrGoiTap.EnableHeadersVisualStyles = false;
            this.dgrGoiTap.ExportFilePath = null;
            this.dgrGoiTap.GridColor = System.Drawing.Color.LightSteelBlue;
            this.dgrGoiTap.Location = new System.Drawing.Point(15, 122);
            this.dgrGoiTap.MultiSelect = false;
            this.dgrGoiTap.Name = "dgrGoiTap";
            this.dgrGoiTap.ReadOnly = true;
            this.dgrGoiTap.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
            dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(231)))), ((int)(((byte)(253)))));
            dataGridViewCellStyle4.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
            dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(212)))), ((int)(((byte)(252)))));
            dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
            this.dgrGoiTap.RowHeadersDefaultCellStyle = dataGridViewCellStyle4;
            this.dgrGoiTap.RowHeadersVisible = false;
            this.dgrGoiTap.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
            this.dgrGoiTap.Size = new System.Drawing.Size(871, 150);
            this.dgrGoiTap.TabIndex = 0;
            this.dgrGoiTap.UseAsListBox = false;
            //
            // Column1
            //
            this.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
            this.Column1.DataPropertyName = "TenGoiTap";
            this.Column1.FillWeight = 63.94557F;
            this.Column1.HeaderText = "Tên gói tập";
            this.Column1.Name = "Column1";
            this.Column1.ReadOnly = true;
            //
            // Column3
            //
            this.Column3.DataPropertyName = "SoThang";
            this.Column3.HeaderText = "Số tháng";
            this.Column3.Name = "Column3";
            this.Column3.ReadOnly = true;
            //
            // Column4
            //
            this.Column4.DataPropertyName = "Gia";
            this.Column4.FillWeight = 136.0544F;
            this.Column4.HeaderText = "Giá";
            this.Column4.Name = "Column4";
            this.Column4.ReadOnly = true;
            this.Column4.Width = 200;
            //
            // Column2
            //
            this.Column2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
            this.Column2.HeaderText = "";
            this.Column2.Name = "Column2";
            this.Column2.ReadOnly = true;
            //
            // cbbGYM
            //
            this.cbbGYM.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbbGYM.FormattingEnabled = true;
            this.cbbGYM.Items.AddRange(new object[] {
            "GYM",
            "SAUNA"});
            this.cbbGYM.Location = new System.Drawing.Point(261, 89);
            this.cbbGYM.Name = "cbbGYM";
            this.cbbGYM.Size = new System.Drawing.Size(121, 21);
            this.cbbGYM.TabIndex = 2;
            this.cbbGYM.SelectedIndexChanged += new System.EventHandler(this.cbbGYM_SelectedIndexChanged);
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(228, 92);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(27, 13);
            this.label1.TabIndex = 4;
            this.label1.Text = "Loại";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(21, 92);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(56, 13);
            this.label2.TabIndex = 4;
            this.label2.Text = "Phòng tập";
            //
            // cbbPhong1
            //
            this.cbbPhong1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbbPhong1.FormattingEnabled = true;
            this.cbbPhong1.Location = new System.Drawing.Point(84, 89);
            this.cbbPhong1.Name = "cbbPhong1";
            this.cbbPhong1.Size = new System.Drawing.Size(121, 21);
            this.cbbPhong1.TabIndex = 5;
            this.cbbPhong1.SelectedIndexChanged += new System.EventHandler(this.cbbPhong1_SelectedIndexChanged_1);
            //
            // lblChucNang
            //
            this.lblChucNang.AutoSize = true;
            this.lblChucNang.Font = new System.Drawing.Font("Tahoma", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblChucNang.Location = new System.Drawing.Point(5, 11);
            this.lblChucNang.Name = "lblChucNang";
            this.lblChucNang.Size = new System.Drawing.Size(390, 58);
            this.lblChucNang.TabIndex = 6;
            this.lblChucNang.Text = "Quản lý gói tập";
            //
            // btnXoa
            //
            this.btnXoa.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnXoa.Image = global::GymFitnessOlympic.Properties.Resources.delete;
            this.btnXoa.Location = new System.Drawing.Point(801, 89);
            this.btnXoa.Name = "btnXoa";
            this.btnXoa.Size = new System.Drawing.Size(85, 27);
            this.btnXoa.TabIndex = 1;
            this.btnXoa.Text = "Xóa";
            this.btnXoa.Click += new System.EventHandler(this.btnXoa_Click);
            //
            // btnSua
            //
            this.btnSua.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnSua.Image = global::GymFitnessOlympic.Properties.Resources.Edit;
            this.btnSua.Location = new System.Drawing.Point(710, 89);
            this.btnSua.Name = "btnSua";
            this.btnSua.Size = new System.Drawing.Size(85, 27);
            this.btnSua.TabIndex = 1;
            this.btnSua.Text = "Sửa";
            this.btnSua.Click += new System.EventHandler(this.btnSua_Click);
            //
            // btnThem
            //
            this.btnThem.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnThem.Image = global::GymFitnessOlympic.Properties.Resources.add;
            this.btnThem.Location = new System.Drawing.Point(619, 89);
            this.btnThem.Name = "btnThem";
            this.btnThem.Size = new System.Drawing.Size(85, 27);
            this.btnThem.TabIndex = 1;
            this.btnThem.Text = "Thêm";
            this.btnThem.Click += new System.EventHandler(this.btnThem_Click);
            //
            // QLGoiTap
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.lblChucNang);
            this.Controls.Add(this.cbbPhong1);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.cbbGYM);
            this.Controls.Add(this.btnXoa);
            this.Controls.Add(this.btnSua);
            this.Controls.Add(this.btnThem);
            this.Controls.Add(this.dgrGoiTap);
            this.Name = "QLGoiTap";
            this.Size = new System.Drawing.Size(900, 290);
            ((System.ComponentModel.ISupportInitialize)(this.dgrGoiTap)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private CEMS.Controls.Commons.DataGridViewEx dgrGoiTap;
        private DevExpress.XtraEditors.SimpleButton btnThem;
        private DevExpress.XtraEditors.SimpleButton btnSua;
        private DevExpress.XtraEditors.SimpleButton btnXoa;
        private System.Windows.Forms.ComboBox cbbGYM;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.ComboBox cbbPhong1;
        private System.Windows.Forms.Label lblChucNang;
        private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
        private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
        private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
        private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
    }
}


text:
package dtos.validation;

import java.util.ArrayList;
import java.util.Collection;

import javax.annotation.Nullable;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Created by daniel on 20.03.15.
 */
public class GenericReferenceValidator<T> implements ReferenceValidator {

    private final String field;
    private final Validator<T> validator;
    @Nullable private final T t;

    public GenericReferenceValidator(@Nullable String field, @Nullable T value,
        Validator<T> validator) {

        checkNotNull(validator);
        if (field != null) {
            checkArgument(!field.isEmpty());
        }

        this.field = field;
        this.validator = validator;
        this.t = value;
    }

    @Override public Collection<ValidationError> validate() throws ValidationException {
        Collection<ValidationErrorMessage> validationErrorMessages = this.validator.validate(t);
        Collection<ValidationError> validationErrors =
            new ArrayList<>(validationErrorMessages.size());

        for (ValidationErrorMessage validationErrorMessage : validationErrorMessages) {
            validationErrors.add(ValidationError.of(field, validationErrorMessage));
        }

        return validationErrors;
    }
}


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

namespace SudokuSharp
{
    public partial class Board
    {
        private _FillClass _fillClass;

        /// <summary>
        /// Hack to allow a namespace inside a class. Allows access to the Fill functions.
        /// </summary>
        public _FillClass Fill
        {
            get
            {
                if (_fillClass == null)
                    _fillClass = new _FillClass(this);

                return _fillClass;
            }
        }

        /// <summary>
        /// Hack to allow a namespace inside a class.
        /// </summary>
        public partial class _FillClass
        {
            Board _parent;

            /// <summary>
            /// Hack to allow a namespace inside a class.
            /// </summary>
            public _FillClass(Board Parent)
            {
                _parent = Parent;
            }

            // This class is not made public because it only checks for the presence of a digit in a row or column.
            // It does nothing to guard against duplicates, so is useless for the general board class.
            class ConstraintData
            {
                public ConstraintData(Board Src)
                {
                    foreach (var loc in Location.All)
                    {
                        DigitInRow[Src[loc], loc.Row] =
                            DigitInColumn[Src[loc], loc.Column] =
                            DigitInZone[Src[loc], loc.Zone] = true;
                    }
                }
                public bool[,] DigitInRow = new bool[10, 9];
                public bool[,] DigitInColumn = new bool[10, 9];
                public bool[,] DigitInZone = new bool[10, 9];
            }
        }
    }
}


text:
#ifndef TENSORFLOW_CORE_UTIL_CUDA_KERNEL_HELPER_H_
#define TENSORFLOW_CORE_UTIL_CUDA_KERNEL_HELPER_H_

#if GOOGLE_CUDA

#include <algorithm>

#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
#include "tensorflow/core/platform/types.h"

#define CUDA_1D_KERNEL_LOOP(i, n)                            \
  for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < n; \
       i += blockDim.x * gridDim.x)

namespace tensorflow {

typedef Eigen::GpuDevice GPUDevice;

struct CudaLaunchConfig {
  // Logical number of thread that works on the elements. If each logical
  // thread works on exactly a single element, this is the same as the working
  // element count.
  int virtual_thread_count = -1;
  // Number of threads per block.
  int thread_per_block = -1;
  // Number of blocks for Cuda kernel launch.
  int block_count = -1;
};

// Calculate the Cuda launch config we should use for a kernel launch.
// This is assuming the kernel is quite simple and will largely be
// memory-limited.
inline CudaLaunchConfig GetCudaLaunchConfig(int work_element_count,
                                            const GPUDevice& d) {
  const int virtual_thread_count = work_element_count;
  const int physical_thread_count = std::min(
      d.getNumCudaMultiProcessors() * d.maxCudaThreadsPerMultiProcessor(),
      virtual_thread_count);
  const int thread_per_block = std::min(1024, d.maxCudaThreadsPerBlock());
  const int block_count = std::min(
      (physical_thread_count + thread_per_block - 1) / thread_per_block,
      d.getNumCudaMultiProcessors());

  CudaLaunchConfig config;
  config.virtual_thread_count = virtual_thread_count;
  config.thread_per_block = thread_per_block;
  config.block_count = block_count;
  return config;
}

template <typename T>
__device__ __host__ inline T ldg(const T* address) {
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 350
  return __ldg(address);
#else
  return *address;
#endif
}

// CUDA provides atomic ops, but not for all types.  We provide wrappers
// for some ops and provide implementation for all reasonable types.
#define CUDA_ATOMIC_WRAPPER(op, T) \
  __device__ __forceinline__ T CudaAtomic##op(T* address, T val)

// Reason of guarding: NVCC cannot compile the "::" in "cuda_builtin::atomicOp".
#ifdef __GCUDACC__
#define USE_CUDA_ATOMIC(op, T) \
  CUDA_ATOMIC_WRAPPER(op, T) { return cuda_builtin::atomic##op(address, val); }
#else
#define USE_CUDA_ATOMIC(op, T) \
  CUDA_ATOMIC_WRAPPER(op, T) { return atomic##op(address, val); }
#endif

// For atomicAdd.
USE_CUDA_ATOMIC(Add, int32);
USE_CUDA_ATOMIC(Add, uint32);
USE_CUDA_ATOMIC(Add, uint64);
USE_CUDA_ATOMIC(Add, float);

// For atomicMax.
USE_CUDA_ATOMIC(Max, int32);
USE_CUDA_ATOMIC(Max, uint32);
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 350
USE_CUDA_ATOMIC(Max, uint64);
#else
// The uint64 overload of atomicMax() is only available for __CUDA_ARCH__ >=
// 350.  If not satisfied, we provide a custom implementation using atomicCAS().
CUDA_ATOMIC_WRAPPER(Max, uint64) {
  uint64* address_as_ull = (uint64*)address;
  uint64 old = *address_as_ull, assumed;

  do {
    assumed = old;
    old = atomicCAS(address_as_ull, assumed, max(val, assumed));
  } while (assumed != old);

  return old;
}
#endif

// Custom implementation of atomicAdd for double.
// This implementation is copied from CUDA manual.
CUDA_ATOMIC_WRAPPER(Add, double) {
  uint64* address_as_ull = (uint64*)address;
  uint64 old = *address_as_ull, assumed;

  do {
    assumed = old;
    old = atomicCAS(address_as_ull, assumed,
                    __double_as_longlong(val + __longlong_as_double(assumed)));

    // Note: uses integer comparison to avoid hang in case of NaN
  } while (assumed != old);

  return __longlong_as_double(old);
}

// Helper functions for CudaAtomicAdd(half*, half), below.
//
// Note that if __CUDA_ARCH__ >= 530, we could probably use __hadd2()
// for a more efficient implementation, assuming that adding -0.0
// will never harm the neighboring value. In this version, we take special
// care to guarantee the bits of the untouched value are unchanged.
inline __device__ uint32 add_to_low_half(uint32 val, float x) {
  Eigen::half low_half;
  low_half.x = static_cast<uint16>(val & 0xffffu);
  low_half = static_cast<Eigen::half>(static_cast<float>(low_half) + x);
  return (val & 0xffff0000u) | low_half.x;
}

inline __device__ uint32 add_to_high_half(uint32 val, float x) {
  Eigen::half high_half;
  high_half.x = static_cast<uint16>(val >> 16);
  high_half = static_cast<Eigen::half>(static_cast<float>(high_half) + x);
  return (val & 0xffffu) | (high_half.x << 16);
}

// Custom implementation of atomicAdd for half. Note that we don't have
// atomicCAS() for anything less than 32 bits, so we need to include the
// other 16 bits in the operation.
//
// Unlike the other atomic adds, this version is going to be very slow
// under high concurrency, since most threads will be spinning on failing
// their compare-and-swap tests. (The fact that we get false sharing on the
// neighboring fp16 makes this even worse.) If you are doing a large reduction,
// you are much better off with doing the intermediate steps in fp32 and then
// switching to fp16 as late as you can in the calculations.
//
// Note: Assumes little endian.
CUDA_ATOMIC_WRAPPER(Add, Eigen::half) {
  float val_as_float(val);
  intptr_t address_int = reinterpret_cast<intptr_t>(address);
  if ((address_int & 0x2) == 0) {
    // The half is in the first part of the uint32 (lower 16 bits).
    uint32* address_as_uint32 = reinterpret_cast<uint32*>(address);
    assert(((intptr_t)address_as_uint32 & 0x3) == 0);
    uint32 old = *address_as_uint32, assumed;

    do {
      assumed = old;
      old = atomicCAS(address_as_uint32, assumed,
                      add_to_low_half(assumed, val_as_float));

      // Note: uses integer comparison to avoid hang in case of NaN
    } while (assumed != old);

    Eigen::half ret;
    ret.x = old & 0xffffu;
    return ret;
  } else {
    // The half is in the second part of the uint32 (upper 16 bits).
    uint32* address_as_uint32 = reinterpret_cast<uint32*>(address_int - 2);
    assert(((intptr_t)address_as_uint32 & 0x3) == 0);
    uint32 old = *address_as_uint32, assumed;

    do {
      assumed = old;
      old = atomicCAS(address_as_uint32, assumed,
                      add_to_high_half(assumed, val_as_float));

      // Note: uses integer comparison to avoid hang in case of NaN
    } while (assumed != old);

    Eigen::half ret;
    ret.x = old >> 16;
    return ret;
  }
}

template <typename T>
__global__ void SetZero(const int nthreads, T* bottom_diff) {
  CUDA_1D_KERNEL_LOOP(index, nthreads) { *(bottom_diff + index) = T(0); }
}

// For atomicSub.

// Custom implementation for sub by just negating the value.
#define WRAPPED_ATOMIC_SUB(T) \
  CUDA_ATOMIC_WRAPPER(Sub, T) { return CudaAtomicAdd(address, -val); }

WRAPPED_ATOMIC_SUB(uint64);
WRAPPED_ATOMIC_SUB(int32);
WRAPPED_ATOMIC_SUB(uint32);
WRAPPED_ATOMIC_SUB(float);
WRAPPED_ATOMIC_SUB(double);

#undef WRAPPED_ATOMIC_SUB

#undef USE_CUDA_ATOMIC
#undef CUDA_ATOMIC_WRAPPER

template <typename T>
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T tf_min(const T& x, const T& y) {
  return x > y ? y : x;
}

template <typename T>
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T tf_max(const T& x, const T& y) {
  return x < y ? y : x;
}

}  // namespace tensorflow

#endif  // GOOGLE_CUDA

#endif  // TENSORFLOW_CORE_UTIL_CUDA_KERNEL_HELPER_H_


text:
@interface NSMutableData (WFAppendByte)
- (void)appendFloatAsIEEE754:(float)arg1;
- (void)appendUInt8:(unsigned char)arg1;
- (void)appendUInt16:(unsigned short)arg1;
- (void)appendUInt32:(unsigned long)arg1;
- (void)appendBytes:(unsigned char)arg1:(unsigned char)arg2:(unsigned char)arg3:(unsigned char)arg4;
- (void)appendBytes:(unsigned char)arg1:(unsigned char)arg2:(unsigned char)arg3;
- (void)appendBytes:(unsigned char)arg1:(unsigned char)arg2;
- (void)appendByte:(unsigned char)arg1;
@end