text:
""": Stack based error message exception class"""

#===========================================================================
import sys

#===========================================================================
class Error ( Exception ):
   """: Stack based error message exception class.
   """

   #-----------------------------------------------------------------------
   @staticmethod
   def raiseException( exception, msg ):
      excType, excValue, trace = sys.exc_info()

      if not isinstance( exception, Error ):
         exception = Error( str( exception ) )

      exception.add( msg )

      raise exception, None, trace

   #-----------------------------------------------------------------------
   @staticmethod
   def fromException( exception, msg ):
      excType, excValue, trace = sys.exc_info()

      newError = Error( str( exception ) )
      newError.add( msg )

      raise newError, None, trace

   #-----------------------------------------------------------------------
   def __init__( self, msg ):
      """: Constructor
      """
      self._msg = [ msg ]

      Exception.__init__( self )

   #-----------------------------------------------------------------------
   def add( self, msg ):
      self._msg.append( msg )

   #-----------------------------------------------------------------------
   def __str__( self ):
      s = "\n"
      for msg in reversed( self._msg ):
         s += "- %s\n" % msg

      return s

   #-----------------------------------------------------------------------

#===========================================================================


text:
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

import javax.imageio.ImageIO;
import javax.swing.JOptionPane;

/**
 * Card Description:
 * A New Laptop
 * Play in Computer Lab
 * Prerequisites:
 * 4 integrity pts
 * Success:
 * Get 3 quality pts
 * A chip of choice
 * Fail: Discard 1 game card
 * @author Hieu Tran
 *
 */

public class Card24 extends Card{

