text:
namespace AppRepairsProductTableMaintenance
{
    partial class frmProducts
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

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

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.btnDelete = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.txtReleaseDate = new System.Windows.Forms.TextBox();
            this.txtYearsWarranty = new System.Windows.Forms.TextBox();
            this.label4 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.txtName = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.btnClose = new System.Windows.Forms.Button();
            this.btnEdit = new System.Windows.Forms.Button();
            this.btnAdd = new System.Windows.Forms.Button();
            this.btnGetProduct = new System.Windows.Forms.Button();
            this.cboProductCodes = new System.Windows.Forms.ComboBox();
            this.SuspendLayout();
            //
            // btnDelete
            //
            this.btnDelete.Location = new System.Drawing.Point(222, 177);
            this.btnDelete.Name = "btnDelete";
            this.btnDelete.Size = new System.Drawing.Size(94, 25);
            this.btnDelete.TabIndex = 4;
            this.btnDelete.Text = "&Delete";
            this.btnDelete.UseVisualStyleBackColor = true;
            this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.Location = new System.Drawing.Point(26, 36);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(104, 18);
            this.label1.TabIndex = 52;
            this.label1.Text = "Product Code:";
            //
            // txtReleaseDate
            //
            this.txtReleaseDate.Location = new System.Drawing.Point(170, 132);
            this.txtReleaseDate.Name = "txtReleaseDate";
            this.txtReleaseDate.ReadOnly = true;
            this.txtReleaseDate.Size = new System.Drawing.Size(281, 20);
            this.txtReleaseDate.TabIndex = 51;
            this.txtReleaseDate.Tag = "Release Date";
            //
            // txtYearsWarranty
            //
            this.txtYearsWarranty.Location = new System.Drawing.Point(170, 101);
            this.txtYearsWarranty.Name = "txtYearsWarranty";
            this.txtYearsWarranty.ReadOnly = true;
            this.txtYearsWarranty.Size = new System.Drawing.Size(281, 20);
            this.txtYearsWarranty.TabIndex = 50;
            this.txtYearsWarranty.Tag = "Years of Warranty";
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label4.Location = new System.Drawing.Point(26, 134);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(101, 18);
            this.label4.TabIndex = 49;
            this.label4.Text = "Release Date:";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label3.Location = new System.Drawing.Point(26, 103);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(131, 18);
            this.label3.TabIndex = 48;
            this.label3.Text = "Years of Warranty:";
            //
            // txtName
            //
            this.txtName.Location = new System.Drawing.Point(170, 69);
            this.txtName.Name = "txtName";
            this.txtName.ReadOnly = true;
            this.txtName.Size = new System.Drawing.Size(281, 20);
            this.txtName.TabIndex = 47;
            this.txtName.Tag = "Product Name";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.Location = new System.Drawing.Point(26, 71);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(52, 18);
            this.label2.TabIndex = 46;
            this.label2.Text = "Name:";
            //
            // btnClose
            //
            this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnClose.Location = new System.Drawing.Point(357, 177);
            this.btnClose.Name = "btnClose";
            this.btnClose.Size = new System.Drawing.Size(94, 25);
            this.btnClose.TabIndex = 5;
            this.btnClose.Text = "&Close";
            this.btnClose.UseVisualStyleBackColor = true;
            this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
            //
            // btnEdit
            //
            this.btnEdit.Location = new System.Drawing.Point(122, 177);
            this.btnEdit.Name = "btnEdit";
            this.btnEdit.Size = new System.Drawing.Size(94, 25);
            this.btnEdit.TabIndex = 3;
            this.btnEdit.Text = "&Edit...";
            this.btnEdit.UseVisualStyleBackColor = true;
            this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click);
            //
            // btnAdd
            //
            this.btnAdd.Location = new System.Drawing.Point(22, 177);
            this.btnAdd.Name = "btnAdd";
            this.btnAdd.Size = new System.Drawing.Size(94, 25);
            this.btnAdd.TabIndex = 2;
            this.btnAdd.Text = "&Add New...";
            this.btnAdd.UseVisualStyleBackColor = true;
            this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
            //
            // btnGetProduct
            //
            this.btnGetProduct.Location = new System.Drawing.Point(357, 30);
            this.btnGetProduct.Name = "btnGetProduct";
            this.btnGetProduct.Size = new System.Drawing.Size(94, 25);
            this.btnGetProduct.TabIndex = 1;
            this.btnGetProduct.Text = "&Find Product";
            this.btnGetProduct.UseVisualStyleBackColor = true;
            this.btnGetProduct.Click += new System.EventHandler(this.btnGetProduct_Click);
            //
            // cboProductCodes
            //
            this.cboProductCodes.FormattingEnabled = true;
            this.cboProductCodes.Location = new System.Drawing.Point(170, 33);
            this.cboProductCodes.Name = "cboProductCodes";
            this.cboProductCodes.Size = new System.Drawing.Size(170, 21);
            this.cboProductCodes.TabIndex = 0;
            this.cboProductCodes.Tag = "Product Code";
            //
            // frmProducts
            //
            this.AcceptButton = this.btnGetProduct;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.btnClose;
            this.ClientSize = new System.Drawing.Size(480, 226);
            this.Controls.Add(this.btnDelete);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.txtReleaseDate);
            this.Controls.Add(this.txtYearsWarranty);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.txtName);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.btnClose);
            this.Controls.Add(this.btnEdit);
            this.Controls.Add(this.btnAdd);
            this.Controls.Add(this.btnGetProduct);
            this.Controls.Add(this.cboProductCodes);
            this.Name = "frmProducts";
            this.Text = "Products";
            this.Load += new System.EventHandler(this.frmProducts_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button btnDelete;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox txtReleaseDate;
        private System.Windows.Forms.TextBox txtYearsWarranty;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.TextBox txtName;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Button btnClose;
        private System.Windows.Forms.Button btnEdit;
        private System.Windows.Forms.Button btnAdd;
        private System.Windows.Forms.Button btnGetProduct;
        private System.Windows.Forms.ComboBox cboProductCodes;
    }
}


