text:
package org.usfirst.frc.team4453.library.vision;

import java.util.LinkedList;

/**
 * This class represents a sequence of Pipeline Steps that run in parallel.
 * @author Conner Ebbinghaus
 *
 */
public class Pipeline
{
	/**
	 * The PipelineSteps.
	 */
	private LinkedList<PipelineStep> steps = new LinkedList<PipelineStep>();

	/**
	 * Adds a step to the end of the pipeline.
	 * @param in
	 */
	public void add(PipelineStep in)
	{
		steps.add(in);
	}

	/**
	 * Starts all steps.
	 */
	public void start()
	{
		for(PipelineStep p : steps)
		{
			p.start();
		}
	}

	/**
	 * Stops all running steps.
	 * @throws InterruptedException If the calling thread is interrupted while waiting for a step to stop.
	 */
	public void stop() throws InterruptedException
	{
		for(PipelineStep p : steps)
		{
			p.stop();
		}
	}

	/**
	 * Returns the step after the specified one, or null if it does not exist.
	 * @param in The step to find the next of.
	 * @return The next step, or null if the specified step is not in this pipeline or it is the last step.
	 */
	public PipelineStep getNextStep(PipelineStep in)
	{
		int i = steps.lastIndexOf(in);
		if(i != -1 && steps.size() != i+1)
		{
			return steps.get(i+1);
		}
		return null;
	}

	/**
	 * Returns true if the specified step is the first.
	 * @param in The step.
	 * @return True if the step is first.
	 */
	public boolean isFirst(PipelineStep in)
	{
		int i = steps.lastIndexOf(in);
		return i==0;
	}
}


text:
package webui

import (
	"strings"

	"github.com/go-macaron/binding"
)

func init() {
	// UIntegerNotZero
	binding.AddRule(&binding.Rule{
		IsMatch: func(rule string) bool {
			return strings.HasPrefix(rule, "IntegerNotZero")
		},
		IsValid: func(errs binding.Errors, name string, v interface{}) (bool, binding.Errors) {
			num, ok := v.(int)
			if !ok {
				return false, errs
			}
			if num < 0 {
				errs.Add([]string{name}, "IntegerNotZero", "Value should be greater than zero")
				return false, errs
			}
			return true, errs
		},
	})
	// UIntegerAndLessOne
	binding.AddRule(&binding.Rule{
		IsMatch: func(rule string) bool {
			return strings.HasPrefix(rule, "UIntegerAndLessOne")
		},
		IsValid: func(errs binding.Errors, name string, v interface{}) (bool, binding.Errors) {
			num, ok := v.(int)
			if !ok {
				return false, errs
			}
			if num < -1 {
				errs.Add([]string{name}, "UIntegerAndLessOne", "Value should be a positive integer or -1")
				return false, errs
			}
			return true, errs
		},
	})
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.flink.formats.avro.registry.confluent;

import io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient;
import io.confluent.kafka.schemaregistry.client.rest.RestService;
import io.confluent.kafka.schemaregistry.client.security.basicauth.BasicAuthCredentialProvider;
import io.confluent.kafka.schemaregistry.client.security.bearerauth.BearerAuthCredentialProvider;
import org.junit.jupiter.api.Test;
import org.powermock.reflect.Whitebox;

import javax.net.ssl.SSLSocketFactory;

import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * Tests for properties set by {@link RegistryAvroFormatFactory} in {@link
 * CachedSchemaCoderProvider}.
 */
class CachedSchemaCoderProviderTest {

    @Test
    void testThatSslIsNotInitializedForNoSslProperties() {
        CachedSchemaCoderProvider provider = initCachedSchemaCoderProvider(new HashMap<>());
        SSLSocketFactory sslSocketFactory = getSslSocketFactoryFromProvider(provider);

        assertThat(sslSocketFactory).isNull();
    }

    @Test
    void testThatSslIsInitializedForSslProperties() throws URISyntaxException {
        String keystoreFile = getAbsolutePath("/test-keystore.jks");
        String keystorePassword = "123456";
        Map<String, String> configs = new HashMap<>();
        configs.put("schema.registry.ssl.keystore.location", keystoreFile);
        configs.put("schema.registry.ssl.keystore.password", keystorePassword);
        configs.put("schema.registry.ssl.truststore.location", keystoreFile);
        configs.put("schema.registry.ssl.truststore.password", keystorePassword);

        CachedSchemaCoderProvider provider = initCachedSchemaCoderProvider(configs);
        SSLSocketFactory sslSocketFactory = getSslSocketFactoryFromProvider(provider);

        assertThat(sslSocketFactory).isNotNull();
    }

    @Test
    void testThatBasicAuthIsNotInitializedForNoBasicAuthProperties() {
        CachedSchemaCoderProvider provider = initCachedSchemaCoderProvider(new HashMap<>());
        BasicAuthCredentialProvider basicAuthCredentialProvider =
                getBasicAuthFromProvider(provider);

        assertThat(basicAuthCredentialProvider).isNull();
    }

    @Test
    void testThatBasicAuthIsInitializedForBasicAuthProperties() {
        String userPassword = "user:pwd";
        Map<String, String> configs = new HashMap<>();
        configs.put("basic.auth.credentials.source", "USER_INFO");
        configs.put("basic.auth.user.info", userPassword);

        CachedSchemaCoderProvider provider = initCachedSchemaCoderProvider(configs);
        BasicAuthCredentialProvider basicAuthCredentialProvider =
                getBasicAuthFromProvider(provider);

        assertThat(basicAuthCredentialProvider).isNotNull();
        assertThat(basicAuthCredentialProvider.getUserInfo(null)).isEqualTo(userPassword);
    }

    @Test
    void testThatBearerAuthIsNotInitializedForNoBearerAuthProperties() {
        CachedSchemaCoderProvider provider = initCachedSchemaCoderProvider(new HashMap<>());
        BearerAuthCredentialProvider bearerAuthCredentialProvider =
                getBearerAuthFromProvider(provider);

        assertThat(bearerAuthCredentialProvider).isNull();
    }

    @Test
    void testThatBearerAuthIsInitializedForBearerAuthProperties() {
        String token = "123456";
        Map<String, String> configs = new HashMap<>();
        configs.put("bearer.auth.credentials.source", "STATIC_TOKEN");
        configs.put("bearer.auth.token", token);

        CachedSchemaCoderProvider provider = initCachedSchemaCoderProvider(configs);
        BearerAuthCredentialProvider bearerAuthCredentialProvider =
                getBearerAuthFromProvider(provider);

        assertThat(bearerAuthCredentialProvider).isNotNull();
        assertThat(bearerAuthCredentialProvider.getBearerToken(null)).isEqualTo(token);
    }

    private String getAbsolutePath(String path) throws URISyntaxException {
        return CachedSchemaCoderProviderTest.class.getResource(path).toURI().getPath();
    }

    private CachedSchemaCoderProvider initCachedSchemaCoderProvider(Map<String, String> config) {
        return new CachedSchemaCoderProvider("test", "someUrl", 1000, config);
    }

    private SSLSocketFactory getSslSocketFactoryFromProvider(CachedSchemaCoderProvider provider) {
        return getInternalStateFromRestService("sslSocketFactory", provider);
    }

    private BasicAuthCredentialProvider getBasicAuthFromProvider(
            CachedSchemaCoderProvider provider) {
        return getInternalStateFromRestService("basicAuthCredentialProvider", provider);
    }

    private BearerAuthCredentialProvider getBearerAuthFromProvider(
            CachedSchemaCoderProvider provider) {
        return getInternalStateFromRestService("bearerAuthCredentialProvider", provider);
    }

    private <T> T getInternalStateFromRestService(String name, CachedSchemaCoderProvider provider) {
        CachedSchemaRegistryClient cachedSchemaRegistryClient =
                Whitebox.getInternalState(provider.get(), "schemaRegistryClient");
        RestService restService =
                Whitebox.getInternalState(cachedSchemaRegistryClient, "restService");
        return Whitebox.getInternalState(restService, name);
    }
}


text:
package router

import (
	"github.com/gorilla/mux"
)

// NewRouter creates a gorilla/mux router from a list of Route structures.
func NewRouter(routes Routes) *mux.Router {
	router := mux.NewRouter().StrictSlash(true)
	for _, route := range routes.Routes {
		router.
			Methods(route.Method...).
			Name(route.Name).
			Path(routes.BasePattern + route.Pattern).
			Queries(route.Queries...).
			HandlerFunc(route.HandlerFunc)
	}

	return router
}


text:
package com.inman.controller;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

@SpringBootApplication
@Configuration
@EnableConfigurationProperties
@ComponentScan( "com.inman")
@EnableJpaRepositories( {"com.inman.repository" } )
@EntityScan( basePackages = { "com.inman" } )
public class Application {
	public static  boolean isPrepared = false;

    public static void main( String[] args ) {
        	SpringApplication.run( Application.class, args);
    }

    public synchronized static void setIsPrepared( boolean value ) {
    	isPrepared = value;
    }
    public synchronized static boolean isPrepared(  ) {
    	return isPrepared;
    }
}


text:
package nonimmutables;

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

@Retention(RetentionPolicy.RUNTIME)
public @interface B1 {};


text:
//
//  DLPhotoManager.h
//  DLPhotoPicker
//
//  Created by 沧海无际 on 16/2/20.
//  Copyright © 2016年 darling0825. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <Photos/Photos.h>
#import "DLPhotoAsset.h"
#import "DLPhotoCollection.h"

typedef NS_ENUM(NSInteger, DLAuthorizationStatus) {
    DLAuthorizationStatusSuccess          = 0,
    DLAuthorizationStatusAccessDenied     = 1,
    DLAuthorizationStatusNoAssets         = 2,
    DLAuthorizationStatusUnknown          = 3,
};

@interface DLPhotoManager : NSObject

@property (nonatomic, strong) NSArray *photoCollections;
@property (nonatomic, strong) NSArray *fetchResults;

+ (instancetype)sharedInstance;

/**
 *  Determines whether or not the empty albums is shown in the album list.
 *
 *  All albums are visible by default. To hide albums without assets matched with `assetsFetchOptions`,
 *  set this property's value to `NO`.
 *
 *  @see assetsFetchOptions
 */
@property (nonatomic, assign) BOOL showsEmptyAlbums;

/**
 *  Set the `assetCollectionSubtypes` to specify which asset collections (albums) to be shown in the picker.
 *  only iOS 8 or later
 *  You can specify which albums and their order to be shown in the picker by creating an `NSArray` of `NSNumber`
 *  that containing the value of `PHAssetCollectionSubtype`.
 */
@property (nonatomic, copy) NSArray *assetCollectionSubtypes NS_AVAILABLE_IOS(8.0);

/**
 *  Set the `PHFetchOptions` to specify options when fetching asset collections (albums).
 *  only iOS 8 or later
 *  @see assetsFetchOptions
 */
@property (nonatomic, strong) PHFetchOptions *assetCollectionFetchOptions NS_AVAILABLE_IOS(8.0);

/**
 *  Set the `PHFetchOptions` to specify options when fetching assets.
 *  only iOS 8 or later
 *  @see assetCollectionFetchOptions
 */
@property (nonatomic, strong) PHFetchOptions *assetsFetchOptions NS_AVAILABLE_IOS(8.0);

/**
 *  only iOS 8 or later
 */
@property (nonatomic, strong) PHImageRequestOptions *thumbnailRequestOptions NS_AVAILABLE_IOS(8.0);

/**
 *  default album (CameraRoll)
 */
@property (nonatomic, copy, readonly) NSString *defaultAlbum;
@property (nonatomic, copy, readonly) DLPhotoCollection *defaultCollection;

/**
 *  PHCachingImageManager
 *  only iOS 8 or later
 */
- (PHCachingImageManager *)phCachingImageManager NS_AVAILABLE_IOS(8.0);

/**
 *  checkAuthorizationStatus
 */
- (void)checkAuthorizationStatus:(void(^)(DLAuthorizationStatus status))completion;

/**
 *  requestAuthorization
 */
- (void)requestAuthorization;

//  favorite asset
- (void)favoriteAsset:(DLPhotoAsset *)photoAsset
           completion:(void(^)(BOOL success, NSError *error))completion;

//  create album
- (void)createAlbumWithName:(NSString *)albumName
                resultBlock:(void(^)(DLPhotoCollection *collection))completion
               failureBlock:(void(^)(NSError *error))failure;
//  remove album
- (void)removeAlbum:(DLPhotoCollection *)photoCollection
        resultBlock:(void(^)(BOOL success))completion
        failureBlock:(void(^)(NSError *error))failure;

/**
 *  save image
 *  if albumName is nil, the image will save to default album.(CameraRoll)
 */
- (void)saveImage:(UIImage *)image
          toAlbum:(NSString *)albumName
       completion:(void(^)(BOOL success))completion
          failure:(void(^)(NSError *error))failure;
- (void)saveImageData:(NSData *)data
              toAlbum:(NSString *)albumName
           completion:(void(^)(BOOL success))completion
              failure:(void(^)(NSError *error))failure;

//  save video
- (void)saveVideo:(NSURL *)videoUrl
          toAlbum:(NSString *)albumName
       completion:(void(^)(BOOL success))completion
          failure:(void(^)(NSError *error))failure;

- (void)removeAsset:(NSArray<DLPhotoAsset *> *)photoAssets
         completion:(void(^)(BOOL success))completion
            failure:(void(^)(NSError *error))failure;

- (void)saveImageData:(NSData *)imageData
              toAlbum:(NSString *)albumName
             metadata:(NSDictionary *)metadata
           completion:(void(^)(BOOL success))completion
              failure:(void(^)(NSError *error))failure;

/**
 *  Photo edit
 *
 *  @param asset      The asset will edit
 *  @param completion completion
 */
- (void)requestContentEditing:(DLPhotoAsset *)asset
                   completion:(void (^)(UIImage *image, PHContentEditingInput *contentEditingInput, NSDictionary *info))completion NS_AVAILABLE_IOS(8.0);

- (void)saveContentEditing:(DLPhotoAsset *)asset
                     image:(UIImage *)image
       contentEditingInput:(PHContentEditingInput *)contentEditingInput
     adjustmentDescription:(NSData *)adjustmentDescription;

/**
 *  fetch Photo Collection
 */
- (void)fetchPhotoCollection:(void(^)(BOOL success))completion;

/**
 *  Get asset count in a 'DLPhotoCollection'
 *
 *  @param photoCollection DLPhotoCollection
 *
 *  @return The count of asset in 'DLPhotoCollection'.
 */
- (NSUInteger)assetCountOfPhotoCollection:(DLPhotoCollection *)photoCollection;

/**
 *  Get assets in a 'DLPhotoCollection'
 *
 *  @param photoCollection DLPhotoCollection
 *
 *  @return DLPhotoCollection
 */
- (NSArray *)assetsForPhotoCollection:(DLPhotoCollection *)photoCollection;

/**
 *  posterAssets
 *
 *  @param photoCollection DLPhotoCollection
 *  @param count           NSUInteger
 *
 *  @return DLPhotoAsset -> NSArray
 */
- (NSArray *)posterAssetsForPhotoCollection:(DLPhotoCollection *)photoCollection count:(NSUInteger)count;

/**
 *  posterImages
 *
 *  @param collection    DLPhotoCollection
 *  @param thumbnailSize CGSize
 *  @param count         NSUInteger(iOS 7: count = 1)
 *
 *  @return UIImage -> NSArray
 */
- (NSArray *)posterImagesForPhotoCollection:(DLPhotoCollection *)collection thumbnailSize:(CGSize)thumbnailSize count:(NSUInteger)count;

/**
 *  Register observer for photo library
 *
 *  @param observer observer
 */
- (void)registerChangeObserver:(id<PHPhotoLibraryChangeObserver>)observer;
- (void)unregisterChangeObserver:(id<PHPhotoLibraryChangeObserver>)observer;

/**
 *  PHImageManager start or stop caching image
 *
 *  only iOS 8 or later
 *  @param asset      DLPhotoAsset
 *  @param targetSize CGSize
 */
- (void)startCachingImagesForAssets:(DLPhotoAsset *)asset targetSize:(CGSize)targetSize;
- (void)stopCachingImagesForAssets:(DLPhotoAsset *)asset targetSize:(CGSize)targetSize;
- (void)stopCachingImagesForAllAssets;

// for test
- (UIImage *)originImage:(DLPhotoAsset *)photoAsset;
@end


text:
package org.apache.cassandra.db.compaction;

import java.util.Map;

import org.apache.cassandra.exceptions.ConfigurationException;

public final class SizeTieredCompactionStrategyOptions
{
    protected static final long DEFAULT_MIN_SSTABLE_SIZE = 50L * 1024L * 1024L;
    protected static final double DEFAULT_BUCKET_LOW = 0.5;
    protected static final double DEFAULT_BUCKET_HIGH = 1.5;
    protected static final String MIN_SSTABLE_SIZE_KEY = "min_sstable_size";
    protected static final String BUCKET_LOW_KEY = "bucket_low";
    protected static final String BUCKET_HIGH_KEY = "bucket_high";

    protected long minSSTableSize;
    protected double bucketLow;
    protected double bucketHigh;

    public SizeTieredCompactionStrategyOptions(Map<String, String> options)
    {
        String optionValue = options.get(MIN_SSTABLE_SIZE_KEY);
        minSSTableSize = optionValue == null ? DEFAULT_MIN_SSTABLE_SIZE : Long.parseLong(optionValue);
        optionValue = options.get(BUCKET_LOW_KEY);
        bucketLow = optionValue == null ? DEFAULT_BUCKET_LOW : Double.parseDouble(optionValue);
        optionValue = options.get(BUCKET_HIGH_KEY);
        bucketHigh = optionValue == null ? DEFAULT_BUCKET_HIGH : Double.parseDouble(optionValue);
    }

    public SizeTieredCompactionStrategyOptions()
    {
        minSSTableSize = DEFAULT_MIN_SSTABLE_SIZE;
        bucketLow = DEFAULT_BUCKET_LOW;
        bucketHigh = DEFAULT_BUCKET_HIGH;
    }

    private static double parseDouble(Map<String, String> options, String key, double defaultValue) throws ConfigurationException
    {
        String optionValue = options.get(key);
        try
        {
            return optionValue == null ? defaultValue : Double.parseDouble(optionValue);
        }
        catch (NumberFormatException e)
        {
            throw new ConfigurationException(String.format("%s is not a parsable float for %s", optionValue, key), e);
        }
    }

    public static Map<String, String> validateOptions(Map<String, String> options, Map<String, String> uncheckedOptions) throws ConfigurationException
    {
        String optionValue = options.get(MIN_SSTABLE_SIZE_KEY);
        try
        {
            long minSSTableSize = optionValue == null ? DEFAULT_MIN_SSTABLE_SIZE : Long.parseLong(optionValue);
            if (minSSTableSize < 0)
            {
                throw new ConfigurationException(String.format("%s must be non negative: %d", MIN_SSTABLE_SIZE_KEY, minSSTableSize));
            }
        }
        catch (NumberFormatException e)
        {
            throw new ConfigurationException(String.format("%s is not a parsable int (base10) for %s", optionValue, MIN_SSTABLE_SIZE_KEY), e);
        }

        double bucketLow = parseDouble(options, BUCKET_LOW_KEY, DEFAULT_BUCKET_LOW);
        double bucketHigh = parseDouble(options, BUCKET_HIGH_KEY, DEFAULT_BUCKET_HIGH);
        if (bucketHigh <= bucketLow)
        {
            throw new ConfigurationException(String.format("%s value (%s) is less than or equal to the %s value (%s)",
                                                           BUCKET_HIGH_KEY, bucketHigh, BUCKET_LOW_KEY, bucketLow));
        }

        uncheckedOptions.remove(MIN_SSTABLE_SIZE_KEY);
        uncheckedOptions.remove(BUCKET_LOW_KEY);
        uncheckedOptions.remove(BUCKET_HIGH_KEY);

        return uncheckedOptions;
    }

    @Override
    public String toString()
    {
        return String.format("Min sstable size: %d, bucket low: %f, bucket high: %f", minSSTableSize, bucketLow, bucketHigh);
    }

}


text:
package com.netflix.spinnaker.halyard.config.model.v1.providers.consul;

import java.util.ArrayList;
import java.util.List;
import lombok.Data;

@Data
public class ConsulConfig {
  boolean enabled = false;
  String agentEndpoint = "localhost";
  Integer agentPort = 8500;
  List<String> datacenters = new ArrayList<>();
}


text:
'use strict';

const Koa = require('koa');
const path = require('path');

const app = new Koa();
const slacker = require('./index.js');

const PROJECT_DIR = process.cwd();

slacker(app, {
  staticDir: path.resolve(PROJECT_DIR, 'public'),
  staticPath: '/static',
  staticMappings: {
    './manifest.json': '/manifest.json'
  },
  clientDir: path.resolve(PROJECT_DIR, 'client'),
  viewsDir: path.resolve(PROJECT_DIR, 'client', 'views'),
  viewsCache: process.env.NODE_ENV === 'production'
});

app.listen(3000, () => {
  console.log('Listening on 3000');
});


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('goals', '0096_trigger_stop_on_complete'),
    ]

    operations = [
        migrations.AddField(
            model_name='trigger',
            name='relative_units',
            field=models.CharField(blank=True, null=True, choices=[('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months'), ('years', 'Years')], max_length=32),
        ),
        migrations.AddField(
            model_name='trigger',
            name='relative_value',
            field=models.IntegerField(default=0),
        ),
    ]


