text:
<?php
/**
 * CakePHP DatabaseLog Plugin
 *
 * Licensed under The MIT License.
 *
 * @license http://www.opensource.org/licenses/mit-license.php MIT License
 * @link https://github.com/dereuromark/CakePHP-DatabaseLog
 */

namespace DatabaseLog\Model\Table;

use ArrayObject;
use Cake\Core\Configure;
use Cake\Datasource\EntityInterface;
use Cake\Datasource\ResultSetInterface;
use Cake\Event\Event;
use Cake\Event\EventInterface;
use Cake\I18n\FrozenTime;
use Cake\Utility\Hash;
use Cake\Utility\Text;
use DatabaseLog\Model\Entity\DatabaseLog;
use RuntimeException;

/**
 * @method \DatabaseLog\Model\Entity\DatabaseLog get($primaryKey, $options = [])
 * @method \DatabaseLog\Model\Entity\DatabaseLog newEntity(array $data, array $options = [])
 * @method array<\DatabaseLog\Model\Entity\DatabaseLog> newEntities(array $data, array $options = [])
 * @method \DatabaseLog\Model\Entity\DatabaseLog|false save(\Cake\Datasource\EntityInterface $entity, $options = [])
 * @method \DatabaseLog\Model\Entity\DatabaseLog patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
 * @method array<\DatabaseLog\Model\Entity\DatabaseLog> patchEntities(iterable $entities, array $data, array $options = [])
 * @method \DatabaseLog\Model\Entity\DatabaseLog findOrCreate($search, ?callable $callback = null, $options = [])
 * @mixin \Cake\ORM\Behavior\TimestampBehavior
 * @method \DatabaseLog\Model\Entity\DatabaseLog saveOrFail(\Cake\Datasource\EntityInterface $entity, $options = [])
 * @mixin \Search\Model\Behavior\SearchBehavior
 * @method \DatabaseLog\Model\Entity\DatabaseLog newEmptyEntity()
 * @method \Cake\Datasource\ResultSetInterface<\DatabaseLog\Model\Entity\DatabaseLog>|false saveMany(iterable $entities, $options = [])
 * @method \Cake\Datasource\ResultSetInterface<\DatabaseLog\Model\Entity\DatabaseLog> saveManyOrFail(iterable $entities, $options = [])
 * @method \Cake\Datasource\ResultSetInterface<\DatabaseLog\Model\Entity\DatabaseLog>|false deleteMany(iterable $entities, $options = [])
 * @method \Cake\Datasource\ResultSetInterface<\DatabaseLog\Model\Entity\DatabaseLog> deleteManyOrFail(iterable $entities, $options = [])
 */
class DatabaseLogsTable extends DatabaseLogAppTable {

	use LazyTableTrait;

	/**
	 * @var array<string>
	 */
	public $searchFields = ['DatabaseLogs.type'];

	/**
	 * initialize method
	 *
	 * @param array $config Config data.
	 * @return void
	 */
	public function initialize(array $config): void {
		$this->setDisplayField('type');
		$this->addBehavior('Timestamp', ['modified' => false]);
		if (static::isSearchEnabled()) {
			$this->addBehavior('Search.Search');
		}
		$this->ensureTables(['DatabaseLog.DatabaseLogs']);

		$callback = Configure::read('DatabaseLog.monitorCallback');
		if (!$callback) {
			return;
		}
		$this->getEventManager()->on('DatabaseLog.alert', $callback);
	}

	/**
	 * @return \Search\Manager
	 */
	public function searchManager() {
		$searchManager = $this->behaviors()->Search->searchManager();
		$searchManager
			->value('type')
			->like('search', ['fields' => ['summary'], 'before' => true, 'after' => true]);
			/*
			->callback('search', ['callback' => function (Query $query, array $args, Base $filter) {
				...
		 	}])
			*/

		return $searchManager;
	}

	/**
	 * Write the log to database
	 *
	 * @param mixed $level
	 * @param string $message
	 * @param array $context
	 * @return bool Success
	 */
	public function log($level, $message, array $context = []) {
		$message = trim($message);
		$summary = Text::truncate($message, 255);

		$data = [
			'type' => $level,
			'summary' => $summary,
			'message' => $message,
			'context' => trim(print_r($context, true)),
			'count' => 1,
		];
		$log = $this->newEntity($data);

		return (bool)$this->save($log);
	}

	/**
	 * @param \Cake\Event\EventInterface $event
	 * @param \DatabaseLog\Model\Entity\DatabaseLog $entity
	 * @param \ArrayObject $options
	 * @return void
	 */
	public function beforeSave(EventInterface $event, EntityInterface $entity, ArrayObject $options) {
		$entity['ip'] = env('REMOTE_ADDR');
		$entity['hostname'] = env('HTTP_HOST') ?: gethostname();
		$entity['uri'] = env('REQUEST_URI');
		$entity['refer'] = env('HTTP_REFERER');
		$entity['user_agent'] = env('HTTP_USER_AGENT');

		if (PHP_SAPI === 'cli') {
			if (!$entity['hostname']) {
				$entity['hostname'] = env('SERVER_NAME');
			}
			if (!$entity['hostname']) {
				$user = env('USER');
				$logName = env('LOGNAME');
				if ($user || $logName) {
					$entity['hostname'] = $user . '@' . $logName;
				}
			}
			if (!$entity['uri']) {
				$type = 'CLI';
				$entity['uri'] = $type . ' ' . str_replace((string)env('PWD'), '', implode(' ', (array)env('argv')));
			}
			if (!$entity['user_agent']) {
				$shell = env('SHELL') ?: 'n/a';
				$entity['user_agent'] = $shell . ' (' . php_uname() . ')';
			}
		}

		$env = getenv('APPLICATION_ENV');
		if ($env) {
			$entity['user_agent'] .= ($entity['user_agent'] ? '' : 'n/a') . ' [' . $env . ']';
		}

		$callback = Configure::read('DatabaseLog.saveCallback');
		if (!is_callable($callback)) {
			return;
		}

		$callback($entity);
	}

	/**
	 * Return a text search on message
	 *
	 * @param string|null $query search string or `type@...`
	 * @return array Conditions
	 */
	public function textSearch($query = null) {
		if ($query) {
			if (strpos($query, 'type@') === 0) {
				$query = str_replace('type@', '', $query);

				return ['Log.type' => $query];
			}

			$escapedQuery = "'" . $query . "'"; // for now - $this->getDataSource()->value($query);

			return ["MATCH (message) AGAINST ($escapedQuery)"];
		}

		return [];
	}

	/**
	 * Return all the unique types
	 *
	 * @return array Types
	 */
	public function getTypesWithCount() {
		$query = $this->find();
		$types = $query
			->select(['type', 'count' => 'COUNT(*)'])
			->distinct('type')
			->order('type ASC')
			->disableHydration()
			->toArray();

		return Hash::combine($types, '{n}.type', '{n}.count');
	}

	/**
	 * Return all the unique types
	 *
	 * @return array Types
	 */
	public function getTypes() {
		$types = $this->find()
			->select(['type'])
			->distinct('type')
			->order('type ASC')
			->disableHydration()
			->toArray();

		return Hash::combine($types, '{n}.type', '{n}.type');
	}

	/**
	 * Remove duplicates and leave only the newest entry
	 * Also stores the new total "number" of this message in the remaining one
	 *
	 * @param bool $strict
	 * @return int
	 */
	public function removeDuplicates($strict = false) {
		$field = $strict ? 'message' : 'summary';

		$query = $this->find();
		$options = [
			'fields' => ['type', $field, 'count' => $query->func()->count('*')],
			'conditions' => [],
			'group' => ['type', $field],
			//'having' => $this->alias . '__count > 0',
			//'order' => ['created' => 'DESC']
		];
		$logs = $query->find('all', $options)->disableHydration()->toArray();

		$count = 0;
		foreach ($logs as $key => $log) {
			if ($log['count'] <= 1) {
				continue;
			}
			$options = [
				'fields' => ['id'],
				'keyField' => 'id',
				'valueField' => 'id',
				'conditions' => [
					'type' => $log['type'],
					$field => $log[$field],
				],
				'order' => ['created' => 'DESC'],
			];
			$entries = $this->find('list', $options)->toArray();

			// keep the newest entry
			$keep = array_shift($entries);
			if ($entries) {
				$this->deleteAll(['id IN' => $entries]);
			}
			$count += $this->updateAll(['count = count + ' . count($entries)], ['id' => $keep]);
		}

		return $count;
	}

	/**
	 * @return int
	 */
	public function garbageCollector() {
		$deleted = $this->_cleanByAge();

		$query = $this->find()
			->order(['id' => 'ASC']);

		$count = $query->count();

		$limit = Configure::read('DatabaseLog.limit') ?: 999999;
		if ($count <= $limit) {
			return $deleted;
		}

		/** @var \DatabaseLog\Model\Entity\DatabaseLog|null $record */
		$record = $query->where()->offset($count - $limit)->first();
		if (!$record) {
			return $deleted;
		}

		return $deleted + $this->deleteAll(['id <' => $record->id]);
	}