text:
package core.framework.internal.web.response;

import core.framework.web.CookieSpec;
import io.undertow.server.handlers.CookieImpl;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

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

/**
 * @author neo
 */
class ResponseHandlerTest {
    private ResponseHandler responseHandler;

    @BeforeEach
    void createResponseHandler() {
        responseHandler = new ResponseHandler(null, null, null);
    }

    @Test
    void cookie() {
        CookieImpl cookie = responseHandler.cookie(new CookieSpec("test").secure().sameSite(), "1=2");
        assertThat(cookie.getName()).isEqualTo("test");
        assertThat(cookie.getValue()).isEqualTo("1%3D2");
        assertThat(cookie.getSameSiteMode()).isEqualTo("Lax");
    }

    @Test
    void cookieKey() {
        assertThat(responseHandler.cookieKey(new CookieSpec("test")))
                .isNotEqualTo(responseHandler.cookieKey(new CookieSpec("test").domain("example.com")))
                .isNotEqualTo(responseHandler.cookieKey(new CookieSpec("test").path("/")));
    }
}

redpajama_set_name: RedPajamaGithub


text:
module Minecraft
  module JSONAPI
    class Response
      attr_reader :result, :source, :response

      def initialize(data)
        data = JSON.parse data

        # Was this a multi-call?
        if data['source'].is_a? Array
          @result =   data['success'].map { |r| r['result'] }
          @source =   data['success'].map { |r| r['source'] }
          @response = data['success'].map { |r| r['success'] }
        else
          @result =   data['result']
          @source =   data['source']
          @response = data['success']
        end
      end
    end
  end
end


text:
var fs = require('fs'),
    path = require('path'),
    spawn = require('child_process').spawn,
    os = require('os'),
    win32 = os.platform() === 'win32',
    child_cwd = path.join(__dirname, '..'),
    str_port = fs.readFileSync(path.join(child_cwd, 'PORT.txt'), 'utf8').trim(),
    argv = process.argv.slice(2),
    arg0 = argv.length > 0 && argv[0],
    arg1 = argv.length > 1 && argv[1],
    bookmarkletOnly = arg0 && arg0 === 'b',
    provided_bin = !bookmarkletOnly && !arg1 ? arg0 : arg1,
    chromium_bin = provided_bin,
    start_str = 'jni rpc: ',
    pdb_started = false,
    hide_backup = false,
    win_bins = [
        'C:\\opt\\chromium\\chrome.exe',
        'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
        'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe'
    ],
    linux_bins = [
        '/opt/chromium/chrome',
        '/usr/bin/chromium-browser',
        '/usr/bin/chromium',
        '/usr/bin/google-chrome'
    ],
    lookup_bins = win32 ? win_bins : linux_bins,
    pdb

function println(str) {
    process.stdout.write(str + '\n')
}

function getChildArgs(initial_args, extra_args, child_cwd) {
    return initial_args.concat(extra_args, [
        '-Djava.class.path=' + path.join(child_cwd, 'bookmarks-all/target/bookmarks-all-jarjar.jar'),
        'bookmarks.all.Main',
        child_cwd
    ])
}

function isDir(dir) {
    return fs.statSync(dir).isDirectory()
}

function findSubDir(baseDir, subDirPrefix) {
    var dirs = fs.readdirSync(baseDir), dir, f
    for (var i = 0, len = dirs.length; i < len; i++) {
        if (isDir(dir=path.join(baseDir, f=dirs[i])) && 0 === f.indexOf(subDirPrefix))
            return dir
    }
    return null
}

function startProtostuffdb() {
    var bin = path.join(child_cwd, 'target/protostuffdb'),
        raw_args = fs.readFileSync(path.join(child_cwd, 'ARGS.txt'), 'utf8').trim(),
        extra_args = raw_args.split(' '),
        child_args = getChildArgs(['127.0.0.1:' + str_port, path.join(__dirname, 'g/user/UserServices.json')], extra_args, child_cwd),
        target_cwd,
        p

    hide_backup = raw_args.indexOf('-Dprotostuffdb.with_backup=true') === -1
    if (!win32) {
        target_cwd = child_cwd
    } else if (isDir(target_cwd = 'C:/Program Files/Java/jdk1.7.0_79/jre/bin/server')) {
        bin += '.exe'
    } else if (fs.existsSync(p = path.join(child_cwd, 'JDK_DIR.txt'))) {
        if (!isDir(target_cwd = path.join(fs.readFileSync(p, 'utf8').trim(), 'jre/bin/server'))) {
            println('JDK_DIR.txt did not contain a valid jdk path.')
            process.exit(1)
            return
        }
        bin += '.exe'
    } else if (!isDir('C:/Program Files/Java') ||
            !(p = findSubDir('C:/Program Files/Java', 'jdk1.7')) ||
            !isDir(target_cwd = path.join(p, 'jre/bin/server'))) {
        println('Please create JDK_DIR.txt in the root dir of the project that contains the full path to your jdk.')
        println('E.g.\nC:/path/to/jdk1.7.0_79')
        process.exit(1)
        return
    } else {
        bin += '.exe'
    }

    pdb = spawn(bin, child_args, { cwd: target_cwd })
    pdb.stdout.on('data', onChildOut)
    pdb.on('close', onChildClose)
}