text:
from django.core.management.base import BaseCommand, CommandError
from pages.models import Page
from pages.tests.testcase import new_page
from django.contrib.auth import get_user_model

lorem = """Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Quisque tempus tellus enim, quis tempus dui pretium non.
Cras eget enim vel magna fringilla cursus ut sit amet mi.
Curabitur id pharetra turpis. Pellentesque quis eros nunc.
Etiam interdum nisi ut sapien facilisis ornare. Mauris in tellus elit.
Integer vulputate venenatis odio. Vivamus in diam vitae magna gravida
sodales sit amet id ex. Aliquam commodo massa at mollis blandit.
Donec auctor sapien et risus gravida, ultrices imperdiet est laoreet."""

class Command(BaseCommand):
    help = 'Create a couple of dummy pages for a demo'

    def handle(self, *args, **options):

        UserModel = get_user_model()
        if UserModel.objects.count() == 0:
            UserModel.objects.create(username='demo', password='demo')

        new_page(content={
            'title': 'Home', 'slug': 'home', 'lead': 'Welcome to the Gerbi CMS', 'content': lorem
        }, template='index.html')
        prod_page = new_page(content={
            'title': 'Products', 'slug': 'products', 'lead': 'Our products', 'content': lorem
        }, template='index.html')
        new_page(content={
            'title': 'Poney', 'slug': 'poney', 'lead': 'Our shiny poney', 'content': lorem},
            parent=prod_page,
            template='index.html')
        new_page(content={
            'title': 'Hat', 'slug': 'hat', 'lead': 'Fedora for elegance', 'content': lorem},
            parent=prod_page,
            template='index.html')
        blog = new_page(content={
            'title': 'Blog', 'slug': 'blog', 'lead': 'Blog example', 'content': lorem},
            template='blog-home.html', delegate_to='blog')
        new_page(content={
            'title': 'Blog post 1', 'slug': 'blog-post-1', 'lead': 'Blog post example', 'content': lorem},
            parent=blog,
            template='blog-post.html')
        new_page(content={
            'title': 'Blog post 2', 'slug': 'blog-post-2', 'lead': 'Blog post example', 'content': lorem},
            parent=blog,
            template='blog-post.html')
        new_page(content={
            'title': 'Blog post 3', 'slug': 'blog-post-3', 'lead': 'Blog post example', 'content': lorem},
            parent=blog,
            template='blog-post.html')
        new_page(content={
            'title': 'Blog post 4', 'slug': 'blog-post-4', 'lead': 'Blog post example', 'content': lorem},
            parent=blog,
            template='blog-post.html')
        new_page(content={
            'title': 'Contact', 'slug': 'contact',
            'lead': 'Contact us at gerbi@example.com', 'content':lorem
        }, template='index.html')