	/**
	 * @return int
	 */
	protected function _cleanByAge() {
		$age = Configure::read('DatabaseLog.maxLength');
		if (!$age) {
			return 0;
		}

		$date = new FrozenTime($age);

		return $this->deleteAll(['created <' => $date]);
	}

	/**
	 * @return void
	 */
	public function truncate() {
		/** @var \Cake\Database\Schema\TableSchema $tableSchema */
		$tableSchema = $this->getSchema();
		$connection = $this->getConnection();
		$sql = $tableSchema->truncateSql($connection);
		foreach ($sql as $snippet) {
			$connection->execute($snippet);
		}
	}

	/**
	 * @param \Cake\Datasource\ResultSetInterface $logs
	 * @return void
	 */
	public function notify(ResultSetInterface $logs) {
		$event = new Event('DatabaseLog.alert', $this, ['logs' => $logs]);
		$this->getEventManager()->dispatch($event);
	}

	/**
	 * @param \DatabaseLog\Model\Entity\DatabaseLog $log
	 * @return string
	 */
	public function format(DatabaseLog $log) {
		$content = $log->created . ': ' . $log->type;
		if ($log->ip) {
			$content .= ' - IP: ' . $log->ip;
		}
		if ($log->refer) {
			$content .= ' - Referer: ' . $log->refer;
		}
		$content .= PHP_EOL . $log->message . PHP_EOL;

		return $content;
	}

	/**
	 * @return string SQL DB type
	 */
	public function databaseType(): string {
		$config = $this->getConnection()->config();
		$type = $config['driver'];

		return substr($type, strrpos($type, '\\') + 1);
	}

	/**
	 * @throws \RuntimeException
	 * @return int|null Bytes
	 */
	public function databaseSize(): ?int {
		if ($this->databaseType() !== 'Sqlite') {
			return null;
		}

		$config = $this->getConnection()->config();
		if (empty($config['database'])) {
			return null;
		}

		$size = filesize($config['database']);
		if ($size === false) {
			throw new RuntimeException('Cannot access DB ' . $config['database']);
		}

		return $size;
	}

}


text:
package sl.hr_client.net.download;

import android.content.Context;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by Administrator on 2017/4/12.
 */

public class DownloadPresenter {
    private DownloadView downloadView;
    private DownloadModel downloadModel;

    public DownloadPresenter(DownloadView downloadView) {
        this.downloadView = downloadView;
        downloadModel = new DownloadModel();
    }

    public void getPDownload(Context context, int pageIndex, int pageSize, String dmTypeID) {
        downloadView.showLoading();

        downloadModel.getDownloads(context, pageIndex, pageSize, dmTypeID)
                .subscribeOn(Schedulers.io())// 在非UI线程中执行getUser
                .observeOn(AndroidSchedulers.mainThread())// 在UI线程中执行结果
                .subscribe(new Subscriber<String>() {
                    @Override
                    public void onNext(String s) {
                        downloadView.updateDownloadsView(s);
                    }

                    @Override
                    public void onCompleted() {
                        downloadView.hideLoading();
                    }

                    @Override
                    public void onError(Throwable e) {
                        downloadView.showError(e.getMessage());
                    }
                });
    }

    public void loadMorePDownload(Context context, int pageIndex, int pageSize, String dmTypeID) {
        downloadView.showLoading();

        downloadModel.getDownloads(context, pageIndex, pageSize, dmTypeID)
                .subscribeOn(Schedulers.io())// 在非UI线程中执行getUser
                .observeOn(AndroidSchedulers.mainThread())// 在UI线程中执行结果
                .subscribe(new Subscriber<String>() {
                    @Override
                    public void onNext(String s) {
                        downloadView.loadMoreDownloadsView(s);
                    }

                    @Override
                    public void onCompleted() {
                        downloadView.hideLoading();
                    }

                    @Override
                    public void onError(Throwable e) {
                        downloadView.showError(e.getMessage());
                    }
                });
    }

    /**
     * 仅改变数量,不作处理
     * @param context
     * @param downloadID
     */
    public void updatePDownloadNum(Context context, String downloadID) {

        downloadModel.updateDownloadNum(context, downloadID)
                .subscribeOn(Schedulers.io())// 在非UI线程中执行getUser
                .observeOn(AndroidSchedulers.mainThread())// 在UI线程中执行结果
                .subscribe(new Subscriber<String>() {
                    @Override
                    public void onNext(String s) {
                    }

                    @Override
                    public void onCompleted() {
                    }

                    @Override
                    public void onError(Throwable e) {
                    }
                });
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.lwjgl.opencl;

/**
 * Native bindings to the APPLE_biased_fixed_point_image_formats extension.
 *
 *
This selector may be passed to {@link CL10#clCreateImage2D CreateImage2D} in the cl_image_format.image_channel_data_type field. It defines a biased signed 1.14 fixed point
 * storage format, with range [-1, 3). The conversion from float to this fixed point format is defined as follows:

 *
 *
ushort float_to_sfixed14( float x ){
    int i = convert_int_sat_rte( x * 0x1.0p14f );         // scale [-1, 3.0) to [-16384, 3*16384), round to nearest integer
    i = add_sat( i, 0x4000 );                             // apply bias, to convert to [0, 65535) range
    return convert_ushort_sat(i);                         // clamp to destination size
}

 *
 *
The inverse conversion is the reverse process. The formats are currently only available on the CPU with the {@link CL10#CL_RGBA RGBA} channel layout.

 */
public final class APPLEBiasedFixedPointImageFormats {

	/**  */
	public static final int
		CL_SFIXED14_APPLE    = 0x10000008,
		CL_BIASED_HALF_APPLE = 0x10000009;

	private APPLEBiasedFixedPointImageFormats() {}

}


text:
package com.ctrip.hermes.core.transport.netty;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;

import com.ctrip.hermes.core.transport.ManualRelease;
import com.ctrip.hermes.core.transport.command.Command;
import com.ctrip.hermes.core.transport.command.parser.CommandParser;
import com.ctrip.hermes.core.transport.command.parser.DefaultCommandParser;

public class NettyDecoder extends HermesLengthFieldBasedFrameDecoder {

	private CommandParser m_commandParser = new DefaultCommandParser();

	public NettyDecoder() {
		super(Integer.MAX_VALUE, Magic.length(), 4, 0, 4 + Magic.length());
	}

	@Override
	protected ByteBuf extractFrame(ChannelHandlerContext ctx, ByteBuf buffer, int index, int length) {
		ByteBuf slicedBuffer = buffer.slice(index, length);
		slicedBuffer.retain();
		return slicedBuffer;
	}

	@Override
	protected void validateMagicNumber(ByteBuf in) {
		Magic.readAndCheckMagic(in);
	}

	@Override
	protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
		ByteBuf frame = null;
		Command cmd = null;
		try {
			frame = (ByteBuf) super.decode(ctx, in);
			if (frame == null) {
				return null;
			}

			cmd = m_commandParser.parse(frame);
			return cmd;
		} finally {
			if (null != frame) {
				if (cmd == null) {
					frame.release();
				} else {
					if (!cmd.getClass().isAnnotationPresent(ManualRelease.class)) {
						frame.release();
					}
				}
			}
		}

	}

}


text:
/* Author: A. Huaman */
/* @date 2013/06/20 */

#pragma once

#include <string>

#include <urdf_model/model.h>
#include <urdf_model/pose.h>
#include <urdf_model/twist.h>
#include <urdf_world/world.h>

#include "dart/common/ResourceRetriever.hpp"
#include "dart/common/Uri.hpp"
#include "dart/utils/urdf/BackwardCompatibility.hpp"

namespace dart {
namespace utils {
namespace urdf_parsing {

/// We need a customized version of the Entity class, because we need to keep
/// track of a Skeleton's uri in order to correctly handle relative file paths.
class Entity
{
public:
  Entity() = default;

  /// Copy over a standard urdfEntity
  Entity(const urdf::Entity& urdfEntity);

  std::shared_ptr<urdf::ModelInterface> model;
  urdf::Pose origin;
  urdf::Twist twist;

  dart::common::Uri uri;
};

class World
{
public:
  std::string name;
  std::vector<Entity> models;
};

std::shared_ptr<World> parseWorldURDF(
    const std::string& xml_string,
    const dart::common::Uri& _baseUri,
    const common::ResourceRetrieverPtr& retriever);

} // namespace urdf_parsing
} // namespace utils
} // namespace dart


text:
namespace StackExchange.Opserver.Models.Security
{
    /// <summary>
    /// Does this REALLY need an explanation?
    /// </summary>
    public class EveryonesAnAdminProvider : SecurityProvider
    {
        public override bool IsAdmin => true;