function isStart(data) {
    return data.length > start_str.length && start_str === String(data.slice(0, start_str.length))
}

function onChildOut(data) {
    if (pdb_started || !isStart(data))
        return
    pdb_started = true
    openWindow()
}

function onChildClose(code) {
    if (code)
        println('child process exited with code ' + code)

    process.exit(0)
    pdb = undefined
}

function onChromiumExit() {
    if (pdb)
        pdb.kill()

    process.exit(0)
}

function resolveBin(p, c) {
    return p ? p : (fs.existsSync(c) && c)
}

function openWindow() {
    global.rpc_host = 'http://127.0.0.1:' + str_port
    global.hide_backup = hide_backup
    global.www_dir = __dirname
    if (bookmarkletOnly)
        global.www_redirect = '/bookmarklet/'

    require('./dist/bookmarklet-nw')

    var args = ['--app=http://127.0.0.1:' + (parseInt(str_port, 10) + 1), '--disk-cache-size 0', '--no-proxy-server'],
        home

    if (!provided_bin && (home = process.env.HOME))
        args.push('--user-data-dir=' + path.join(home, bookmarkletOnly ? '.bookmarklet' : '.bookmarks'))

    spawn(chromium_bin, args)
        .on('exit', onChromiumExit)
        .stderr.pipe(process.stderr)
}

// check if provided and exists
if ((chromium_bin && !fs.existsSync(chromium_bin)) ||
        // check if resolved
        (!chromium_bin && !(chromium_bin = lookup_bins.reduce(resolveBin, null)))) {
    println('chrome/chromium executable not found.')
    return
}

startProtostuffdb()


text:
package at.irian.ankor.annotation;

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

/**
 * @author Thomas Spiegl
 */
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ChangeListener {
    /**
     * One or more patterns
     */
    String[] pattern();

}


text:
<?php

namespace Flowcode\DemoBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Flowcode\PageBundle\Entity\Page;

/**
 * Description of LoadUserData
 *
 * @author Juan Manuel Agüero <jaguero@flowcode.com.ar>
 */
class LoadPageData extends AbstractFixture implements OrderedFixtureInterface {

    public function load(ObjectManager $manager) {

        /* Create Homepage */
        $homepage = new Page();
        $homepage->setName("Homepage");
        $homepage->setDescription("Default Homepage.");
        $homepage->setTemplate("default");
        $homepage->setEnabled(true);
        $manager->persist($homepage);
        $this->addReference("page_homepage", $homepage);

        /* Create Products */
        $page_products = new Page();
        $page_products->setName("Products");
        $page_products->setDescription("Default products page.");
        $page_products->setTemplate("default");
        $page_products->setEnabled(true);

        $manager->persist($page_products);
        $this->addReference("page_products", $page_products);

        $manager->flush();
    }

    public function getOrder() {
        return 3;
    }

}


text:
import argparse
import hashlib
import json
import os

giantsteps_tempo_INDEX_PATH = '../mirdata/indexes/giantsteps_tempo_index.json'
BEATLES_ANNOTATION_SCHEMA = ['JAMS']

def md5(file_path):
    """Get md5 hash of a file.
    Parameters
    ----------
    file_path: str
        File path.
    Returns
    -------
    md5_hash: str
        md5 hash of data in file_path
    """
    hash_md5 = hashlib.md5()
    with open(file_path, 'rb') as fhandle:
        for chunk in iter(lambda: fhandle.read(4096), b''):
            hash_md5.update(chunk)
    return hash_md5.hexdigest()

def make_giantsteps_tempo_index(data_path):
    dir_github = 'giantsteps-tempo-dataset-0b7d47ba8cae59d3535a02e3db69e2cf6d0af5bb'
    meta1_dir = os.path.join(data_path, dir_github, 'annotations', 'jams')
    meta2_dir = os.path.join(data_path, dir_github, 'annotations_v2', 'jams')
    audio_dir = os.path.join(data_path, 'audio')
    giantsteps_tempo_index = {}
    print(sorted(os.listdir(meta1_dir)))
    for track_id, ann_dir in enumerate(sorted(os.listdir(meta1_dir))):
        ann_dir_full = os.path.join(meta1_dir, ann_dir)
        if '.jams' in ann_dir:
            codec = '.mp3'
            audio_path = os.path.join(audio_dir, ann_dir.replace('.jams', codec))
            ann1_path = os.path.join(meta1_dir, ann_dir)
            ann2_path = os.path.join(meta2_dir, ann_dir)
            giantsteps_tempo_index[track_id] = {
                'audio': (audio_path.replace(data_path + '/', ''), md5(audio_path)),
                'annotation_v1': (ann1_path.replace(data_path + '/', ''), md5(ann1_path)),
                'annotation_v2': (ann2_path.replace(data_path + '/', ''), md5(ann2_path)),
            }
    with open(giantsteps_tempo_INDEX_PATH, 'w') as fhandle:
        json.dump(giantsteps_tempo_index, fhandle, indent=2)