text:
<?php

namespace League\Plates\Template;

use org\bovigo\vfs\vfsStream;

class TemplateTest extends \PHPUnit_Framework_TestCase
{
    private $template;

    public function setUp()
    {
        vfsStream::setup('templates');

        $engine = new \League\Plates\Engine(vfsStream::url('templates'));
        $engine->registerFunction('uppercase', 'strtoupper');

        $this->template = new \League\Plates\Template\Template($engine, 'template');
    }

    public function testCanCreateInstance()
    {
        $this->assertInstanceOf('League\Plates\Template\Template', $this->template);
    }

    public function testCanCallFunction()
    {
        vfsStream::create(
            array(
                'template.php' => '<?php echo $this->uppercase("jonathan") ?>',
            )
        );

        $this->assertEquals($this->template->render(), 'JONATHAN');
    }

    public function testAssignData()
    {
        vfsStream::create(
            array(
                'template.php' => '<?php echo $name ?>',
            )
        );

        $this->template->data(array('name' => 'Jonathan'));
        $this->assertEquals($this->template->render(), 'Jonathan');
    }

    public function testExists()
    {
        vfsStream::create(
            array(
                'template.php' => '',
            )
        );

        $this->assertEquals($this->template->exists(), true);
    }

    public function testDoesNotExist()
    {
        $this->assertEquals($this->template->exists(), false);
    }

    public function testGetPath()
    {
        $this->assertEquals($this->template->path(), 'vfs://templates/template.php');
    }

    public function testRender()
    {
        vfsStream::create(
            array(
                'template.php' => 'Hello World',
            )
        );

        $this->assertEquals($this->template->render(), 'Hello World');
    }

    public function testRenderWithData()
    {
        vfsStream::create(
            array(
                'template.php' => '<?php echo $name ?>',
            )
        );

        $this->assertEquals($this->template->render(array('name' => 'Jonathan')), 'Jonathan');
    }

    public function testRenderDoesNotExist()
    {
        $this->setExpectedException('LogicException', 'The template "template" could not be found at "vfs://templates/template.php".');
        var_dump($this->template->render());
    }

    public function testLayout()
    {
        vfsStream::create(
            array(
                'template.php' => '<?php $this->layout("layout") ?>',
                'layout.php' => 'Hello World',
            )
        );

        $this->assertEquals($this->template->render(), 'Hello World');
    }

    public function testSection()
    {
        vfsStream::create(
            array(
                'template.php' => '<?php $this->layout("layout")?><?php $this->start("test") ?>Hello World<?php $this->stop() ?>',
                'layout.php' => '<?php echo $this->section("test") ?>',
            )
        );

        $this->assertEquals($this->template->render(), 'Hello World');
    }

    public function testStartSectionWithInvalidName()
    {
        $this->setExpectedException('LogicException', 'The section name "content" is reserved.');

        vfsStream::create(
            array(
                'template.php' => '<?php $this->start("content") ?>'
            )
        );

        $this->template->render();
    }

    public function testStopSectionBeforeStarting()
    {
        $this->setExpectedException('LogicException', 'You must start a section before you can stop it.');

        vfsStream::create(
            array(
                'template.php' => '<?php $this->stop() ?>'
            )
        );

        $this->template->render();
    }

    public function testSectionDefaultValue()
    {
        vfsStream::create(array(
            'template.php' => '<?php echo $this->section("test", "Default value") ?>'
        ));

        $this->assertEquals($this->template->render(), 'Default value');
    }

    public function testNullSection()
    {
        vfsStream::create(
            array(
                'template.php' => '<?php $this->layout("layout") ?>',
                'layout.php' => '<?php if (is_null($this->section("test"))) echo "NULL" ?>',
            )
        );

        $this->assertEquals($this->template->render(), 'NULL');
    }

    public function testFetchFunction()
    {
        vfsStream::create(
            array(
                'template.php' => '<?php echo $this->fetch("fetched") ?>',
                'fetched.php' => 'Hello World',
            )
        );

        $this->assertEquals($this->template->render(), 'Hello World');
    }

    public function testInsertFunction()
    {
        vfsStream::create(
            array(
                'template.php' => '<?php $this->insert("inserted") ?>',
                'inserted.php' => 'Hello World',
            )
        );

        $this->assertEquals($this->template->render(), 'Hello World');
    }

    public function testBatchFunction()
    {
        vfsStream::create(
            array(
                'template.php' => '<?php echo $this->batch("Jonathan", "uppercase|strtolower") ?>'
            )
        );

        $this->assertEquals($this->template->render(), 'jonathan');
    }

    public function testBatchFunctionWithInvalidFunction()
    {
        $this->setExpectedException('LogicException', 'The batch function could not find the "function_that_does_not_exist" function.');

        vfsStream::create(
            array(
                'template.php' => '<?php echo $this->batch("Jonathan", "function_that_does_not_exist") ?>'
            )
        );

        $this->template->render();
    }

    public function testEscapeFunction()
    {
        vfsStream::create(
            array(
                'template.php' => '<?php echo $this->escape("Jonathan") ?>'
            )
        );

        $this->assertEquals($this->template->render(), '<strong>Jonathan</strong>');
    }

    public function testEscapeFunctionBatch()
    {
        vfsStream::create(
            array(
                'template.php' => '<?php echo $this->escape("Jonathan", "strtoupper|strrev") ?>'
            )
        );

        $this->assertEquals($this->template->render(), '>GNORTS/<NAHTANOJ>GNORTS<');
    }

    public function testEscapeShortcutFunction()
    {
        vfsStream::create(
            array(
                'template.php' => '<?php echo $this->e("Jonathan") ?>'
            )
        );

        $this->assertEquals($this->template->render(), '<strong>Jonathan</strong>');
    }
}


text:
require 'facebook_ads/client'
require 'facebook_ads/object/ad_account'

module FacebookAds
  class Api
    attr_reader :client, :http

    def initialize(auth_token)
      @client = Client.new(auth_token)
    end

    def ad_accounts
      @ad_accounts ||= Object::AdAccount.all(client)
    end

    def find_ad_account(account_id)
      Object::AdAccount.find(account_id, client)
    end
  end
end


text:
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "gfxMatrix.h"
#include "cairo.h"
#include "mozilla/gfx/Tools.h"

#define CAIRO_MATRIX(x) reinterpret_cast<cairo_matrix_t*>((x))
#define CONST_CAIRO_MATRIX(x) reinterpret_cast<const cairo_matrix_t*>((x))

const gfxMatrix&
gfxMatrix::Reset()
{
    cairo_matrix_init_identity(CAIRO_MATRIX(this));
    return *this;
}

const gfxMatrix&
gfxMatrix::Invert()
{
    cairo_matrix_invert(CAIRO_MATRIX(this));
    return *this;
}

const gfxMatrix&
gfxMatrix::Scale(gfxFloat x, gfxFloat y)
{
    cairo_matrix_scale(CAIRO_MATRIX(this), x, y);
    return *this;
}

const gfxMatrix&
gfxMatrix::Translate(const gfxPoint& pt)
{
    cairo_matrix_translate(CAIRO_MATRIX(this), pt.x, pt.y);
    return *this;
}

const gfxMatrix&
gfxMatrix::Rotate(gfxFloat radians)
{
    cairo_matrix_rotate(CAIRO_MATRIX(this), radians);
    return *this;
}

const gfxMatrix&
gfxMatrix::Multiply(const gfxMatrix& m)
{
    cairo_matrix_multiply(CAIRO_MATRIX(this), CAIRO_MATRIX(this), CONST_CAIRO_MATRIX(&m));
    return *this;
}

const gfxMatrix&
gfxMatrix::PreMultiply(const gfxMatrix& m)
{
    cairo_matrix_multiply(CAIRO_MATRIX(this), CONST_CAIRO_MATRIX(&m), CAIRO_MATRIX(this));
    return *this;
}

gfxPoint
gfxMatrix::Transform(const gfxPoint& point) const
{
    gfxPoint ret = point;
    cairo_matrix_transform_point(CONST_CAIRO_MATRIX(this), &ret.x, &ret.y);
    return ret;
}

gfxSize
gfxMatrix::Transform(const gfxSize& size) const
{
    gfxSize ret = size;
    cairo_matrix_transform_distance(CONST_CAIRO_MATRIX(this), &ret.width, &ret.height);
    return ret;
}

gfxRect
gfxMatrix::Transform(const gfxRect& rect) const
{
    return gfxRect(Transform(rect.TopLeft()), Transform(rect.Size()));
}

gfxRect
gfxMatrix::TransformBounds(const gfxRect& rect) const
{
    /* Code taken from cairo-matrix.c, _cairo_matrix_transform_bounding_box isn't public */
    int i;
    double quad_x[4], quad_y[4];
    double min_x, max_x;
    double min_y, max_y;

    quad_x[0] = rect.X();
    quad_y[0] = rect.Y();
    cairo_matrix_transform_point (CONST_CAIRO_MATRIX(this), &quad_x[0], &quad_y[0]);

    quad_x[1] = rect.XMost();
    quad_y[1] = rect.Y();
    cairo_matrix_transform_point (CONST_CAIRO_MATRIX(this), &quad_x[1], &quad_y[1]);

    quad_x[2] = rect.X();
    quad_y[2] = rect.YMost();
    cairo_matrix_transform_point (CONST_CAIRO_MATRIX(this), &quad_x[2], &quad_y[2]);

    quad_x[3] = rect.XMost();
    quad_y[3] = rect.YMost();
    cairo_matrix_transform_point (CONST_CAIRO_MATRIX(this), &quad_x[3], &quad_y[3]);

    min_x = max_x = quad_x[0];
    min_y = max_y = quad_y[0];

    for (i = 1; i < 4; i++) {
        if (quad_x[i] < min_x)
            min_x = quad_x[i];
        if (quad_x[i] > max_x)
            max_x = quad_x[i];

        if (quad_y[i] < min_y)
            min_y = quad_y[i];
        if (quad_y[i] > max_y)
            max_y = quad_y[i];
    }

    return gfxRect(min_x, min_y, max_x - min_x, max_y - min_y);
}

static void NudgeToInteger(double *aVal)
{
    float f = float(*aVal);
    mozilla::gfx::NudgeToInteger(&f);
    *aVal = f;
}

void
gfxMatrix::NudgeToIntegers(void)
{
    NudgeToInteger(&xx);
    NudgeToInteger(&xy);
    NudgeToInteger(&yx);
    NudgeToInteger(&yy);
    NudgeToInteger(&x0);
    NudgeToInteger(&y0);
}


text:
package no.uib.pap.pathwaymatcher.stages;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.List;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import com.google.common.io.Files;

class PreprocessorTest {

    private static final String PATH = "resources/input/";

    @Test  //Test reading a file with Unix line endings LF
    void readInputlineEndUnixTest() {
        System.out.println();
        List<String> lines = null;
        try {
            lines = Files.readLines(new File(PATH + "lineEndUnix.txt"), Charset.defaultCharset());
        } catch (IOException e) {
            e.printStackTrace();
            fail("The file should be read without errors.");
        }
        assertEquals(10, lines.size());
    }

    @Test	//Test reading a file with Windows line endings CRLF
    void readInputlineEndWindowsTest() {
        List<String> lines = null;
        try {
            lines = Files.readLines(new File(PATH + "lineEndWindows.txt"), Charset.defaultCharset());
        } catch (IOException e) {
            e.printStackTrace();
            fail("The file should be read without errors.");
        }
        assertEquals(10, lines.size());
    }

    @Test	//Test reading a file with Mac line endings CR
    void readInputlineEndMacTest() {
        List<String> lines = null;
        try {
            lines = Files.readLines(new File(PATH + "lineEndMac.txt"), Charset.defaultCharset());
        } catch (IOException e) {
            e.printStackTrace();
            fail("The file should be read without errors.");
        }
        assertEquals(10, lines.size());
    }

}