	public Card24() {
		name = "A New Laptop";
		//Required 4 integrity pts
		checkReqPts = true;
		reqIntegrityPts = 4;
		//Play in Computer Lab
		checkReqLoc = true;
		reqLocation.add(11);
		//initialize image
		try {
			img = ImageIO.read(new File("img/card24.png"));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	@Override
	//Win: get 3 QP and choose 1 chips
	public Player win(Player player) {
		//get 3 qp
		player.updateQP(3);
		//choose 1 point
		Object[] option = {"Learning", "Integrity", "Craft"};
		String input = (String) JOptionPane.showInputDialog(null, "Choose now...",
	            "Choose a point", JOptionPane.PLAIN_MESSAGE, null,
	            option, option[1]);
		if(input.equals("Learning")) {
			player.updateLearningPts(1);
		}
		else if (input.equals("Integrity")) {
			player.updateIntegrityPts(1);
		}
		else { //Craft
			player.updateCraftPts(1);
		}

		return player;
	}

	@Override
	//Fail: Discard 1 game card
	public Player fail(Player player) {
		if(player.isHuman()) {
			discardCard();
		}
		return player;
	}
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef __ASM_STACKTRACE_H
#define __ASM_STACKTRACE_H

struct stackframe {
	unsigned long fp;
	unsigned long sp;
	unsigned long lr;
	unsigned long pc;
};

struct metag_frame {
	unsigned long fp;
	unsigned long lr;
};

extern int unwind_frame(struct stackframe *frame);
extern void walk_stackframe(struct stackframe *frame,
			    int (*fn)(struct stackframe *, void *), void *data);

#endif	/* __ASM_STACKTRACE_H */


text:
//-----------------------------------------------------------------------
// <copyright file="FileProperties.cs" company="Microsoft">
//    Copyright 2013 Microsoft Corporation
//
//    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.
// </copyright>
//-----------------------------------------------------------------------

namespace Microsoft.Azure.Storage.File
{
    using Microsoft.Azure.Storage.Core.Util;
    using Microsoft.Azure.Storage.Shared.Protocol;
    using System;

    /// <summary>
    /// Represents the system properties for a file.
    /// </summary>
    public sealed class FileProperties
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="FileProperties"/> class.
        /// </summary>
        public FileProperties()
        {
            this.Length = -1;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="FileProperties"/> class based on an existing instance.
        /// </summary>
        /// <param name="other">The set of file properties to clone.</param>
        public FileProperties(FileProperties other)
        {
            CommonUtility.AssertNotNull("other", other);

            this.ContentType = other.ContentType;
            this.ContentDisposition = other.ContentDisposition;
            this.ContentEncoding = other.ContentEncoding;
            this.ContentLanguage = other.ContentLanguage;
            this.CacheControl = other.CacheControl;
            this.ContentChecksum.MD5 = other.ContentChecksum.MD5;
            this.ContentChecksum.CRC64 = other.ContentChecksum.CRC64;
            this.Length = other.Length;
            this.ETag = other.ETag;
            this.LastModified = other.LastModified;
            this.IsServerEncrypted = other.IsServerEncrypted;
            this.filePermissionKey = other.filePermissionKey;
            this.ntfsAttributes = other.ntfsAttributes;
            this.creationTime = other.creationTime;
            this.lastWriteTime = other.lastWriteTime;
            this.filePermissionKeyToSet = other.filePermissionKeyToSet;
            this.ntfsAttributesToSet = other.ntfsAttributesToSet;
            this.creationTimeToSet = other.creationTimeToSet;
            this.lastWriteTimeToSet = other.lastWriteTimeToSet;
        }

        /// <summary>
        /// Gets or sets the cache-control value stored for the file.
        /// </summary>
        /// <value>The file's cache-control value.</value>
        public string CacheControl { get; set; }

        /// <summary>
        /// Gets or sets the content-disposition value stored for the file.
        /// </summary>
        /// <value>The file's content-disposition value.</value>
        /// <remarks>
        /// If this property has not been set for the file, it returns null.
        /// </remarks>
        public string ContentDisposition { get; set; }

        /// <summary>
        /// Gets or sets the content-encoding value stored for the file.
        /// </summary>
        /// <value>The file's content-encoding value.</value>
        /// <remarks>
        /// If this property has not been set for the file, it returns <c>null</c>.
        /// </remarks>
        public string ContentEncoding { get; set; }

        /// <summary>
        /// Gets or sets the content-language value stored for the file.
        /// </summary>
        /// <value>The file's content-language value.</value>
        /// <remarks>
        /// If this property has not been set for the file, it returns <c>null</c>.
        /// </remarks>
        public string ContentLanguage { get; set; }

        /// <summary>
        /// Gets the size of the file, in bytes.
        /// </summary>
        /// <value>The file's size in bytes.</value>
        public long Length { get; internal set; }

        /// <summary>
        /// Gets or sets the content-MD5 value stored for the file.
        /// </summary>
        /// <value>The file's content-MD5 hash.</value>
        public string ContentMD5
        {
            get => this.ContentChecksum.MD5;
            set => this.ContentChecksum.MD5 = value;
        }

        /// <summary>
        /// Gets or sets the content checksum value stored for the file.
        /// </summary>
        /// <value>A Checksum instance containing the blob's content checksum values.</value>
        internal Checksum ContentChecksum { get; set; } = new Checksum(md5: default(string), crc64: default(string));

        /// <summary>
        /// Gets or sets the content-type value stored for the file.
        /// </summary>
        /// <value>The file's content-type value.</value>
        /// <remarks>
        /// If this property has not been set for the file, it returns <c>null</c>.
        /// </remarks>
        public string ContentType { get; set; }

        /// <summary>
        /// Gets the file's ETag value.
        /// </summary>
        /// <value>The file's ETag value.</value>
        public string ETag { get; internal set; }

        /// <summary>
        /// Gets the the last-modified time for the file, expressed as a UTC value.
        /// </summary>
        /// <value>The file's last-modified time, in UTC format.</value>
        public DateTimeOffset? LastModified { get; internal set; }

        /// <summary>
        /// Gets the file's server-side encryption state.
        /// </summary>
        /// <value>A bool representing the file's server-side encryption state.</value>
        public bool IsServerEncrypted { get; internal set; }

        /// <summary>
        /// The file's File Permission Key.
        /// </summary>
        internal string filePermissionKey;

        /// <summary>
        /// The file permission key to set on the next File Create or Set Properties call.
        /// </summary>
        internal string filePermissionKeyToSet;

        /// <summary>
        /// Gets or sets the file's File Permission Key.
        /// </summary>
        public string FilePermissionKey
        {
            get
            {
                return filePermissionKeyToSet ?? filePermissionKey;
            }
            set
            {
                filePermissionKeyToSet = value;
            }
        }

        /// <summary>
        /// Get or sets the file system attributes for files and directories.
        /// If not set, indicates preservation of existing values.
        /// </summary>
        internal CloudFileNtfsAttributes? ntfsAttributes;

        /// <summary>
        /// The NTFS file attributes to set on the new File Create or Set Properties call.
        /// </summary>
        internal CloudFileNtfsAttributes? ntfsAttributesToSet;

        /// <summary>
        /// Get or sets the file system attributes for files and directories.
        /// </summary>
        public CloudFileNtfsAttributes? NtfsAttributes
        {
            get
            {
                return ntfsAttributesToSet ?? ntfsAttributes;
            }
            set
            {
                ntfsAttributesToSet = value;
            }
        }

        /// <summary>
        /// The <see cref="DateTimeOffset"/> when the File was created.
        /// </summary>
        internal DateTimeOffset? creationTime;

        /// <summary>
        /// The file creation time to set on the next Create File or Set Properties call.
        /// </summary>
        internal DateTimeOffset? creationTimeToSet;

        /// <summary>
        /// Gets or sets the <see cref="DateTimeOffset"/> when the File was created.
        /// </summary>
        public DateTimeOffset? CreationTime
        {
            get
            {
                return creationTimeToSet ?? creationTime;
            }
            set
            {
                creationTimeToSet = value;
            }
        }

        /// <summary>
        /// The <see cref="DateTimeOffset"/> when the File was last written to.
        /// </summary>
        internal DateTimeOffset? lastWriteTime;

        /// <summary>
        /// The last write time to set on the next Create or Update Properties call.
        /// </summary>
        internal DateTimeOffset? lastWriteTimeToSet;

        /// <summary>
        /// Gets or sets the <see cref="DateTimeOffset"/> when the File was last written to.
        /// </summary>
        public DateTimeOffset? LastWriteTime
        {
            get
            {
                return lastWriteTimeToSet ?? lastWriteTime;
            }
            set
            {
                lastWriteTimeToSet = value;
            }
        }

        /// <summary>
        /// The <see cref="DateTimeOffset"/> when the File was last changed.  Read only.
        /// </summary>
        public DateTimeOffset? ChangeTime { get; internal set; }

        /// <summary>
        /// The File Id.  Read only.
        /// </summary>
        public string FileId { get; internal set; }

        /// <summary>
        /// The Id of this file's parent.  Ready only.
        /// </summary>
        public string ParentId { get; internal set; }
    }
}


text:
export const PERSON_REQUEST = 'PERSON_REQUEST';
export const PERSON_SUCCESS = 'PERSON_SUCCESS';
export const PERSON_FAILURE = 'PERSON_FAILURE';
// 清除数据
export const PERSON_CLEAN = 'PERSON_CLEAN';
// 修改
export const PERSON_UPDATE = 'PERSON_UPDATE';
// 删除
export const PERSON_DELETE = 'PERSON_DELETE';


text:
import React from 'react'

const NoMatch = () => (

Nothing to see here. Move along.

)

export default NoMatch


text:
var app = angular.module('myApp', []);
function CommentObj($http){
    this.getComment = function(commentId, callback){
        $http.get('/comments/get', {params: {commentId: commentId}})
            .success(function(data, status, headers, config){
                callback(null, data);
            })
            .error(function(data, status, headers, config){
                callback(data, {});
            });
    };
    this.addComment = function(rootCommentId, parentId, newComment, callback){
        $http.post('/comments/add', { rootCommentId: rootCommentId,
                                     parentCommentId: parentId,
                                     newComment: newComment})
            .success(function(data, status, headers, config){
                callback(null, data);
            })
            .error(function(data, status, headers, config){

            });
    };
}
//创建Service服务
app.service('commentSrv', ['$http', CommentObj]);
app.controller('photoController', ['$scope', '$http', 'commentSrv',
    function($scope, $http, commentSrv){
        $http.get('/photos')
            .success(function(data, status, headers, config){
                $scope.photos = data;
                $scope.photo = $scope.photos[0];
                $scope.loadComments();
            })
            .error(function(data, status, headers, config){
                $scope.photos = [];
            });
        $scope.loadComments = function() {
            commentSrv.getComment($scope.photo.commentId, function(err, comment){
                if (err) {
                    $scope.commentThread = {};
                } else {
                    $scope.commentThread = comment;
                }
            });
        };
        $scope.addReply = function(parentCommentId, subject, body){
            var newComment = {subject: subject, body: body};
            commentSrv.addComment($scope.commentThread._id,
                                  parentCommentId,
                                  newComment, function(err, comment){
                    $scope.loadComments();
                });
        };
        $scope.setPhoto = function(photoId) {
            $http.get('/photo', {params: {photoId: photoId}})
                .success(function(data, status, headers, config){
                    $scope.photo = data;
                    $scope.loadComments();
                })
                .error(function(data, status, headers, config){
                    $scope.photo = {};
                });
        };
    }]);
app.controller('pageController', ['$scope', '$http', 'commentSrv',
    function($scope, $http, commentSrv){
        $http.get('/page', {params: {pageName: 'Photos Page'}})
            .success(function(data, status, headers, config){
                $scope.page = data;
                $scope.loadComments();
            })
            .error(function(data, status, headers, config){
                $scope.page = {};
            });
        $scope.addReply = function(parentCommentId, subject, body){
            var newComment ={subject: subject, body: body};
            commentSrv.addComment($scope.commentThread._id,
                                  parentCommentId,
                                  newComment, function(err, comment){
                    $scope.loadComments();
                });
        };
        $scope.loadComments = function(){
            commentSrv.getComment($scope.page.commentId, function(err, comment){
                if (err) {
                    $scope.commentThread = {};
                } else {
                    $scope.commentThread = comment;
                }
            });
        };
    }]);


text:
#include <rthw.h>
#include <rtthread.h>
#include "board.h"
#include "usart.h"

/**
 * @addtogroup NUVOTON_M451
 */

/*@{*/

/*******************************************************************************
* Function Name  : NVIC_Configuration
* Description    : Configures Vector Table base location.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void NVIC_Configuration(void)
{
//    NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
}

/**
* @brief  Inserts a delay time.
* @param  nCount: specifies the delay time length.
* @retval None
*/
static void delay(__IO uint32_t nCount)
{
	/* Decrement nCount value */
	while (nCount != 0)
	{
		nCount--;
	}
}

static void rt_hw_system_init(void)
{
    /*---------------------------------------------------------------------------------------------------------*/
    /* Init System Clock                                                                                */
    /*---------------------------------------------------------------------------------------------------------*/
    /* Unlock protected registers */
    SYS_UnlockReg();

    /* Enable HIRC clock (Internal RC 22.1184MHz) */
    CLK_EnableXtalRC(CLK_PWRCTL_HIRCEN_Msk);

    /* Wait for HIRC clock ready */
    CLK_WaitClockReady(CLK_STATUS_HIRCSTB_Msk);

    /* Select HCLK clock source as HIRC and and HCLK clock divider as 1 */
    CLK_SetHCLK(CLK_CLKSEL0_HCLKSEL_HIRC, CLK_CLKDIV0_HCLK(1));

    /* Enable HXT clock (external XTAL 12MHz) */
    CLK_EnableXtalRC(CLK_PWRCTL_HXTEN_Msk);

    /* Wait for HXT clock ready */
    CLK_WaitClockReady(CLK_STATUS_HXTSTB_Msk);

    /* Set core clock as PLL_CLOCK from PLL */
    CLK_SetCoreClock(BOARD_PLL_CLOCK);

    /* Set SysTick clock source to HCLK source divide 2 */
    CLK_SetSysTickClockSrc(CLK_CLKSEL0_STCLKSEL_HCLK_DIV2);

    /* Lock protected registers */
    SYS_LockReg();
}

/**
 * This is the timer interrupt service routine.
 *
 */
void SysTick_Handler(void)
{
	/* enter interrupt */
	rt_interrupt_enter();

	rt_tick_increase();

	/* leave interrupt */
	rt_interrupt_leave();
}
/**
 * This function will initial Nuvoton board.
 */
void rt_hw_board_init()
{
	/* NVIC Configuration */
	NVIC_Configuration();

    /* Configure the system clock */
    rt_hw_system_init();
	/* Configure the SysTick */
	SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);

	/* Initial usart deriver, and set console device */
	rt_hw_usart_init();
#ifdef RT_USING_CONSOLE
	rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif

	/* Call components board initial (use INIT_BOARD_EXPORT()) */
#ifdef RT_USING_COMPONENTS_INIT
    rt_components_board_init();
#endif
}

/*@}*/


text:
@interface KWBeBetweenMatcher()

#pragma mark -
#pragma mark Properties

@property (nonatomic, readwrite, retain) id lowerEndpoint;
@property (nonatomic, readwrite, retain) id upperEndpoint;

@end

@implementation KWBeBetweenMatcher

#pragma mark -
#pragma mark Initializing

- (void)dealloc {
    [lowerEndpoint release];
    [upperEndpoint release];
    [super dealloc];
}

#pragma mark -
#pragma mark Properties

@synthesize lowerEndpoint;
@synthesize upperEndpoint;

#pragma mark -
#pragma mark Getting Matcher Strings

+ (NSArray *)matcherStrings {
    return [NSArray arrayWithObjects:@"beBetween:and:", @"beInTheIntervalFrom:to:", nil];
}

#pragma mark -
#pragma mark Matching

- (BOOL)evaluate {
    if (![self.subject respondsToSelector:@selector(compare:)])
        [NSException raise:@"KWMatcherException" format:@"subject does not respond to -compare:"];

    NSComparisonResult lowerResult = [self.subject compare:self.lowerEndpoint];
    NSComparisonResult upperResult = [self.subject compare:self.upperEndpoint];
    return (lowerResult == NSOrderedDescending || lowerResult == NSOrderedSame) &&
           (upperResult == NSOrderedAscending || upperResult == NSOrderedSame);
}

#pragma mark -
#pragma mark Getting Failure Messages

- (NSString *)failureMessageForShould {
    return [NSString stringWithFormat:@"expected subject to be in the interval [%@, %@], got %@",
                                      [KWFormatter formatObject:self.lowerEndpoint],
                                      [KWFormatter formatObject:self.upperEndpoint],
                                      [KWFormatter formatObject:self.subject]];
}

- (NSString *)description
{
  return [NSString stringWithFormat:@"be between %@ and %@", self.lowerEndpoint, self.upperEndpoint];
}

#pragma mark -
#pragma mark Configuring Matchers

- (void)beBetween:(id)aLowerEndpoint and:(id)anUpperEndpoint {
    [self beInTheIntervalFrom:aLowerEndpoint to:anUpperEndpoint];
}

- (void)beInTheIntervalFrom:(id)aLowerEndpoint to:(id)anUpperEndpoint {
    self.lowerEndpoint = aLowerEndpoint;
    self.upperEndpoint = anUpperEndpoint;
}

@end


text:
Resource Not Found

  Unfortunately, we could not find the resource you were looking for


text:
#pragma once
#include <aws/ec2/EC2_EXPORTS.h>
#include <aws/ec2/model/TrafficMirrorTarget.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/ec2/model/ResponseMetadata.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Xml
{
  class XmlDocument;
} // namespace Xml
} // namespace Utils
namespace EC2
{
namespace Model
{
  class AWS_EC2_API CreateTrafficMirrorTargetResponse
  {
  public:
    CreateTrafficMirrorTargetResponse();
    CreateTrafficMirrorTargetResponse(const Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
    CreateTrafficMirrorTargetResponse& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);