def main(args):
    make_giantsteps_tempo_index(args.giantsteps_tempo_data_path)

if __name__ == '__main__':
    PARSER = argparse.ArgumentParser(description='Make giantsteps_tempo index file.')
    PARSER.add_argument(
        'giantsteps_tempo_data_path', type=str, help='Path to giantsteps_tempo data folder.'
    )
    main(PARSER.parse_args())


text:
<?php

namespace Z\Exception;

/**
 * @author Alexander Kiryukhin <alexander@symdev.org>
 */
class UnknownVariableException extends \Exception
{
}


text:
package org.uorm.dao.dialect;

import org.uorm.dao.common.JdbcUtils;

/**
 * 如要实现快速Access分页,使用
 * select top 每页数量 * from 表 where id > (select max(id) from (select top (页数-1)*每页数量 id from 表 order by id) a) order by id
 * 类似这种SQL语句,直接使用普通查询,而不是用分页查询
 * @author 郭训长
 * @version 1.0.0
 * ===================================

 * 修订日期                 修订人            描述

 * 2013-8-29       郭训长            创建

 */
public class AccessDialect implements Dialect {

	/* (non-Javadoc)
	 * @see org.uorm.dao.dialect.Dialect#supportsOffset()
	 */
	@Override
	public boolean supportsOffset() {
		return false;
	}

	/* (non-Javadoc)
	 * @see org.uorm.dao.dialect.Dialect#getLimitString(java.lang.String, int, int)
	 */
	@Override
	public String getLimitString(String query, int offset, int limit) {
		if ( offset > 0 ) {
			throw new UnsupportedOperationException( "query result offset is not supported" );
		}
		return new StringBuffer( query.length() + 8 )
		.append( query )
		.insert( getAfterSelectInsertPoint( query ), " top " + limit )
		.toString();
	}

	static int getAfterSelectInsertPoint(String sql) {
		int selectIndex = sql.toLowerCase().indexOf( "select" );
		final int selectDistinctIndex = sql.toLowerCase().indexOf( "select distinct" );
		return selectIndex + ( selectDistinctIndex == selectIndex ? 15 : 6 );
	}

	/* (non-Javadoc)
	 * @see org.uorm.dao.dialect.Dialect#getSelectGUIDString()
	 */
	@Override
	public String getSelectGUIDString() {
		throw new UnsupportedOperationException( getClass().getName() + " does not support GUID with sql" );
	}

	/* (non-Javadoc)
	 * @see org.uorm.dao.dialect.Dialect#getSequenceNextValString(java.lang.String)
	 */
	@Override
	public String getSequenceNextValString(String tablename) {
		throw new UnsupportedOperationException( getClass().getName() + " does not support Sequence" );
	}

	/* (non-Javadoc)
	 * @see org.uorm.dao.dialect.Dialect#getCountSql(java.lang.String)
	 */
	@Override
	public String getCountSql(String query) {
		String rsel = JdbcUtils.removeSelect(query);
		if(rsel == null) {
			return "SELECT COUNT(0) FROM (" + query +") AS _TCOUNT";
		} else {
			return "SELECT COUNT(0) FROM (SELECT 0 " + rsel +") AS _TCOUNT";
		}
//		return "SELECT COUNT(0) FROM (SELECT 0 " + JdbcUtils.removeSelect(query) +")";
//		return "SELECT COUNT(0) FROM (" + query +")";
	}

}


text:
#include "common.h"

/**
 * A parent child talk session using a pipe. Feel free to expand on this program!
 * @author amit
 */

static void do_parent();
static void do_child();

int count = 0;
char *str1 = "hello child";
char *str2 = "hello parent";
char *responses[] = {"Please tell me more.",
                    "Are you sure?",
                    "Why do you think that?",
                    "Why do you feel like that?",
                    "I am not sure I understand. Please explain again.",
                    "I hope things will get better for you",
                    "Can't you be more positive?",
                    "Are such questions on your mind often?",
                    "Please don't repeat yourself!",
                    "Perhaps you don't want to.",
                    "Why not?",
                    "Do you dream often?",
                    "I see.",
                    "Tell me about your problems.",
                    "Tell me more.",
                    "What makes you think like that?",
                    "Do you often feel like this?",
                    "It is a pleasure to talk to you.",
                    "How are you?",
                    "I am fine.",
                    "Don't bother me."
					};
const int RESPONSE_LENGTH = 21;
const int TALK_LENGTH = 10;
int	pipe_parent[2], pipe_child[2];
char	line[MAXLINE];