text:
package org.drip.market.otc;

/*
 * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 */

/*!
 * Copyright (C) 2016 Lakshmi Krishnamurthy
 * Copyright (C) 2015 Lakshmi Krishnamurthy
 *
 *  This file is part of DRIP, a free-software/open-source library for buy/side financial/trading model
 *  	libraries targeting analysts and developers
 *  	https://lakshmidrip.github.io/DRIP/
 *
 *  DRIP is composed of four main libraries:
 *
 *  - DRIP Fixed Income - https://lakshmidrip.github.io/DRIP-Fixed-Income/
 *  - DRIP Asset Allocation - https://lakshmidrip.github.io/DRIP-Asset-Allocation/
 *  - DRIP Numerical Optimizer - https://lakshmidrip.github.io/DRIP-Numerical-Optimizer/
 *  - DRIP Statistical Learning - https://lakshmidrip.github.io/DRIP-Statistical-Learning/
 *
 *  - DRIP Fixed Income: Library for Instrument/Trading Conventions, Treasury Futures/Options,
 *  	Funding/Forward/Overnight Curves, Multi-Curve Construction/Valuation, Collateral Valuation and XVA
 *  	Metric Generation, Calibration and Hedge Attributions, Statistical Curve Construction, Bond RV
 *  	Metrics, Stochastic Evolution and Option Pricing, Interest Rate Dynamics and Option Pricing, LMM
 *  	Extensions/Calibrations/Greeks, Algorithmic Differentiation, and Asset Backed Models and Analytics.
 *
 *  - DRIP Asset Allocation: Library for model libraries for MPT framework, Black Litterman Strategy
 *  	Incorporator, Holdings Constraint, and Transaction Costs.
 *
 *  - DRIP Numerical Optimizer: Library for Numerical Optimization and Spline Functionality.
 *
 *  - DRIP Statistical Learning: Library for Statistical Evaluation and Machine Learning.
 *
 *  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.
 */

/**
 * SwapOptionSettlement contains the details of the OTC Swap Option Settlements.
 *
 * @author Lakshmi Krishnamurthy
 */

public class SwapOptionSettlement {

	/**
	 * Swap Option Settlement Type - Cash Settled
	 */

	public static final int SETTLEMENT_TYPE_CASH_SETTLED = 1;

	/**
	 * Swap Option Settlement Type - Physical Delivery
	 */

	public static final int SETTLEMENT_TYPE_PHYSICAL_DELIVERY = 2;

	/**
	 * Swap Option Cash Settlement Quote Method - Internal Rate of Return
	 */

	public static final int SETTLEMENT_QUOTE_IRR = 1;

	/**
	 * Swap Option Cash Settlement Quote Method - Exact Curve
	 */

	public static final int SETTLEMENT_QUOTE_EXACT_CURVE = 2;

	private int _iSettlementType = -1;
	private int _iSettlementQuote = -1;

	/**
	 * SwapOptionSettlement Constructor
	 *
	 * @param iSettlementType Settlement Type
	 * @param iSettlementQuote Settlement Quote
	 *
	 * @throws java.lang.Exception Thrown if the Inputs are Invalid
	 */

	public SwapOptionSettlement (
		final int iSettlementType,
		final int iSettlementQuote)
		throws java.lang.Exception
	{
		if (SETTLEMENT_TYPE_CASH_SETTLED != (_iSettlementType = iSettlementType) &&
			SETTLEMENT_TYPE_PHYSICAL_DELIVERY != _iSettlementType)
			throw new java.lang.Exception ("SwapOptionSettlement ctr: Invalid Settlement Type");

		if (SETTLEMENT_TYPE_CASH_SETTLED == _iSettlementType && SETTLEMENT_QUOTE_IRR != (_iSettlementQuote =
			iSettlementQuote) && SETTLEMENT_QUOTE_EXACT_CURVE != _iSettlementQuote)
			throw new java.lang.Exception ("SwapOptionSettlement ctr: Invalid Settlement Quote");
	}

	/**
	 * Retrieve the Settlement Type
	 *
	 * @return The Settlement Type
	 */

	public int settlementType()
	{
		return _iSettlementType;
	}

	/**
	 * Retrieve the Settlement Quote
	 *
	 * @return The Settlement Quote
	 */

	public int settlementQuote()
	{
		return _iSettlementQuote;
	}

	@Override public java.lang.String toString()
	{
		if (SETTLEMENT_TYPE_PHYSICAL_DELIVERY == _iSettlementType) return "PHYSICAL DELIVERY";

		return "CASH SETTLED | " + (SETTLEMENT_QUOTE_IRR == _iSettlementQuote ? "INTERNAL RATE OF RETURN" :
			"EXACT CURVE");
	}
}


text:
package net.authorize.data.xml.reporting;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;

import net.authorize.ResponseCode;
import net.authorize.ResponseReasonCode;
import net.authorize.aim.Transaction;
import net.authorize.data.Order;
import net.authorize.data.creditcard.AVSCode;
import net.authorize.data.creditcard.CardType;
import net.authorize.data.xml.Customer;
import net.authorize.data.xml.Payment;
import net.authorize.util.StringUtils;

/**
 * Reporting transaction details.
 */
public class TransactionDetails {

	private String transId;
	private String refTransId;
	private String splitTenderId;
	private Date submitTimeUTC;
	private Date submitTimeLocal;
	private ReportingTransactionType transactionType;
	private TransactionStatusType transactionStatus;
	private ResponseCode responseCode;
	private ResponseReasonCode responseReasonCode;
	private String authCode;
	private AVSCode avsResponse;
	private CardCodeResponseType cardCodeResponse;
	private CAVVResponseType CAVVResponse;
	private FDSFilterActionType FDSFilterAction;
	private ArrayList<FDSFilter> FDSFilterList = new ArrayList<FDSFilter>();
	private BatchDetails batch;
	private Order order;
	// reporting
	private BigDecimal prepaidBalanceRemaining = null;
	private boolean itemTaxExempt;

	private BigDecimal requestedAmount;
	private BigDecimal authAmount;
	private BigDecimal settleAmount;
	private Payment payment;
	private Customer customer;
	private boolean recurringBilling;
	private String customerIP;

	private String invoiceNumber;
	private String firstName;
	private String lastName;
	private CardType accountType;
	private String accountNumber;

	private boolean fullTransactionDetails = false;

	private TransactionDetails() { }

	public static TransactionDetails createTransactionDetails() {
		return new TransactionDetails();
	}

	/**
	 * @return the transId
	 */
	public String getTransId() {
		return transId;
	}

	/**
	 * @param transId
	 *            the transId to set
	 */
	public void setTransId(String transId) {
		this.transId = transId;
	}

	/**
	 * @return the submitTimeUTC
	 */
	public Date getSubmitTimeUTC() {
		return submitTimeUTC;
	}

	/**
	 * @param submitTimeUTC
	 *            the submitTimeUTC to set
	 */
	public void setSubmitTimeUTC(Date submitTimeUTC) {
		this.submitTimeUTC = submitTimeUTC;
	}

	/**
	 * @param submitTimeUTC
	 *            the submitTimeUTC to set
	 */
	public void setSubmitTimeUTC(String submitTimeUTC) {
		if (StringUtils.isNotEmpty(submitTimeUTC)) {
			this.submitTimeUTC = net.authorize.util.DateUtil
					.getDateFromFormattedDate(submitTimeUTC,
							fullTransactionDetails?ReportingDetails.DATE_FORMAT_FULL:ReportingDetails.DATE_FORMAT);
		}
	}

	/**
	 * @return the submitTimeLocal
	 */
	public Date getSubmitTimeLocal() {
		return submitTimeLocal;
	}

	/**
	 * @param submitTimeLocal
	 *            the submitTimeLocal to set
	 */
	public void setSubmitTimeLocal(Date submitTimeLocal) {
		this.submitTimeLocal = submitTimeLocal;
	}

	/**
	 * @param submitTimeLocal
	 *            the submitTimeLocal to set
	 */
	public void setSubmitTimeLocal(String submitTimeLocal) {
		if (StringUtils.isNotEmpty(submitTimeLocal)) {
			this.submitTimeLocal = net.authorize.util.DateUtil
					.getDateFromFormattedDate(submitTimeLocal,
							fullTransactionDetails?ReportingDetails.DATE_FORMAT_FULL:ReportingDetails.DATE_FORMAT);
		}
	}

	/**
	 * @return the transactionStatus
	 */
	public TransactionStatusType getTransactionStatus() {
		return transactionStatus;
	}

	/**
	 * @param transactionStatus
	 *            the transactionStatus to set
	 */
	public void setTransactionStatus(TransactionStatusType transactionStatus) {
		this.transactionStatus = transactionStatus;
	}

	/**
	 * @param transactionStatus
	 *            the transactionStatus to set
	 */
	public void setTransactionStatus(String transactionStatus) {
		if (StringUtils.isNotEmpty(transactionStatus)) {
			this.transactionStatus = TransactionStatusType
					.fromValue(transactionStatus);
		}
	}

	/**
	 * @return the invoiceNumber
	 */
	public String getInvoiceNumber() {
		return invoiceNumber;
	}

	/**
	 * @param invoiceNumber
	 *            the invoiceNumber to set
	 */
	public void setInvoiceNumber(String invoiceNumber) {
		this.invoiceNumber = invoiceNumber;
	}

	/**
	 * @return the firstName
	 */
	public String getFirstName() {
		return firstName;
	}

	/**
	 * @param firstName
	 *            the firstName to set
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	/**
	 * @return the lastName
	 */
	public String getLastName() {
		return lastName;
	}

	/**
	 * @param lastName
	 *            the lastName to set
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	/**
	 * @return the accountType
	 */
	public CardType getAccountType() {
		return accountType;
	}

	/**
	 * @param accountType
	 *            the accountType to set
	 */
	public void setAccountType(CardType accountType) {
		this.accountType = accountType;
	}

	/**
	 * @param accountType
	 *            the accountType to set
	 */
	public void setAccountType(String accountType) {
		if (StringUtils.isNotEmpty(accountType)) {
			this.accountType = CardType.findByValue(accountType);
		}
	}

	/**
	 * @return the accountNumber
	 */
	public String getAccountNumber() {
		return accountNumber;
	}

	/**
	 * @param accountNumber
	 *            the accountNumber to set
	 */
	public void setAccountNumber(String accountNumber) {
		this.accountNumber = accountNumber;
	}

	/**
	 * @return the fullTransactionDetails
	 */
	public boolean isFullTransactionDetails() {
		return fullTransactionDetails;
	}

	/**
	 * @param fullTransactionDetails the fullTransactionDetails to set
	 */
	public void setFullTransactionDetails(boolean fullTransactionDetails) {
		this.fullTransactionDetails = fullTransactionDetails;
	}

	/**
	 * @return the refTransId
	 */
	public String getRefTransId() {
		return refTransId;
	}

	/**
	 * @param refTransId the refTransId to set
	 */
	public void setRefTransId(String refTransId) {
		this.refTransId = refTransId;
	}

	/**
	 * @return the splitTenderId
	 */
	public String getSplitTenderId() {
		return splitTenderId;
	}

	/**
	 * @param splitTenderId the splitTenderId to set
	 */
	public void setSplitTenderId(String splitTenderId) {
		this.splitTenderId = splitTenderId;
	}

	/**
	 * @return the transactionType
	 */
	public ReportingTransactionType getTransactionType() {
		return transactionType;
	}

	/**
	 * @param transactionType the transactionType to set
	 */
	public void setTransactionType(ReportingTransactionType transactionType) {
		this.transactionType = transactionType;
	}

	/**
	 * @return the responseCode
	 */
	public ResponseCode getResponseCode() {
		return responseCode;
	}

	/**
	 * @param responseCode the responseCode to set
	 */
	public void setResponseCode(ResponseCode responseCode) {
		this.responseCode = responseCode;
	}

	/**
	 * @return the responseReasonCode
	 */
	public ResponseReasonCode getResponseReasonCode() {
		return responseReasonCode;
	}