        internal override bool InAdminGroups(ISecurableSection settings) { return true; }
        public override bool InGroups(string groupNames, string accountName) { return true; }
        public override bool ValidateUser(string userName, string password) { return true; }
    }
}


text:
/*

  Project:       1Sheeld Library
  File:          FacebookShield.cpp

  Version:       1.0

  Compiler:      Arduino avr-gcc 4.3.2

  Author:        Integreight

  Date:          2014.5

*/
#include "OneSheeld.h"
#include "FacebookShield.h"

//Post Sender
void FacebookShieldClass::post(const char* status)
{
	//Check length of string
	int statusLength = strlen(status);
	if(!statusLength) return;
	OneSheeld.sendPacket(FACEBOOK_ID,0,FACEBOOK_UPDATE_STATUS,1,new FunctionArg(statusLength,(byte*)status));
}
//Support strings Arduino
#if !defined(ARDUINO_LINUX)
void FacebookShieldClass::post(String status)
{
	const char * cTypeStatus = status.c_str();

	post(cTypeStatus);
}
#endif

//Support string galileo
#if defined(ARDUINO_LINUX)
void FacebookShieldClass::post(String status)
{
	int statusLength = status.length();

	char cTypeStatus [statusLength+1];

	for(int i=0; i<statusLength; i++)
	{
		cTypeStatus[i]=status[i];
	}
	cTypeStatus[statusLength]='\0';

	post(cTypeStatus);
}
#endif

void FacebookShieldClass::postLastPicture(const char * pictureText, byte imageSource)
{
	//Check length of string
	int pictureTextLength = strlen(pictureText);
	if(!pictureTextLength) return;
	OneSheeld.sendPacket(FACEBOOK_ID,0,FACEBOOK_POST_LAST_PIC,2,new FunctionArg(pictureTextLength,(byte*)pictureText),
																new FunctionArg(1,(byte *)&imageSource));
}

//Support string and image source Arduino
#if !defined(ARDUINO_LINUX)
void FacebookShieldClass::postLastPicture(String pictureText , byte imageSource)
{
	const char * cTypePictureText = pictureText.c_str();

	postLastPicture(cTypePictureText,imageSource);
}
#endif

//Support string and image source galileo
#if defined(ARDUINO_LINUX)
void FacebookShieldClass::postLastPicture(String pictureText , byte imageSource)
{
	int pictureTextLength = pictureText.length();

	char cTypePictureText [pictureTextLength+1];

	for(int i=0 ;i<pictureTextLength;i++)
	{
		cTypePictureText[i] = pictureText[i];
	}
	cTypePictureText[pictureTextLength]='\0';

	postLastPicture(cTypePictureText,imageSource);
}
#endif

#ifdef FACEBOOK_SHIELD
//Instantiating Object
FacebookShieldClass Facebook;
#endif


text:
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ANSIBLE_PLAYBOOK=rackhd_package
source $DIR/box_handler.sh
#########################################
#
#  Usage
#
#########################################
Usage(){
    echo "Function: this script is used to build ovf: the pre-build cache of vagrant box"
    echo "usage: $0 [arguments]"
    echo "    mandatory arguments:"
    echo "      --OS_VER: The version of the base os"
    echo "      --TARGET_DIR: The target directory to put ovf and log file"
}

#########################################
#
#  build ovf
#
#########################################
build(){
    pushd $DIR
    echo "[Info] Generate a parameter file pass to packer"
    CFG_FILE=template.cfg
    # parameter file pass to packer
    echo {                                                         > $CFG_FILE
    echo  \"playbook\": \"${ANSIBLE_PLAYBOOK}\",                   >> $CFG_FILE
    echo  \"vm_name\": \"rackhd-${OS_VER}\"                        >> $CFG_FILE
    echo }                                                         >> $CFG_FILE
    echo "[Info] the parameter file:"
    cat $CFG_FILE

    echo "[Info] Customize the template-${OS_VER}.json , to remove the vagrant-upload step"
    # pre-process the packer template file
    PACKER_TEMP=template-${OS_VER}.json.tmp
    TMP_FILE_STREAM=$(cat template-${OS_VER}.json)
    # Delete the post-processors blocks in the template.json, before sending to 'packer build'
    TMP_FILE_STREAM=$( jq 'del(.["post-processors"][0][1])' template-${OS_VER}.json | jq 'del(.["push"])')
    # Write back the template file
    echo "$TMP_FILE_STREAM" > $PACKER_TEMP
    echo "[Info] The template-${OS_VER}.json has been customized"

    $PACKER build --force --only=virtualbox-iso  --var-file=$CFG_FILE  ${PACKER_TEMP} | tee packer-install.log && \
    ## Check packer build command status
    ## Because above we use pipeline, so use  ${PIPESTATUS[0]} to catch return-code of command before pipeline.(only works on bash)
    if [ ${PIPESTATUS[0]} != 0 ]; then
        echo "[ERROR] Packer Build failed.. exit"
        exit 3
    fi
    # src dir may be the same with TARGET_DIR
    set +e
    mv  output-*/*.* $TARGET_DIR/
    mv packer-install.log $TARGET_DIR
    set -e
    popd
}

###################################################################
#
#  Parse and check Arguments
#
##################################################################
parseArguments(){
    while [ "$1" != "" ]; do
        case $1 in
            --OS_VER )                      shift
                                            OS_VER=$1
                                            ;;
            --TARGET_DIR )                  shift
                                            TARGET_DIR=$1
                                            ;;
            * )                             Usage
                                            exit 1
        esac
        shift
    done
    if [ ! -n "${OS_VER}" ] ; then
        echo "[ERROR]Arguments OS_VER is required!"
        Usage
        exit 1
    fi

    if [ ! -n "${TARGET_DIR}" ]; then
        echo "[ERROR]Arguments TARGET_DIR is required"
        Usage
        exit 1
    fi
    mkdir -p ${TARGET_DIR}
}

########################################################
#
# Main
#
######################################################
main(){
    parseArguments "$@"
    checkDependencies
    preparePackerEnv
    cleanUpBox
    trap cleanUpBox SIGINT SIGTERM SIGKILL EXIT
    build
}

main "$@"


text:
<form [formGroup]="apiForm" (ngSubmit)="onPublish()">
    <mat-form-field class="text-container" color="accent">
        <textarea matInput formControlName="json" placeholder="JSON"
                  matTextareaAutosize matAutosizeMinRows="10" matAutosizeMaxRows="10">
        </textarea>
    </mat-form-field>

    <button mat-raised-button color="accent" type="button" (click)="onPublish()">Publish</button>

    <button mat-raised-button color="warn" type="button" (click)="onUnpublish()">Unpublish</button>

    <mat-form-field class="text-container" color="warn">
        <textarea matInput formControlName="results" placeholder="Results"
                  matTextareaAutosize matAutosizeMinRows="10" matAutosizeMaxRows="10">
        </textarea>
    </mat-form-field>
</form>


text:
FROM python:2.7

MAINTAINER bluecap

WORKDIR /yarr-client
COPY . /yarr-client
RUN pip install -r requirements.txt \
    && pip install -r test_requirements.txt \
    && pip install -e .

COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

EXPOSE 5000

CMD ["runserver"]


text:
.class final enum Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;
.super Ljava/lang/Enum;
.source "DeviceInfo.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/sprint/net/cdma/DeviceInfo;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x401a
    name = "TechnologySupport"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Enum",
        "<",
        "Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;",
        ">;"
    }
.end annotation

# static fields
.field private static final synthetic $VALUES:[Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

.field public static final enum CDMA2000_1X:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

.field public static final enum CDMA2000_HRPD:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

.field public static final enum GSM:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

.field public static final enum INITIAL:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

.field public static final enum LTE:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

.field public static final enum TDS:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

.field public static final enum UMTS:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

# instance fields
.field private name:Ljava/lang/String;

.field private value:I

# direct methods
.method static constructor <clinit>()V
    .locals 10

    .prologue
    const/4 v9, 0x0

    const/4 v8, 0x5

    const/4 v7, 0x4

    const/4 v6, 0x2

    const/4 v5, 0x1

    .line 190
    new-instance v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    const-string v1, "INITIAL"

    const/4 v2, -0x1

    const-string v3, ""

    invoke-direct {v0, v1, v9, v2, v3}, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;-><init>(Ljava/lang/String;IILjava/lang/String;)V

    sput-object v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->INITIAL:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    .line 191
    new-instance v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    const-string v1, "CDMA2000_1X"

    const-string v2, "CDMA2000_1X"

    invoke-direct {v0, v1, v5, v5, v2}, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;-><init>(Ljava/lang/String;IILjava/lang/String;)V

    sput-object v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->CDMA2000_1X:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    .line 192
    new-instance v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    const-string v1, "CDMA2000_HRPD"

    const-string v2, "CDMA2000_HRPD"

    invoke-direct {v0, v1, v6, v6, v2}, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;-><init>(Ljava/lang/String;IILjava/lang/String;)V

    sput-object v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->CDMA2000_HRPD:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    .line 193
    new-instance v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    const-string v1, "GSM"

    const/4 v2, 0x3

    const-string v3, "GSM"

    invoke-direct {v0, v1, v2, v7, v3}, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;-><init>(Ljava/lang/String;IILjava/lang/String;)V

    sput-object v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->GSM:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    .line 194
    new-instance v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    const-string v1, "UMTS"

    const-string v2, "UMTS"

    invoke-direct {v0, v1, v7, v8, v2}, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;-><init>(Ljava/lang/String;IILjava/lang/String;)V

    sput-object v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->UMTS:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    .line 195
    new-instance v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    const-string v1, "LTE"

    const/16 v2, 0x8

    const-string v3, "LTE"

    invoke-direct {v0, v1, v8, v2, v3}, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;-><init>(Ljava/lang/String;IILjava/lang/String;)V

    sput-object v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->LTE:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    .line 196
    new-instance v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    const-string v1, "TDS"

    const/4 v2, 0x6

    const/16 v3, 0x9

    const-string v4, "TDS"

    invoke-direct {v0, v1, v2, v3, v4}, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;-><init>(Ljava/lang/String;IILjava/lang/String;)V

    sput-object v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->TDS:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    .line 189
    const/4 v0, 0x7

    new-array v0, v0, [Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    sget-object v1, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->INITIAL:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    aput-object v1, v0, v9

    sget-object v1, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->CDMA2000_1X:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    aput-object v1, v0, v5

    sget-object v1, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->CDMA2000_HRPD:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    aput-object v1, v0, v6

    const/4 v1, 0x3

    sget-object v2, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->GSM:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    aput-object v2, v0, v1

    sget-object v1, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->UMTS:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    aput-object v1, v0, v7

    sget-object v1, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->LTE:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    aput-object v1, v0, v8

    const/4 v1, 0x6

    sget-object v2, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->TDS:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    aput-object v2, v0, v1

    sput-object v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->$VALUES:[Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    return-void
.end method

.method private constructor <init>(Ljava/lang/String;IILjava/lang/String;)V
    .locals 0
    .param p3, "value"    # I
    .param p4, "name"    # Ljava/lang/String;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(I",
            "Ljava/lang/String;",
            ")V"
        }
    .end annotation

    .prologue
    .line 200
    invoke-direct {p0, p1, p2}, Ljava/lang/Enum;-><init>(Ljava/lang/String;I)V

    .line 201
    iput p3, p0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->value:I

    .line 202
    iput-object p4, p0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->name:Ljava/lang/String;

    .line 203
    return-void
.end method

.method public static fromValue(I)Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;
    .locals 5
    .param p0, "value"    # I

    .prologue
    .line 207
    invoke-static {}, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->values()[Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    move-result-object v0

    .local v0, "arr$":[Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;
    array-length v2, v0

    .local v2, "len$":I
    const/4 v1, 0x0

    .local v1, "i$":I
    :goto_0
    if-ge v1, v2, :cond_1

    aget-object v3, v0, v1

    .line 209
    .local v3, "ts":Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;
    iget v4, v3, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->value:I

    if-ne v4, p0, :cond_0

    .line 212
    .end local v3    # "ts":Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;
    :goto_1
    return-object v3

    .line 207
    .restart local v3    # "ts":Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;
    :cond_0
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 212
    .end local v3    # "ts":Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;
    :cond_1
    sget-object v3, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->INITIAL:Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    goto :goto_1
.end method

.method public static valueOf(Ljava/lang/String;)Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;
    .locals 1
    .param p0, "name"    # Ljava/lang/String;

    .prologue
    .line 189
    const-class v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    invoke-static {v0, p0}, Ljava/lang/Enum;->valueOf(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;

    move-result-object v0

    check-cast v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    return-object v0
.end method

.method public static values()[Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;
    .locals 1

    .prologue
    .line 189
    sget-object v0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->$VALUES:[Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    invoke-virtual {v0}, [Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->clone()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, [Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;

    return-object v0
.end method

# virtual methods
.method public getName()Ljava/lang/String;
    .locals 1

    .prologue
    .line 204
    iget-object v0, p0, Lcom/sprint/net/cdma/DeviceInfo$TechnologySupport;->name:Ljava/lang/String;

    return-object v0
.end method


text:
package com.github.i49.pulp.api.vocabularies.dc;

import java.net.URI;
import java.util.Optional;

import com.github.i49.pulp.api.vocabularies.Property;
import com.github.i49.pulp.api.vocabularies.PropertyBuilder;

/**
 * A topic of the resource.
 * This property represents the term of {@link DublinCore#SUBJECT}.
 */
public interface Subject extends Property<String> {

	/**
	 * Returns the authority responsible for the subject code.
	 *
	 * @return one of authorities defined in {@link SubjectAuthority}, may be empty.
	 */
	Optional<SubjectAuthority> getAuthority();

	/**
	 * Returns the code of this subject.
	 *
	 * @return the code of this subject, may be empty.
	 */
	Optional<String> getCode();

	/**
	 * Returns the URI representing the scheme of the subject code.
	 *
	 * @return the scheme URI of the subject code, may be empty.
	 */
	Optional<URI> getScheme();

	/**
	 * Builder for building instances of {@link Subject}.
	 */
	public interface Builder extends PropertyBuilder<String, Subject, Builder> {

		/**
		 * Specifies the code of the subject and its authority.
		 * Calling this method clears the scheme already specified.
		 *
		 * @param authority one of authorities defined in {@link SubjectAuthority}, which is responsible for the code.
		 * @param code the code of the subject.
		 * @return this builder.
		 * @throws IllegalArgumentException if one or more parameters are invalid.
		 */
		Builder ofCode(SubjectAuthority authority, String code);

		/**
		 * Specifies the code of the subject and its scheme.
		 * Calling this method clears the authority already specified.
		 *
		 * @param scheme the URI representing the scheme of the subject code.
		 * @param code the code of the subject.
		 * @return this builder.
		 * @throws IllegalArgumentException if one or more parameters are invalid.
		 */
		Builder ofCode(URI scheme, String code);
	}
}


text:
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace demo.apptarefa.domain.Models.Mapping
{
    public class FuncionarioMap : EntityTypeConfiguration<Funcionario>
    {
        public FuncionarioMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Nome)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Email)
                .HasMaxLength(100);

            this.Property(t => t.Situacao)
                .IsFixedLength()
                .HasMaxLength(1);

            // Table & Column Mappings
            this.ToTable("Funcionario");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Nome).HasColumnName("Nome");
            this.Property(t => t.Email).HasColumnName("Email");
            this.Property(t => t.IdDoUsuarioIceScrum).HasColumnName("IdDoUsuarioIceScrum");
            this.Property(t => t.Situacao).HasColumnName("Situacao");
        }
    }
}