int main(void)
{
	pid_t	pid;

	if (pipe(pipe_parent) < 0)
		err_sys("pipe error");
	if (pipe(pipe_child) < 0)
		err_sys("pipe error");

	if ((pid = fork()) < 0)
		err_sys("fork error");

	else if (pid > 0) {		/* parent */
		close(pipe_parent[0]); /* close read end of pipe */
		close(pipe_child[1]); /* close write end of pipe */
		do_parent();
	} else {				/* child */
		close(pipe_parent[1]); /* close write end of pipe */
		close(pipe_child[0]); /* close read end of pipe */
		do_child();
	}
	exit(EXIT_SUCCESS);
}

/**
 * The parent process for the chat session.
 */
static void do_parent()
{
	int index, i;
	srandom(getpid());
	while (TRUE) {
		sleep(1);
		if (count == 0) {
			write(pipe_parent[1], str1, strnlen(str1, MAXLINE));
		} else {
			index = random() % RESPONSE_LENGTH;
			write(pipe_parent[1], responses[index] , strnlen(responses[index], MAXLINE));
		}
		sleep(1);
		read(pipe_child[0], line, MAXLINE);
		printf("%schild[%d]: %s%s\n", blue, count, line, none);
		if (strcmp(line, "bye") == 0) {
			break;
		}
		count++;
		if (count == TALK_LENGTH) {
			printf("parent[%d]: My time is exhausted. Bye.\n", count);
			break;
		}
		for (i=0; i<MAXLINE; i++) line[i] = 0;
	}
}

/**
 * The child process for the chat session.
 */