    /**
     *
Information about the Traffic Mirror target.

     */
    inline const TrafficMirrorTarget& GetTrafficMirrorTarget() const{ return m_trafficMirrorTarget; }

    /**
     *
Information about the Traffic Mirror target.

     */
    inline void SetTrafficMirrorTarget(const TrafficMirrorTarget& value) { m_trafficMirrorTarget = value; }

    /**
     *
Information about the Traffic Mirror target.

     */
    inline void SetTrafficMirrorTarget(TrafficMirrorTarget&& value) { m_trafficMirrorTarget = std::move(value); }

    /**
     *
Information about the Traffic Mirror target.

     */
    inline CreateTrafficMirrorTargetResponse& WithTrafficMirrorTarget(const TrafficMirrorTarget& value) { SetTrafficMirrorTarget(value); return *this;}

    /**
     *
Information about the Traffic Mirror target.

     */
    inline CreateTrafficMirrorTargetResponse& WithTrafficMirrorTarget(TrafficMirrorTarget&& value) { SetTrafficMirrorTarget(std::move(value)); return *this;}

    /**
     *
Unique, case-sensitive identifier that you provide to ensure the idempotency
     * of the request. For more information, see How
     * to ensure idempotency.

     */
    inline const Aws::String& GetClientToken() const{ return m_clientToken; }

    /**
     *
Unique, case-sensitive identifier that you provide to ensure the idempotency
     * of the request. For more information, see How
     * to ensure idempotency.

     */
    inline void SetClientToken(const Aws::String& value) { m_clientToken = value; }

    /**
     *
Unique, case-sensitive identifier that you provide to ensure the idempotency
     * of the request. For more information, see How
     * to ensure idempotency.

     */
    inline void SetClientToken(Aws::String&& value) { m_clientToken = std::move(value); }

    /**
     *
Unique, case-sensitive identifier that you provide to ensure the idempotency
     * of the request. For more information, see How
     * to ensure idempotency.

     */
    inline void SetClientToken(const char* value) { m_clientToken.assign(value); }

    /**
     *
Unique, case-sensitive identifier that you provide to ensure the idempotency
     * of the request. For more information, see How
     * to ensure idempotency.

     */
    inline CreateTrafficMirrorTargetResponse& WithClientToken(const Aws::String& value) { SetClientToken(value); return *this;}

    /**
     *
Unique, case-sensitive identifier that you provide to ensure the idempotency
     * of the request. For more information, see How
     * to ensure idempotency.

     */
    inline CreateTrafficMirrorTargetResponse& WithClientToken(Aws::String&& value) { SetClientToken(std::move(value)); return *this;}

    /**
     *
Unique, case-sensitive identifier that you provide to ensure the idempotency
     * of the request. For more information, see How
     * to ensure idempotency.

     */
    inline CreateTrafficMirrorTargetResponse& WithClientToken(const char* value) { SetClientToken(value); return *this;}

    inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; }

    inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; }

    inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); }

    inline CreateTrafficMirrorTargetResponse& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;}

    inline CreateTrafficMirrorTargetResponse& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;}

  private:

    TrafficMirrorTarget m_trafficMirrorTarget;

    Aws::String m_clientToken;

    ResponseMetadata m_responseMetadata;
  };

} // namespace Model
} // namespace EC2
} // namespace Aws


text:
from LinkedList import LinkedList

def alternating_split(input_list):
	a = LinkedList()
	b = LinkedList()
	count = 1
	current = input_list.head
	while current != None:
		if count % 2 == 1:
			a.append(current.data)
		else:
			b.append(current.data)
		count += 1
		current = current.next
	return a, b

test_list = LinkedList()
for iterator in range(0, 10):
	test_list.append(iterator)

test_list.print_list()
a, b = alternating_split(test_list)
a.print_list()
b.print_list()


text:
layout: default
authorlist: "Addor, N., A.J. Newman, N, Mizukami, and M.P. Clark"
title: "The CAMELS data set: catchment attributes and meteorology for large-sample studies"
date: 2017-01-01 16:54:46
journal: "Hydrol. and Earth Syst. Sci. Discuss."
volume:
pages: in review
review:
doi: 10.5194/hess-2017-169
download:
tags: [inreview, paper_CAMELS_attributes, paper_CAMELS_timeseries]
categories:
- papers
---


text:
#ifndef IO_KNAPSACKREADER_H_
#define IO_KNAPSACKREADER_H_

#include "main/KnapSack.h"
#include "util/StringUtils.h"
#include <cstdlib>
#include <fstream>
#include <string>

/**
 *  Helper class used to interpret knapsack problems from input files.
 *
 *	Example File:
 *
 *	------------------------
 *	10.0 4 2
 *	XXL blue Ox		3.0 2.00
 *	gray mouse		1.0 2.45
 *	------------------------
 *
 *	Means:
 *	Capacity = 10.0
 *	MaxNumPerItem = 4
 *	NumOfItems = 2
 *	Item 1: Name(XXL blue Ox), Weight(3.0), Worth(2.00)
 *	Item 2: Name(gray mouse), Weight(1.0), Worth(2.45)
 *	Itemnames are always STRLENGTH_ITEMNAME characters long
 *
 */
class KnapSackReader{
private:
	//Input file constraints
	static const int STRLENGTH_ITEMNAME = 13;
	KnapSackReader();

public:

	/**
	 * Reads the knapsack problem file found at the given path and
	 * creates a KnapSack object representing the read problem.
	 * Returns the created knapsack.
	 */
	static KnapSack readKnapSackFrom(const char* fileName);

};

#endif /* IO_KNAPSACKREADER_H_ */


text:
namespace Gek
{
    namespace Shapes
    {
        Frustum::Frustum(void) noexcept
        {
        }

        Frustum::Frustum(Frustum const &frustum) noexcept
        {
            for (uint32_t index = 0; index < 6; ++index)
            {
                planeList[index] = frustum.planeList[index];
            }
        }

        Frustum::Frustum(Math::Float4x4 const &perspectiveTransform) noexcept
        {
            create(perspectiveTransform);
        }

        void Frustum::create(Math::Float4x4 const &perspectiveTransform) noexcept
        {
            // Near clipping plane
            planeList[0].a = perspectiveTransform._13;
            planeList[0].b = perspectiveTransform._23;
            planeList[0].c = perspectiveTransform._33;
            planeList[0].d = perspectiveTransform._43;

            // Far clipping plane
            planeList[1].a = perspectiveTransform._14 - perspectiveTransform._13;
            planeList[1].b = perspectiveTransform._24 - perspectiveTransform._23;
            planeList[1].c = perspectiveTransform._34 - perspectiveTransform._33;
            planeList[1].d = perspectiveTransform._44 - perspectiveTransform._43;

            // Left clipping plane
            planeList[2].a = perspectiveTransform._14 + perspectiveTransform._11;
            planeList[2].b = perspectiveTransform._24 + perspectiveTransform._21;
            planeList[2].c = perspectiveTransform._34 + perspectiveTransform._31;
            planeList[2].d = perspectiveTransform._44 + perspectiveTransform._41;

            // Right clipping plane
            planeList[3].a = perspectiveTransform._14 - perspectiveTransform._11;
            planeList[3].b = perspectiveTransform._24 - perspectiveTransform._21;
            planeList[3].c = perspectiveTransform._34 - perspectiveTransform._31;
            planeList[3].d = perspectiveTransform._44 - perspectiveTransform._41;

            // Bottom clipping plane
            planeList[4].a = perspectiveTransform._14 + perspectiveTransform._12;
            planeList[4].b = perspectiveTransform._24 + perspectiveTransform._22;
            planeList[4].c = perspectiveTransform._34 + perspectiveTransform._32;
            planeList[4].d = perspectiveTransform._44 + perspectiveTransform._42;

            // Top clipping plane
            planeList[5].a = perspectiveTransform._14 - perspectiveTransform._12;
            planeList[5].b = perspectiveTransform._24 - perspectiveTransform._22;
            planeList[5].c = perspectiveTransform._34 - perspectiveTransform._32;
            planeList[5].d = perspectiveTransform._44 - perspectiveTransform._42;

            for (auto &plane : planeList)
            {
                plane.normalize();
            }
        }
    }; // namespace Shapes
}; // namespace Gek


text:
<?php declare(strict_types = 1);

namespace Adeira\Tests;

class Service1 extends \Adeira\CompilerExtension
{

}


text:
category: Projections
---

# Creating a Projection


text:
/*
 * CcnAdmin.h
 *
 * Toolkit for parsing scenario files and configuring a ccn network
 *
 *  Created on: Sep 14, 2012
 *      Author: manolis sifalakis
 */

#ifndef CCN_ADMIN_H_
#define CCN_ADMIN_H_

#include <string>
#include "shared.h"

/*************************************************************************************************
 * Class CcnAdmin performs the configuration and administration of the CCN scenarios
 *
 * - Parses the scenario config file and stores the settings
 * - Configures the CCN nodes at init time with the pre-run setup
 * - At runtime it acts "Dark City" style transparently altering the state of the CCN
 *   network to reflect transient conditions
 *************************************************************************************************/

class CcnAdmin: public cSimpleModule
{
private:

    /**
     * Various possible scenario configuration options
     */

    enum ConfigType {   // left is the section name in the config file, right is resp. config cmd
        eCommentsMode = 0, NOOP=0,
        eInterestMode = 1, SEND_INTEREST = 1,
        ePreCacheMode = 2, PRE_CACHE=2,
        eFwdRulesMode = 3, ADD_FWD_RULES=3
    };

    static const char * const configType2Str[];