text:
#include "camera_color_calibration/controller.hpp"

#include <ros/ros.h>

Controller::Controller(std::string app_name) :
  app_name_(app_name) {
}

void Controller::CreateView(int argc, char** argv, std::string filename) {
  view_ = new View(this);
  view_->Build(argc, argv, app_name_, filename);
}

void Controller::CreateModel(int argc, char** argv) {
  model_ = new Model(this);
  model_->Build(argc, argv);
}

bool Controller::SpinOnce() {
  ros::spinOnce();
  // Make sure the timer is not stopped
  return true;
}

void Controller::OnNewPixelClass(double x, double y, PixelClass pixel_class) {
  model_->AddNewPixelClass(x, y, pixel_class);
}
void Controller::OnClearTable() {
  model_->ClearTable();
}
void Controller::OnSwitchCamera() {
  model_->SwitchCamera();
}

bool Controller::OnSendTable() {
  return model_->SendTable();
}

void Controller::OnNewRawImage(const sensor_msgs::Image& msg) {
  view_->SetRawImage(msg);
  view_->RedrawArea("raw");
}

void Controller::OnNewSegmentedImage(const sensor_msgs::Image& msg) {
  view_->SetSegmentedImage(msg);
  view_->RedrawArea("segmented");
}


text:
<?php
if (!defined('UPDRAFTPLUS_DIR')) die('No direct access allowed');

/*
This is a small glue class, which makes available all the commands in UpdraftPlus_Commands, and translates the response from UpdraftPlus_Commands (which is either data to return, or a WP_Error) into the format used by UpdraftCentral.
*/

if (class_exists('UpdraftCentral_UpdraftPlus_Commands')) return;

class UpdraftCentral_UpdraftPlus_Commands extends UpdraftCentral_Commands {

	private $commands;

	public function __construct($rc) {

		parent::__construct($rc);

		if (!class_exists('UpdraftPlus_Commands')) include_once(UPDRAFTPLUS_DIR.'/includes/class-commands.php');
		$this->commands = new UpdraftPlus_Commands($this);

	}