	/**
	 * @param responseReasonCode the responseReasonCode to set
	 */
	public void setResponseReasonCode(ResponseReasonCode responseReasonCode) {
		this.responseReasonCode = responseReasonCode;
	}

	/**
	 * @return the authCode
	 */
	public String getAuthCode() {
		return authCode;
	}

	/**
	 * @param authCode the authCode to set
	 */
	public void setAuthCode(String authCode) {
		this.authCode = authCode;
	}

	/**
	 * @return the avsResponse
	 */
	public AVSCode getAvsResponse() {
		return avsResponse;
	}

	/**
	 * @param avsResponse the avsResponse to set
	 */
	public void setAvsResponse(AVSCode avsResponse) {
		this.avsResponse = avsResponse;
	}

	/**
	 * @return the cardCodeResponse
	 */
	public CardCodeResponseType getCardCodeResponse() {
		return cardCodeResponse;
	}

	/**
	 * @param cardCodeResponse the cardCodeResponse to set
	 */
	public void setCardCodeResponse(CardCodeResponseType cardCodeResponse) {
		this.cardCodeResponse = cardCodeResponse;
	}

	/**
	 * @return the cAVVResponse
	 */
	public CAVVResponseType getCAVVResponse() {
		return CAVVResponse;
	}

	/**
	 * @param cAVVResponse the cAVVResponse to set
	 */
	public void setCAVVResponse(CAVVResponseType cAVVResponse) {
		CAVVResponse = cAVVResponse;
	}

	/**
	 * @return the fDSFilterAction
	 */
	public FDSFilterActionType getFDSFilterAction() {
		return FDSFilterAction;
	}

	/**
	 * @param fDSFilterAction the fDSFilterAction to set
	 */
	public void setFDSFilterAction(FDSFilterActionType fDSFilterAction) {
		FDSFilterAction = fDSFilterAction;
	}

	/**
	 * @return the fDSFilterList
	 */
	public ArrayList<FDSFilter> getFDSFilterList() {
		return FDSFilterList;
	}

	/**
	 * @param fDSFilterList the fDSFilterList to set
	 */
	public void setFDSFilterList(ArrayList<FDSFilter> fDSFilterList) {
		FDSFilterList = fDSFilterList;
	}

	/**
	 * @return the batch
	 */
	public BatchDetails getBatch() {
		return batch;
	}

	/**
	 * @param batch the batch to set
	 */
	public void setBatch(BatchDetails batch) {
		this.batch = batch;
	}

	/**
	 * @return the order
	 */
	public Order getOrder() {
		return order;
	}

	/**
	 * @param order the order to set
	 */
	public void setOrder(Order order) {
		this.order = order;
	}

	/**
	 * @return the requestedAmount
	 */
	public BigDecimal getRequestedAmount() {
		return requestedAmount;
	}

	/**
	 * @param requestedAmount the requestedAmount to set
	 */
	public void setRequestedAmount(BigDecimal requestedAmount) {
		this.requestedAmount = requestedAmount;
	}