    /**
     * Generic scenario configuration event data
     */
    typedef struct _ConfigRequest {
        _ConfigRequest  *next;

        int             nodeId;         // owner of the request (Ccn module ID)
        bool            isScheduled;    // whether a configuration event has been scheduled for execution
        bool            isExecuted;     // whether a configuration event has been executed
        cMessage        *event;         // ptr to event that will trigger the config action

        ConfigType      type;           // ConfigType enum value
        std::string     namedData;      // Named content (prefix)
        double          execTime;       // time of execution

        union {
            struct {  // FIB rule (ADD_FWD_RULE)
                cModule *nextHop;
                cModule *accessFrom;
            };

            struct {  // Add to cache content (PRE_CACHE) and Interest request (SEND_INTEREST)
                int     startChunk;     // starting chunk in PRE_CACHE request or I-request
                int     numChunks;      // number of chunks in PRE_CACHE request or I-request
            };
        };
    } ConfigRequest;

    /**
     * Registry of all the CCN modules in the omnet environment
     */
    typedef struct _NodeInfo {
        struct _NodeInfo    *next;
        struct _NodeInfo    *prev;
        int                 nodeId;         // getId() of Ccn module (NOT the node compound module); can also be arbitrary
        cModule             *nodePtr;       // ptr of Ccn module (NOT the node compound module)
        ConfigRequest       *configStart;
        ConfigRequest       *configEnd;
        int                 numConfigEvents;
    } NodeInfo;

    NodeInfo        *registryStart, *registryEnd;
    int             registrySize;

    int         debugLevel;

    /**
     * Utility functions for the Ccn Modules registry
     */
    NodeInfo *  getNodeInfo(int id);
    NodeInfo *  getNodeInfo(cModule *module);
    void        deleteNodeConfig(NodeInfo *node);
    void        handleMessage (cMessage *msg);

public:

    CcnAdmin ():
        cSimpleModule(),
        registryStart(NULL),
        registryEnd(NULL),
        registrySize(0),
        debugLevel(0)
    {return;};

    ~CcnAdmin ();

    /**
     * Initialization and termination of the module
     */
    virtual void    initialize();
    virtual void    finish() {return; };

    /**
     * Exported service functions (for direct method invocation by other modules)
     */
    bool registerCcnNode (cModule *node, int nodeId);
    bool unRegisterCcnNode (cModule *node, int nodeId);
    bool parseNodeConfig (cModule *node, const std::string &file);
    void scheduleConfigEvents (cModule *node);

};

#endif /* CCN_ADMIN_H_ */


text:
$(document).ready(function(){

	carouselD_Module.slick({
		slidesToShow: 1,
	  	slidesToScroll: 1,
	  	arrows: false,
	  	fade: true,
  		asNavFor: carouselD_ModuleSmall,
  		responsive: [
		    {
				breakpoint: 1024,
				settings: {
					fade: false
				}
		    }
	  	]
	});

	carouselD_ModuleSmall.slick({
		slidesToShow: 6,
	  	slidesToScroll: 1,
	  	variableWidth: true,
	  	arrows: false,
  		focusOnSelect: true,
  		asNavFor: carouselD_Module,
  		responsive: [
		    {
				breakpoint: 1024,
				settings: "unslick"
		    }
	  	]
	});

	d_ModuleArrowLeft.on('click', function() {
	    carouselD_Module.slick('slickPrev');
	});

	d_ModuleArrowRight.on('click', function() {
	    carouselD_Module.slick('slickNext');
	});

});


text:
from __future__ import unicode_literals

from shop.rest.renderers import CMSPageRenderer

class ModifiedCMSPageRenderer(CMSPageRenderer):
    """
    Modified CMSPageRender to support rendering non CMS templates.
    """
    def render(self, data, accepted_media_type=None, renderer_context=None):
        renderer_context = renderer_context or {}
        view = renderer_context['view']
        request = renderer_context['request']
        response = renderer_context['response']
        template_context = self.get_template_context(dict(data), renderer_context)

        if response.exception:
            template = self.get_exception_template(response)
        else:
            template_names = self.get_template_names(response, view)
            template = self.resolve_template(template_names)
            template_context['paginator'] = view.paginator
            if request.current_page:
                # set edit_mode, so that otherwise invisible placeholders can be edited inline
                template_context['edit_mode'] = request.current_page.publisher_is_draft

        template_context['data'] = data
        template_context.update(renderer_context)
        return template.render(template_context, request=request)


text:
<?php

namespace Exceptions\Http\Client;

use Exceptions\Http\HttpExceptionInterface;

/**
 * This is a tag interface used to group together all potential Client Error HTTP exceptions (400 class).
 *
 * @author   Mathieu Dumoulin <thecrazycodr@gmail.com>
 * @license  MIT
 */
interface ClientErrorExceptionInterface extends HttpExceptionInterface
{
}