	public function __call($name, $arguments) {

		if ('_' == substr($name, 0, 1) || !method_exists($this->commands, $name)) return $this->_generic_error_response('unknown_rpc_command', array(
			'prefix' => 'updraftplus',
			'command' => $name,
			'class' => 'UpdraftCentral_UpdraftPlus_Commands'
		));

		$result = call_user_func_array(array($this->commands, $name), $arguments);

		if (is_wp_error($result)) {

			return $this->_generic_error_response($result->get_error_code(), $result->get_error_data());

		} else {

			return $this->_response($result);

		}

	}

	public function _updraftplus_background_operation_started($msg) {

		// Under-the-hood hackery to allow the browser connection to be closed, and the backup/download to continue

		$rpc_response = $this->rc->return_rpc_message($this->_response($msg));

		$data = isset($rpc_response['data']) ? $rpc_response['data'] : null;

		$ud_rpc = $this->rc->get_current_udrpc();

		$encoded = json_encode($ud_rpc->create_message($rpc_response['response'], $data, true));

		global $updraftplus;
		$updraftplus->close_browser_connection($encoded);

	}
}


text:
<?php

namespace Oro\Bundle\ApiBundle\Tests\Unit\Processor\Subresource\Shared;

use Oro\Bundle\ApiBundle\Model\Error;
use Oro\Bundle\ApiBundle\Processor\Subresource\Shared\NormalizeParentEntityClass;
use Oro\Bundle\ApiBundle\Request\DataType;
use Oro\Bundle\ApiBundle\Tests\Unit\Processor\Subresource\GetSubresourceProcessorTestCase;

class NormalizeParentEntityClassTest extends GetSubresourceProcessorTestCase
{
    /** @var \PHPUnit_Framework_MockObject_MockObject */
    protected $valueNormalizer;

    /** @var \PHPUnit_Framework_MockObject_MockObject */
    protected $resourcesProvider;

    /** @var NormalizeParentEntityClass */
    protected $processor;

    protected function setUp()
    {
        parent::setUp();

        $this->valueNormalizer = $this->getMockBuilder('Oro\Bundle\ApiBundle\Request\ValueNormalizer')
            ->disableOriginalConstructor()
            ->getMock();
        $this->resourcesProvider = $this->getMockBuilder('Oro\Bundle\ApiBundle\Provider\ResourcesProvider')
            ->disableOriginalConstructor()
            ->getMock();

        $this->processor = new NormalizeParentEntityClass(
            $this->valueNormalizer,
            $this->resourcesProvider
        );
    }

    public function testProcessWhenParentClassNameIsNotSet()
    {
        $this->processor->process($this->context);

        $this->assertEquals(
            [
                Error::createValidationError(
                    'entity type constraint',
                    'The parent entity class must be set in the context.'
                )
            ],
            $this->context->getErrors()
        );
    }

    public function testProcessWhenParentClassAlreadyNormalized()
    {
        $this->context->setParentClassName('Test\Class');

        $this->valueNormalizer->expects($this->never())
            ->method('normalizeValue');

        $this->processor->process($this->context);
    }

    public function testConvertParentEntityTypeToEntityClass()
    {
        $this->context->setParentClassName('test');

        $this->valueNormalizer->expects($this->once())
            ->method('normalizeValue')
            ->with($this->context->getParentClassName(), DataType::ENTITY_CLASS, $this->context->getRequestType())
            ->willReturn('Test\Class');
        $this->resourcesProvider->expects($this->once())
            ->method('isResourceAccessible')
            ->with('Test\Class', $this->context->getVersion(), $this->context->getRequestType())
            ->willReturn(true);

        $this->processor->process($this->context);

        $this->assertSame('Test\Class', $this->context->getParentClassName());
    }

    /**
     * @expectedException \Oro\Bundle\ApiBundle\Exception\ResourceNotAccessibleException
     */
    public function testProcessForNotAccessibleParentEntityType()
    {
        $this->context->setParentClassName('test');

        $this->valueNormalizer->expects($this->once())
            ->method('normalizeValue')
            ->with($this->context->getParentClassName(), DataType::ENTITY_CLASS, $this->context->getRequestType())
            ->willReturn('Test\Class');
        $this->resourcesProvider->expects($this->once())
            ->method('isResourceAccessible')
            ->with('Test\Class', $this->context->getVersion(), $this->context->getRequestType())
            ->willReturn(false);

        $this->processor->process($this->context);
    }

    public function testProcessForInvalidParentEntityType()
    {
        $this->context->setParentClassName('test');

        $this->valueNormalizer->expects($this->once())
            ->method('normalizeValue')
            ->with($this->context->getParentClassName(), DataType::ENTITY_CLASS, $this->context->getRequestType())
            ->willThrowException(new \Exception('some error'));

        $this->processor->process($this->context);

        $this->assertNull($this->context->getParentClassName());
        $this->assertEquals(
            [
                Error::createValidationError('entity type constraint', 'Unknown parent entity type: test.')
            ],
            $this->context->getErrors()
        );
    }
}


text:
package com.sfl.pms.persistence.repositories.payment.method.group;

import com.sfl.pms.persistence.repositories.payment.method.AbstractPaymentMethodDefinitionRepository;
import com.sfl.pms.services.currency.model.Currency;
import com.sfl.pms.services.payment.method.model.PaymentMethodGroupType;
import com.sfl.pms.services.payment.method.model.group.GroupPaymentMethodDefinition;
import com.sfl.pms.services.payment.provider.model.PaymentProviderType;
import org.springframework.stereotype.Repository;

import javax.annotation.Nonnull;

/**
 * User: Ruben Dilanyan
 * Company: SFL LLC
 * Date: 7/25/15
 * Time: 2:03 PM
 */
@Repository
public interface GroupPaymentMethodDefinitionRepository extends AbstractPaymentMethodDefinitionRepository<GroupPaymentMethodDefinition> {

    /**
     * Finds group payment method definition using payment method group, currency and payment provider
     *
     * @param paymentMethodGroupType
     * @param currency
     * @param paymentProviderType
     * @return groupPaymentMethodDefinition
     */
    GroupPaymentMethodDefinition findByPaymentMethodGroupTypeAndCurrencyAndPaymentProviderType(@Nonnull final PaymentMethodGroupType paymentMethodGroupType, @Nonnull final Currency currency, @Nonnull final PaymentProviderType paymentProviderType);
}


text:
#ifndef _PSEUDOFS_H_INCLUDED
#define _PSEUDOFS_H_INCLUDED

#include <sys/jail.h>

/*
 * Opaque structures
 */
struct mntarg;
struct mount;
struct nameidata;
struct proc;
struct sbuf;
struct statfs;
struct thread;
struct uio;
struct vfsconf;
struct vnode;

/*
 * Limits and constants
 */
#define PFS_NAMELEN		24
#define PFS_FSNAMELEN		16	/* equal to MFSNAMELEN */
#define PFS_DELEN		(8 + PFS_NAMELEN)

typedef enum {
	pfstype_none = 0,
	pfstype_root,
	pfstype_dir,
	pfstype_this,
	pfstype_parent,
	pfstype_file,
	pfstype_symlink,
	pfstype_procdir
} pfs_type_t;

/*
 * Flags
 */
#define PFS_RD		0x0001	/* readable */
#define PFS_WR		0x0002	/* writeable */
#define PFS_RDWR	(PFS_RD|PFS_WR)
#define PFS_RAWRD	0x0004	/* raw reader */
#define	PFS_RAWWR	0x0008	/* raw writer */
#define PFS_RAW		(PFS_RAWRD|PFS_RAWWR)
#define PFS_PROCDEP	0x0010	/* process-dependent */

/*
 * Data structures
 */
struct pfs_info;
struct pfs_node;
struct pfs_bitmap;

/*
 * Init / uninit callback
 */
#define PFS_INIT_ARGS \
	struct pfs_info *pi, struct vfsconf *vfc
#define PFS_INIT_ARGNAMES \
	pi, vfc
#define PFS_INIT_PROTO(name) \
	int name(PFS_INIT_ARGS);
typedef int (*pfs_init_t)(PFS_INIT_ARGS);

/*
 * Filler callback
 * Called with proc held but unlocked
 */
#define PFS_FILL_ARGS \
	struct thread *td, struct proc *p, struct pfs_node *pn, \
	struct sbuf *sb, struct uio *uio
#define PFS_FILL_ARGNAMES \
	td, p, pn, sb, uio
#define PFS_FILL_PROTO(name) \
	int name(PFS_FILL_ARGS);
typedef int (*pfs_fill_t)(PFS_FILL_ARGS);

/*
 * Attribute callback
 * Called with proc locked
 */
struct vattr;
#define PFS_ATTR_ARGS \
	struct thread *td, struct proc *p, struct pfs_node *pn, \
	struct vattr *vap
#define PFS_ATTR_ARGNAMES \
	td, p, pn, vap
#define PFS_ATTR_PROTO(name) \
	int name(PFS_ATTR_ARGS);
typedef int (*pfs_attr_t)(PFS_ATTR_ARGS);

struct pfs_bitmap;		/* opaque */

/*
 * Visibility callback
 * Called with proc locked
 */