static void do_child()
{
	int index, i;
	srandom(getpid());
	while (TRUE) {
		sleep(1);
		read(pipe_parent[0], line, MAXLINE);
		printf("%sparent[%d]: %s%s\n", red, count, line, none);
		sleep(1);
		if (strncmp(line, "bye", MAXLINE) == 0) {
			break;
		}
		count++;
		if (count == TALK_LENGTH) {
			printf("child[%d]: My friends are here. Bye.\n", count);
			write(pipe_child[1], "bye", 4);
			break;
		}
		for (i=0; i<MAXLINE; i++) line[i] = 0;
		if (count == 0) {
			write(pipe_parent[1], str2, strnlen(str2, MAXLINE));
		} else {
			index = random() % RESPONSE_LENGTH;
			write(pipe_child[1], responses[index], strnlen(responses[index], MAXLINE));
		}
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--drawable/btn_context_menu.xml-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/ic_traffic_car_ltgray_18dp" android:state_focused="false" android:state_pressed="false"  android:state_checked="false"/>
    <item android:drawable="@drawable/ic_traffic_car_pink_18dp" android:state_pressed="true" />
    <item android:drawable="@drawable/ic_traffic_car_pink_18dp" android:state_focused="true" />
    <item android:drawable="@drawable/ic_traffic_car_pink_18dp" android:state_checked="true" />
</selector>


text:
package org.innovateuk.ifs.finance.domain.builder;

import org.innovateuk.ifs.BaseBuilder;
import org.innovateuk.ifs.category.domain.ResearchCategory;
import org.innovateuk.ifs.competition.domain.Competition;
import org.innovateuk.ifs.competition.resource.FundingRules;
import org.innovateuk.ifs.finance.domain.GrantClaimMaximum;
import org.innovateuk.ifs.finance.resource.OrganisationSize;

import java.util.List;
import java.util.function.BiConsumer;

import static java.util.Collections.emptyList;
import static org.innovateuk.ifs.base.amend.BaseBuilderAmendFunctions.uniqueIds;

public class GrantClaimMaximumBuilder extends BaseBuilder<GrantClaimMaximum, GrantClaimMaximumBuilder> {

    private GrantClaimMaximumBuilder(List<BiConsumer<Integer, GrantClaimMaximum>> multiActions) {
        super(multiActions);
    }

    public static GrantClaimMaximumBuilder newGrantClaimMaximum() {
        return new GrantClaimMaximumBuilder(emptyList()).with(uniqueIds());
    }

    @Override
    protected GrantClaimMaximumBuilder createNewBuilderWithActions(List<BiConsumer<Integer, GrantClaimMaximum>>
                                                                           actions) {
        return new GrantClaimMaximumBuilder(actions);
    }

    @Override
    protected GrantClaimMaximum createInitial() {
        return new GrantClaimMaximum();
    }

    public GrantClaimMaximumBuilder withId(Long... ids) {
        return withArraySetFieldByReflection("id", ids);
    }

    public GrantClaimMaximumBuilder withCompetitions(List<Competition>... competitions) {
        return withArray((value, max) -> max.setCompetitions(value), competitions);
    }

    public GrantClaimMaximumBuilder withResearchCategory(ResearchCategory... researchCategory) {
        return withArray((value, max) -> max.setResearchCategory(value), researchCategory);
    }

    public GrantClaimMaximumBuilder withSize(OrganisationSize... size) {
        return withArray((value, max) -> max.setOrganisationSize(value), size);
    }

    public GrantClaimMaximumBuilder withMaximum(Integer... maximum) {
        return withArray((value, max) -> max.setMaximum(value), maximum);
    }

    public GrantClaimMaximumBuilder withFundingRules(FundingRules... rules) {
        return withArray((value, max) -> max.setFundingRules(value), rules);
    }

    public GrantClaimMaximumBuilder withFixedLevelFunding(boolean... fixedLevelFunding) {
        return withArray((value, max) -> max.setFixedFundingLevel(value), fixedLevelFunding);
    }
}


text:
<bill session="115" type="h" number="3210" updated="2017-10-05T04:34:04Z">
  <state datetime="2017-07-26T14:21:25-04:00">PASS_OVER:HOUSE</state>
  <status>
    <unknown datetime="2017-07-26T14:21:25-04:00"/>
  </status>
  <introduced datetime="2017-07-12"/>
  <titles>
    <title type="short" as="introduced">SECRET Act of 2017</title>
    <title type="short" as="introduced">SECRET Act of 2017</title>
    <title type="short" as="introduced">Securely Expediting Clearances Through Reporting Transparency Act of 2017</title>
    <title type="short" as="introduced">Securely Expediting Clearances Through Reporting Transparency Act of 2017</title>
    <title type="short" as="reported to house">SECRET Act of 2017</title>
    <title type="short" as="reported to house">SECRET Act of 2017</title>
    <title type="short" as="reported to house">Securely Expediting Clearances Through Reporting Transparency Act of 2017</title>
    <title type="short" as="reported to house">Securely Expediting Clearances Through Reporting Transparency Act of 2017</title>
    <title type="short" as="passed house">SECRET Act of 2017</title>
    <title type="short" as="passed house">SECRET Act of 2017</title>
    <title type="short" as="passed house">Securely Expediting Clearances Through Reporting Transparency Act of 2017</title>
    <title type="short" as="passed house">Securely Expediting Clearances Through Reporting Transparency Act of 2017</title>
    <title type="official" as="introduced">To require the Director of the National Background Investigations Bureau to submit a report on the backlog of personnel security clearance investigations, and for other purposes.</title>
    <title type="display">SECRET Act of 2017</title>
  </titles>
  <sponsor bioguide_id="K000387"/>
  <cosponsors>
    <cosponsor bioguide_id="C001078" joined="2017-07-12"/>
  </cosponsors>
  <actions>
    <action datetime="2017-07-12">
      <text>Introduced in House</text>
    </action>
    <action datetime="2017-07-12" state="REFERRED">
      <text>Referred to the House Committee on Oversight and Government Reform.</text>
    </action>
    <action datetime="2017-07-19">
      <text>Committee Consideration and Mark-up Session Held.</text>
    </action>
    <calendar datetime="2017-07-19" state="REPORTED">
      <text>Ordered to be Reported (Amended) by Voice Vote.</text>
    </calendar>
    <action datetime="2017-07-25">
      <text>Reported (Amended) by the Committee on Oversight and Government Reform. H. Rept. 115-258.</text>
    </action>
    <calendar datetime="2017-07-25" calendar="Union" number="188">
      <text>Placed on the Union Calendar, Calendar No. 188.</text>
    </calendar>
    <action datetime="2017-07-26T14:06:17-04:00">
      <text>Mr. Mitchell moved to suspend the rules and pass the bill, as amended.</text>
    </action>
    <action datetime="2017-07-26T14:06:32-04:00">
      <text>Considered under suspension of the rules.</text>
      <reference ref="CR H6327-6328" label="consideration"/>
    </action>
    <action datetime="2017-07-26T14:06:33-04:00">
      <text>DEBATE - The House proceeded with forty minutes of debate on H.R. 3210.</text>
    </action>
    <vote how="by voice vote" type="vote" datetime="2017-07-26T14:21:25-04:00" where="h" result="pass" state="PASS_OVER:HOUSE">
      <text>On motion to suspend the rules and pass the bill, as amended Agreed to by voice vote.</text>
      <reference ref="CR H6327" label="text"/>
    </vote>
    <action datetime="2017-07-26T14:21:28-04:00">
      <text>Motion to reconsider laid on the table Agreed to without objection.</text>
    </action>
    <action datetime="2017-07-27">
      <text>Received in the Senate and Read twice and referred to the Committee on Homeland Security and Governmental Affairs.</text>
    </action>
    <calendar datetime="2017-10-04">
      <text>Committee on Homeland Security and Governmental Affairs. Ordered to be reported with an amendment in the nature of a substitute favorably.</text>
    </calendar>
  </actions>
  <committees>
    <committee subcommittee="" code="SSGA" name="Senate Homeland Security and Governmental Affairs" activity="Markup, Referral"/>
    <committee subcommittee="" code="HSGO" name="House Oversight and Government Reform" activity="Reporting, Markup, Referral"/>
  </committees>
  <relatedbills/>
  <subjects>
    <term name="Government operations and politics"/>
    <term name="Congressional oversight"/>
    <term name="Executive Office of the President"/>
    <term name="Executive agency funding and structure"/>
    <term name="Government employee pay, benefits, personnel management"/>
    <term name="Government studies and investigations"/>
    <term name="Intelligence activities, surveillance, classified information"/>
    <term name="Office of Personnel Management (OPM)"/>
    <term name="Presidents and presidential powers, Vice Presidents"/>
  </subjects>
  <amendments/>
  <summary date="2017-07-26T15:49:43Z" status="Passed House amended">(This measure has not been amended since it was reported to the House on July 25, 2017. The summary of that version is repeated here.)

Securely Expediting Clearances Through Reporting Transparency Act of 2017 or the SECRET Act of 2017

(Sec. 2) This bill requires the Office of Personnel Management's National Background Investigations Bureau (NBIB) to report on the backlog of security clearance investigations.

(Sec. 3) Additionally, the NBIB must report on the process for conducting and adjudicating security clearance investigations for personnel in the Executive Office of the President.

(Sec. 4) Finally, the NBIB must report on the duplicative costs of implementing a plan for the Defense Security Service to conduct, after October 1, 2017, security investigations for Department of Defense (DOD) personnel whose investigations are adjudicated by DOD's Consolidated Adjudication Facility.</summary>
  <committee-reports>
    <report>H. Rept. 115-258</report>
  </committee-reports>
</bill>


text:
package holepunch

import (
	"context"
	"errors"
	"fmt"
	"sync"
	"time"

	"github.com/libp2p/go-libp2p/core/event"
	"github.com/libp2p/go-libp2p/core/host"
	"github.com/libp2p/go-libp2p/core/network"
	"github.com/libp2p/go-libp2p/core/peer"
	"github.com/libp2p/go-libp2p/core/protocol"
	pb "github.com/libp2p/go-libp2p/p2p/protocol/holepunch/pb"
	"github.com/libp2p/go-libp2p/p2p/protocol/identify"

	logging "github.com/ipfs/go-log/v2"
	"github.com/libp2p/go-msgio/protoio"
	ma "github.com/multiformats/go-multiaddr"
)

// Protocol is the libp2p protocol for Hole Punching.
const Protocol protocol.ID = "/libp2p/dcutr"

var log = logging.Logger("p2p-holepunch")

// StreamTimeout is the timeout for the hole punch protocol stream.
var StreamTimeout = 1 * time.Minute

const (
	ServiceName = "libp2p.holepunch"

	maxMsgSize = 4 * 1024 // 4K
)

// ErrClosed is returned when the hole punching is closed
var ErrClosed = errors.New("hole punching service closing")

type Option func(*Service) error

// The Service runs on every node that supports the DCUtR protocol.
type Service struct {
	ctx       context.Context
	ctxCancel context.CancelFunc

	host host.Host
	ids  identify.IDService

	holePuncherMx sync.Mutex
	holePuncher   *holePuncher

	hasPublicAddrsChan chan struct{}

	tracer *tracer
	filter AddrFilter

	refCount sync.WaitGroup
}

// NewService creates a new service that can be used for hole punching
// The Service runs on all hosts that support the DCUtR protocol,
// no matter if they are behind a NAT / firewall or not.
// The Service handles DCUtR streams (which are initiated from the node behind
// a NAT / Firewall once we establish a connection to them through a relay.
func NewService(h host.Host, ids identify.IDService, opts ...Option) (*Service, error) {
	if ids == nil {
		return nil, errors.New("identify service can't be nil")
	}

	ctx, cancel := context.WithCancel(context.Background())
	s := &Service{
		ctx:                ctx,
		ctxCancel:          cancel,
		host:               h,
		ids:                ids,
		hasPublicAddrsChan: make(chan struct{}),
	}

	for _, opt := range opts {
		if err := opt(s); err != nil {
			cancel()
			return nil, err
		}
	}

	s.refCount.Add(1)
	go s.watchForPublicAddr()

	return s, nil
}

func (s *Service) watchForPublicAddr() {
	defer s.refCount.Done()

	log.Debug("waiting until we have at least one public address", "peer", s.host.ID())

	// TODO: We should have an event here that fires when identify discovers a new
	// address (and when autonat confirms that address).
	// As we currently don't have an event like this, just check our observed addresses
	// regularly (exponential backoff starting at 250 ms, capped at 5s).
	duration := 250 * time.Millisecond
	const maxDuration = 5 * time.Second
	t := time.NewTimer(duration)
	defer t.Stop()
	for {
		if containsPublicAddr(s.ids.OwnObservedAddrs()) {
			log.Debug("Host now has a public address. Starting holepunch protocol.")
			s.host.SetStreamHandler(Protocol, s.handleNewStream)
			break
		}

		select {
		case <-s.ctx.Done():
			return
		case <-t.C:
			duration *= 2
			if duration > maxDuration {
				duration = maxDuration
			}
			t.Reset(duration)
		}
	}

	// Only start the holePuncher if we're behind a NAT / firewall.
	sub, err := s.host.EventBus().Subscribe(&event.EvtLocalReachabilityChanged{})
	if err != nil {
		log.Debugf("failed to subscripe to Reachability event: %s", err)
		return
	}
	defer sub.Close()
	for {
		select {
		case <-s.ctx.Done():
			return
		case e, ok := <-sub.Out():
			if !ok {
				return
			}
			if e.(event.EvtLocalReachabilityChanged).Reachability != network.ReachabilityPrivate {
				continue
			}
			s.holePuncherMx.Lock()
			s.holePuncher = newHolePuncher(s.host, s.ids, s.tracer, s.filter)
			s.holePuncherMx.Unlock()
			close(s.hasPublicAddrsChan)
			return
		}
	}
}

// Close closes the Hole Punch Service.
func (s *Service) Close() error {
	var err error
	s.holePuncherMx.Lock()
	if s.holePuncher != nil {
		err = s.holePuncher.Close()
	}
	s.holePuncherMx.Unlock()
	s.tracer.Close()
	s.host.RemoveStreamHandler(Protocol)
	s.ctxCancel()
	s.refCount.Wait()
	return err
}

func (s *Service) incomingHolePunch(str network.Stream) (rtt time.Duration, addrs []ma.Multiaddr, err error) {
	// sanity check: a hole punch request should only come from peers behind a relay
	if !isRelayAddress(str.Conn().RemoteMultiaddr()) {
		return 0, nil, fmt.Errorf("received hole punch stream: %s", str.Conn().RemoteMultiaddr())
	}
	ownAddrs := removeRelayAddrs(s.ids.OwnObservedAddrs())
	if s.filter != nil {
		ownAddrs = s.filter.FilterLocal(str.Conn().RemotePeer(), ownAddrs)
	}

	// If we can't tell the peer where to dial us, there's no point in starting the hole punching.
	if len(ownAddrs) == 0 {
		return 0, nil, errors.New("rejecting hole punch request, as we don't have any public addresses")
	}

	if err := str.Scope().ReserveMemory(maxMsgSize, network.ReservationPriorityAlways); err != nil {
		log.Debugf("error reserving memory for stream: %s, err")
		return 0, nil, err
	}
	defer str.Scope().ReleaseMemory(maxMsgSize)

	wr := protoio.NewDelimitedWriter(str)
	rd := protoio.NewDelimitedReader(str, maxMsgSize)

	// Read Connect message
	msg := new(pb.HolePunch)

	str.SetDeadline(time.Now().Add(StreamTimeout))

	if err := rd.ReadMsg(msg); err != nil {
		return 0, nil, fmt.Errorf("failed to read message from initator: %w", err)
	}
	if t := msg.GetType(); t != pb.HolePunch_CONNECT {
		return 0, nil, fmt.Errorf("expected CONNECT message from initiator but got %d", t)
	}

	obsDial := removeRelayAddrs(addrsFromBytes(msg.ObsAddrs))
	if s.filter != nil {
		obsDial = s.filter.FilterRemote(str.Conn().RemotePeer(), obsDial)
	}

	log.Debugw("received hole punch request", "peer", str.Conn().RemotePeer(), "addrs", obsDial)
	if len(obsDial) == 0 {
		return 0, nil, errors.New("expected CONNECT message to contain at least one address")
	}

	// Write CONNECT message
	msg.Reset()
	msg.Type = pb.HolePunch_CONNECT.Enum()
	msg.ObsAddrs = addrsToBytes(ownAddrs)
	tstart := time.Now()
	if err := wr.WriteMsg(msg); err != nil {
		return 0, nil, fmt.Errorf("failed to write CONNECT message to initator: %w", err)
	}

	// Read SYNC message
	msg.Reset()
	if err := rd.ReadMsg(msg); err != nil {
		return 0, nil, fmt.Errorf("failed to read message from initator: %w", err)
	}
	if t := msg.GetType(); t != pb.HolePunch_SYNC {
		return 0, nil, fmt.Errorf("expected SYNC message from initiator but got %d", t)
	}
	return time.Since(tstart), obsDial, nil
}

func (s *Service) handleNewStream(str network.Stream) {
	// Check directionality of the underlying connection.
	// Peer A receives an inbound connection from peer B.
	// Peer A opens a new hole punch stream to peer B.
	// Peer B receives this stream, calling this function.
	// Peer B sees the underlying connection as an outbound connection.
	if str.Conn().Stat().Direction == network.DirInbound {
		str.Reset()
		return
	}

	if err := str.Scope().SetService(ServiceName); err != nil {
		log.Debugf("error attaching stream to holepunch service: %s", err)
		str.Reset()
		return
	}

	rp := str.Conn().RemotePeer()
	rtt, addrs, err := s.incomingHolePunch(str)
	if err != nil {
		s.tracer.ProtocolError(rp, err)
		log.Debugw("error handling holepunching stream from", "peer", rp, "error", err)
		str.Reset()
		return
	}
	str.Close()

	// Hole punch now by forcing a connect
	pi := peer.AddrInfo{
		ID:    rp,
		Addrs: addrs,
	}
	s.tracer.StartHolePunch(rp, addrs, rtt)
	log.Debugw("starting hole punch", "peer", rp)
	start := time.Now()
	s.tracer.HolePunchAttempt(pi.ID)
	err = holePunchConnect(s.ctx, s.host, pi, false)
	dt := time.Since(start)
	s.tracer.EndHolePunch(rp, dt, err)
}

// DirectConnect is only exposed for testing purposes.
// TODO: find a solution for this.
func (s *Service) DirectConnect(p peer.ID) error {
	<-s.hasPublicAddrsChan
	s.holePuncherMx.Lock()
	holePuncher := s.holePuncher
	s.holePuncherMx.Unlock()
	return holePuncher.DirectConnect(p)
}


text:
package org.knowm.xchange.exceptions;

public class NonceException extends ExchangeException {

  public NonceException(Throwable cause) {
    super(cause);
  }

  public NonceException(String message, Throwable cause) {
    super(message, cause);
  }

  public NonceException(String message) {
    super(message);
  }

  public NonceException() {
    super("Something went wrong with using the provided Nonce.");
  }
}