	/**
	 * @param requestedAmount the requestedAmount to set
	 */
	public void setRequestedAmount(String requestedAmount) {
		if(StringUtils.isNotEmpty(requestedAmount)) {
			this.requestedAmount = new BigDecimal(requestedAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
		}
	}

	/**
	 * @return the authAmount
	 */
	public BigDecimal getAuthAmount() {
		return authAmount;
	}

	/**
	 * @param authAmount the authAmount to set
	 */
	public void setAuthAmount(BigDecimal authAmount) {
		this.authAmount = authAmount;
	}

	/**
	 * @param authAmount the authAmount to set
	 */
	public void setAuthAmount(String authAmount) {
		if(StringUtils.isNotEmpty(authAmount)) {
			this.authAmount = new BigDecimal(authAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
		}
	}

	/**
	 * @return the settleAmount
	 */
	public BigDecimal getSettleAmount() {
		return settleAmount;
	}

	/**
	 * @param settleAmount the settleAmount to set
	 */
	public void setSettleAmount(BigDecimal settleAmount) {
		this.settleAmount = settleAmount;
	}

	/**
	 * @param settleAmount the settleAmount to set
	 */
	public void setSettleAmount(String settleAmount) {
		if(StringUtils.isNotEmpty(settleAmount)) {
			this.settleAmount = new BigDecimal(settleAmount).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
		}
	}

	/**
	 * @return the payment
	 */
	public Payment getPayment() {
		return payment;
	}

	/**
	 * @param payment the payment to set
	 */
	public void setPayment(Payment payment) {
		this.payment = payment;
	}

	/**
	 * @return the customer
	 */
	public Customer getCustomer() {
		return customer;
	}

	/**
	 * @param customer the customer to set
	 */
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	/**
	 * @return the recurringBilling
	 */
	public boolean isRecurringBilling() {
		return recurringBilling;
	}

	/**
	 * @param recurringBilling the recurringBilling to set
	 */
	public void setRecurringBilling(boolean recurringBilling) {
		this.recurringBilling = recurringBilling;
	}

	/**
	 * @param recurringBilling the recurringBilling to set
	 */
	public void setRecurringBilling(String recurringBilling) {
		if(StringUtils.isNotEmpty(recurringBilling)) {
			this.recurringBilling = Boolean.valueOf(recurringBilling);
		}
	}

	/**
	 * @return the customerIP
	 */
	public String getCustomerIP() {
		return customerIP;
	}

	/**
	 * @param customerIP the customerIP to set
	 */
	public void setCustomerIP(String customerIP) {
		this.customerIP = customerIP;
	}

	/**
	 * @return the prepaidBalanceRemaining
	 */
	public BigDecimal getPrepaidBalanceRemaining() {
		return prepaidBalanceRemaining;
	}

	/**
	 * @param prepaidBalanceRemaining the prepaidBalanceRemaining to set
	 */
	public void setPrepaidBalanceRemaining(BigDecimal prepaidBalanceRemaining) {
		this.prepaidBalanceRemaining = prepaidBalanceRemaining;
	}

	/**
	 * @param prepaidBalanceRemaining the prepaidBalanceRemaining to set
	 */
	public void setPrepaidBalanceRemaining(String prepaidBalanceRemaining) {
		if(StringUtils.isNotEmpty(prepaidBalanceRemaining)) {
			this.prepaidBalanceRemaining = new BigDecimal(prepaidBalanceRemaining).setScale(Transaction.CURRENCY_DECIMAL_PLACES, BigDecimal.ROUND_HALF_UP);
		}
	}

	/**
	 * @return the itemTaxExempt
	 */
	public boolean isItemTaxExempt() {
		return itemTaxExempt;
	}

	/**
	 * @param itemTaxExempt the itemTaxExempt to set
	 */
	public void setItemTaxExempt(boolean itemTaxExempt) {
		this.itemTaxExempt = itemTaxExempt;
	}

	/**
	 * @param itemTaxExempt the itemTaxExempt to set
	 */
	public void setItemTaxExempt(String itemTaxExempt) {
		if(StringUtils.isNotEmpty(itemTaxExempt)) {
			this.itemTaxExempt = Boolean.valueOf(itemTaxExempt);
		}
	}

}


text:
package iso20022

// Details of settlement of a transaction.
type SettlementDetails90 struct {

	// Specifies whether the transaction was executed with a high priority.
	Priority *PriorityNumeric4Choice `xml:"Prty,omitempty"`

	// Identifies the type of securities transaction.
	SecuritiesTransactionType *SecuritiesTransactionType18Choice `xml:"SctiesTxTp"`

	// Conditions under which the order/trade was to be settled.
	SettlementTransactionCondition []*SettlementTransactionCondition16Choice `xml:"SttlmTxCond,omitempty"`

	// Specifies whether partial settlement was allowed.
	PartialSettlementIndicator *SettlementTransactionCondition5Code `xml:"PrtlSttlmInd,omitempty"`

	// Specifies whether there was change of beneficial ownership.
	BeneficialOwnership *BeneficialOwnership4Choice `xml:"BnfclOwnrsh,omitempty"`

	// Specifies whether the settlement instruction was a block parent or child.
	BlockTrade *BlockTrade4Choice `xml:"BlckTrad,omitempty"`

	// Specifies whether the settlement transaction was CCP (Central Counterparty) eligible.
	CCPEligibility *CentralCounterPartyEligibility4Choice `xml:"CCPElgblty,omitempty"`

	// Specifies the category of cash clearing system, for example, cheque clearing.
	CashClearingSystem *CashSettlementSystem4Choice `xml:"CshClrSys,omitempty"`

	// Specifies the underlying business area/type of trade having caused the collateral movement.
	ExposureType *ExposureType16Choice `xml:"XpsrTp,omitempty"`

	// Specifies if an instruction was for a market side or a client side transaction.
	MarketClientSide *MarketClientSide4Choice `xml:"MktClntSd,omitempty"`

	// Specifies whether the settlement transaction was eligible for netting.
	NettingEligibility *NettingEligibility4Choice `xml:"NetgElgblty,omitempty"`

	// Specifies whether registration was to occur upon receipt.
	Registration *Registration9Choice `xml:"Regn,omitempty"`

	// Specifies the type of repurchase transaction.
	RepurchaseType *RepurchaseType12Choice `xml:"RpTp,omitempty"`

	// Regulatory restrictions applicable to a security.
	LegalRestrictions *Restriction5Choice `xml:"LglRstrctns,omitempty"`

	// Specifies whether the settlement transaction was to be settled through an RTGS or a non RTGS system.
	SecuritiesRTGS *SecuritiesRTGS4Choice `xml:"SctiesRTGS,omitempty"`

	// Role of a party in the settlement of the transaction.
	SettlingCapacity *SettlingCapacity7Choice `xml:"SttlgCpcty,omitempty"`

	// Specifies whether the settlement instruction was to be settled through the default or the alternate settlement system.
	SettlementSystemMethod *SettlementSystemMethod4Choice `xml:"SttlmSysMtd,omitempty"`

	// Tax role capacity of the instructing party.
	TaxCapacity *TaxCapacityParty4Choice `xml:"TaxCpcty,omitempty"`

	// Specifies the stamp duty type or exemption reason applicable to the settlement transaction.
	StampDutyTaxBasis *GenericIdentification30 `xml:"StmpDtyTaxBsis,omitempty"`

	// Condition for automatic borrowing.
	AutomaticBorrowing *AutomaticBorrowing6Choice `xml:"AutomtcBrrwg,omitempty"`

	// Specifies whether physical settlement was executed using a letter of guarantee or if the physical certificates were used.
	LetterOfGuarantee *LetterOfGuarantee4Choice `xml:"LttrOfGrnt,omitempty"`

	// Specifies whether securities were requested to be included in the pool of securities eligible for collateral purposes.
	EligibleForCollateral *YesNoIndicator `xml:"ElgblForColl,omitempty"`

	// Specifies the securities sub balance type indicator (example restriction type for a market infrastructure).
	SecuritiesSubBalanceType *GenericIdentification30 `xml:"SctiesSubBalTp,omitempty"`

	// Specifies the cash sub balance type indicator (example restriction type for a market infrastructure).
	CashSubBalanceType *GenericIdentification30 `xml:"CshSubBalTp,omitempty"`
}

func (s *SettlementDetails90) AddPriority() *PriorityNumeric4Choice {
	s.Priority = new(PriorityNumeric4Choice)
	return s.Priority
}

func (s *SettlementDetails90) AddSecuritiesTransactionType() *SecuritiesTransactionType18Choice {
	s.SecuritiesTransactionType = new(SecuritiesTransactionType18Choice)
	return s.SecuritiesTransactionType
}

func (s *SettlementDetails90) AddSettlementTransactionCondition() *SettlementTransactionCondition16Choice {
	newValue := new(SettlementTransactionCondition16Choice)
	s.SettlementTransactionCondition = append(s.SettlementTransactionCondition, newValue)
	return newValue
}

func (s *SettlementDetails90) SetPartialSettlementIndicator(value string) {
	s.PartialSettlementIndicator = (*SettlementTransactionCondition5Code)(&value)
}

func (s *SettlementDetails90) AddBeneficialOwnership() *BeneficialOwnership4Choice {
	s.BeneficialOwnership = new(BeneficialOwnership4Choice)
	return s.BeneficialOwnership
}

func (s *SettlementDetails90) AddBlockTrade() *BlockTrade4Choice {
	s.BlockTrade = new(BlockTrade4Choice)
	return s.BlockTrade
}

func (s *SettlementDetails90) AddCCPEligibility() *CentralCounterPartyEligibility4Choice {
	s.CCPEligibility = new(CentralCounterPartyEligibility4Choice)
	return s.CCPEligibility
}

func (s *SettlementDetails90) AddCashClearingSystem() *CashSettlementSystem4Choice {
	s.CashClearingSystem = new(CashSettlementSystem4Choice)
	return s.CashClearingSystem
}

func (s *SettlementDetails90) AddExposureType() *ExposureType16Choice {
	s.ExposureType = new(ExposureType16Choice)
	return s.ExposureType
}

func (s *SettlementDetails90) AddMarketClientSide() *MarketClientSide4Choice {
	s.MarketClientSide = new(MarketClientSide4Choice)
	return s.MarketClientSide
}

func (s *SettlementDetails90) AddNettingEligibility() *NettingEligibility4Choice {
	s.NettingEligibility = new(NettingEligibility4Choice)
	return s.NettingEligibility
}

func (s *SettlementDetails90) AddRegistration() *Registration9Choice {
	s.Registration = new(Registration9Choice)
	return s.Registration
}

func (s *SettlementDetails90) AddRepurchaseType() *RepurchaseType12Choice {
	s.RepurchaseType = new(RepurchaseType12Choice)
	return s.RepurchaseType
}

func (s *SettlementDetails90) AddLegalRestrictions() *Restriction5Choice {
	s.LegalRestrictions = new(Restriction5Choice)
	return s.LegalRestrictions
}

func (s *SettlementDetails90) AddSecuritiesRTGS() *SecuritiesRTGS4Choice {
	s.SecuritiesRTGS = new(SecuritiesRTGS4Choice)
	return s.SecuritiesRTGS
}

func (s *SettlementDetails90) AddSettlingCapacity() *SettlingCapacity7Choice {
	s.SettlingCapacity = new(SettlingCapacity7Choice)
	return s.SettlingCapacity
}

func (s *SettlementDetails90) AddSettlementSystemMethod() *SettlementSystemMethod4Choice {
	s.SettlementSystemMethod = new(SettlementSystemMethod4Choice)
	return s.SettlementSystemMethod
}

func (s *SettlementDetails90) AddTaxCapacity() *TaxCapacityParty4Choice {
	s.TaxCapacity = new(TaxCapacityParty4Choice)
	return s.TaxCapacity
}

func (s *SettlementDetails90) AddStampDutyTaxBasis() *GenericIdentification30 {
	s.StampDutyTaxBasis = new(GenericIdentification30)
	return s.StampDutyTaxBasis
}

func (s *SettlementDetails90) AddAutomaticBorrowing() *AutomaticBorrowing6Choice {
	s.AutomaticBorrowing = new(AutomaticBorrowing6Choice)
	return s.AutomaticBorrowing
}

func (s *SettlementDetails90) AddLetterOfGuarantee() *LetterOfGuarantee4Choice {
	s.LetterOfGuarantee = new(LetterOfGuarantee4Choice)
	return s.LetterOfGuarantee
}

func (s *SettlementDetails90) SetEligibleForCollateral(value string) {
	s.EligibleForCollateral = (*YesNoIndicator)(&value)
}

func (s *SettlementDetails90) AddSecuritiesSubBalanceType() *GenericIdentification30 {
	s.SecuritiesSubBalanceType = new(GenericIdentification30)
	return s.SecuritiesSubBalanceType
}

func (s *SettlementDetails90) AddCashSubBalanceType() *GenericIdentification30 {
	s.CashSubBalanceType = new(GenericIdentification30)
	return s.CashSubBalanceType
}


text:
<?php

/* Simple configuration file for Laravel Sitemap package */
return array(
    'use_cache' => true,
    'cache_key' => 'Laravel.Sitemap.'.\Request::getHttpHost(),
    'cache_duration' => 3600, //minutes
    'escaping' => true,
);


text:
@interface DCDeleteScribbleCommand : DCCustimizableCommand

- (void)execute;

@end


text:
using NBi.Extensibility.Resolving;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NBi.Core.Calculation.Predicate.DateTime
{
    class DateTimeLessThanOrEqual : DateTimePredicate
    {
        public DateTimeLessThanOrEqual(bool not, IScalarResolver reference) : base(not, reference)
        { }

        protected override bool Compare(System.DateTime x, System.DateTime y)
        {
            return x <= y;
        }
        public override string ToString()
        {
            return $"is before, or equal, {Reference.Execute()}";
        }
    }
}


text:
package mallit.java;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import javax.transaction.TransactionRolledbackException;

/**
 * Tämä luokka vastaa pääosin yksilötyyppien tuonnista ja viennistä tietokantaan.
 * Lisäksi luokka käsittelee monimutkaisemmat usean taulun transaktiot.
 *
 * @author John Lång (jllang@cs.helsinki.fi)
 */
public final class TietokantaDAO {

    private static final String ALUE_KETJU_LIITOS, KETJUN_TUNNUKSEN_HAKU,
            ALUETUNNUSHAKU1, ALUETUNNUSHAKU2;

    private static DataSource yhteydet;

    static {
        ALUE_KETJU_LIITOS       = "insert into ketjujen_sijainnit values (?, ?)";
        KETJUN_TUNNUKSEN_HAKU   = "select tunnus from ketjut where aihe = ?";
        ALUETUNNUSHAKU1         = "select tunnus from alueet where nimi in (?";
        ALUETUNNUSHAKU2         = "select tunnus from alueet where nimi = ?";
        try {
            InitialContext cxt = new InitialContext();
            yhteydet = (DataSource) cxt.lookup("java:/comp/env/jdbc/tietokanta");
        } catch (NamingException e) {
            Logger.getLogger(TietokantaDAO.class.getName()).log(Level.SEVERE,
                    null, e);
        }
    }

    static Connection annaKertayhteys() throws SQLException {
        return yhteydet.getConnection();
    }

    /**
     * Palauttaa Connection-olion, jolta on poistettu autocommit käytöstä.
     *
     * @return Uusi yhteys
     * @throws SQLException
     */
    static Connection annaTransaktioyhteys() throws SQLException {
        final Connection yhteys = TietokantaDAO.annaKertayhteys();
        yhteys.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
        yhteys.setAutoCommit(false);
        return yhteys;
    }

   /**
     * Tallentaa annettujen olioiden tilan tietokantaan yhtenä transaktiona. Jos
     * jonkin olion vienti tietokantaan epäonnistuu, transaktio perutaan.
     * Tietokanta jää eheään tilaan kun tämä metodi on suoritettu.
     *
     * @param tietokohteet Tietokohteet, joiden kenttien arvot viedään
     * tietokantaan.
     * @return <tt>true</tt> joss kaikki annetut tietokohteet saatiin viedyksi
     * tietokantaan.
     */
    public static boolean vie(final Yksilotyyppi... tietokohteet) {
        Connection yhteys           = null;
        PreparedStatement kysely    = null;
        boolean onnistui            = true;
        try {
            yhteys = annaTransaktioyhteys();
            // Kyselyitä ei voida tehdä batchissa koska tietokohteet eivät ole
            // välttämättä samaa tyyppiä (eri luokilla kun on erilaiset kyselyt).
            // Joka tapauksessa tässä nautitaan transaktion tarjoamasta ACID:sta.
            for (Yksilotyyppi tietokohde : tietokohteet) {
                kysely = yhteys.prepareStatement(tietokohde.paivityslause());
                tietokohde.valmistelePaivitys(kysely);
                if (kysely.executeUpdate() == 0) {
                    onnistui = false;
                    break;
                }
            }
            if (onnistui) {
                yhteys.commit();
            } else {
                yhteys.rollback();
            }
        } catch (SQLException | NullPointerException e) {
            Logger.getLogger(TietokantaDAO.class.getName())
                    .log(Level.SEVERE, null, e);
        } finally {
            sulje(yhteys, kysely, null);
        }
        return onnistui;
    }

    /**
     * Onko annettua avainta vastaava monikko olemassa tietokantataulussa.
     *
     * @param luokka
     * @param avain
     * @return Viite arvoon <tt>true</tt> joss tietokannassa on annetun avaimen
     * yksilöimä monikko. Virhetilanteissa palautetaan <tt>null</tt>.
     */
    public static Boolean onOlemassa(final Class luokka, final String avain) {
        // Tämän metodin pitää palauttaa Boolean, sillä virheitä ei voida
        // heitellä ulos kesken kaiken. Virheen heittäminen jättäisi nimittäin
        // yhteyden auki.
        ResultSet vastaus           = null;
        Connection yhteys           = null;
        PreparedStatement kysely    = null;
        Boolean onOlemassa          = null;
        try {
            switch (luokka.getSimpleName()) {
//                case "Alue":
                case "Jasen":
                    yhteys = annaKertayhteys();
                    kysely = Jasen.olemassaolokysely(yhteys, avain);
                    vastaus = kysely.executeQuery();
                    vastaus.next();
                    onOlemassa = vastaus.getBoolean(1);
                    break;
//                case "Ketju":
//                case "Viesti":
                default:
                    // Loogisesti ajatellen tässä pitäisi myös palauttaa false
                    // jos pyydettyä luokkaa vastaavaa taulua ei ole, mutta
                    // jotenkin se olisi hassua...
//                    onOlemassa = false;
                    throw new AssertionError();
            }
        } catch (SQLException | AssertionError e) {
            Logger.getLogger(TietokantaDAO.class.getName())
                    .log(Level.SEVERE, null, e);
        } finally {
            sulje(yhteys, kysely, vastaus);
        }
        return onOlemassa;
    }

    /**
     * Suorittaa annetun SQL select-kyselyn. Metodi ei sulje yhteyksiä.
     *
     * @param hakukysely
     * @return Kyselyn vastaus. <b>Huom.</b> Ennen ensimmäisen rivin lukemista
     * tulee kutsua ResultSet-olion metodia <tt>next()</tt> ResultSet-olion
     * metodia <tt>close() </tt> tulee kutsua kun sen sisältämä data on
     * käsitelty.
     */
    static ResultSet hae(final PreparedStatement hakukysely) {
        try {
            final ResultSet vastaus = hakukysely.executeQuery();
            return vastaus;
        } catch (SQLException e) {
            Logger.getLogger(TietokantaDAO.class.getName()).log(Level.SEVERE, null, e);
            return null;
        }
    }

    public static Yksilotyyppi[] tuoSivu(final Class luokka,
            final String jarjestys, final boolean laskeva, final int pituus,
            final int siirto) {
        ResultSet vastaus           = null;
        Connection yhteys           = null;
        PreparedStatement kysely    = null;
        Yksilotyyppi[] kohteet      = null;
        int i = 0;
        try {
            switch (luokka.getSimpleName()) {
                case "Alue":
                    kohteet = new Alue[pituus];
                    yhteys = annaKertayhteys();
                    kysely = yhteys.prepareStatement("select * from alueet "
                            + "order by ? " + (laskeva ? "desc" : "asc")
                            + " limit ? offset ?;");
                    kysely.setString(1, jarjestys);
                    kysely.setInt(2, pituus);
                    kysely.setInt(3, siirto);
                    vastaus = kysely.executeQuery();
                    while (vastaus.next()) {
                        kohteet[i++] = Alue.luo(vastaus);
                    }
                    break;
                case "Jasen":
                    kohteet = new Jasen[pituus];
                    yhteys = annaKertayhteys();
                    kysely = yhteys.prepareStatement("select * from jasenet "
                            + "order by ? limit ? offset ?;");
                    kysely.setString(1, jarjestys);
                    kysely.setInt(2, pituus);
                    kysely.setInt(3, siirto);
                    vastaus = kysely.executeQuery();
                    while (vastaus.next()) {
                        kohteet[i++] = Jasen.luo(vastaus);
                    }
                    break;
                case "Ketju":
                    kohteet = new Ketju[pituus];
                    yhteys = annaKertayhteys();
                    kysely = yhteys.prepareStatement("select * from ketjut "
                            + "order by ? limit ? offset ?;");
                    kysely.setString(1, jarjestys);
                    kysely.setInt(2, pituus);
                    kysely.setInt(3, siirto);
                    vastaus = kysely.executeQuery();
                    while (vastaus.next()) {
                        kohteet[i++] = Ketju.luo(vastaus);
                    }
                    break;
                case "Viesti":
                    kohteet = new Viesti[pituus];
                    yhteys = annaKertayhteys();
                    kysely = yhteys.prepareStatement("select * from viestit "
                            + "order by ? limit ? offset ?;");
                    kysely.setString(1, jarjestys);
                    kysely.setInt(2, pituus);
                    kysely.setInt(3, siirto);
                    vastaus = kysely.executeQuery();
                    while (vastaus.next()) {
                        kohteet[i++] = Viesti.luo(vastaus);
                    }
                    break;
                default:
                    throw new AssertionError();
            }
        } catch (SQLException | AssertionError e) {
            Logger.getLogger(TietokantaDAO.class.getName())
                    .log(Level.SEVERE, null, e);
        } finally {
            sulje(yhteys, kysely, vastaus);
        }
        return kohteet;
    }

    /**
     * Luo ensimmäisenä parametrina annetun luokan ilmentymän. Olion tila
     * haetaan tietokannasta annetun avaimen perusteella luokkaa vastaavasta
     * relaatiosta.
     *
     * @param luokka Haettavan olion luokka.
     * @param avain Oliota vastaavan monikon avain.
     * @return Uusi
     * @throws AssertionError Jos syötteeksi annetaan jokin tuntematon luokka.
     */
    public static Yksilotyyppi tuo(final Class luokka, final int... avain) {
        ResultSet vastaus           = null;
        Connection yhteys           = null;
        PreparedStatement kysely    = null;
        Yksilotyyppi olio           = null;
        // Tämä koodi on aika ruman näköistä koska Javassa luokat eivät ole
        // first class -arvoja:
        try {
            switch (luokka.getSimpleName()) {
                case "Alue":
                    yhteys = annaKertayhteys();
                    kysely = Alue.hakukysely(yhteys, avain[0]);
                    vastaus = kysely.executeQuery();
                    vastaus.next();
                    olio = Alue.luo(vastaus);
                    break;
                case "Jasen":
                    yhteys = annaKertayhteys();
                    kysely = Jasen.hakukysely(yhteys, avain[0]);
                    vastaus = kysely.executeQuery();
                    vastaus.next();
                    olio = Jasen.luo(vastaus);
                    break;
                case "Ketju":
                    yhteys = annaKertayhteys();
                    kysely = Ketju.hakukysely(yhteys, avain[0]);
                    vastaus = kysely.executeQuery();
                    vastaus.next();
                    olio = Ketju.luo(vastaus);
                    break;
                case "Viesti":
                    yhteys = annaKertayhteys();
                    kysely = Viesti.hakukysely(yhteys, avain[0], avain[1]);
                    vastaus = kysely.executeQuery();
                    vastaus.next();
                    olio = Viesti.luo(vastaus);
                    break;
                default:
                    System.err.println("Tietokannasta yritettiin tuoda tuntematon "
                            + "yksilötyyppi!");
                    throw new AssertionError();
            }
        } catch (SQLException | AssertionError e) {
            Logger.getLogger(TietokantaDAO.class.getName())
                    .log(Level.SEVERE, null, e);
        } finally {
            sulje(yhteys, kysely, vastaus);
        }
        return olio;
    }

    /**
     * Luo ensimmäisenä parametrina annetun luokan ilmentymän. Olion tila
     * haetaan tietokannasta annetun avaimen perusteella luokkaa vastaavasta
     * relaatiosta.
     *
     * @param luokka Haettavan olion luokka.
     * @param avain Oliota vastaavan monikon avain.
     * @return Uusi
     * @throws AssertionError Jos syötteeksi annetaan jokin tuntematon luokka.
     */
    public static Yksilotyyppi tuo(final Class luokka, final String avain) {
        ResultSet vastaus           = null;
        Connection yhteys           = null;
        PreparedStatement kysely    = null;
        Yksilotyyppi olio           = null;
        // Tämä koodi on aika ruman näköistä koska Javassa luokat eivät ole
        // first class -arvoja:
        try {
            switch (luokka.getSimpleName()) {
                case "Alue":
                    yhteys = annaKertayhteys();
                    kysely = Alue.hakukysely(yhteys, avain);
                    vastaus = kysely.executeQuery();
                    vastaus.next();
                    olio = Alue.luo(vastaus);
                    break;
                case "Jasen":
                    yhteys = annaKertayhteys();
                    kysely = Jasen.hakukysely(yhteys, avain);
                    vastaus = kysely.executeQuery();
                    vastaus.next();
                    olio = Jasen.luo(vastaus);
                    break;
                case "Ketju":
                    yhteys = annaKertayhteys();
                    kysely = Ketju.hakukysely(yhteys, avain);
                    vastaus = kysely.executeQuery();
                    vastaus.next();
                    olio = Ketju.luo(vastaus);
                    break;
                case "Viesti":
                    System.err.println("Viestillä ei ole toissijaista "
                            + "hakukyselyä.");
                default:
                    System.err.println("Tietokannasta yritettiin tuoda "
                            + "tuntematon yksilötyyppi!");
                    throw new AssertionError();
            }
        } catch (SQLException | AssertionError e) {
            Logger.getLogger(TietokantaDAO.class.getName())
                    .log(Level.SEVERE, null, e);
        } finally {
            sulje(yhteys, kysely, vastaus);
        }
        return olio;
    }

    /**
     * Luo uuden ketjun ja suorittaa siihen tarvittavat tietokantakyselyt.
     * Kyseessä on transaktio, joten tietokanta jää koherenttiin tilaan metodin
     * suorituksen päätyttyä. (Ketjun luonti tosin ei ole taattu.)
     *
     * @param kirjoittaja   Ensimmäisen viestin kirjoittaja.
     * @param aihe          Ensimmäisen viestin aihe.
     * @param sisalto       Ensimmäisen viestin sisältö.
     * @param alueidenNimet Ketjun alueiden nimet.
     * @return              Luodun ketjun tunnus tai 0 jos ketjun luonti
     *                      epäonnistui.
     */
    public static int luoKetju(final Jasen kirjoittaja, final String aihe,
            final String sisalto, final String[] alueidenNimet) {
        // Tämän transaktion koodi näyttää aika hirveältä ja perustuu
        // sivuvaikutuksiin, mutta ainakin sen pitäisi toimia...
        Connection yhteys = null;
        PreparedStatement ketjunLisays = null, ketjunTunnuksenHaku = null,
                alueidenTunnustenHaku = null, viestinLisays = null, alueenLisays
                = null, viestienKasvatus = null;
        ResultSet ketjunTunnusRS = null, alueidenTunnuksetRS = null;
        boolean onnistui = true;
        final Timestamp ajankohta;
        int ketjunTunnus = 0;
        final int[] alueidenTunnukset;
        try {
            ajankohta = new Timestamp(System.currentTimeMillis());
            yhteys = TietokantaDAO.annaTransaktioyhteys();
            // Ketjun tunnus luodaan tietokannan puolella joten se pitää kysyä:
            if (lisaaKetju(yhteys, ketjunLisays, aihe, ajankohta) != 1) {
                throw new TransactionRolledbackException("Ketjun luonti "
                        + "epäonnistui.");
            }
            ketjunTunnus = haeKetjunTunnus(yhteys, ketjunTunnuksenHaku,
                    ketjunTunnusRS, aihe);
            if (ketjunTunnus == 0) {
                throw new TransactionRolledbackException("Ketjun tunnuksen haku"
                        + " epäonnistui.");
            }
            alueidenTunnukset = haeAlueidenTunnukset(yhteys,
                    alueidenTunnustenHaku, alueidenTunnuksetRS, alueidenNimet);
            if (alueidenTunnukset == null) {
                throw new TransactionRolledbackException("Alueiden tunnusten "
                        + "haku epäonnistui.");
            }
            if (!lisaaAlueet(yhteys, alueenLisays, alueidenTunnukset,
                    ketjunTunnus)) {
                throw new TransactionRolledbackException("Ketjun sijaintien "
                        + "lisäys epäonnistui.");
            }
            if (lisaaViesti(yhteys, viestinLisays, ketjunTunnus, kirjoittaja,
                    ajankohta, sisalto) != 1) {
                throw new TransactionRolledbackException("Viestin luonti "
                        + "epäonnistui.");
            }
            if (kasvataViesteja(yhteys, viestienKasvatus, kirjoittaja) != 1) {
                throw new TransactionRolledbackException("Jäsenen tietojen "
                        + "päivitys epäonnistui.");
            }
        } catch (SQLException | TransactionRolledbackException e) {
            Logger.getLogger(TietokantaDAO.class.getName()).log(Level.SEVERE,
                    null, e);
                onnistui = false;
        } finally {
            if (ketjunTunnusRS != null) {
                try {ketjunTunnusRS.close();} catch (SQLException e) {}
            }
            if (alueidenTunnuksetRS != null) {
                try {alueidenTunnuksetRS.close();} catch (SQLException e) {}
            }
            viimeistele(onnistui, yhteys, ketjunLisays, ketjunTunnuksenHaku,
                    alueidenTunnustenHaku, alueenLisays, viestinLisays);
        }
        return ketjunTunnus;
    }

    private static int lisaaKetju(final Connection yhteys,
            PreparedStatement kysely, final String aihe,
            final Timestamp aikaleima) throws SQLException {
        final Ketju ketju = Ketju.luo(aihe, aikaleima);
        // Mahdollinen IllegalArgumentExceptionkin pitäisi varmaan käsitellä
        // jotenkin...
        kysely = yhteys.prepareStatement(ketju.paivityslause());
        ketju.valmistelePaivitys(kysely);
        return kysely.executeUpdate();
    }

    private static int haeKetjunTunnus(final Connection yhteys,
            PreparedStatement kysely, ResultSet vastaus, final String aihe)
            throws SQLException {
        kysely = yhteys.prepareStatement(KETJUN_TUNNUKSEN_HAKU);
        kysely.setString(1, aihe);
        vastaus = kysely.executeQuery();
        vastaus.next();
        return vastaus.getInt(1);
    }

    private static int[] haeAlueidenTunnukset(final Connection yhteys,
            PreparedStatement kysely, ResultSet vastaus,
            final String[] alueidenNimet) throws SQLException {
        int[] aluetunnukset         = null;
        final int alueita           = alueidenNimet.length;
        final boolean useampiAlue   = alueita > 1;
        final String hakulause      = useampiAlue
                ? ALUETUNNUSHAKU1 : ALUETUNNUSHAKU2;
        final StringBuilder mjr     = new StringBuilder();
        if (useampiAlue) {
            mjr.append(hakulause);
            for (int i = 1; i < alueita; i++) {
                mjr.append(',');
                mjr.append('?');
            }
            mjr.append(')');
            kysely = yhteys.prepareStatement(mjr.toString());
            for (int i = 0; i < alueita; i++) {
                kysely.setString(i + 1, alueidenNimet[i]);
            }
        } else {
            kysely = yhteys.prepareStatement(hakulause);
            kysely.setString(1, alueidenNimet[0]);
        }
        vastaus = kysely.executeQuery();
        aluetunnukset = new int[alueita];
        for (int i = 0; i < alueita; i++) {
            vastaus.next();
            aluetunnukset[i] = vastaus.getInt(1);
        }
        return aluetunnukset;
    }

    private static boolean lisaaAlueet(final Connection yhteys,
            PreparedStatement kysely, final int[] alueidenTunnukset,
            final int ketjunTunnus) throws SQLException {
        final int[] tulokset;
        kysely = yhteys.prepareStatement(ALUE_KETJU_LIITOS);
        for (int alueenTunnus : alueidenTunnukset) {
            kysely.setInt(1, alueenTunnus);
            kysely.setInt(2, ketjunTunnus);
            kysely.addBatch();
        }
        tulokset = kysely.executeBatch();
        for (int tulos : tulokset) {
            if (tulos != 1) {
                return false;
            }
        }
        return true;
    }

    private static int lisaaViesti(final Connection yhteys,
            PreparedStatement kysely, final int ketjunTunnus,
            final Jasen kirjoittaja, final Timestamp ajankohta,
            final String sisalto) throws SQLException {
        Viesti viesti;
        viesti = Viesti.luo(ketjunTunnus, 1, kirjoittaja.annaKayttajanumero(),
                ajankohta, sisalto);
        kysely = yhteys.prepareStatement(viesti.paivityslause());
        viesti.valmistelePaivitys(kysely);
        return kysely.executeUpdate();
    }

    private static int kasvataViesteja(final Connection yhteys,
            PreparedStatement kysely, final Jasen kirjoittaja)
            throws SQLException {;
        kirjoittaja.kasvataViesteja();
        kysely = yhteys.prepareStatement(kirjoittaja.paivityslause());
        kirjoittaja.valmistelePaivitys(kysely);
        return kysely.executeUpdate();
    }

    /**
     * Sulkee kaikki annettujen olioiden tietokantayhteydet. Tämä metodi ei
     * kutsu Connection-olion metodia close.
     *
     * @param yhteys
     * @param kysely
     * @param vastaus
     * @see TietokantaDAO#sitouta(java.sql.Connection, java.sql.ResultSet, java.sql.PreparedStatement...)
     */
    static void sulje(final Connection yhteys,
            final PreparedStatement kysely, final ResultSet vastaus) {
        if (vastaus != null) {
            try { vastaus.close(); } catch (SQLException e) {}
        }
        if (kysely != null) {
            try { kysely.close(); } catch (SQLException e) {}
        }
        if (yhteys != null) {
            try { yhteys.close(); } catch (SQLException e) {}
        }
    }

    private static void viimeistele(final boolean onnistui,
            final Connection yhteys, final PreparedStatement... kyselyt) {
        for (PreparedStatement kysely : kyselyt) {
            if (kysely != null) {
                try {kysely.close();} catch (SQLException e) {}
            }
        }
        if (onnistui) {
            try {yhteys.commit();} catch (SQLException e) {}
        } else {
            try {yhteys.rollback();} catch (SQLException e) {};
        }
        try {yhteys.close();} catch (SQLException e) {}
    }
}


text:
<?php

namespace Google\Cloud\TestUtils;

use GuzzleHttp\Client;

/**
 * Trait ComputeEngineDeploymentTrait
 * @package Google\Cloud\TestUtils
 *
 * Use this trait to deploy the project to GCP for an end-to-end test.
 */
trait DeploymentTrait
{
    /** @var \GuzzleHttp\Client */
    private $client;

    /**
     * Called before deploying the app. The concrete test class can override
     * this.
     */
    private static function beforeDeploy()
    {
    }

    private static function doDeploy()
    {
        throw new \Exception('This method must be implemented your test');
    }

    /**
     * Called after deploying the app. The concrete test class can override
     * this.
     */
    private static function afterDeploy()
    {
    }

    /**
     * Deploy the application.
     *
     * @beforeClass
     */
    public static function deployApp()
    {
        if (getenv('RUN_DEPLOYMENT_TESTS') !== 'true') {
            self::markTestSkipped(
                'To run this test, set RUN_DEPLOYMENT_TESTS env to true.'
            );
        }
        if (getenv('GOOGLE_SKIP_DEPLOYMENT') !== 'true') {
            static::beforeDeploy();
            if (static::doDeploy() === false) {
                self::fail('Deployment failed.');
            }
            if ((int) $delay = getenv('GOOGLE_DEPLOYMENT_DELAY')) {
                sleep($delay);
            }
            static::afterDeploy();
        }
    }

    /**
     * Delete the application.
     *
     * @afterClass
     */
    public static function deleteApp()
    {
        if (
            getenv('GOOGLE_KEEP_DEPLOYMENT') !== 'true'
            && getenv('GOOGLE_SKIP_DEPLOYMENT') !== 'true'
        ) {
            self::doDelete();
        }
    }

    private static function doDelete()
    {
        throw new \Exception('This method must be implemented in your test');
    }

    /**
     * Set up the client.
     *
     * @before
     */
    public function setUpClient()
    {
        $this->client = new Client(['base_uri' => self::getBaseUri()]);
    }

    private static function getBaseUri()
    {
        throw new \Exception('This method must be implemented in your test');
    }
}


text:
var mainMenuState = {
  preload: function() {
    game.cache.removeSound('victory');
    game.load.audio('menus', 'fantasy-wars/game/assets/audio/BGM/menus.ogg');
    var battleStateButton = null;
    var campaignStateButton = null;
    var instructionsStateButton = null;
  },

  create: function() {
    _playSound('menus');
    _setBackgroundImage('logo');
      // (x, y, spritekey, targetState, gameMode, mapkey, armykey, audio, overFrame, outFrame, downFrame, upFrame)
    battleStateButton = new MenuButton(528, 175, "mainMenuButtons", "mapSelectState", "battleGround", "map", "army1", "army2", "battleButton", 0, 0, 1, 0);
    // battleStateButton.setButtonAnimation("");
    campaignStateButton = new MenuButton(528, 275, "mainMenuButtons", "mapSelectState", "campaign", "map", "army1", "army2", "battleButton", 2, 2, 3, 2);
    // campaignStateButton._setButtonAnimation("");
    instructionsStateButton = new MenuButton(528, 375, "mainMenuButtons", "instructionsState", "map", "army1", "army2", "battleButton", 4, 4, 5, 4);
    // instructionsStateButton._setButtonAnimation("");
  }
};

function _playSound(audioKey) {
  var bgm = game.add.audio(audioKey);
  bgm.play();
};

function _setBackgroundImage(imgKey) {
  var logo = game.add.image(0, 0, imgKey);
  logo.width = game.width;
  logo.height = game.height;
};

function _setButtonAnimation(imgKey) {
  this.animations.add("onClick", imgKey);
};


text:
import { Greeter } from "../src/ts_bits/greeter";
import * as chai from "chai";

const expect = chai.expect;

describe("greeter", () => {
    it("should greet with message", () => {
        const greeter = new Greeter("friend");
        expect(greeter.greet()).to.equal("Bonjour, friend!");
    });

    it("should be able to fail", () => {
        expect(1).to.equal(1)
    })
});


text:
package net.minidev.ovh.api.dedicated.server;

/**
 * A structure describing informations bandwidth orderable for this dedicated server
 */
public class OvhTrafficOrderable {
	/**
	 * Is traffic orderable for this server
	 *
	 * canBeNull
	 */
	public Boolean orderable;

	/**
	 * traffic orderable
	 *
	 * canBeNull
	 */
	public OvhTrafficOrderEnum[] traffic;
}


text:
<!DOCTYPE html>
<meta charset="utf-8" />

  <title>Google Desktop Search Download - Reflections</title>

  <meta name="description" content="Default Page Description" />

<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="http://blog.shiv.me/css/latex.css" />
<link rel="stylesheet" href="http://blog.shiv.me/css/main.css" />

<meta name="generator" content="Hugo 0.75.1" />

Google Desktop Search Download

  Oct 21, 2004

Google Desktop Search Download

Check it out!!! I love thee Google, “Lord of Search”!!

Really really neat way to access information. Very quick, a little scary considering that Google can go on to become the next MS! We the users of technology (particularly developers, testers etc) are going to have more exiciting times!!

Google Desktop is a like have the Google search engine installed for searching your system. it indexes your system, and ofcourse it currently supports only Microsoft products, but hope that a few of the open source software liek thunderbird and firefox are also supported soon.

Looking for that file that you know is about something , but just can’t remember where you put it on your system.. no probs, just load up a browser with GDesktop and it’ll find it for you!

        Powered By Hugo / Theme HugoTeX

        Shiva Velmurugan
        ©
        2016


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<servico xmlns="http://servicos.gov.br/v3/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://servicos.gov.br/v3/schema ../servico.xsd">
    <nome><![CDATA[Outorga de Retransmissora de TV]]></nome>
    <sigla>RTV</sigla>
    <nomes-populares/>
    <descricao><![CDATA[O Serviço de RTV é aquele que se destina a retransmitir, de forma simultânea ou não, os sinais de estação geradora de televisão, para a recepção livre e gratuita pelo público em geral, e tem por finalidade possibilitar que os sinais das estações geradoras sejam recebidos em locais por eles não atingidos diretamente ou atingidos em condições técnicas inadequadas.]]></descricao>
    <contato><![CDATA[Reclamações, sugestões, elogios e solicitação de informações das áreas de atuação do ministério podem ser feitas via sistema.

Para isso, é preciso fazer um cadastro rápido e simples que o permitirá acompanhar o andamento da sua solicitação dentro do Ministério das Comunicações.

Acesse o link [http://sistema.mc.gov.br/OuvidoriaWeb/externo/loginExterno.action?paramExterno=1]!

Ministério da Ciência, Tecnologia, Inovações e Comunicações
Telefone: (61) 2027-6000]]></contato>
    <gratuito>false</gratuito>
    <solicitantes>
        <solicitante>
            <tipo>Pessoas físicas, Estados e Territórios, Municípios, Universidades, Sociedades Anônimas ou de responsabilidade Limitadas e Fundações.</tipo>
            <requisitos><![CDATA[Os Serviços de RTV poderão ser executados diretamente pela União ou, indiretamente, mediante autorização para as pessoas jurídicas de direito público ou privado, elencadas no artigo oitavo, do Decreto nº 5.371/2005. A autorização terá prazo indeterminado e caráter precário, não cabendo ao Poder Concedente pagar indenização de qualquer espécie, quando de sua extinção a qualquer título, que se dará mediante ato justificado.]]></requisitos>
        </solicitante>
    </solicitantes>
    <tempo-total-estimado>
        <ate max="1" unidade="dias-corridos"/>
        <descricao><![CDATA[O protocolo da solicitação é imediato e gratuito. Entretanto, o tempo empregado para conclusão da análise do processo pode variar devido às peculiaridades de cada processo, podendo também gerar custos.]]></descricao>
    </tempo-total-estimado>
    <etapas>
        <etapa>
            <titulo>Participação em Edital de Habilitação / Solicitação de Outorga</titulo>
            <descricao><![CDATA[A participação pode ser feita por meio de requisição ao Ministério das Comunicações e com a participação nos avisos de habilitação publicados.]]></descricao>
            <documentos>
                <default>
                    <item>A entidade que possuir retransmissora regular tem o direito de requerer canal de radiofrequência, com largura de 6MHz, junto ao Ministro das Comunicações, para retransmissão da mesma programação, mantida a mesma área de cobertura.</item>
                </default>
            </documentos>
            <custos>
                <default/>
            </custos>
            <canais-de-prestacao>
                <default>
                    <canal-de-prestacao tipo="web">
                        <descricao><![CDATA[http://www.mc.gov.br/espaco-do-radiodifusor/rtv]]></descricao>
                    </canal-de-prestacao>
                </default>
            </canais-de-prestacao>
        </etapa>
    </etapas>
    <orgao id="http://estruturaorganizacional.dados.gov.br/id/unidade-organizacional/1988"/>
    <segmentos-da-sociedade>
        <item>Cidadãos</item>
        <item>Empresas</item>
        <item>Demais segmentos (ONGs, organizações sociais, etc)</item>
        <item>Órgãos e entidades públicas</item>
    </segmentos-da-sociedade>
    <areas-de-interesse>
        <item>Comunicações</item>
    </areas-de-interesse>
    <palavras-chave>
        <item>RTV</item>
        <item>Primária</item>
        <item>Secundária</item>
        <item>Retransmissoras de Televisão</item>
        <item>RTVD</item>
    </palavras-chave>
    <legislacoes>
        <item><![CDATA[.]]></item>
    </legislacoes>
</servico>