#define PFS_VIS_ARGS \
	struct thread *td, struct proc *p, struct pfs_node *pn
#define PFS_VIS_ARGNAMES \
	td, p, pn
#define PFS_VIS_PROTO(name) \
	int name(PFS_VIS_ARGS);
typedef int (*pfs_vis_t)(PFS_VIS_ARGS);

/*
 * Ioctl callback
 * Called with proc locked
 */
#define PFS_IOCTL_ARGS \
	struct thread *td, struct proc *p, struct pfs_node *pn, \
	unsigned long cmd, void *data
#define PFS_IOCTL_ARGNAMES \
	td, p, pn, cmd, data
#define PFS_IOCTL_PROTO(name) \
	int name(PFS_IOCTL_ARGS);
typedef int (*pfs_ioctl_t)(PFS_IOCTL_ARGS);

/*
 * Getextattr callback
 * Called with proc locked
 */
#define PFS_GETEXTATTR_ARGS \
	struct thread *td, struct proc *p, struct pfs_node *pn, \
	int attrnamespace, const char *name, struct uio *uio,	\
	size_t *size, struct ucred *cred
#define PFS_GETEXTATTR_ARGNAMES \
	td, p, pn, attrnamespace, name, uio, size, cred
#define PFS_GETEXTATTR_PROTO(name) \
	int name(PFS_GETEXTATTR_ARGS);
struct ucred;
typedef int (*pfs_getextattr_t)(PFS_GETEXTATTR_ARGS);

/*
 * Last-close callback
 * Called with proc locked
 */
#define PFS_CLOSE_ARGS \
	struct thread *td, struct proc *p, struct pfs_node *pn
#define PFS_CLOSE_ARGNAMES \
	td, p, pn
#define PFS_CLOSE_PROTO(name) \
	int name(PFS_CLOSE_ARGS);
typedef int (*pfs_close_t)(PFS_CLOSE_ARGS);

/*
 * Destroy callback
 */
#define PFS_DESTROY_ARGS \
	struct pfs_node *pn
#define PFS_DESTROY_ARGNAMES \
	pn
#define PFS_DESTROY_PROTO(name) \
	int name(PFS_DESTROY_ARGS);
typedef int (*pfs_destroy_t)(PFS_DESTROY_ARGS);

/*
 * pfs_info: describes a pseudofs instance
 *
 * The pi_mutex is only used to avoid using the global subr_unit lock for
 * unrhdr.  The rest of struct pfs_info is only modified while Giant is
 * held (during vfs_init() and vfs_uninit()).
 */
struct pfs_info {
	char			 pi_name[PFS_FSNAMELEN];
	pfs_init_t		 pi_init;
	pfs_init_t		 pi_uninit;

	/* members below this line are initialized at run time*/
	struct pfs_node		*pi_root;
	struct mtx		 pi_mutex;
	struct unrhdr		*pi_unrhdr;
};

/*
 * pfs_node: describes a node (file or directory) within a pseudofs
 *
 * - Fields marked (o) are protected by the node's own mutex.
 * - Fields marked (p) are protected by the node's parent's mutex.
 * - Remaining fields are not protected by any lock and are assumed to be
 *   immutable once the node has been created.
 *
 * To prevent deadlocks, if a node's mutex is to be held at the same time
 * as its parent's (e.g. when adding or removing nodes to a directory),
 * the parent's mutex must always be acquired first.  Unfortunately, this
 * is not enforcable by WITNESS.
 */
struct pfs_node {
	char			 pn_name[PFS_NAMELEN];
	pfs_type_t		 pn_type;
	int			 pn_flags;
	struct mtx		 pn_mutex;
	void			*pn_data;		/* (o) */

	pfs_fill_t		 pn_fill;
	pfs_ioctl_t		 pn_ioctl;
	pfs_close_t		 pn_close;
	pfs_attr_t		 pn_attr;
	pfs_vis_t		 pn_vis;
	pfs_getextattr_t	 pn_getextattr;
	pfs_destroy_t		 pn_destroy;

	struct pfs_info		*pn_info;
	u_int32_t		 pn_fileno;		/* (o) */

	struct pfs_node		*pn_parent;		/* (o) */
	struct pfs_node		*pn_nodes;		/* (o) */
	struct pfs_node		*pn_next;		/* (p) */
};

/*
 * VFS interface
 */
int		 pfs_mount	(struct pfs_info *pi, struct mount *mp);
int		 pfs_cmount	(struct mntarg *ma, void *data, uint64_t flags);
int		 pfs_unmount	(struct mount *mp, int mntflags);
int		 pfs_root	(struct mount *mp, int flags,
				 struct vnode **vpp);
int		 pfs_statfs	(struct mount *mp, struct statfs *sbp);
int		 pfs_init	(struct pfs_info *pi, struct vfsconf *vfc);
int		 pfs_uninit	(struct pfs_info *pi, struct vfsconf *vfc);

/*
 * Directory structure construction and manipulation
 */
struct pfs_node	*pfs_create_dir	(struct pfs_node *parent, const char *name,
				 pfs_attr_t attr, pfs_vis_t vis,
				 pfs_destroy_t destroy, int flags);
struct pfs_node	*pfs_create_file(struct pfs_node *parent, const char *name,
				 pfs_fill_t fill, pfs_attr_t attr,
				 pfs_vis_t vis, pfs_destroy_t destroy,
				 int flags);
struct pfs_node	*pfs_create_link(struct pfs_node *parent, const char *name,
				 pfs_fill_t fill, pfs_attr_t attr,
				 pfs_vis_t vis, pfs_destroy_t destroy,
				 int flags);
struct pfs_node	*pfs_find_node	(struct pfs_node *parent, const char *name);
void		 pfs_purge	(struct pfs_node *pn);
int		 pfs_destroy	(struct pfs_node *pn);

/*
 * Now for some initialization magic...
 */
#define PSEUDOFS(name, version, jflag)					\
									\
static struct pfs_info name##_info = {					\
	#name,								\
	name##_init,							\
	name##_uninit,							\
};									\
									\
static int								\
_##name##_mount(struct mount *mp) {					\
        if (jflag && !prison_allow(curthread->td_ucred, jflag))		\
                return (EPERM);						\
	return pfs_mount(&name##_info, mp);				\
}									\
									\
static int								\
_##name##_init(struct vfsconf *vfc) {					\
	return pfs_init(&name##_info, vfc);				\
}									\
									\
static int								\
_##name##_uninit(struct vfsconf *vfc) {					\
	return pfs_uninit(&name##_info, vfc);				\
}									\
									\