text:
\documentclass[12pt,letterpaper]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{color}
\usepackage{graphicx}
\usepackage[pdftex,bookmarksopen]{hyperref}
\hypersetup{pdfauthor={John Sibert}}
\hypersetup{pdfsubject={tagest User's Manual}}
\hypersetup{pdftitle={tagest Users Manual}}
\hypersetup{pdfkeywords={tagest, tagmove, jnigraphics, tag attrition,
ADRM}}
\hypersetup{pdfpagemode=UseThumbs}

%\markright{Sibert \hfil tagest User's Manual\hfil \today}

\newcommand\doublespacing{\baselineskip=1.6\normalbaselineskip}
\newcommand\singlespacing{\baselineskip=1.0\normalbaselineskip}
\renewcommand\deg[1]{$^\circ$#1}
\newcommand\uvD{$(uvD)$}
\newcommand\SD{SEAPODYM}
\newcommand\SDTE{SEAPODYM-TAGEST}
\newcommand\UK{uKfSST}
\newcommand\EK{ensemble Kalman filter}
\newcommand\ADMB{ADModel Builder} \title{\TT\ User's Manual}
\newcommand\help[1]{\color{red}{\it #1 }\normalcolor}
\newcommand\TT{{\tt tagest \& tagmove}}
\newcommand\TE{{\tt tagest}}
\newcommand\TM{{\tt tagmove}}
\newcommand\PAR{{\tt .par}}
\newcommand\TAG{{\tt .tag}}
\newcommand\ADRM{Advection Diffusion Reaction Model}

\author{
John Sibert\thanks{sibert@hawaii.edu}\\
Joint Institute of Marine and Atmospheric Research\\
University of Hawai'i at Manoa\\
Honolulu, HI  96822 U.S.A.\\[0.125in]
\date{\today}
}

\title{Using FAD gradients to compute advection in \TT}

\begin{document}
\maketitle

\doublespacing

Let $[z]$ mean ``the unit (or dimension) of the variable $z$''.
The unit of the advective components, $u$ and $v$, of movement in \TT\
is nautical miles per month or nm mo$^{-1}$;
$[u] = $ nm mo$^{-1}$.
(Confusingly, $(u,v)$ are reported in
nm da$^{-1}$ in the \PAR\ files and converted to nm mo$^{-1}$ in {\tt
uvcomp.cpp}.)

Let $G$ be the density of FADs;  $[G] = $ FADs nm$^{-2}$. We are
interested in relating the horizontal gradients of FAD density to
advection  by a simple function such that $u = f(\frac{dG}{dx})$;
$[\frac{dG}{dx}] = $ FADs nm$^{-2}$nm$^{-1} = $ FADs nm$^{-3}$. Here
are three possible formulations for $f(\frac{dG}{dx})$.

1. Simple linear relationship between advection and
FAD gradient
\[
u = C\cdot \frac{dG}{dx}
.\]
What is [C]?
We can write $[u] = [C]\cdot [\frac{dG}{dx}]$ and solve for $[C]$.
\[
[C] = \frac{[u]}{[\frac{dG}{dx}]}
    = \frac{{\rm nm\; mo}^{-1}}{\rm{FADs\;nm}^{-3}}
.
\]
%   = \frac{{\rm mo}^{-1}}{\rm{FADs\;nm}^{-2}}
%   = \frac{1}{{\rm FADs}}\cdot\frac{{\rm nm}^{2}}{\rm{mo}}
%   = \frac{{\rm nm}}{{\rm FADs}}\cdot\frac{{\rm nm}}{{\rm mo}}
Any way you try to simplify the units, $C$ is an awkward constant.

2. The current model assumes slightly different linear relationship
\[
u = C \cdot s^* \cdot \frac{dG}{dx},
\]
where $s^*$ is the maximum sustained swimming speed;
$[s^*] = {\rm nm\; mo}^{-1}$.
Then
\[
[C] = \frac{[u]}{[s^*][\frac{dG}{dx}]}
    = \frac{{\rm nm\; mo}^{-1}}{{\rm nm\; mo}^{-1}\cdot\rm{FADs\;nm}^{-3}}
    = \frac{1}{\rm{FADs\;nm}^{-3}}
,\]
which appears to directly relate advection to the gradient of FAD
density.

3. It is possible to ``normalize'' the FAD density to the mean FAD
density. Let $G^* = G/\bar{G}$, where $\bar{G}$ is the mean FAD
density; $[\bar{G}] = {\rm{FADs\;nm}^{-2}}$.
Then $\frac{dG^*}{dx} = \frac{1}{\bar{G}}\cdot\frac{dG}{dx}$.

\[
u = C \cdot \frac{s^*}{\bar{G}} \cdot \frac{dG}{dx},
\]
where $s^*$ is the maximum sustained swimming speed as before.
Then
\[
[C] = \frac{[u]}{\frac{[s^*]}{[\bar{G}]}\cdot[\frac{dG}{dx}]}
    = \frac{[u]\cdot[\bar{G}]}{[s^*]\cdot[\frac{dG}{dx}]}
    = \frac{{\rm nm\; mo}^{-1}\cdot{\rm{FADs\;nm}^{-2}}}{{\rm nm\; mo}^{-1}\cdot\rm{FADs\;nm}^{-3}}
    = \frac{1}{\rm{FADs\;nm}^{-1}}
.\]

It is hard to say which of these three alternatives are best. I was
hoping for a dimensionless coefficient, but couldn't find it easily.
You should check my math though. I sort of like the third option
because the dimensions are simpler and the normalization gets avoid
some problems of interpreting the weighting factor as a measure of
regional sensitivity.

\end{document}


text:
int CEF_CALLBACK keyboard_handler_on_pre_key_event(
    struct _cef_keyboard_handler_t* self, cef_browser_t* browser,
    const struct _cef_key_event_t* event, cef_event_handle_t os_event,
    int* is_keyboard_shortcut) {
  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  DCHECK(self);
  if (!self)
    return 0;
  // Verify param: browser; type: refptr_diff
  DCHECK(browser);
  if (!browser)
    return 0;
  // Verify param: event; type: struct_byref_const
  DCHECK(event);
  if (!event)
    return 0;
  // Verify param: is_keyboard_shortcut; type: bool_byaddr
  DCHECK(is_keyboard_shortcut);
  if (!is_keyboard_shortcut)
    return 0;

  // Translate param: event; type: struct_byref_const
  CefKeyEvent eventObj;
  if (event)
    eventObj.Set(*event, false);
  // Translate param: is_keyboard_shortcut; type: bool_byaddr
  bool is_keyboard_shortcutBool = (
      is_keyboard_shortcut && *is_keyboard_shortcut)?true:false;

  // Execute
  bool _retval = CefKeyboardHandlerCppToC::Get(self)->OnPreKeyEvent(
      CefBrowserCToCpp::Wrap(browser),
      eventObj,
      os_event,
      &is_keyboard_shortcutBool);

  // Restore param: is_keyboard_shortcut; type: bool_byaddr
  if (is_keyboard_shortcut)
    *is_keyboard_shortcut = is_keyboard_shortcutBool?true:false;

  // Return type: bool
  return _retval;
}

int CEF_CALLBACK keyboard_handler_on_key_event(
    struct _cef_keyboard_handler_t* self, cef_browser_t* browser,
    const struct _cef_key_event_t* event, cef_event_handle_t os_event) {
  // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING

  DCHECK(self);
  if (!self)
    return 0;
  // Verify param: browser; type: refptr_diff
  DCHECK(browser);
  if (!browser)
    return 0;
  // Verify param: event; type: struct_byref_const
  DCHECK(event);
  if (!event)
    return 0;

  // Translate param: event; type: struct_byref_const
  CefKeyEvent eventObj;
  if (event)
    eventObj.Set(*event, false);

  // Execute
  bool _retval = CefKeyboardHandlerCppToC::Get(self)->OnKeyEvent(
      CefBrowserCToCpp::Wrap(browser),
      eventObj,
      os_event);

  // Return type: bool
  return _retval;
}

// CONSTRUCTOR - Do not edit by hand.

CefKeyboardHandlerCppToC::CefKeyboardHandlerCppToC(CefKeyboardHandler* cls)
    : CefCppToC<CefKeyboardHandlerCppToC, CefKeyboardHandler,
        cef_keyboard_handler_t>(cls) {
  struct_.struct_.on_pre_key_event = keyboard_handler_on_pre_key_event;
  struct_.struct_.on_key_event = keyboard_handler_on_key_event;
}

#ifndef NDEBUG
template<> long CefCppToC<CefKeyboardHandlerCppToC, CefKeyboardHandler,
    cef_keyboard_handler_t>::DebugObjCt = 0;
#endif


text:
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "android_webview/renderer/aw_content_renderer_client.h"

#include <vector>

#include "android_webview/common/aw_resource.h"
#include "android_webview/common/aw_switches.h"
#include "android_webview/common/render_view_messages.h"
#include "android_webview/common/url_constants.h"
#include "android_webview/grit/aw_resources.h"
#include "android_webview/grit/aw_strings.h"
#include "android_webview/renderer/aw_content_settings_client.h"
#include "android_webview/renderer/aw_key_systems.h"
#include "android_webview/renderer/aw_message_port_client.h"
#include "android_webview/renderer/aw_print_web_view_helper_delegate.h"
#include "android_webview/renderer/aw_render_frame_ext.h"
#include "android_webview/renderer/aw_render_view_ext.h"
#include "android_webview/renderer/print_render_frame_observer.h"
#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/content/renderer/autofill_agent.h"
#include "components/autofill/content/renderer/password_autofill_agent.h"
#include "components/printing/renderer/print_web_view_helper.h"
#include "components/visitedlink/renderer/visitedlink_slave.h"
#include "content/public/common/url_constants.h"
#include "content/public/renderer/document_state.h"
#include "content/public/renderer/navigation_state.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h"
#include "net/base/escape.h"
#include "net/base/net_errors.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/platform/WebURLError.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebNavigationType.h"
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "url/gurl.h"
#include "url/url_constants.h"

using content::RenderThread;

namespace android_webview {

AwContentRendererClient::AwContentRendererClient()
    : disable_page_visibility_(
          base::CommandLine::ForCurrentProcess()
              ->HasSwitch(switches::kDisablePageVisibility)) {}

AwContentRendererClient::~AwContentRendererClient() {
}

void AwContentRendererClient::RenderThreadStarted() {
  RenderThread* thread = RenderThread::Get();
  aw_render_process_observer_.reset(new AwRenderProcessObserver);
  thread->AddObserver(aw_render_process_observer_.get());

  visited_link_slave_.reset(new visitedlink::VisitedLinkSlave);
  thread->AddObserver(visited_link_slave_.get());

  // Using WebString requires blink initialization.
  thread->EnsureWebKitInitialized();

  blink::WebString content_scheme(base::ASCIIToUTF16(url::kContentScheme));
  blink::WebSecurityPolicy::registerURLSchemeAsLocal(content_scheme);

  blink::WebString aw_scheme(
      base::ASCIIToUTF16(android_webview::kAndroidWebViewVideoPosterScheme));
  blink::WebSecurityPolicy::registerURLSchemeAsSecure(aw_scheme);
}

bool AwContentRendererClient::HandleNavigation(
    content::RenderFrame* render_frame,
    bool is_content_initiated,
    int opener_id,
    blink::WebFrame* frame,
    const blink::WebURLRequest& request,
    blink::WebNavigationType type,
    blink::WebNavigationPolicy default_policy,
    bool is_redirect) {
  // Only GETs can be overridden.
  if (!request.httpMethod().equals("GET"))
    return false;

  // Any navigation from loadUrl, and goBack/Forward are considered application-
  // initiated and hence will not yield a shouldOverrideUrlLoading() callback.
  // Webview classic does not consider reload application-initiated so we
  // continue the same behavior.
  // TODO(sgurun) is_content_initiated is normally false for cross-origin
  // navigations but since android_webview does not swap out renderers, this
  // works fine. This will stop working if android_webview starts swapping out
  // renderers on navigation.
  bool application_initiated =
      !is_content_initiated || type == blink::WebNavigationTypeBackForward;

  // Don't offer application-initiated navigations unless it's a redirect.
  if (application_initiated && !is_redirect)
    return false;

  bool is_main_frame = !frame->parent();
  const GURL& gurl = request.url();
  // For HTTP schemes, only top-level navigations can be overridden. Similarly,
  // WebView Classic lets app override only top level about:blank navigations.
  // So we filter out non-top about:blank navigations here.
  if (!is_main_frame &&
      (gurl.SchemeIs(url::kHttpScheme) || gurl.SchemeIs(url::kHttpsScheme) ||
       gurl.SchemeIs(url::kAboutScheme)))
    return false;

  // use NavigationInterception throttle to handle the call as that can
  // be deferred until after the java side has been constructed.
  if (opener_id != MSG_ROUTING_NONE) {
    return false;
  }

  bool ignore_navigation = false;
  base::string16 url = request.url().string();
  bool has_user_gesture = request.hasUserGesture();

  int render_frame_id = render_frame->GetRoutingID();
  RenderThread::Get()->Send(new AwViewHostMsg_ShouldOverrideUrlLoading(
      render_frame_id, url, has_user_gesture, is_redirect, is_main_frame,
      &ignore_navigation));
  return ignore_navigation;
}

void AwContentRendererClient::RenderFrameCreated(
    content::RenderFrame* render_frame) {
  new AwContentSettingsClient(render_frame);
  new PrintRenderFrameObserver(render_frame);
  new AwRenderFrameExt(render_frame);
  new AwMessagePortClient(render_frame);

  // TODO(jam): when the frame tree moves into content and parent() works at
  // RenderFrame construction, simplify this by just checking parent().
  content::RenderFrame* parent_frame =
      render_frame->GetRenderView()->GetMainRenderFrame();
  if (parent_frame && parent_frame != render_frame) {
    // Avoid any race conditions from having the browser's UI thread tell the IO
    // thread that a subframe was created.
    RenderThread::Get()->Send(new AwViewHostMsg_SubFrameCreated(
        parent_frame->GetRoutingID(), render_frame->GetRoutingID()));
  }

  // TODO(sgurun) do not create a password autofill agent (change
  // autofill agent to store a weakptr).
  autofill::PasswordAutofillAgent* password_autofill_agent =
      new autofill::PasswordAutofillAgent(render_frame);
  new autofill::AutofillAgent(render_frame, password_autofill_agent, NULL);
}

void AwContentRendererClient::RenderViewCreated(
    content::RenderView* render_view) {
  AwRenderViewExt::RenderViewCreated(render_view);

  new printing::PrintWebViewHelper(
      render_view,
      scoped_ptr<printing::PrintWebViewHelper::Delegate>(
          new AwPrintWebViewHelperDelegate()));
}

bool AwContentRendererClient::HasErrorPage(int http_status_code,
                          std::string* error_domain) {
  return http_status_code >= 400;
}

void AwContentRendererClient::GetNavigationErrorStrings(
    content::RenderFrame* /* render_frame */,
    const blink::WebURLRequest& failed_request,
    const blink::WebURLError& error,
    std::string* error_html,
    base::string16* error_description) {
  if (error_html) {
    std::string url =
        net::EscapeForHTML(GURL(failed_request.url()).possibly_invalid_spec());
    std::string err =
        base::UTF16ToUTF8(base::StringPiece16(error.localizedDescription));

    std::vector<std::string> replacements;
    replacements.push_back(
        l10n_util::GetStringUTF8(IDS_AW_WEBPAGE_NOT_AVAILABLE));
    if (err.empty()) {
      replacements.push_back(l10n_util::GetStringFUTF8(
          IDS_AW_WEBPAGE_TEMPORARILY_DOWN, base::UTF8ToUTF16(url)));
      replacements.push_back(l10n_util::GetStringUTF8(
          IDS_AW_WEBPAGE_TEMPORARILY_DOWN_SUGGESTIONS));
    } else {
      replacements.push_back(l10n_util::GetStringFUTF8(
          IDS_AW_WEBPAGE_CAN_NOT_BE_LOADED, base::UTF8ToUTF16(url)));
      replacements.push_back(err);
    }
    if (base::i18n::IsRTL())
      replacements.push_back("direction: rtl;");
    else
      replacements.push_back("");
    *error_html = base::ReplaceStringPlaceholders(
        ResourceBundle::GetSharedInstance().GetRawDataResource(
            IDR_AW_LOAD_ERROR_HTML),
        replacements, nullptr);
  }
  if (error_description) {
    if (error.localizedDescription.isEmpty())
      *error_description = base::ASCIIToUTF16(net::ErrorToString(error.reason));
    else
      *error_description = error.localizedDescription;
  }
}

unsigned long long AwContentRendererClient::VisitedLinkHash(
    const char* canonical_url,
    size_t length) {
  return visited_link_slave_->ComputeURLFingerprint(canonical_url, length);
}

bool AwContentRendererClient::IsLinkVisited(unsigned long long link_hash) {
  return visited_link_slave_->IsVisited(link_hash);
}

void AwContentRendererClient::AddKeySystems(
    std::vector<media::KeySystemInfo>* key_systems) {
  AwAddKeySystems(key_systems);
}

bool AwContentRendererClient::ShouldOverridePageVisibilityState(
    const content::RenderFrame* render_frame,
    blink::WebPageVisibilityState* override_state) {
  if (disable_page_visibility_) {
    *override_state = blink::WebPageVisibilityStateVisible;
    return true;
  }

  return false;
}

}  // namespace android_webview


text:
package org.scalatest

/**
 * Classes, traits, and objects related to testing asynchronous and multi-threaded
 * behavior.
 *
 * This package is released as part of the `scalatest-core` module.
 */
package object concurrent


text:
var betFormatter = require("./app/util/betformatter.js");
var validators = require('./app/util/validaton.js');
var dc = require("./app/services/dividendCalculatorService.js");
var readline = require('readline');
var winRule = require("./app/rules/winRule.js");
var firstPlaceRule = require("./app/rules/firstPlaceRule.js");
var secondPlaceRule = require("./app/rules/secondPlaceRule.js");
var thirdPlaceRule = require("./app/rules/thirdPlaceRule.js");
var exactaRule = require("./app/rules/exactaRule.js");

var logger = require("./defaultLogger.js");
var config = require('./config');
var productConstants = config.productConstants;
var delimeter = config.validationConstants;

var InputData = [];
var Bets = new betFormatter();

var reader = readline.createInterface({
	input: process.stdin,
	output: process.stdout,
	terminal: true
});
console.log('Usage Bet:<W/P/E>:<selection[,selection]>:<stake>');
console.log('Usage Result:<first>:<second>:<third>');
reader.prompt(true);

reader.on('line', function (line) {
	var errors = validators(line);
	if (errors) {
		console.log("Invalid InputData", errors);
		reader.prompt(true);
	} else {
		InputData.push(line);
		//Result will be last Line
		if ((/Result/).test(line)) {
			reader.close();
		} else {
			reader.prompt(true);
		}
	}
});

//After input stream is closed
reader.on('close', function (line) {
	logger.info("InputData", InputData);
	var betsAndResult = Bets.getFormattedBets(InputData);
	if (betsAndResult.Errors) {
		console.log("Invalid InputData", betsAndResult.Errors);
	} else {
		var dCalcWin = new dc(productConstants.WIN, winRule, betsAndResult.Result);
		console.log(productConstants.WIN.name + delimeter.COLON_DELIMITER +
			betsAndResult.Result.first + delimeter.COLON_DELIMITER +
			delimeter.DOLLAR_SIGN + dCalcWin.calculateDividends(betsAndResult.Bets));

		var dCalcPlace1 = new dc(productConstants.PLACE, firstPlaceRule, betsAndResult.Result);
		console.log(productConstants.PLACE.name + delimeter.COLON_DELIMITER +
			betsAndResult.Result.first + delimeter.COLON_DELIMITER +
			delimeter.DOLLAR_SIGN + dCalcPlace1.calculateDividends(betsAndResult.Bets));

		var dCalcPlace2 = new dc(productConstants.PLACE, secondPlaceRule, betsAndResult.Result);
		console.log(productConstants.PLACE.name + delimeter.COLON_DELIMITER +
			betsAndResult.Result.second + delimeter.COLON_DELIMITER +
			delimeter.DOLLAR_SIGN + dCalcPlace2.calculateDividends(betsAndResult.Bets));

		var dCalcPlace3 = new dc(productConstants.PLACE, thirdPlaceRule, betsAndResult.Result);
		console.log(productConstants.PLACE.name + delimeter.COLON_DELIMITER +
			betsAndResult.Result.third + delimeter.COLON_DELIMITER +
			delimeter.DOLLAR_SIGN + dCalcPlace3.calculateDividends(betsAndResult.Bets));

		var dCalcExacta = new dc(productConstants.EXACTA, exactaRule, betsAndResult.Result);
		console.log(productConstants.EXACTA.name + delimeter.COLON_DELIMITER +
			betsAndResult.Result.first + delimeter.COMMA_DELIMITER + betsAndResult.Result.second + delimeter.COLON_DELIMITER +
			delimeter.DOLLAR_SIGN + dCalcExacta.calculateDividends(betsAndResult.Bets));
	}

});


text:
package scalaz.stream

import org.scalacheck.{Arbitrary, Gen}
import org.scalacheck.Arbitrary.arbitrary
import scalaz.Equal
import scodec.bits.ByteVector

import Process._
import ReceiveY._

object TestInstances {
  implicit val arbitraryByteVector: Arbitrary[ByteVector] =
    Arbitrary(arbitrary[String].map(s => ByteVector.view(s.getBytes)))

  implicit def arbitraryIndexedSeq[A: Arbitrary]: Arbitrary[IndexedSeq[A]] =
    Arbitrary(arbitrary[List[A]].map(_.toIndexedSeq))

  implicit def arbitraryProcess0[A: Arbitrary]: Arbitrary[Process0[A]] =
    Arbitrary(arbitrary[List[A]].map(list => emitSeq(list)))

  implicit def arbitraryReceiveY[A: Arbitrary,B: Arbitrary]: Arbitrary[ReceiveY[A,B]] =
    Arbitrary(Gen.oneOf(
      arbitrary[A].map(ReceiveL(_)),
      arbitrary[B].map(ReceiveR(_))
    ))

  implicit def equalProcess0[A: Equal]: Equal[Process0[A]] =
    Equal.equal(_.toList == _.toList)
}


text:
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD) #define what pin 1-40 sequence is like
GPIO.setup(7,GPIO.OUT)
for x in range(0,3):
    GPIO.output(7,True)
    time.sleep(1)
    GPIO.output(7,False)
    time.sleep(1)
GPIO.cleanup()


text:
    {{ .Site.Params.firstName }} {{ .Site.Params.lastName }}

  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

  </button>

        About

      {{ if .Site.Params.showSkills }}

            Skills

      {{ end }}
      {{ if .Site.Params.showProjects }}

            Projects

      {{ end }}
      {{ if .Site.Params.showOpenSource }}

            Open Source

      {{ end }}
      {{ if .Site.Params.showPublications }}

            {{ default "Publications" .Site.Params.publicationsAlternateName }}

      {{ end }}
      {{ if .Site.Params.showExperience }}

            Experience

      {{ end }}
      {{ if .Site.Params.showEducation }}

            Education

      {{ end }}
      {{ if .Site.Params.showBlog }}

            Blog

      {{ end }}


text:
module EventMachine
  # = EventMachine::ThreadedResource
  #
  # A threaded resource is a "quick and dirty" wrapper around the concept of
  # wiring up synchronous code into a standard EM::Pool. This is useful to keep
  # interfaces coherent and provide a simple approach at "making an interface
  # async-ish".
  #
  # General usage is to wrap libraries that do not support EventMachine, or to
  # have a specific number of dedicated high-cpu worker resources.
  #
  # == Basic Usage example
  #
  # This example requires the cassandra gem. The cassandra gem contains an
  # EventMachine interface, but it's sadly Fiber based and thus only works on
  # 1.9. It also requires (potentially) complex stack switching logic to reach
  # completion of nested operations. By contrast this approach provides a block
  # in which normal synchronous code can occur, but makes no attempt to wire the
  # IO into EventMachines C++ IO implementations, instead relying on the reactor
  # pattern in rb_thread_select.
  #
  #    cassandra_dispatcher = ThreadedResource.new do
  #      Cassandra.new('allthethings', '127.0.0.1:9160')
  #    end
  #
  #    pool = EM::Pool.new
  #
  #    pool.add cassandra_dispatcher
  #
  #    # If we don't care about the result:
  #    pool.perform do |dispatcher|
  #      # The following block executes inside a dedicated thread, and should not
  #      # access EventMachine things:
  #      dispatcher.dispatch do |cassandra|
  #        cassandra.insert(:Things, '10', 'stuff' => 'things')
  #      end
  #    end
  #
  #    # Example where we care about the result:
  #    pool.perform do |dispatcher|
  #      # The dispatch block is executed in the resources thread.
  #      completion = dispatcher.dispatch do |cassandra|
  #        cassandra.get(:Things, '10', 'stuff')
  #      end
  #
  #      # This block will be yielded on the EM thread:
  #      completion.callback do |result|
  #        EM.do_something_with(result)
  #      end
  #
  #      completion
  #    end
  class ThreadedResource

    # The block should return the resource that will be yielded in a dispatch.
    def initialize
      @resource = yield

      @running = true
      @queue   = ::Queue.new
      @thread  = Thread.new do
        @queue.pop.call while @running
      end
    end

    # Called on the EM thread, generally in a perform block to return a
    # completion for the work.
    def dispatch
      completion = EM::Completion.new
      @queue << lambda do
        begin
          result = yield @resource
          completion.succeed result
        rescue Exception => e
          completion.fail e
        end
      end
      completion
    end

    # Kill the internal thread. should only be used to cleanup - generally
    # only required for tests.
    def shutdown
      @running = false
      @queue << lambda {}
      @thread.join
    end

  end
end


text:
package rok3.projekt.zespver3.network.packet;

public class RoomChat__ {
	public byte[] content;
}


text:
.class interface abstract Landroid/support/v4/view/accessibility/AccessibilityRecordCompat$AccessibilityRecordImpl;
.super Ljava/lang/Object;
.source "AccessibilityRecordCompat.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/support/v4/view/accessibility/AccessibilityRecordCompat;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x608
    name = "AccessibilityRecordImpl"
.end annotation

# virtual methods
.method public abstract getAddedCount(Ljava/lang/Object;)I
.end method

.method public abstract getBeforeText(Ljava/lang/Object;)Ljava/lang/CharSequence;
.end method

.method public abstract getClassName(Ljava/lang/Object;)Ljava/lang/CharSequence;
.end method

.method public abstract getContentDescription(Ljava/lang/Object;)Ljava/lang/CharSequence;
.end method

.method public abstract getCurrentItemIndex(Ljava/lang/Object;)I
.end method

.method public abstract getFromIndex(Ljava/lang/Object;)I
.end method

.method public abstract getItemCount(Ljava/lang/Object;)I
.end method

.method public abstract getMaxScrollX(Ljava/lang/Object;)I
.end method

.method public abstract getMaxScrollY(Ljava/lang/Object;)I
.end method

.method public abstract getParcelableData(Ljava/lang/Object;)Landroid/os/Parcelable;
.end method

.method public abstract getRemovedCount(Ljava/lang/Object;)I
.end method

.method public abstract getScrollX(Ljava/lang/Object;)I
.end method

.method public abstract getScrollY(Ljava/lang/Object;)I
.end method

.method public abstract getSource(Ljava/lang/Object;)Landroid/support/v4/view/accessibility/AccessibilityNodeInfoCompat;
.end method

.method public abstract getText(Ljava/lang/Object;)Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/Object;",
            ")",
            "Ljava/util/List",
            "<",
            "Ljava/lang/CharSequence;",
            ">;"
        }
    .end annotation
.end method

.method public abstract getToIndex(Ljava/lang/Object;)I
.end method

.method public abstract getWindowId(Ljava/lang/Object;)I
.end method

.method public abstract isChecked(Ljava/lang/Object;)Z
.end method

.method public abstract isEnabled(Ljava/lang/Object;)Z
.end method

.method public abstract isFullScreen(Ljava/lang/Object;)Z
.end method

.method public abstract isPassword(Ljava/lang/Object;)Z
.end method

.method public abstract isScrollable(Ljava/lang/Object;)Z
.end method

.method public abstract obtain()Ljava/lang/Object;
.end method

.method public abstract obtain(Ljava/lang/Object;)Ljava/lang/Object;
.end method

.method public abstract recycle(Ljava/lang/Object;)V
.end method

.method public abstract setAddedCount(Ljava/lang/Object;I)V
.end method

.method public abstract setBeforeText(Ljava/lang/Object;Ljava/lang/CharSequence;)V
.end method

.method public abstract setChecked(Ljava/lang/Object;Z)V
.end method

.method public abstract setClassName(Ljava/lang/Object;Ljava/lang/CharSequence;)V
.end method

.method public abstract setContentDescription(Ljava/lang/Object;Ljava/lang/CharSequence;)V
.end method

.method public abstract setCurrentItemIndex(Ljava/lang/Object;I)V
.end method

.method public abstract setEnabled(Ljava/lang/Object;Z)V
.end method

.method public abstract setFromIndex(Ljava/lang/Object;I)V
.end method

.method public abstract setFullScreen(Ljava/lang/Object;Z)V
.end method

.method public abstract setItemCount(Ljava/lang/Object;I)V
.end method

.method public abstract setMaxScrollX(Ljava/lang/Object;I)V
.end method

.method public abstract setMaxScrollY(Ljava/lang/Object;I)V
.end method

.method public abstract setParcelableData(Ljava/lang/Object;Landroid/os/Parcelable;)V
.end method

.method public abstract setPassword(Ljava/lang/Object;Z)V
.end method

.method public abstract setRemovedCount(Ljava/lang/Object;I)V
.end method

.method public abstract setScrollX(Ljava/lang/Object;I)V
.end method

.method public abstract setScrollY(Ljava/lang/Object;I)V
.end method

.method public abstract setScrollable(Ljava/lang/Object;Z)V
.end method

.method public abstract setSource(Ljava/lang/Object;Landroid/view/View;)V
.end method

.method public abstract setSource(Ljava/lang/Object;Landroid/view/View;I)V
.end method

.method public abstract setToIndex(Ljava/lang/Object;I)V
.end method


text:
<?php
namespace Simonetti\Boleto;

use Simonetti\Boleto\Carne\Parcela;

/**
 * Class Carne
 * @package Simonetti\Boleto
 */
class Carne
{

    /**
     * @var Banco
     */
    private $banco;

    /**
     * @var Cedente
     */
    private $cedente;

    /**
     * @var Sacado
     */
    private $sacado;

    /**
     * @var Avalista
     */
    private $avalista;

    /**
     * @var string
     */
    private $numeroMoeda;

    /**
     * @var \DateTime
     */
    private $dataDocumento;

    /**
     * @var \DateTime
     */
    private $dataProcessamento;

    /**
     * @var array
     */
    private $parcelas = [];

    /**
     * @var array
     */
    private $instrucoes = [];

    /**
     * @var array
     */
    private $demonstrativos = [];

    /**
     * Carne constructor.
     * @param Banco $banco
     * @param Cedente $cedente
     * @param Sacado $sacado
     * @param Avalista $avalista
     */
    public function __construct(Banco $banco, Cedente $cedente, Sacado $sacado, Avalista $avalista = null)
    {
        $this->banco = $banco;
        $this->cedente = $cedente;
        $this->sacado = $sacado;
        $this->avalista = $avalista;
    }

    /**
     * @param Banco $banco
     */
    public function setBanco($banco)
    {
        $this->banco = $banco;
    }

    /**
     * @param Cedente $cedente
     */
    public function setCedente($cedente)
    {
        $this->cedente = $cedente;
    }

    /**
     * @param Sacado $sacado
     */
    public function setSacado($sacado)
    {
        $this->sacado = $sacado;
    }

    /**
     * @param Avalista $avalista
     */
    public function setAvalista($avalista)
    {
        $this->avalista = $avalista;
    }

    /**
     * @param string $numeroMoeda
     */
    public function setNumeroMoeda($numeroMoeda)
    {
        $this->numeroMoeda = $numeroMoeda;
    }

    /**
     * @param \DateTime $dataDocumento
     */
    public function setDataDocumento($dataDocumento)
    {
        $this->dataDocumento = $dataDocumento;
    }

    /**
     * @param \DateTime $dataProcessamento
     */
    public function setDataProcessamento($dataProcessamento)
    {
        $this->dataProcessamento = $dataProcessamento;
    }

    public function addParcela(Parcela $parcela)
    {
        $this->parcelas[] = $parcela;
    }

    /**
     * @return Banco
     */
    public function getBanco()
    {
        return $this->banco;
    }

    /**
     * @return Cedente
     */
    public function getCedente()
    {
        return $this->cedente;
    }

    /**
     * @return Sacado
     */
    public function getSacado()
    {
        return $this->sacado;
    }

    /**
     * @return Avalista
     */
    public function getAvalista()
    {
        return $this->avalista;
    }

    /**
     * @return array
     */
    public function getParcelas()
    {
        return $this->parcelas;
    }

    /**
     * @return string
     */
    public function getNumeroMoeda()
    {
        return $this->numeroMoeda;
    }

    /**
     * @return \DateTime
     */
    public function getDataDocumento()
    {
        return $this->dataDocumento;
    }

    /**
     * @return \DateTime
     */
    public function getDataProcessamento()
    {
        return $this->dataProcessamento;
    }

    /**
     * @return array
     */
    public function getInstrucoes()
    {
        return $this->instrucoes;
    }

    /**
     * @return array
     */
    public function getDemonstrativos()
    {
        return $this->demonstrativos;
    }

    public function addDemonstrativo($demostrativo)
    {
        $this->demonstrativos[] = $demostrativo;
    }

    public function addInstrucao($instrucao)
    {
        $this->instrucoes[] = $instrucao;
    }

    /**
     * @return array
     */
    public function getBoletos()
    {

        $boletos = [];

        /**
         * @var $parcela Parcela
         */
        foreach($this->parcelas as $parcela) {
            $boleto = new Boleto();
            $boleto->setBanco($this->getBanco());
            $boleto->setCedente($this->getCedente());
            $boleto->setSacado($this->getSacado());
            $boleto->setAvalista($this->getAvalista());
            $boleto->setNumeroDocumento($parcela->getNumeroDocumento());
            $boleto->setNossoNumero($parcela->getNossoNumero());
            $boleto->setDataVencimento($parcela->getDataVencimento() );
            $boleto->setDataDocumento($this->dataDocumento);
            $boleto->setDataProcessamento($this->dataProcessamento);
            $boleto->setNumeroMoeda($this->numeroMoeda);
            $boleto->setValorBoleto($parcela->getValorBoleto());

            $boleto->setDemonstrativos($this->demonstrativos);
            $boleto->setInstrucoes($parcela->getInstrucoes());

            $boletos[] = $boleto;
        }

        return $boletos;
    }
}


text:
package org.example.game.pathfinding;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import static org.hamcrest.Matchers.*;
import static org.hamcrest.MatcherAssert.assertThat;

import java.util.List;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import com.badlogic.gdx.math.Rectangle;

public class PathfinderTest {
	PathGraph graph;
	boolean[][] map;
	Pathfinder pathfinder;

	MapNode source, target;

	static final boolean[][] mediumMap = createMap(7, 6);
	static final Rectangle[] mediumMapObstacles = new Rectangle[]{
		new Rectangle(1, 4, 1, 1)
		  , new Rectangle(3, 1, 1, 4)
	};

	static final boolean[][] largeMap = createMap(26, 20);
	static final Rectangle[] largeMapObstacles = new Rectangle[]{
		new Rectangle(7, 5, 1, 13)
		  , new Rectangle(8, 17, 7, 1)
		  , new Rectangle(14, 14, 1, 3)
		  , new Rectangle(12, 13, 11, 1)
		  , new Rectangle(12, 4, 1, 9)
		  , new Rectangle(13, 4, 7, 1)
		  , new Rectangle(13, 0, 1, 4)
		  , new Rectangle(19, 5, 1, 7)
		  , new Rectangle(20, 6, 5, 1)
	};

	@BeforeClass
	public static void setupClass(){
		addObstacles(mediumMap, mediumMapObstacles);
		System.out.println("Medium map:");
		printMap(mediumMap);

		addObstacles(largeMap, largeMapObstacles);
		System.out.println("Large map:");
		printMap(largeMap);
	}

	@Before
	public void setup(){
		graph = new PathGraph();
		fillGraph(graph, mediumMap);

		pathfinder = new Pathfinder();

		source = new MapNode(1, 3);
		target = new MapNode(5, 4);
	}

	@Test
	public void findPath_sourceEqualsTarget(){
		List<MapNode> path = findPath(source, source);

		assertEquals(1, path.size());
		assertEquals(source, path.get(0));
	}

	@Test
	public void findPath_toUnexistentTarget_shouldReturnEmptyPath(){
		List<MapNode> path = findPath(source, new MapNode(100, 100));

		assertTrue(path.isEmpty());
	}

	@Test
	public void findPath_toAdjacentTest(){
		MapNode adjacent = new MapNode(source.getX() + 1, source.getY());

		List<MapNode> path = findPath(source, adjacent);

		assertEquals(2, path.size());
		assertEquals(path.get(0), source);
		assertEquals(path.get(1), adjacent);
	}

	@Test
	public void findPath_shouldContourObstacles(){
		List<MapNode> path = findPath(source, target);

		printPathInMap(mediumMap, path);

		assertThat(path, hasItems(source, target));
	}
	@Test
	public void findPath_inLargeMap(){
		MapNode s = new MapNode(3, 10);
		MapNode t = new MapNode(14, 3);

		graph = new PathGraph();
		fillGraph(graph, largeMap);

		List<MapNode> path = pathfinder.findPath(graph, s, t);

		printPathInMap(largeMap, path);

		assertThat(path.size(), is(greaterThan(2)));
		assertEquals(path.get(0), s);
		assertEquals(path.get(path.size() - 1), t);
	}

	private List<MapNode> findPath(MapNode source, MapNode target) {
		List<MapNode> path = pathfinder.findPath(graph
				, source
				, target);
		return path;
	}

	private static void addObstacles(boolean[][] map, Rectangle[] obstacles) {
		for(Rectangle obstacle : obstacles){
			int x = (int)obstacle.x, y = (int)obstacle.y;
			int width = (int)obstacle.width, height = (int)obstacle.height;

			for(int row=y; row < y + height; ++row){
				for(int col= x; col < x + width; ++col){
					try {
						map[row][col] = false;
					} catch (RuntimeException e) {
						System.out.println("Exception at row: " + row + ", col: " + col + " "
								+ "of " + map.length + ", " + map[0].length + ") "
								+ "in obstacle[" + x + ", " + y + ", " + width + ", " + height + "]");
						throw e;
					}
				}
			}
		}
	}

	public static boolean[][] createMap(int width, int height) {
		boolean[][] map = new boolean[height][width];

		for(int i=0; i < height; ++i){
			for (int j = 0; j < width; j++) {
				map[i][j] = true;
			}
		}

		return map;
	}

	public static void printMap(boolean[][] map) {
		printPathInMap(map, null);
	}
	public static void printPathInMap(boolean[][] map, List<MapNode> path) {
		for(int i=0; i < map.length; ++i){
			System.out.print(String.format("%2d : ", i));
			for (int j = 0; j < map[i].length; j++) {
				if(map[i][j]){
					if(path == null || ! path.contains(new MapNode(j, i))){
						System.out.print("[ ] ");
					}
					else{
						System.out.print("[*] ");
					}
				}
				else{
					System.out.print("[X] ");
				}
			}
			System.out.println();
		}
		System.out.println();
	}

	private void fillGraph(PathGraph graph, boolean[][] map) {
		int rows = map.length;
		for (int y = 0; y < rows; y++) {
			int cols = map[y].length;
			for(int x=0; x < cols; ++x){
				addNode(graph, map, x, y, rows, cols);
			}
		}
	}

	private void addNode(PathGraph graph, boolean[][] map, int x, int y, int rows, int cols) {
		MapNode node = new MapNode(x, y);
		graph.addNode(node);

		if(!map[(int)node.getY()][(int)node.getX()]){
			return;
		}

		for(MapNode neighbour : getNeighbours(x, y)){
			int nx = (int)neighbour.getX();
			int ny = (int)neighbour.getY();
			if(! between(nx, 0, cols) || !between(ny, 0, rows)){
				continue;
			}
			if(map[ny][nx]){
				graph.addNode(neighbour);
				graph.addAdjacent(node, neighbour);
			}
		}
	}

	private boolean between(int value, int lessBound, int greaterBound) {
		return value >= lessBound && value < greaterBound;
	}

	private MapNode[] getNeighbours(int x, int y) {
		return new MapNode[]{
				new MapNode(x - 1, y), new MapNode(x + 1, y)
				, new MapNode(x, y - 1), new MapNode(x, y + 1)};
	}
}


text:
require File.expand_path('../../../../spec_helper', __FILE__)
require File.expand_path('../../fixtures/classes', __FILE__)

describe "UNIXSocket#recv_io" do

  platform_is_not :windows do
    before :each do
      @path = SocketSpecs.socket_path
      File.unlink(@path) if File.exists?(@path)

      @server = UNIXServer.open(@path)
      @client = UNIXSocket.open(@path)
    end

    after :each do
      @client.close
      @server.close
      File.unlink(@path) if File.exists?(@path)
    end

    it "reads an IO object across the socket" do
      path = File.expand_path('../../fixtures/send_io.txt', __FILE__)
      f = File.open(path)

      @client.send_io(f)
      io = @server.accept.recv_io

      io.read.should == File.read(path)
    end

    it "takes an optional class to use" do
      path = File.expand_path('../../fixtures/send_io.txt', __FILE__)
      f = File.open(path)

      @client.send_io(f)
      io = @server.accept.recv_io(File)

      io.should be_kind_of(File)
    end

    it "takes an optional mode to use" do
      path = File.expand_path('../../fixtures/send_io.txt', __FILE__)
      f = File.open(path)

      @client.send_io(f)
      io = @server.accept.recv_io(File, "r")

      io.mode.should == IO::RDONLY
    end
  end
end


text:
module Concerns
  module HasNonPersistantSynchronizationWithSiModel
    extend ActiveSupport::Concern

    included do
      attr_accessor :si_attributes

      SYNCHRONISABLE_CLASSES = ['Web::Trip', 'Web::Commute', 'Web::DbCommute']
      JOIN_TABLE_FIELDS      = [:location, :destination]

      def rpc_client
        @rpc_client ||= WebEngine::RpcClient.new
      end

      def get_from_si
        raise "Class #{self.class.name} is not supported for synchronization" unless SYNCHRONISABLE_CLASSES.include?(self.class.name)

        validate_si_mandatory_fields
        WebEngine::SiClient.initialize_connection

        # rpc_client = WebEngine::RpcClient.new
        si_entity  = self.class.name.split('::').last.downcase

        processed_attributes = {}

        self.class::SI_MANDATORY_FIELDS.each do |mandatory_field|
          processed_attributes[field_name_or_field_id(mandatory_field)] = field_id_or_field_value(mandatory_field)
        end

        result = rpc_client.send("get_#{si_entity}", processed_attributes)

        if result && result.response_object
          self.si_attributes = result.response_object
          map_si_attributes_to_model_fields
        end
      end

      def validate_si_mandatory_fields
        missing_fields = []
        self.class::SI_MANDATORY_FIELDS.each do |mandatory_field|
          missing_fields << mandatory_field unless self.send(mandatory_field)
        end

        raise "Missing fiel(s): #{missing_fields.map(&:to_s).join(', ')} to get data from SI." if missing_fields.any?
      end

      def map_si_attributes_to_model_fields
        self.class::SI_FIELDS_MAPPING.each do |origin_field, destination_field|
          self.send("#{destination_field.to_s}=", self.si_attributes[origin_field.to_s])
        end
      end

      def field_name_or_field_id(field_name)
        JOIN_TABLE_FIELDS.include?(field_name) ? "#{field_name}_id".to_sym : field_name.to_sym
      end

      def field_id_or_field_value(field_name)
        JOIN_TABLE_FIELDS.include?(field_name) ? self.send(field_name).id : self.send(field_name)
      end

      # def save_to_si
      # end
    end
  end
end


text:
CSRF_SECRET_KEY = 'my Key'
SESSION_KEY = 'my session Key'