static struct vfsops name##_vfsops = {					\
	.vfs_cmount =		pfs_cmount,				\
	.vfs_init =		_##name##_init,				\
	.vfs_mount =		_##name##_mount,			\
	.vfs_root =		pfs_root,				\
	.vfs_statfs =		pfs_statfs,				\
	.vfs_uninit =		_##name##_uninit,			\
	.vfs_unmount =		pfs_unmount,				\
};									\
VFS_SET(name##_vfsops, name, VFCF_SYNTHETIC | (jflag ? VFCF_JAIL : 0));	\
MODULE_VERSION(name, version);						\
MODULE_DEPEND(name, pseudofs, 1, 1, 1);

#endif


text:
module Construqt
  module Flavour
    module Nixian
      module Tastes
        module Systemd
          class DhcpClient
            def render(iface, taste_type, taste)
            end
            def activate(ctx)
              @context = ctx
              self
            end
          end
          add(Entities::DhcpClient, DhcpClient)
        end
      end
    end
  end
end


text:
package hudson.model;

/**
 * Partial {@link Action} implementation that doesn't have any UI presence.
 *
 * <p>
 * This class can be used as a convenient base class, when you use
 * {@link Action} for just storing data associated with a build.
 *
 * @author Kohsuke Kawaguchi
 * @since 1.188
 */
public abstract class InvisibleAction implements Action {
    public final String getIconFileName() {
        return null;
    }

    public final String getDisplayName() {
        return null;
    }

    public final String getUrlName() {
        return null;
    }
}


text:
package com.metova.android.util.concurrent;

import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;

import android.os.Handler;
import android.os.Looper;

/**
 * As a general rule, this thread pool should be used for all situations
 * a separate thread is needed to do work.
 */
public class GlobalThreadPool {

    private static final ThreadPool threadPool;
    private static final Handler handler;

    private GlobalThreadPool() {

    }

    static {
        handler = new Handler( Looper.getMainLooper() );
        threadPool = new ThreadPool();
    }

    /**
     * Executes the given Runnable at some time in the future on the UI thread.
     * @param task the action to be executed
     */
    public static boolean invokeOnUiThread( Runnable task ) {

        return handler.post( task );
    }

    /**
     * Executes the given Runnable after the specified delay on the UI thread.
     * @param task the action to be executed
     */
    public static boolean invokeOnUiThread( Runnable task, long delayMillis ) {

        return handler.postDelayed( task, delayMillis );
    }

    /**
     * Submits a given Runnable for execution and returns a Future object representing
     * that task.
     * @param task the action to be executed
     * @param result the result to return once the task has finished execution
     * @see {@link ThreadPoolExecutor#submit(Runnable, Object)}
     * @see {@link Future}
     */
    public static <T> Future<T> submit( Runnable task, T result ) {

        return threadPool.submit( task, result );
    }

    /**
     * Removes the task from the worker queue if it's present. If successful, this task will not be executed.
     * This will fail if the task doesn't exist in the worker queue or if the task is already executing.
     * @param task the task to remove
     * @return true if the task was removed
     * @see #invoke(Runnable)
     * @see ThreadPoolExecutor#remove(Runnable)
     */
    public static boolean remove( Runnable task ) {

        return threadPool.remove( task );
    }

    /**
     * Executes the given Runnable at some time in the future on another thread.
     * @param task the action to be executed
     * @see #remove(Runnable)
     * @see {@link ThreadPoolExecutor#execute(Runnable)}
     */
    public static void invoke( Runnable task ) {

        threadPool.execute( task );
    }

    /**
     * Sets the amount of threads managed by the thread pool. This can be set at any time, as the thread pool
     * will shrink or grow to accomodate the new size. It is recommended that if you need to grow or shrink
     * the thread pool for a subset of operations to set the pool size back to its default value once that subset has
     * been executed.
     *

     * Default is 10.
     * @param poolSize the new size
     * @see ThreadPoolExecutor#setCorePoolSize(int)
     */
    public static void setPoolSize( int poolSize ) {

        threadPool.setCorePoolSize( poolSize );
        threadPool.setMaximumPoolSize( poolSize );
    }
}


text:
<!-- 2017-12-07 -->

Welcome to another issue of Haskell Weekly!
Haskell is a safe, purely functional programming language with a fast, concurrent runtime.
This is a weekly summary of what's going on in its community.

## Featured

-   [Stack 1.6.1](https://groups.google.com/d/msg/haskell-stack/pRZAMkBlx8U/LrDrGPB8AAAJ)

    Stack, a cross-platform program for developing Haskell projects, released version 1.6.1.

-   [Reflecting on Haskell in 2017](http://www.stephendiehl.com/posts/haskell_2018.html)

    > Haskell has had a great year and 2017 was defined by vast quantities of new code, including 14,000 new Haskell projects on Github. The amount of writing this year was voluminous and my list of interesting work is eight times as large as last year.

-   [Stack and nightly breakage](https://www.snoyman.com/blog/2017/12/stack-and-nightly-breakage)

    > I'm sure a number of readers have already seen something about the situation around Stack and Stackage Nightly/GHC 8.2. I tried to clarify how this happened on the relevant Github issue, plus the GHC Trac ticket, but thought I'd reshare as a blog post for others who are interested.

-   [Pure functional validation in a nutshell](https://medium.com/blacklane-engineering/pure-functional-validation-64a7885d22ac)

    > Why should you care about typed, functional programming? The data validation example sort of makes the point on its own: if you care about validating the data that users input into your forms, why shouldn't you care just as much about the data that gets input into your functions?

-   [1 year of Haskell](https://mmhaskell.com/blog/2017/12/4/1-year-of-haskell)

    > This week marks the one year anniversary of Monday Morning Haskell! I've written an awful lot in the past year.

-   [Making two garbage collectors be good neighbors (using linear types)](https://www.tweag.io/posts/2017-11-29-linear-jvm.html)

    > When two garbaged-collected languages share references to the same values, each garbage collector (GC) needs to be careful to not collect these values while the other language has references to them.

-   [MOBA item optimization in Haskell](http://deliberate-software.com/optimization/)

    > I love MOBAs, and I love Haskell. Since Paragon is my current go-to game, I wanted to determine the cards to buy to maximize my damage per second.

-   [Req 1.0.0, HTTP client, and streaming](https://markkarpov.com/post/req-1.0.0-http-client-and-streaming.html)

    > This post is about changes in `req-1.0.0`, some details of how `http-client` works, in particular how it streams response bodies. Even if you do not want to use `req` for some reason, I hope the post still may be interesting.

-   [Receipts printer photo booth](https://trandi.wordpress.com/2017/11/29/receipts-printer-photo-booth/)

    > Several days of struggle didn't yield much for capturing the video stream from a webcam. A few proof of concept libraries, not updated in years, are no match for the Python ones, which proves again that what matters is not really how "good" a programming language is, but its ecosystem!

-   [Finding bugs in Haskell code by proving it](https://www.joachim-breitner.de/blog/734-Finding_bugs_in_Haskell_code_by_proving_it)

    > We have used `hs-to-coq` on various examples, as described in our CPP'18 paper, but it is high-time to use it for real.

## Jobs

-   [Confer Health seeking Software Engineer in Boston](https://jobs.lever.co/lumiohealth.com/6c004fba-e034-4b5f-8c5c-dce928b46f24)

    > We're a small, world-class team combining Silicon Valley urgency with East Coast science. We just closed a large Series A led by one of Silicon Valley's best investors and we're looking to add a third person to our software team, so come work with us!

Are you looking to hire a Haskell developer?
If so, [advertise with us](/advertising.html)!

## In brief

-   [Answering r/haskell: How to unit test code that uses polymorphic interfaces?](https://deque.blog/2017/12/01/answering-r-haskell-how-to-unit-test-code-that-uses-polymorphic-interfaces/)
-   [Applicative functors and data validation](https://carlosmchica.github.io/applicatives-validation/)
-   [Applicative functors in Haskell](https://medium.com/lazy-eval/applicative-functors-in-haskell-f509e1c764d3)
-   [Book review: "Programming in Haskell" by Graham Hutton (2nd ed.)](https://eli.thegreenplace.net/2017/book-review-programming-in-haskell-by-graham-hutton-2nd-ed/)
-   [Constructing dependent vectors](https://ipfs.io/ipfs/QmT9BRYANsGddN52eMsC3JGNwStbda5h8Zirm2gCmyjb8p/blog/constructing-vectors/)
-   [Debugging Church numerals in Haskell](http://www.hansdieterhiep.nl/tutorials/debugging-church-numerals-in-haskell/)
-   [Introduction to golden testing](https://ro-che.info/articles/2017-12-04-golden-tests)
-   [Preprocessing](https://www.arcadianvisions.com/blog/2017/hpp.html)
-   [Using Haskell on the frontend](http://blog.vmchale.com/article/haskell-frontend)
-   [ZuriHac 2018: Registration now open](https://mail.haskell.org/pipermail/haskell/2017-December/025310.html)

## Package of the week

This week's package of the week is [Warp](https://www.stackage.org/nightly-2017-12-07/package/warp-3.2.13),
a fast, light-weight web server for WAI applications.

## Call for participation

-   [codeworld: Bookmarks in Guide](https://github.com/google/codeworld/issues/569)
-   [duckling: Debugging tools for classifiers](https://github.com/facebook/duckling/issues/114)
-   [idris-vimscript: Choose optimisations to enable based on command-line arguments](https://github.com/owickstrom/idris-vimscript/issues/7)
-   [shakespeare: Many functions in shakespeare are undocumented](https://github.com/yesodweb/shakespeare/issues/213)

## Events

-   December 7: Raleigh Haskell Meetup: [(hack . yack)](https://www.meetup.com/Raleigh-Haskell-Meetup/events/245546893/)
-   December 11: Karlsruhe Haskell Lerngruppe: [Typen und Typklassen: Kapitel 6](https://www.meetup.com/Karlsruhe-Haskell-Lerngruppe/events/244433365/)
-   December 12: FP AMS: [Second category theory study group meetup](https://www.meetup.com/fp-ams/events/244922609/)
-   December 13: Sydney Haskell User Group: [Haskell Programming From First Principles Study Group](https://www.meetup.com/SydneyHaskell/events/245485224/)
-   December 14: Las Vegas Functional Programming User Group: [Functional Programming Meetup](https://www.meetup.com/las-vegas-functional-programming/events/245590893/)


text:
title: Event Handlers Are Not Raised
page_title: Event Handlers Are Not Raised - RadButton
description: Check our Web Forms article about Event Handlers Are Not Raised.
slug: button/troubleshooting/event-handlers-are-not-raised
tags: event,handlers,are,not,raised
published: True
position: 2
---

# Event Handlers Are Not Raised

When RadCompression is enabled and you are using .NET 4.0, event handlers might not be raised in a default document in IIS 7 or IIS 7.5 Integrated Mode, **which could break the normal work of RadButton**.

This problem is caused by a breaking change in .NET 4.0 described in this official [ASP.NET Breaking Changes](https://www.asp.net/learn/whitepapers/aspnet4/breaking-changes#0.1**Toc256770154) section. To workaround it one can set **preCondition="managedHandler"** for the RadCompression module. You may also need to remove the **runAllManagedModulesForAllRequests** setting from your web.config if you have it (or set it to false).

## See Also

 * [RadButton Known Issues in IE6 and IE7]({%slug button/troubleshooting/radbutton-known-issues-in-ie6-and-ie7%})

 * [RadButton Not Performing Postback]({%slug button/troubleshooting/radbutton-not-performing-postback%})

 * [Client-side Click Event Handler Is Not Executed]({%slug button/troubleshooting/client-side-click-event-handler-is-not-executed%})


text:
class Survey < ActiveRecord::Base
  belongs_to :decision
  attr_accessible :a_element_id, :a_value, :b_element_id, :b_value, :decision_id, :a_value_row, :a_value_col, :b_value_row, :b_value_col
end


text:
namespace Poco {
namespace Util {

class Util_API TimerTask: public Poco::RefCountedObject, public Poco::Runnable
	/// A task that can be scheduled for one-time or
	/// repeated execution by a Timer.
	///
	/// This is an abstract class. Subclasses must override the run() member
	/// function to implement the actual task logic.
{
public:
	typedef Poco::AutoPtr<TimerTask> Ptr;

	TimerTask();
		/// Creates the TimerTask.

	void cancel();
		/// Cancels the execution of the timer.
		/// If the task has been scheduled for one-time execution and has
		/// not yet run, or has not yet been scheduled, it will never run.
		/// If the task has been scheduled for repeated execution, it will never
		/// run again. If the task is running when this call occurs, the task
		/// will run to completion, but will never run again.
		///
		/// Warning: A TimerTask that has been cancelled must not be scheduled again.
		/// An attempt to do so results in a Poco::Util::IllegalStateException being thrown.

	bool isCancelled() const;
		/// Returns true iff the TimerTask has been cancelled by a call
		/// to cancel().

	Poco::Timestamp lastExecution() const;
		/// Returns the time of the last execution of the timer task.
		///
		/// Returns 0 if the timer has never been executed.

protected:
	~TimerTask();
		/// Destroys the TimerTask.

private:
	TimerTask(const TimerTask&);
	TimerTask& operator = (const TimerTask&);

	Poco::Timestamp _lastExecution;
	bool _isCancelled;

	friend class TaskNotification;
};

//
// inlines
//
inline bool TimerTask::isCancelled() const
{
	return _isCancelled;
}

inline Poco::Timestamp TimerTask::lastExecution() const
{
	return _lastExecution;
}

} } // namespace Poco::Util

#endif // Util_TimerTask_INCLUDED


text:
module.exports = simon;

function simon(world, steps, callback) {
    // Optional first argument
    if (typeof steps === 'function') {
        callback = steps;
        steps = world;
        world = {};
    }
    var step;
    executeStep();
    function executeStep() {
        step = steps.shift();
        // No more steps, we're done
        if (!step) {
            return callback();
        }
        // sync step
        if (step.length == 1) {
            step(world);
            return executeStep();
        }
        // async step
        step(world, function(err) {
            if (err) return callback(err);
            executeStep();
        })
    }
}


text:
var tabs = require('sdk/tabs');
var timers = require('sdk/timers');
var timeout = -1;

tabs.on('activate', () => {
  timers.clearTimeout(timeout);
  if (!tabs.activeTab.isPinned)
    timeout = timers.setTimeout(() => {
      let newIndex = 0;
      for (let tab in tabs)
        if (tab.isPinned)
          newIndex++;
      tabs.activeTab.index = newIndex;
    }, 1000);
});

exports.onUnload = (reason) => { timers.clearTimeout(timeout); }


text:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("Test Module for BUILDLet PInvoke Class Library")]
[assembly: AssemblyDescription("Test Module for BUILDLet PInvoke Class Library")]
[assembly: AssemblyConfiguration("")]
// [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Test Module for BUILDLet PInvoke Class Library")]
// [assembly: AssemblyCopyright("")]
// [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照できなくなります。このアセンブリ内で COM から型にアクセスする必要がある場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]

// このプロジェクトが COM に公開される場合、次の GUID がタイプ ライブラリの ID になります。
[assembly: Guid("793f15be-5792-4feb-bdc0-4123dff951dd")]

// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// すべての値を指定するか、以下のように '*' を使用してビルド番号とリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
// [assembly: AssemblyFileVersion("1.0.0.0")]


text:
FROM golang:1.6

RUN go get github.com/ian-kent/websysd

EXPOSE 7050

ENTRYPOINT ["/go/bin/websysd"]


text:
define(
   ({
    timeout: "Limit czasu",
    highlightLocation: "Wyróżnij lokalizację",
    useTracking: "Uważaj na zmiany lokalizacji",
    warning: "Nieprawidłowe dane wejściowe"
  })
);


text:
[MySQL](https://MySQL.org) is one of the most popular database servers in the world. Notable users include Wikipedia, Facebook and Google.

## Introduction

This chart bootstraps a single node MySQL deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites

- Kubernetes 1.6+ with Beta APIs enabled
- PV provisioner support in the underlying infrastructure

## Installing the Chart

To install the chart with the release name `my-release`:

```bash
$ helm install --name my-release stable/mysql
```

The command deploys MySQL on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.

By default a random password will be generated for the root user. If you'd like to set your own password change the mysqlRootPassword
in the values.yaml.

You can retrieve your root password by running the following command. Make sure to replace [YOUR_RELEASE_NAME]:

    printf $(printf '\%o' `kubectl get secret [YOUR_RELEASE_NAME]-mysql -o jsonpath="{.data.mysql-root-password[*]}"`)

> **Tip**: List all releases using `helm list`

## Uninstalling the Chart

To uninstall/delete the `my-release` deployment:

```bash
$ helm delete my-release
```

The command removes all the Kubernetes components associated with the chart and deletes the release.

## Configuration

The following tables lists the configurable parameters of the MySQL chart and their default values.

| Parameter                  | Description                        | Default                                                    |
| -----------------------    | ---------------------------------- | ---------------------------------------------------------- |
| `imageTag`                 | `mysql` image tag.                 | Most recent release                                        |
| `imagePullPolicy`          | Image pull policy                  | `IfNotPresent`                                             |
| `mysqlRootPassword`        | Password for the `root` user.      | `nil`                                                      |
| `mysqlUser`                | Username of new user to create.    | `nil`                                                      |
| `mysqlPassword`            | Password for the new user.         | `nil`                                                      |
| `mysqlDatabase`            | Name for new database to create.   | `nil`                                                      |
| `persistence.enabled`      | Create a volume to store data      | true                                                       |
| `persistence.size`         | Size of persistent volume claim    | 8Gi RW                                                     |
| `persistence.storageClass` | Type of persistent volume claim    | nil  (uses alpha storage class annotation)                 |
| `persistence.accessMode`   | ReadWriteOnce or ReadOnly          | ReadWriteOnce                                              |
| `persistence.existingClaim`| Name of existing persistent volume | `nil`
| `persistence.subPath`      | Subdirectory of the volume to mount | `nil`
| `resources`                | CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `100m`                              |
| `configurationFiles`       | List of mysql configuration files  | `nil`

Some of the parameters above map to the env variables defined in the [MySQL DockerHub image](https://hub.docker.com/_/mysql/).

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

```bash
$ helm install --name my-release \
  --set mysqlLRootPassword=secretpassword,mysqlUser=my-user,mysqlPassword=my-password,mysqlDatabase=my-database \
    stable/mysql
```

The above command sets the MySQL `root` account password to `secretpassword`. Additionally it creates a standard database user named `my-user`, with the password `my-password`, who has access to a database named `my-database`.

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

```bash
$ helm install --name my-release -f values.yaml stable/mysql
```

> **Tip**: You can use the default [values.yaml](values.yaml)

## Persistence

The [MySQL](https://hub.docker.com/_/mysql/) image stores the MySQL data and configurations at the `/var/lib/mysql` path of the container.

By default a PersistentVolumeClaim is created and mounted into that directory. In order to disable this functionality
you can change the values.yaml to disable persistence and use an emptyDir instead.

> *"An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node. When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever."*

## Custom MySQL configuration files

The [MySQL](https://hub.docker.com/_/mysql/) image accepts custom configuration files at the path `/etc/mysql/conf.d`. If you want to use a customized MySQL configuration, you can create your alternative configuration files by passing the file contents on the `configurationFiles` attribute. Note that according to the MySQL documentation only files ending with `.cfn` are loaded.

```yaml
configurationFiles:
  mysql.cnf: |-
    [mysqld]
    skip-host-cache
    skip-name-resolve
    sql-mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
  mysql_custom.cnf: |-
    [mysqld]
```


text:
package config

// Fetcher provides an interface to get typed information out of a configuration
// "source". These sources could be the OS enviornment, a .gitconfig, or even
// just a `map`.
type Fetcher interface {
	// Get returns the string value associated with a given key and a bool
	// determining if the key exists.
	Get(key string) (val string, ok bool)

	// All returns a copy of all the key/value pairs for the current environment.
	All() map[string]string
}