text:
package org.buildoop.storm;

import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.StormSubmitter;
import backtype.storm.generated.AlreadyAliveException;
import backtype.storm.generated.InvalidTopologyException;
import backtype.storm.generated.StormTopology;
import backtype.storm.spout.SchemeAsMultiScheme;
import backtype.storm.topology.TopologyBuilder;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Tuple;

import org.apache.storm.hbase.bolt.mapper.SimpleHBaseMapper;
import org.apache.storm.hbase.bolt.HBaseBolt;
import org.buildoop.storm.bolts.AuditParserBolt;
import org.buildoop.storm.bolts.AuditLoginsCounterBolt;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import storm.kafka.BrokerHosts;
import storm.kafka.KafkaSpout;
import storm.kafka.SpoutConfig;
import storm.kafka.StringScheme;
import storm.kafka.ZkHosts;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

import com.hmsonline.storm.contrib.bolt.elasticsearch.ElasticSearchBolt;
import com.hmsonline.storm.contrib.bolt.elasticsearch.mapper.DefaultTupleMapper;
import com.hmsonline.storm.contrib.bolt.elasticsearch.mapper.TupleMapper;
import com.hmsonline.storm.elasticsearch.StormElasticSearchConstants;

public class AuditActiveLoginsTopology {
	public static final Logger LOG = LoggerFactory
			.getLogger(AuditActiveLoginsTopology.class);

	private final BrokerHosts kafkaBrokerHosts;

	public AuditActiveLoginsTopology(String zookeeperHosts) {
		kafkaBrokerHosts = new ZkHosts(zookeeperHosts);
	}

	public StormTopology buildTopology(Properties properties) {

		// Load properties for the storm topology
		String kafkaTopic = properties.getProperty("kafka.topic");

		SpoutConfig kafkaConfig = new SpoutConfig(kafkaBrokerHosts, kafkaTopic, "",	"storm");
		kafkaConfig.scheme = new SchemeAsMultiScheme(new StringScheme());
		TopologyBuilder builder = new TopologyBuilder();

		// Specific audit logs analysis bolts
		AuditLoginsCounterBolt loginCounterbolt = new AuditLoginsCounterBolt();
		AuditParserBolt auditParserBolt = new AuditParserBolt();

		// Elastic search bolt
		TupleMapper tupleMapper = new DefaultTupleMapper();
		ElasticSearchBolt elasticSearchBolt = new ElasticSearchBolt(tupleMapper);

		// Topology scheme: KafkaSpout -> auditParserBolt -> loginCounterBolt -> elasticSearchBolt
		builder.setSpout("KafkaSpout", new KafkaSpout(kafkaConfig), 1);
		builder.setBolt("ParseBolt", auditParserBolt, 1).shuffleGrouping("KafkaSpout");
		builder.setBolt("CountBolt", loginCounterbolt, 1).shuffleGrouping("ParseBolt");
		builder.setBolt("ElasticSearchBolt", elasticSearchBolt, 1)
		.fieldsGrouping("CountBolt", new Fields("id", "index", "type", "document"));

		return builder.createTopology();
	}

	private static List<String> parseZkHosts(String zkNodes) {

		String[] hostsAndPorts = zkNodes.split(",");
		List<String> hosts = new ArrayList<String>(hostsAndPorts.length);

		for (int i = 0; i < hostsAndPorts.length; i++) {
			hosts.add(i, hostsAndPorts[i].split(":")[0]);
		}
		return hosts;
	}

	private static int parseZkPort(String zkNodes) {

		String[] hostsAndPorts = zkNodes.split(",");
		int port = Integer.parseInt(hostsAndPorts[0].split(":")[1]);
		return port;
	}

	private static Properties loadProperties(String propertiesFile) throws Exception {
		Properties properties = new Properties();
		FileInputStream in = new FileInputStream(propertiesFile);
		properties.load(in);
		in.close();

		return properties;
	}

	private static void loadTopologyPropertiesAndSubmit(Properties properties,
			Config config) throws Exception {

		String stormExecutionMode = properties.getProperty("storm.execution.mode","local");
		int stormWorkersNumber = Integer.parseInt(properties.getProperty("storm.workers.number","2"));
		int maxTaskParallism = Integer.parseInt(properties.getProperty("storm.max.task.parallelism","2"));
		String topologyName = properties.getProperty("storm.topology.name","topologyName");
		String zookeeperHosts = properties.getProperty("zookeeper.hosts");
		int topologyBatchEmitMillis = Integer.parseInt(
				properties.getProperty("storm.topology.batch.interval.miliseconds","2000"));

		// How often a batch can be emitted in a Trident topology.
		config.put(Config.TOPOLOGY_TRIDENT_BATCH_EMIT_INTERVAL_MILLIS, topologyBatchEmitMillis);
		config.setNumWorkers(stormWorkersNumber);
		config.setMaxTaskParallelism(maxTaskParallism);

		AuditActiveLoginsTopology auditActiveLoginsTopology = new AuditActiveLoginsTopology(zookeeperHosts);
		StormTopology stormTopology = auditActiveLoginsTopology.buildTopology(properties);

		// Elastic Search specific properties
		config.put(StormElasticSearchConstants.ES_HOST, properties.getProperty("elasticsearch.host", "localhost"));
		config.put(StormElasticSearchConstants.ES_PORT, (Integer.parseInt(properties.getProperty("elasticsearch.port", "9300"))));
		config.put(StormElasticSearchConstants.ES_CLUSTER_NAME, properties.getProperty("elasticsearch.cluster.name"));
		config.put("elasticsearch.index", properties.getProperty("elasticsearch.index"));
		config.put("elasticsearch.type", properties.getProperty("elasticsearch.type"));

		switch (stormExecutionMode){
			case ("cluster"):
				String nimbusHost = properties.getProperty("storm.nimbus.host","localhost");
				String nimbusPort = properties.getProperty("storm.nimbus.port","6627");
				config.put(Config.NIMBUS_HOST, nimbusHost);
				config.put(Config.NIMBUS_THRIFT_PORT, Integer.parseInt(nimbusPort));
				config.put(Config.STORM_ZOOKEEPER_PORT, parseZkPort(zookeeperHosts));
				config.put(Config.STORM_ZOOKEEPER_SERVERS, parseZkHosts(zookeeperHosts));
				StormSubmitter.submitTopology(topologyName, config, stormTopology);
				break;
			case ("local"):
			default:
				int localTimeExecution = Integer.parseInt(properties.getProperty("storm.local.execution.time","20000"));
				LocalCluster cluster = new LocalCluster();
				cluster.submitTopology(topologyName, config, stormTopology);
				Thread.sleep(localTimeExecution);
				cluster.killTopology(topologyName);
				cluster.shutdown();
				System.exit(0);
		}
	}

	public static void main(String[] args) throws Exception {

		String propertiesFile = args[0];
		Properties properties = loadProperties(propertiesFile);
		Config config = new Config();

		loadTopologyPropertiesAndSubmit(properties,config);

	}

}


text:
package com.blockwithme.hacktors;

import javax.annotation.ParametersAreNonnullByDefault;

import com.blockwithme.base40.Enum40;

/**
 * The possible item general categories.
 *
 * @author monster
 */
@ParametersAreNonnullByDefault
public class ItemCategory extends Enum40<ItemCategory> {
    /** serialVersionUID */
    private static final long serialVersionUID = 1258867690868228474L;

    // CHECKSTYLE.OFF: ConstantName
    /** The edible items (eggs are a sub-category). */
    public static final ItemCategory Food = new ItemCategory();
    /** The eggs items (a sub-category of food). */
    public static final ItemCategory Egg = new ItemCategory();
    /** The raw material items. */
    public static final ItemCategory Material = new ItemCategory();
    /** The tool items. */
    public static final ItemCategory Tool = new ItemCategory();
    /** The weapon items. */
    public static final ItemCategory Weapon = new ItemCategory();
    /** The armor items. */
    public static final ItemCategory Armor = new ItemCategory();

    // CHECKSTYLE.ON: ConstantName

    /**  Can this be eaten? */
    public final boolean isEdible() {
        return (this == Food) || (this == Egg);
    }

    /** Default constructor. */
    protected ItemCategory() {
        this(ItemCategory.class);
    }

    /** Constructor for super-classes. */
    protected ItemCategory(final Class<? extends ItemCategory> cls) {
        super(cls);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Handles actions related to GIS MULTIPOINT objects
 *
 * @package PhpMyAdmin-GIS
 */

namespace PMA\libraries\gis;

use \TCPDF;

/**
 * Handles actions related to GIS MULTIPOINT objects
 *
 * @package PhpMyAdmin-GIS
 */
class GISMultipoint extends GISGeometry
{
    // Hold the singleton instance of the class
    private static $_instance;

    /**
     * A private constructor; prevents direct creation of object.
     *
     * @access private
     */
    private function __construct()
    {
    }

    /**
     * Returns the singleton.
     *
     * @return GISMultipoint the singleton
     * @access public
     */
    public static function singleton()
    {
        if (!isset(self::$_instance)) {
            $class = __CLASS__;
            self::$_instance = new $class;
        }

        return self::$_instance;
    }

    /**
     * Scales each row.
     *
     * @param string $spatial spatial data of a row
     *
     * @return array an array containing the min, max values for x and y coordinates
     * @access public
     */
    public function scaleRow($spatial)
    {
        // Trim to remove leading 'MULTIPOINT(' and trailing ')'
        $multipoint
            = mb_substr(
                $spatial,
                11,
                mb_strlen($spatial) - 12
            );

        return $this->setMinMax($multipoint, array());
    }

    /**
     * Adds to the PNG image object, the data related to a row in the GIS dataset.
     *
     * @param string $spatial     GIS MULTIPOINT object
     * @param string $label       Label for the GIS MULTIPOINT object
     * @param string $point_color Color for the GIS MULTIPOINT object
     * @param array  $scale_data  Array containing data related to scaling
     * @param object $image       Image object
     *
     * @return object the modified image object
     * @access public
     */
    public function prepareRowAsPng(
        $spatial,
        $label,
        $point_color,
        $scale_data,
        $image
    ) {
        // allocate colors
        $black = imagecolorallocate($image, 0, 0, 0);
        $red = hexdec(mb_substr($point_color, 1, 2));
        $green = hexdec(mb_substr($point_color, 3, 2));
        $blue = hexdec(mb_substr($point_color, 4, 2));
        $color = imagecolorallocate($image, $red, $green, $blue);

        // Trim to remove leading 'MULTIPOINT(' and trailing ')'
        $multipoint
            = mb_substr(
                $spatial,
                11,
                mb_strlen($spatial) - 12
            );
        $points_arr = $this->extractPoints($multipoint, $scale_data);

        foreach ($points_arr as $point) {
            // draw a small circle to mark the point
            if ($point[0] != '' && $point[1] != '') {
                imagearc($image, $point[0], $point[1], 7, 7, 0, 360, $color);
            }
        }
        // print label for each point
        if ((isset($label) && trim($label) != '')
            && ($points_arr[0][0] != '' && $points_arr[0][1] != '')
        ) {
            imagestring(
                $image,
                1,
                $points_arr[0][0],
                $points_arr[0][1],
                trim($label),
                $black
            );
        }

        return $image;
    }

    /**
     * Adds to the TCPDF instance, the data related to a row in the GIS dataset.
     *
     * @param string $spatial     GIS MULTIPOINT object
     * @param string $label       Label for the GIS MULTIPOINT object
     * @param string $point_color Color for the GIS MULTIPOINT object
     * @param array  $scale_data  Array containing data related to scaling
     * @param TCPDF  $pdf         TCPDF instance
     *
     * @return TCPDF the modified TCPDF instance
     * @access public
     */
    public function prepareRowAsPdf(
        $spatial,
        $label,
        $point_color,
        $scale_data,
        $pdf
    ) {
        // allocate colors
        $red = hexdec(mb_substr($point_color, 1, 2));
        $green = hexdec(mb_substr($point_color, 3, 2));
        $blue = hexdec(mb_substr($point_color, 4, 2));
        $line = array('width' => 1.25, 'color' => array($red, $green, $blue));

        // Trim to remove leading 'MULTIPOINT(' and trailing ')'
        $multipoint
            = mb_substr(
                $spatial,
                11,
                mb_strlen($spatial) - 12
            );
        $points_arr = $this->extractPoints($multipoint, $scale_data);

        foreach ($points_arr as $point) {
            // draw a small circle to mark the point
            if ($point[0] != '' && $point[1] != '') {
                $pdf->Circle($point[0], $point[1], 2, 0, 360, 'D', $line);
            }
        }
        // print label for each point
        if ((isset($label) && trim($label) != '')
            && ($points_arr[0][0] != '' && $points_arr[0][1] != '')
        ) {
            $pdf->SetXY($points_arr[0][0], $points_arr[0][1]);
            $pdf->SetFontSize(5);
            $pdf->Cell(0, 0, trim($label));
        }

        return $pdf;
    }

    /**
     * Prepares and returns the code related to a row in the GIS dataset as SVG.
     *
     * @param string $spatial     GIS MULTIPOINT object
     * @param string $label       Label for the GIS MULTIPOINT object
     * @param string $point_color Color for the GIS MULTIPOINT object
     * @param array  $scale_data  Array containing data related to scaling
     *
     * @return string the code related to a row in the GIS dataset
     * @access public
     */
    public function prepareRowAsSvg($spatial, $label, $point_color, $scale_data)
    {
        $point_options = array(
            'name'         => $label,
            'class'        => 'multipoint vector',
            'fill'         => 'white',
            'stroke'       => $point_color,
            'stroke-width' => 2,
        );

        // Trim to remove leading 'MULTIPOINT(' and trailing ')'
        $multipoint
            = mb_substr(
                $spatial,
                11,
                mb_strlen($spatial) - 12
            );
        $points_arr = $this->extractPoints($multipoint, $scale_data);

        $row = '';
        foreach ($points_arr as $point) {
            if ($point[0] != '' && $point[1] != '') {
                $row .= '<circle cx="' . $point[0] . '" cy="'
                    . $point[1] . '" r="3"';
                $point_options['id'] = $label . rand();
                foreach ($point_options as $option => $val) {
                    $row .= ' ' . $option . '="' . trim($val) . '"';
                }
                $row .= '/>';
            }
        }

        return $row;
    }

    /**
     * Prepares JavaScript related to a row in the GIS dataset
     * to visualize it with OpenLayers.
     *
     * @param string $spatial     GIS MULTIPOINT object
     * @param int    $srid        Spatial reference ID
     * @param string $label       Label for the GIS MULTIPOINT object
     * @param string $point_color Color for the GIS MULTIPOINT object
     * @param array  $scale_data  Array containing data related to scaling
     *
     * @return string JavaScript related to a row in the GIS dataset
     * @access public
     */
    public function prepareRowAsOl(
        $spatial,
        $srid,
        $label,
        $point_color,
        $scale_data
    ) {
        $style_options = array(
            'pointRadius'  => 3,
            'fillColor'    => '#ffffff',
            'strokeColor'  => $point_color,
            'strokeWidth'  => 2,
            'label'        => $label,
            'labelYOffset' => -8,
            'fontSize'     => 10,
        );
        if ($srid == 0) {
            $srid = 4326;
        }
        $result = $this->getBoundsForOl($srid, $scale_data);

        // Trim to remove leading 'MULTIPOINT(' and trailing ')'
        $multipoint
            = mb_substr(
                $spatial,
                11,
                mb_strlen($spatial) - 12
            );
        $points_arr = $this->extractPoints($multipoint, null);

        $result .= 'vectorLayer.addFeatures(new OpenLayers.Feature.Vector('
            . 'new OpenLayers.Geometry.MultiPoint('
            . $this->getPointsArrayForOpenLayers($points_arr, $srid)
            . '), null, ' . json_encode($style_options) . '));';

        return $result;
    }

    /**
     * Generate the WKT with the set of parameters passed by the GIS editor.
     *
     * @param array  $gis_data GIS data
     * @param int    $index    Index into the parameter object
     * @param string $empty    Multipoint does not adhere to this
     *
     * @return string WKT with the set of parameters passed by the GIS editor
     * @access public
     */
    public function generateWkt($gis_data, $index, $empty = '')
    {
        $no_of_points = isset($gis_data[$index]['MULTIPOINT']['no_of_points'])
            ? $gis_data[$index]['MULTIPOINT']['no_of_points'] : 1;
        if ($no_of_points < 1) {
            $no_of_points = 1;
        }
        $wkt = 'MULTIPOINT(';
        for ($i = 0; $i < $no_of_points; $i++) {
            $wkt .= ((isset($gis_data[$index]['MULTIPOINT'][$i]['x'])
                    && trim($gis_data[$index]['MULTIPOINT'][$i]['x']) != '')
                    ? $gis_data[$index]['MULTIPOINT'][$i]['x'] : '')
                . ' ' . ((isset($gis_data[$index]['MULTIPOINT'][$i]['y'])
                    && trim($gis_data[$index]['MULTIPOINT'][$i]['y']) != '')
                    ? $gis_data[$index]['MULTIPOINT'][$i]['y'] : '') . ',';
        }

        $wkt
            = mb_substr(
                $wkt,
                0,
                mb_strlen($wkt) - 1
            );
        $wkt .= ')';

        return $wkt;
    }

    /**
     * Generate the WKT for the data from ESRI shape files.
     *
     * @param array $row_data GIS data
     *
     * @return string the WKT for the data from ESRI shape files
     * @access public
     */
    public function getShape($row_data)
    {
        $wkt = 'MULTIPOINT(';
        for ($i = 0; $i < $row_data['numpoints']; $i++) {
            $wkt .= $row_data['points'][$i]['x'] . ' '
                . $row_data['points'][$i]['y'] . ',';
        }

        $wkt
            = mb_substr(
                $wkt,
                0,
                mb_strlen($wkt) - 1
            );
        $wkt .= ')';

        return $wkt;
    }

    /**
     * Generate parameters for the GIS data editor from the value of the GIS column.
     *
     * @param string  $value Value of the GIS column
     * @param integer $index Index of the geometry
     *
     * @return array params for the GIS data editor from the value of the GIS column
     * @access public
     */
    public function generateParams($value, $index = -1)
    {
        $params = array();
        if ($index == -1) {
            $index = 0;
            $data = GISGeometry::generateParams($value);
            $params['srid'] = $data['srid'];
            $wkt = $data['wkt'];
        } else {
            $params[$index]['gis_type'] = 'MULTIPOINT';
            $wkt = $value;
        }

        // Trim to remove leading 'MULTIPOINT(' and trailing ')'
        $points
            = mb_substr(
                $wkt,
                11,
                mb_strlen($wkt) - 12
            );
        $points_arr = $this->extractPoints($points, null);

        $no_of_points = count($points_arr);
        $params[$index]['MULTIPOINT']['no_of_points'] = $no_of_points;
        for ($i = 0; $i < $no_of_points; $i++) {
            $params[$index]['MULTIPOINT'][$i]['x'] = $points_arr[$i][0];
            $params[$index]['MULTIPOINT'][$i]['y'] = $points_arr[$i][1];
        }

        return $params;
    }

    /**
     * Overridden to make sure that only the points having valid values
     * for x and y coordinates are added.
     *
     * @param array  $points_arr x and y coordinates for each point
     * @param string $srid       spatial reference id
     *
     * @return string JavaScript for adding an array of points to OpenLayers
     * @access protected
     */
    protected function getPointsArrayForOpenLayers($points_arr, $srid)
    {
        $ol_array = 'new Array(';
        foreach ($points_arr as $point) {
            if ($point[0] != '' && $point[1] != '') {
                $ol_array .= $this->getPointForOpenLayers($point, $srid) . ', ';
            }
        }

        $olArrayLength = mb_strlen($ol_array);
        if (mb_substr($ol_array, $olArrayLength - 2) == ', ') {
            $ol_array = mb_substr($ol_array, 0, $olArrayLength - 2);
        }
        $ol_array .= ')';

        return $ol_array;
    }
}


text:
package com.microsoft.azure.management.network.v2019_07_01;

import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/**
 * Rule condition of type network.
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleConditionType", defaultImpl = NetworkRuleCondition.class)
@JsonTypeName("NetworkRuleCondition")
public class NetworkRuleCondition extends FirewallPolicyRuleCondition {
    /**
     * Array of FirewallPolicyRuleConditionNetworkProtocols.
     */
    @JsonProperty(value = "ipProtocols")
    private List<FirewallPolicyRuleConditionNetworkProtocol> ipProtocols;

    /**
     * List of source IP addresses for this rule.
     */
    @JsonProperty(value = "sourceAddresses")
    private List<String> sourceAddresses;

    /**
     * List of destination IP addresses or Service Tags.
     */
    @JsonProperty(value = "destinationAddresses")
    private List<String> destinationAddresses;

    /**
     * List of destination ports.
     */
    @JsonProperty(value = "destinationPorts")
    private List<String> destinationPorts;

    /**
     * Get array of FirewallPolicyRuleConditionNetworkProtocols.
     *
     * @return the ipProtocols value
     */
    public List<FirewallPolicyRuleConditionNetworkProtocol> ipProtocols() {
        return this.ipProtocols;
    }

    /**
     * Set array of FirewallPolicyRuleConditionNetworkProtocols.
     *
     * @param ipProtocols the ipProtocols value to set
     * @return the NetworkRuleCondition object itself.
     */
    public NetworkRuleCondition withIpProtocols(List<FirewallPolicyRuleConditionNetworkProtocol> ipProtocols) {
        this.ipProtocols = ipProtocols;
        return this;
    }

    /**
     * Get list of source IP addresses for this rule.
     *
     * @return the sourceAddresses value
     */
    public List<String> sourceAddresses() {
        return this.sourceAddresses;
    }

    /**
     * Set list of source IP addresses for this rule.
     *
     * @param sourceAddresses the sourceAddresses value to set
     * @return the NetworkRuleCondition object itself.
     */
    public NetworkRuleCondition withSourceAddresses(List<String> sourceAddresses) {
        this.sourceAddresses = sourceAddresses;
        return this;
    }

    /**
     * Get list of destination IP addresses or Service Tags.
     *
     * @return the destinationAddresses value
     */
    public List<String> destinationAddresses() {
        return this.destinationAddresses;
    }

    /**
     * Set list of destination IP addresses or Service Tags.
     *
     * @param destinationAddresses the destinationAddresses value to set
     * @return the NetworkRuleCondition object itself.
     */
    public NetworkRuleCondition withDestinationAddresses(List<String> destinationAddresses) {
        this.destinationAddresses = destinationAddresses;
        return this;
    }

    /**
     * Get list of destination ports.
     *
     * @return the destinationPorts value
     */
    public List<String> destinationPorts() {
        return this.destinationPorts;
    }

    /**
     * Set list of destination ports.
     *
     * @param destinationPorts the destinationPorts value to set
     * @return the NetworkRuleCondition object itself.
     */
    public NetworkRuleCondition withDestinationPorts(List<String> destinationPorts) {
        this.destinationPorts = destinationPorts;
        return this;
    }

}


text:
import * as React from 'react';

import ProgressBar from '../../containers/widget/progress/progressBar';
import Filter from '../../containers/form/task/filter.form';
import TaskAddForm from '../../containers/form/task/add.form';
import CategoryAddForm from '../../containers/form/category/add.form';

import { Col, Row } from 'react-bootstrap';
import './widgets.less';

export const Widgets = (): JSX.Element => {
	return (
		<Row>
			<Col xs={6} xsOffset={6} md={4} mdOffset={8} className='todo-search'>
				<Filter />
			</Col>
			<Row className='todo-progressbar'>
				<Col>
					<ProgressBar />
				</Col>
			</Row>
			<Row className='todo-form-container'>
				<Col md={4} className='add-form'>
					<CategoryAddForm />
				</Col>
				<Col mdOffset={8} className='add-form'>
					<TaskAddForm />
				</Col>
			</Row>
		</Row>
	);
};


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Highway Express -Dash board</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/sb-admin.css" rel="stylesheet">

    <link href="css/plugins/morris.css" rel="stylesheet">

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                    Toggle navigation

                </button>
                Highway Express

John Smith

 Yesterday at 4:32 PM

Lorem ipsum dolor sit amet, consectetur...

John Smith

 Yesterday at 4:32 PM

Lorem ipsum dolor sit amet, consectetur...

John Smith

 Yesterday at 4:32 PM

Lorem ipsum dolor sit amet, consectetur...

                            Read All New Messages

                            Alert Name Alert Badge

                            Alert Name Alert Badge

                            Alert Name Alert Badge

                            Alert Name Alert Badge

                            Alert Name Alert Badge

                            Alert Name Alert Badge

                            View All

                     System Admin

                             Profile

                             Inbox

                             Settings

                             Log Out

                         Home

                         Bus time table

                                 view bus time table

                                 update bus time table

                                 update route time table

                         Notifications

                         Bus schedule

                         Add new

                                 Bus admin

                                 Bus time keeper

                                 Bus /Bus Driver

                                 Bus route

                                 Bus station

                         View and Update

                                 Bus admin

                                 Bus time keepers

                                 Buses /Bus Drivers

                                 Bus routes

                                 Bus stations

                         Setting

                         Contact

                            admin user setting
                            change your password

                                  Home

                                 Contact Us

Chanage user password

                                <form name="changepassword" id="contactForm" novalidate>

										current password
										<input class="form-control" id="currentpassword" type="text">

										New password
										<input class="form-control" id="newpassword" type="text">

										Re-Enter password
										<input class="form-control" id="reenterpassword" type="text">

												<button type="submit" class="btn btn-lg btn-primary">Change password</button>

								</form>


text:
package com.microrisc.simply.iqrf.dpa;

import com.microrisc.simply.Simply;
import com.microrisc.simply.asynchrony.AsynchronousMessagingManager;
import com.microrisc.simply.iqrf.dpa.asynchrony.DPA_AsynchronousMessage;
import com.microrisc.simply.iqrf.dpa.asynchrony.DPA_AsynchronousMessageProperties;
import com.microrisc.simply.iqrf.dpa.broadcasting.services.BroadcastServices;
import com.microrisc.simply.services.ServicesAccessor;

/**
 * Extended Simply interface for access to DPA functionality.
 *
 * @author Michal Konopa
 */
public interface DPA_Simply extends Simply, ServicesAccessor {
    /**
     * Returns access to broadcast services.
     * @return access to broadcast services
     */
    BroadcastServices getBroadcastServices();

    /**
     * Returns manager of asynchronous messaging.
     * @return manager of asynchronous messaging
     */
    AsynchronousMessagingManager<DPA_AsynchronousMessage, DPA_AsynchronousMessageProperties>
        getAsynchronousMessagingManager();
}


text:
package org.apache.hadoop.hive.ql.metadata;

import com.google.common.collect.Lists;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.IMetaStoreClient;
import org.apache.hadoop.hive.metastore.annotation.MetastoreCheckinTest;
import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;
import org.apache.hadoop.hive.metastore.api.Partition;
import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet;
import org.apache.hadoop.hive.metastore.api.PrivilegeGrantInfo;
import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.hadoop.hive.metastore.client.CustomIgnoreRule;
import org.apache.hadoop.hive.metastore.client.TestListPartitions;
import org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder;
import org.apache.hadoop.hive.metastore.client.builder.TableBuilder;
import org.apache.hadoop.hive.metastore.minihms.AbstractMetaStoreService;
import org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy;
import org.apache.hadoop.hive.ql.session.SessionState;
import org.apache.thrift.TException;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static junit.framework.TestCase.assertFalse;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

/**
 * Test class for list partitions related methods on temporary tables.
 */
@RunWith(Parameterized.class)
@Category(MetastoreCheckinTest.class)
public class TestSessionHiveMetastoreClientListPartitionsTempTable
    extends TestListPartitions {

  private HiveConf conf;

  private static final String PART_PRIV = "PARTITION_LEVEL_PRIVILEGE";

  public TestSessionHiveMetastoreClientListPartitionsTempTable(String name, AbstractMetaStoreService metaStore) {
    super(name, metaStore);
    ignoreRule = new CustomIgnoreRule();
  }

  @Before
  public void setUp() throws Exception {
    initHiveConf();
    SessionState.start(conf);
    setClient(Hive.get(conf).getMSC());
    getClient().dropDatabase(DB_NAME, true, true, true);
    getMetaStore().cleanWarehouseDirs();
  }

  private void initHiveConf() throws HiveException {
    conf = Hive.get().getConf();
    conf.setBoolVar(HiveConf.ConfVars.METASTORE_FASTPATH, true);
  }

  @Override
  protected Table createTestTable(IMetaStoreClient client, String dbName, String tableName,
      List<String> partCols, boolean setPartitionLevelPrivileges) throws TException {
    TableBuilder builder =
        new TableBuilder().setDbName(dbName).setTableName(tableName).addCol("id", "int")
            .addCol("name", "string").setTemporary(true);

    partCols.forEach(col -> builder.addPartCol(col, "string"));
    Table table = builder.build(conf);

    if (setPartitionLevelPrivileges) {
      table.putToParameters(PART_PRIV, "true");
    }

    client.createTable(table);
    return table;
  }

  @Override
  protected void addPartition(IMetaStoreClient client, Table table, List<String> values) throws TException {
    PartitionBuilder builder = new PartitionBuilder().inTable(table);
    values.forEach(builder::addValue);
    Partition partition = builder.build(conf);
    if (table.getParameters().containsKey(PART_PRIV) && table.getParameters().get(PART_PRIV).equals("true")) {
      PrincipalPrivilegeSet privileges = new PrincipalPrivilegeSet();
      Map<String, List<PrivilegeGrantInfo>> userPrivileges = new HashMap<>();
      userPrivileges.put(USER_NAME, new ArrayList<>());
      privileges.setUserPrivileges(userPrivileges);

      Map<String, List<PrivilegeGrantInfo>> groupPrivileges = new HashMap<>();
      groupPrivileges.put(GROUP, new ArrayList<>());
      privileges.setGroupPrivileges(groupPrivileges);
      partition.setPrivileges(privileges);
    }
    client.add_partition(partition);
  }

  @Override
  protected void assertAuthInfoReturned(String userName, String group, Partition partition) {
    PrincipalPrivilegeSet privileges = partition.getPrivileges();
    assertNotNull(privileges);
    assertTrue(privileges.getUserPrivileges().containsKey(userName));
    assertTrue(privileges.getGroupPrivileges().containsKey(group));
  }

  @Test
  @Override
  public void testListPartitionsAllHighMaxParts() throws Exception {
    List<List<String>> testData = createTable4PartColsParts(getClient());
    List<Partition> partitions = getClient().listPartitions(DB_NAME, TABLE_NAME, (short) 101);
    assertFalse(partitions.isEmpty());
    assertEquals(testData.size(), partitions.size());
  }

  @Test(expected = MetaException.class)
  @Override
  public void testListPartitionsAllNullTblName() throws Exception {
    super.testListPartitionsAllNullTblName();
  }

  @Test(expected = MetaException.class)
  @Override
  public void testListPartitionsAllNullDbName() throws Exception {
    super.testListPartitionsAllNullDbName();
  }

  @Test
  @Override
  public void testListPartitionSpecsHighMaxParts() throws Exception {
    List<List<String>> testValues = createTable4PartColsParts(getClient());
    PartitionSpecProxy partitionSpecs = getClient().listPartitionSpecs(DB_NAME, TABLE_NAME, 101);
    assertNotNull(partitionSpecs);
    assertPartitionsSpecProxy(partitionSpecs, testValues);
  }

  @Test(expected = MetaException.class)
  @Override
  public void testListPartitionSpecsNullTblName() throws Exception {
    super.testListPartitionSpecsNullTblName();
  }

  @Test
  @Override
  public void testListPartitionsWithAuthHighMaxParts() throws Exception {
    createTable4PartColsPartsAuthOn(getClient());
    List<Partition> partitions =
        getClient().listPartitionsWithAuthInfo(DB_NAME, TABLE_NAME, (short) 101, USER_NAME, Lists.newArrayList(GROUP));
    partitions.forEach(p -> assertAuthInfoReturned(USER_NAME, GROUP, p));
  }

  @Test(expected = NoSuchObjectException.class)
  @Override
  public void testListPartitionsWithAuthNullGroup()
      throws Exception {
    super.testListPartitionsWithAuthNullGroup();
  }

  @Test(expected = NoSuchObjectException.class)
  @Override
  public void testListPartitionsWithAuthByValues()
      throws Exception {
    super.testListPartitionsWithAuthByValues();
  }

  @Test(expected = MetaException.class)
  @Override
  public void testListPartitionsWithAuthByValuesNullDbName()
      throws Exception {
    super.testListPartitionsWithAuthByValuesNullDbName();
  }

  @Test(expected = MetaException.class)
  @Override
  public void testListPartitionsWithAuthByValuesNullTblName()
      throws Exception {
    super.testListPartitionsWithAuthByValuesNullTblName();
  }

  @Test(expected = MetaException.class)
  @Override
  public void testListPartitionNamesNullDbName() throws Exception {
    super.testListPartitionNamesNullDbName();
  }

  @Test(expected = MetaException.class)
  @Override
  public void testListPartitionNamesNullTblName() throws Exception {
    super.testListPartitionNamesNullTblName();
  }

  @Test(expected = MetaException.class)
  @Override
  public void testListPartitionNamesByValuesNullDbName()
      throws Exception {
    super.testListPartitionNamesByValuesNullDbName();
  }

  @Test(expected = MetaException.class)
  @Override
  public void testListPartitionNamesByValuesNullTblName()
      throws Exception {
    super.testListPartitionNamesByValuesNullTblName();
  }

  @Test
  @Override
  public void testListPartitionsWithAuthNoTable() throws Exception {
    getClient().listPartitionsWithAuthInfo(DB_NAME, TABLE_NAME, (short)-1, "", Lists.newArrayList());
  }

}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>HockeyAppUploadParams - FAKE - F# Make</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Steffen Forkmann, Mauricio Scheffer, Colin Bull">

    <link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">

    <link type="text/css" rel="stylesheet" href="http://fsharp.github.io/FAKE/content/style.css" />

fsharp.org

github page

FAKE - F# Make

HockeyAppUploadParams

The HockeyApp parameter type
Based on http://support.hockeyapp.net/kb/api/api-apps#upload-app

Record Fields

Record Field	Description

            ApiToken

            Signature: string

(Required) API token

            BuildServerUrl

            Signature: string

Set to the URL of the build job on your build server

            CommitSHA

            Signature: string

Set to the git commit sha for this build

            DownloadStatus

            Signature: DownloadStatusOption

Release download status (can only be set with full-access tokens)

            Dsym

            Signature: string

file data for dsym (IOS: *.dysm.zip or Android: mapping.txt)

            File

            Signature: string

(Required) file data for the build (.ipa or .apk)

            Mandatory

            Signature: MandatoryOption

Set version as mandatory

            Notes

            Signature: string

Release notes for the build

            NotesType

            Signature: NoteType

Release notes type for the build

            Notify

            Signature: NotifyOption

Set the notify option

            OwnerId

            Signature: string

Set the owner of the app

            Private

            Signature: bool

Set to true to enable the private download page (default is false)

            ReleaseType

            Signature: ReleaseType

Set the release type of the app

            RepositoryUrl

            Signature: string

Set to your source repository

FAKE - F# Make

Home page

Get FAKE - F# Make via NuGet

Source Code on GitHub

License (Apache 2)

Release Notes

Contributing to FAKE - F# Make

Who is using FAKE?

Ask a question

Tutorials

Getting started

NuGet package restore

Using FxCop in a build

Generating AssemblyInfo

Create NuGet packages

Running specific targets

Running FAKE from command line

Running targets in parallel

Using the F# compiler from FAKE

Creating custom tasks

TeamCity integration

Running canopy tests

Octopus Deploy

TypeScript support

Azure WebJobs support

Azure Cloud Services support

Android publisher

File Watcher

Fake.Deploy

Reference

API Reference


text:
/*************************************************************************
	> File Name: functions.cpp
	> Author: Alrash
	> Mail: kasukuikawai@gmail.com
	> Created Time: Mon 11 Jul 2016 10:20:45 PM CST
 ************************************************************************/

#include <vector>
#include <string>
#include <iostream>

std::vector<std::string> split(const std::string &str, const std::string &pattern){
    //存放结果
    std::vector<std::string> result;
    int pos = 0, size = str.size();

    //提取并存放结果
    for (int i = 0; i < size; i++){
        pos = str.find(pattern, i);

        if (pos < size && pos != std::string::npos){
            result.push_back(str.substr(i, pos - i));
            i = pos + pattern.size() - 1;
        }else{
            result.push_back(str.substr(i));
            break;
        }
    }

    return result;
}

//替换所有substr所指字符串
std::string replaceAll(const std::string &str, const std::string &substr, const std::string &repstr){
    std::string result = str;
    int len = substr.size(), pos;

    while ((pos = result.find(substr)) != std::string::npos){
        result.replace(pos, len, repstr);
    }

    return result;
}


text:
namespace {

using ::ash::AccessibilityManager;

void SetAutomationManagerEnabled(content::BrowserContext* context,
                                 bool enabled) {
  DCHECK(context);
  AutomationManagerAura* manager = AutomationManagerAura::GetInstance();
  if (enabled)
    manager->Enable();
  else
    manager->Disable();
}

}  // namespace

AccessibilityControllerClient::AccessibilityControllerClient() {
  ash::AccessibilityController::Get()->SetClient(this);
}

AccessibilityControllerClient::~AccessibilityControllerClient() {
  ash::AccessibilityController::Get()->SetClient(nullptr);
}

void AccessibilityControllerClient::TriggerAccessibilityAlert(
    ash::AccessibilityAlert alert) {
  Profile* profile = ProfileManager::GetActiveUserProfile();
  if (!profile)
    return;

  int msg = 0;
  switch (alert) {
    case ash::AccessibilityAlert::CAPS_ON:
      msg = IDS_A11Y_ALERT_CAPS_ON;
      break;
    case ash::AccessibilityAlert::CAPS_OFF:
      msg = IDS_A11Y_ALERT_CAPS_OFF;
      break;
    case ash::AccessibilityAlert::SCREEN_ON:
      // Enable automation manager when alert is screen-on, as it is
      // previously disabled by alert screen-off.
      SetAutomationManagerEnabled(profile, true);
      msg = IDS_A11Y_ALERT_SCREEN_ON;
      break;
    case ash::AccessibilityAlert::SCREEN_OFF:
      msg = IDS_A11Y_ALERT_SCREEN_OFF;
      break;
    case ash::AccessibilityAlert::WINDOW_MOVED_TO_ANOTHER_DISPLAY:
      msg = IDS_A11Y_ALERT_WINDOW_MOVED_TO_ANOTHER_DISPLAY;
      break;
    case ash::AccessibilityAlert::WINDOW_NEEDED:
      msg = IDS_A11Y_ALERT_WINDOW_NEEDED;
      break;
    case ash::AccessibilityAlert::WINDOW_OVERVIEW_MODE_ENTERED:
      msg = IDS_A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED;
      break;
    case ash::AccessibilityAlert::WORKSPACE_FULLSCREEN_STATE_ENTERED:
      msg = IDS_A11Y_ALERT_WORKSPACE_FULLSCREEN_STATE_ENTERED;
      break;
    case ash::AccessibilityAlert::WORKSPACE_FULLSCREEN_STATE_EXITED:
      msg = IDS_A11Y_ALERT_WORKSPACE_FULLSCREEN_STATE_EXITED;
      break;
    case ash::AccessibilityAlert::NONE:
      msg = 0;
      break;
  }

  if (msg) {
    AutomationManagerAura::GetInstance()->HandleAlert(
        l10n_util::GetStringUTF8(msg));
    // After handling the alert, if the alert is screen-off, we should
    // disable automation manager to handle any following a11y events.
    if (alert == ash::AccessibilityAlert::SCREEN_OFF)
      SetAutomationManagerEnabled(profile, false);
  }
}

void AccessibilityControllerClient::TriggerAccessibilityAlertWithMessage(
    const std::string& message) {
  Profile* profile = ProfileManager::GetActiveUserProfile();
  if (!profile)
    return;

  AutomationManagerAura::GetInstance()->HandleAlert(message);
}

void AccessibilityControllerClient::PlayEarcon(ash::Sound sound_key) {
  AccessibilityManager::Get()->PlayEarcon(
      sound_key, ash::PlaySoundOption::kOnlyIfSpokenFeedbackEnabled);
}

base::TimeDelta AccessibilityControllerClient::PlayShutdownSound() {
  return AccessibilityManager::Get()->PlayShutdownSound();
}

void AccessibilityControllerClient::HandleAccessibilityGesture(
    ax::mojom::Gesture gesture,
    gfx::PointF location) {
  AccessibilityManager::Get()->HandleAccessibilityGesture(gesture, location);
}

bool AccessibilityControllerClient::ToggleDictation() {
  return AccessibilityManager::Get()->ToggleDictation();
}

void AccessibilityControllerClient::SilenceSpokenFeedback() {
  content::TtsController::GetInstance()->Stop();
}

void AccessibilityControllerClient::OnTwoFingerTouchStart() {
  AccessibilityManager::Get()->OnTwoFingerTouchStart();
}

void AccessibilityControllerClient::OnTwoFingerTouchStop() {
  AccessibilityManager::Get()->OnTwoFingerTouchStop();
}

bool AccessibilityControllerClient::ShouldToggleSpokenFeedbackViaTouch() const {
  return AccessibilityManager::Get()->ShouldToggleSpokenFeedbackViaTouch();
}

void AccessibilityControllerClient::PlaySpokenFeedbackToggleCountdown(
    int tick_count) {
  AccessibilityManager::Get()->PlaySpokenFeedbackToggleCountdown(tick_count);
}

void AccessibilityControllerClient::RequestSelectToSpeakStateChange() {
  AccessibilityManager::Get()->RequestSelectToSpeakStateChange();
}

void AccessibilityControllerClient::RequestAutoclickScrollableBoundsForPoint(
    gfx::Point& point_in_screen) {
  AccessibilityManager::Get()->RequestAutoclickScrollableBoundsForPoint(
      point_in_screen);
}

void AccessibilityControllerClient::MagnifierBoundsChanged(
    const gfx::Rect& bounds_in_screen) {
  AccessibilityManager::Get()->MagnifierBoundsChanged(bounds_in_screen);
}

void AccessibilityControllerClient::OnSwitchAccessDisabled() {
  AccessibilityManager::Get()->OnSwitchAccessDisabled();
}

void AccessibilityControllerClient::OnSelectToSpeakPanelAction(
    ash::SelectToSpeakPanelAction action,
    double value) {
  AccessibilityManager::Get()->OnSelectToSpeakPanelAction(action, value);
}

void AccessibilityControllerClient::SetA11yOverrideWindow(
    aura::Window* a11y_override_window) {
  AutomationManagerAura::GetInstance()->SetA11yOverrideWindow(
      a11y_override_window);
}


text:
'use strict';

require('mocha');
var assert = require('assert');
var utils = require('../lib/utils');
var Mode = require('../lib/mode');

describe('mode', function() {
  it('should throw an error when `name` is not defined', function(cb) {
    try {
      Mode();
      cb(new Error('expected an error'));
    } catch (err) {
      assert(err);
      assert.equal(err.message, 'expected options.name to be set');
      cb();
    }
  });

  it('should throw an error when `type` is not valid', function(cb) {
    try {
      Mode({name: 'foo', type: 'bar'});
      cb(new Error('expected an error'));
    } catch (err) {
      assert(err);
      assert.equal(err.message, '"type" must be one of [mode, toggle] but got "bar"');
      cb();
    }
  });

  it('should create a new instance', function() {
    var mode = new Mode({name: 'foo'});
    assert(mode);
    assert.equal(mode instanceof Mode, true);
    assert.equal(mode.name, 'foo');
    assert.deepEqual(mode.type, ['mode']);
    assert.equal(mode.options.name, 'foo');
    assert.deepEqual(mode.options.type, ['mode']);
  });

  it('should create a new instance without `new` keyword', function() {
    var mode = Mode({name: 'foo'});
    assert(mode);
    assert.equal(mode instanceof Mode, true);
    assert.equal(mode.name, 'foo');
    assert.deepEqual(mode.type, ['mode']);
    assert.equal(mode.options.name, 'foo');
    assert.deepEqual(mode.options.type, ['mode']);
  });

  it('should create an instance with a custom `type` option', function() {
    var mode = new Mode({name: 'foo', type: 'toggle'});
    assert(mode);
    assert.equal(mode instanceof Mode, true);
    assert.equal(mode.name, 'foo');
    assert.deepEqual(mode.type, ['toggle']);
    assert.equal(mode.options.name, 'foo');
    assert.deepEqual(mode.options.type, ['toggle']);
  });

  it('should allow setting the name after the instance is created', function() {
    var mode = new Mode({name: 'foo'});
    assert.equal(mode.name, 'foo');
    assert.equal(mode.options.name, 'foo');
    mode.name = 'bar';
    assert.equal(mode.name, 'bar');
    assert.equal(mode.options.name, 'bar');
  });

  it('should have an identity function when `fn` is not passed on `options`', function() {
    var mode = new Mode({name: 'foo'});
    assert.deepEqual(mode.fn.toString(), utils.identity.toString());
  });

  it('should have a custom function when `fn` is passed on `options`', function() {
    var mode = new Mode({
      name: 'foo',
      fn: function(str) {
        return 'foo ' + str;
      }
    });
    assert.equal(mode.fn('bar'), 'foo bar');
  });

  it('should allow setting the `fn` after the instance is created', function() {
    var mode = new Mode({
      name: 'foo',
      fn: function(str) {
        return 'foo ' + str;
      }
    });
    assert.equal(mode.fn('bar'), 'foo bar');
    mode.fn = function(str) {
      return str + ' foo';
    };
    assert.equal(mode.fn('bar'), 'bar foo');
  });

  it('should have a custom inspect function that returns the name', function() {
    var mode = new Mode({name: 'foo'});
    assert.equal(mode.inspect(), 'foo');
  });
});


text:
#include "Instruction.hpp"

namespace SoftWire
{
	class TokenList;

	class InstructionSet
	{
	public:
		InstructionSet();

		virtual ~InstructionSet();

		const Instruction *instruction(int i);

	private:
		struct Entry
		{
			~Entry() {delete instruction;};

			const char *mnemonic;

			Instruction *instruction;
		};

		Instruction *intrinsicMap;

		static Instruction::Syntax instructionSet[];

		static int numInstructions();
		static int numMnemonics();

		void generateIntrinsics();
	};
}

#endif   // SoftWire_InstructionSet_hpp


text:
package org.elasticsearch.spark.rdd

import scala.reflect.ClassTag

import org.apache.commons.logging.LogFactory
import org.apache.spark.TaskContext
import org.elasticsearch.hadoop.cfg.PropertiesSettings
import org.elasticsearch.hadoop.rest.InitializationUtils
import org.elasticsearch.hadoop.rest.RestService
import org.elasticsearch.hadoop.serialization.builder.ValueWriter
import org.elasticsearch.hadoop.serialization.BytesConverter
import org.elasticsearch.hadoop.serialization.field.FieldExtractor
import org.elasticsearch.hadoop.serialization.JdkBytesConverter
import org.elasticsearch.hadoop.util.SettingsUtils
import org.elasticsearch.hadoop.util.ObjectUtils
import org.elasticsearch.spark.serialization.ScalaMapFieldExtractor
import org.elasticsearch.spark.serialization.ScalaMetadataExtractor
import org.elasticsearch.spark.serialization.ScalaValueWriter

private[spark] class EsRDDWriter[T: ClassTag](val serializedSettings: String,
                                              val runtimeMetadata: Boolean = false)
  extends Serializable {

  protected val log = LogFactory.getLog(this.getClass())

  lazy val settings = {
    val settings = new PropertiesSettings().load(serializedSettings);

    InitializationUtils.setValueWriterIfNotSet(settings, valueWriter, log)
    InitializationUtils.setBytesConverterIfNeeded(settings, bytesConverter, log)
    InitializationUtils.setFieldExtractorIfNotSet(settings, fieldExtractor, log)

    settings
  }

  lazy val metaExtractor = new ScalaMetadataExtractor()

  def write(taskContext: TaskContext, data: Iterator[T]) {
    val writer = RestService.createWriter(settings, taskContext.partitionId, -1, log)

    taskContext.addOnCompleteCallback(() => writer.close())

    if (runtimeMetadata) {
      writer.repository.addRuntimeFieldExtractor(metaExtractor)
    }

    while (data.hasNext) {
      writer.repository.writeToIndex(processData(data))
    }
  }

  protected def valueWriter: Class[_ <: ValueWriter[_]] = classOf[ScalaValueWriter]
  protected def bytesConverter: Class[_ <: BytesConverter] = classOf[JdkBytesConverter]
  protected def fieldExtractor: Class[_ <: FieldExtractor] = classOf[ScalaMapFieldExtractor]

  protected def processData(data: Iterator[T]): Any = {
    val next = data.next
    if (runtimeMetadata) {
      //TODO: is there a better way to do this cast
      next match {
        case (k, v) =>
          {
            // use the key to extract metadata
            metaExtractor.setObject(k);
            // return the value to be used as the document
            v
          }
      }
    } else {
      next
    }
  }
}


text:
#ifndef __SMARTBOOK_H__
#define __SMARTBOOK_H__

/* #define HID_CRYPTO                    // enable scratchpad cryptiion (deprecated) */
/* #define SBK_FAKE_BATTERY              // faking 2nd battery data */
#define HID_BUF   64
#define HID_SIZE  8		/* 16               // HID_SIZE = Protocol used Registers count. */
#define KB_MODLEN 8
#define KB_LEN    250
#define HID_COMMAND_PAYLOAD_LEN 6

/* CBUS command define */
#define SCRATCHPAD_OFFSET     0x40
#define WRITEBURST_MAX_LEN    0x8
#define CA_PMU_LEN

/* Category */
#define CA_INPUT_DEV    0x1
#define CA_MISC         0x2
#define CA_PMU          0x80

/* COMMAND */
#define INPUT_MOUSE       0x2
#define INPUT_KEYBOARD    0x3
#define INPUT_TOUCHPAD    0x4
#define MISC_MOUSE        0x2
#define MISC_KEYBOARD     0x3
#define MISC_TOUCHPAD     0x4
#define MISC_UNSUPPORT    0xff
#define MISC_HANDSHAKE    0x3c
#define MISC_LATENCY      0xaa
#define PMU_BATTERY       0x3
#define PMU_SCREEN        0x55

#define ID_LEN            6
/* ID */
#define SMB_SOURCE_ID_0   0x66
#define SMB_SOURCE_ID_1   0x19
#define SMB_SOURCE_ID_2   0x5a
#define SMB_SOURCE_ID_3   0x22
#define SMB_SOURCE_ID_4   0xba
#define SMB_SOURCE_ID_5   0x51
#define SMB_SINK_ID_0     0x22
#define SMB_SINK_ID_1     0x45
#define SMB_SINK_ID_2     0x43
#define SMB_SINK_ID_3     0x69
#define SMB_SINK_ID_4     0x77
#define SMB_SINK_ID_5     0x26

typedef struct {
	unsigned char category;
	unsigned char command;
	unsigned char payload[HID_COMMAND_PAYLOAD_LEN];
} HIDCommand;

typedef enum {
	ImmediateOff = 0,
	DownCount = 1,
	CancelDownCount = 2
} ScreenOffType;

typedef enum {
	Init = 0,
	Ack = 1
} HandshakeType;

typedef enum {
	NotConnect = 0,
	SmartBook = 1,
	MonitorTV = 2,
	Unknown = 3
} SinkType;

#define DEBUG_LOG

#ifdef DEBUG_LOG
#define smb_print(fmt, args...) printk(KERN_INFO "[SMB] " fmt, ##args)
#else
#define smb_print(fmt, args...)
#endif

/* export function */
extern SinkType SMBGetSinkStatus(void);
extern int SiiHandshakeCommand(HandshakeType ComType);
extern void SiiHidSuspend(int flag);

/* others function */
extern void update_battery_2nd_info(int status_2nd, int capacity_2nd, int present_2nd);
extern void RecordStamp(bool dump, char tag);

#endif


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using AcceptPortal.Resources;

namespace AcceptPortal.Models.Evaluation
{
    public class EvaluationProject
    {
        public EvaluationProject() { }

        public EvaluationProject(int id, string name, string description, string org, string _apiKey, string _domain, DateTime _createDate)
        {
            ID = id;
            Name = name;
            Description = description;
            Organization = org;
            ApiKey = _apiKey;
            Domain = _domain;
            CreationDate = _createDate;
            this.AdminToken = string.Empty;
            #region EvaluationInternal
            this.PostEditProjectId = -1;
            this.EvaluationType = -1;
            this.Questions = new List<EvaluationQuestion>();
            this.EvaluationMethod = 0;
            this.DuplicationLogic = 0;
            this.IncludeOwnerRevision = false;
            this.CustomEmailBody = string.Empty;
            this.ProjectCreator = string.Empty;
            #endregion
        }

        public EvaluationProject(int id, string name, string description, string org, string _apiKey, string _domain, DateTime _createDate, string adminToken)
        {
            ID = id;
            Name = name;
            Description = description;
            Organization = org;
            ApiKey = _apiKey;
            Domain = _domain;
            CreationDate = _createDate;
            this.AdminToken = adminToken;
            #region EvaluationInternal
            this.PostEditProjectId = -1;
            this.EvaluationType = -1;
            this.Questions = new List<EvaluationQuestion>();
            this.EvaluationMethod = 0;
            this.DuplicationLogic = 0;
            this.IncludeOwnerRevision = false;
            this.CustomEmailBody = string.Empty;
            this.ProjectCreator = string.Empty;
            #endregion
        }

        #region EvaluationInternal
        public EvaluationProject(int id, string name, string description, string org, string _apiKey, string _domain, DateTime _createDate,
           string adminToken, int type, int postEditprojectId, int evaluationMethod, int duplicationLogic, bool includeOwner, string customEmailBody, string creator)
        {
            ID = id;
            Name = name;
            Description = description;
            Organization = org;
            ApiKey = _apiKey;
            Domain = _domain;
            CreationDate = _createDate;
            this.AdminToken = adminToken;
            this.PostEditProjectId = postEditprojectId;
            this.EvaluationType = type;
            this.Questions = new List<EvaluationQuestion>();

            this.EvaluationMethod = evaluationMethod;
            this.DuplicationLogic = duplicationLogic;
            this.IncludeOwnerRevision = includeOwner;
            this.CustomEmailBody = customEmailBody;
            this.ProjectCreator = creator;

        }
        #endregion

        public int ID { get; set; }
        public virtual DateTime CreationDate { get; set; }
        public virtual string ApiKey { get; set; }

        [Required(ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "EvaluationRequiredField")]
        [StringLength(200, ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "EvaluationMaximumLength200")]
        public virtual string Domain { get; set; }

        [Required(ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "EvaluationRequiredField")]
        [StringLength(50, ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "EvaluationMaximumLength50")]
        public string Name { get; set; }

        [Required(ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "EvaluationRequiredField")]
        [StringLength(25, ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "EvaluationMaximumLength25")]
        public string Organization { get; set; }

        [Required(ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "EvaluationRequiredField")]
        [StringLength(100, ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "EvaluationMaximumLength100")]
        public string Description { get; set; }

        public string Status { get; set; }
        public EvaluationType EvalType { get; set; }
        public List<EvaluationProvider> Providers { get; set; }
        public List<EvaluationLanguagePair> LanguagePairs { get; set; }
        public string AdminToken { get; set; }

        #region EvaluationInternal
        public virtual string ProjectCreator { get; set; }

        [Required]
        [Display(Name = "EvaluationProjectReferencePostEditProjectLabel", ResourceType = typeof(Resources.Global))]
        public int PostEditProjectId { get; set; }

        [Required]
        [Display(Name = "EvaluationProjectTypeLabel", ResourceType = typeof(Resources.Global))]
        public int EvaluationType { get; set; }

        [Required]
        [Display(Name = "EvaluationMethodLabel", ResourceType = typeof(Resources.Global))]
        public int EvaluationMethod { get; set; }

        [Required]
        [Display(Name = "DuplicationLogicLabel", ResourceType = typeof(Resources.Global))]
        public int DuplicationLogic { get; set; }

        [Required]
        [Display(Name = "IncludeOwnerRevisionLabel", ResourceType = typeof(Resources.Global))]
        public bool IncludeOwnerRevision { get; set; }

        [Display(Name = "CustomEmailBodyLabel", ResourceType = typeof(Resources.Global))]
        public string CustomEmailBody { get; set; }

        public List<EvaluationQuestion> Questions { get; set; }
        #endregion

    }
}


text:
module ApplicationHelper
  def bot_name
    @bot_name ||= (Settings.school.name.gsub(' ','') + 'Bot')
  end

  def pretty_browser(user_agent_string)
   [UserAgent.parse(user_agent_string).browser, UserAgent.parse(user_agent_string).platform].join(', ')
  end
end


text:
Prisoner's dilemma problem explored on the command line in Python

# LICENSE
* See [LICENSE](LICENSE)


text:
//
//  GraphLoader.hpp
//
//
//  Created by tim on 23/03/2017.
//
//

#ifndef GraphLoader_hpp
#define GraphLoader_hpp

#include <stdio.h>
#include <memory>

#include "tensorflow/cc/client/client_session.h"
#include "tensorflow/cc/ops/standard_ops.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/public/session.h"

using namespace tensorflow;

#ifdef __cplusplus
extern "C" {
#endif

    namespace ml {

        class GraphLoader {

            std::string rootPath;

            public:

            GraphLoader(std::string rootString);
            ~GraphLoader();

            Status InitializeSessionGraph(std::unique_ptr<Session>* session, tensorflow::GraphDef* graphDef);

            Status LoadGraphDef(tensorflow::GraphDef* graphDef, std::string graphPath);

        };
    }

#ifdef __cplusplus
}
#endif

#endif /* GraphLoader_hpp */


text:
    background: url(../images/login_form_background.png) no-repeat center center;
    position: relative;
    width: 250px;
    margin: 150px auto;
    overflow: auto;
}

#registration_form input[type=submit] {
    position: relative;
    float: right;
}


text:
'Enumeratee' is a very important component in the iteratees API. It provides a way to adapt and transform streams of data. An `Enumeratee` that might sound familiar is the `Enumeratee.map`.

Starting with a simple problem, consider the following `Iteratee`:

```scala
val sum: Iteratee[Int,Int] = Iteratee.fold[Int,Int](0){ (s,e) => s + e }
```

This `Iteratee` takes `Int` objects as input and computes their sum. Now if we have an `Enumerator` like the following:

```scala
val strings: Enumerator[String] = Enumerator("1","2","3","4")
```

Then obviously we can not apply the `strings:Enumerator[String]` to an `Iteratee[Int,Int]`. What we need is transform each `String` to the corresponding `Int` so that the source and the consumer can be fit together. This means we either have to adapt the `Iteratee[Int,Int]` to be `Iteratee[String,Int]`, or adapt the `Enumerator[String]` to be rather an `Enumerator[Int]`.
An `Enumeratee` is the right tool for doing that. We can create an `Enumeratee[String,Int]` and adapt our `Iteratee[Int,Int]` using it:

```scala
//create am Enumeratee using the map method on Enumeratee
val toInt: Enumeratee[String,Int] = Enumeratee.map[String]{ s => s.toInt }

val adaptedIteratee: Iteratee[String,Int] = toInt.transform(sum)

//this works!
strings |>> adaptedIteratee
```
There is a symbolic alternative to the `transform` method, `&>>` which we can use in our previous example:

```scala
strings |>> toInt &>> sum
```

The `map` method will create an 'Enumeratee' that uses a provided `From => To` function to map the input from the `From` type to the `To` type. We can also adapt the `Enumerator`:

```scala
val adaptedEnumerator: Enumerator[Int] = strings.through(toInt)

//this works!
adaptedEnumerator |>> sum
```

Here too, we can use a symbolic version of the `through` method:

```scala
strings &> toInt |>> sum
```

Let's have a look at the `transform` signature defined in the `Enumeratee` trait:

```scala
trait Enumeratee[From, To] {
  def transform[A](inner: Iteratee[To, A]): Iteratee[From, A] = ...
}
```

This is a fairly simple signature, and is the same for `through` defined on an `Enumerator` :

```scala
trait Enumerator[E] {
  def through[To](enumeratee: Enumeratee[E, To]): Enumerator[To]
}
```

The `transform` and `through` methods on an `Enumeratee` and `Enumerator`, respectively, both use the `apply` method on `Enumeratee`, which has a slightly more sophisticated signature:

```scala
trait Enumeratee[From, To] {
  def apply[A](inner: Iteratee[To, A]): Iteratee[From, Iteratee[To, A]] = ...
}
```

Indeed, an `Enumeratee` is more powerful than just transforming an `Iteratee` type. It really acts like an adapter in that you can get back your original `Iteratee` after pushing some different input through an `Enumeratee`. So in the previous example, we can get back the original `Iteratee[Int,Int]` to continue pushing some `Int` objects in:

```scala
val sum:Iteratee[Int,Int] = Iteratee.fold[Int,Int](0){ (s,e) => s + e }

//create am Enumeratee using the map method on Enumeratee
val toInt: Enumeratee[String,Int] = Enumeratee.map[String]{ s => s.toInt }

val adaptedIteratee: Iteratee[String,Iteratee[Int,Int]] = toInt(sum)

// pushing some strings
val afterPushingStrings: Future[Iteratee[String,Iteratee[Int,Int]]] = {
   Enumerator("1","2","3","4") |>> adaptedIteratee
}

val flattenAndRun:Future[Iteratee[Int,Int]] = Iteratee.flatten(afterPushingStrings).run

val originalIteratee = Iteratee.flatten(flattenAndRun)

val moreInts: Future[Iteratee[Int,Int]] = Enumerator(5,6,7) |>> originalIteratee

val sumFuture:Future[Int] = Iteratee.flatten(moreInts).run

sumFuture onSuccess {
  case s => println(s)// eventually prints 28
}
```

That's why we call the adapted (original) `Iteratee` 'inner' and the resulting `Iteratee` 'outer'.

Now that the `Enumeratee` picture is clear, it is important to know that `transform` drops the left input of the inner `Iteratee` when it is `Done`. This means that if we use `Enumeratee.map` to transform input, if the inner `Iteratee` is `Done` with some left transformed input, the `transform` method will just ignore it.

That might have seemed like a bit too much detail, but it is useful for grasping the model.

Back to our example on `Enumeratee.map`, there is a more general method `Enumeratee.mapInput` which, for example, gives the opportunity to return an `EOF` on some signal:

```scala
val toIntOrEnd: Enumeratee[String,Int ] = Enumeratee.mapInput[String] {
  case Input.El("end") => Input.EOF
  case other => other.map(e => e.toInt)
}
```

`Enumeratee.map` and `Enumeratee.mapImput` are pretty straight forward, they operate on a per chunk basis and they convert them. Another useful `Enumeratee` is the `Enumeratee.filter` :

```scala
def filter[E](predicate: E => Boolean): Enumeratee[E, E]
```

The signature is pretty obvious, `Enumeratee.filter` creates an `Enumeratee[E,E]` and it will test each chunk of input using the provided `predicate: E => Boolean` and it passes it along to the inner (adapted) iteratee if it statisfies the predicate:

```scala
val numbers = Enumerator(1,2,3,4,5,6,7,8,9,10)

val onlyOdds = Enumeratee.filter[Int](i => i % 2 != 0)

numbers.through(onlyOdds) |>> sum
```

There are methods, such as `Enumeratee.collect`, `Enumeratee.drop`, `Enumeratee.dropWhile`, `Enumeratee.take`, `Enumeratee.takeWhile`, which work on the same principle.
Let try to use the `Enumeratee.take` on an Input of chunks of bytes:

```scala
// computes the size in bytes
val fillInMemory: Iteratee[Array[Byte],Array[Byte]] = {
  Iteratee.consume[Array[Byte]]()
}

val limitTo100: Enumeratee[Array[Byte],Array[Byte]] = {
  Enumeratee.take[Array[Byte]](100)
}

val limitedFillInMemory: Iteratee[Array[Byte],Array[Byte]] = {
  limitTo100 &>> fillInMemory
}
```

It looks good, but how many bytes are we taking? What would ideally limit the size, in bytes, of loaded input. What we do above is to limit the number of chunks instead, whatever the size of each chunk is. It seems that the `Enumeratee.take` is not enough here since it has no information about the type of input (in our case an `Array[Byte]`) and this is why it can't count what's inside.

Luckily there is a `Traversable` object that offers a set of methods for creating `Enumeratee` instances for Input types that are `TraversableLike`. An `Array[Byte]` is `TraversableLike` and so we can use`Traversable.take`:

```scala
val fillInMemory: Iteratee[Array[Byte],Array[Byte]] = {
  Iteratee.consume[Array[Byte]]()
}

val limitTo100: Enumeratee[Array[Byte],Array[Byte]] = {
  Traversable.take[Array[Byte]](100)
}

// We are sure not to get more than 100 bytes loaded into memory
val limitedFillInMemory: Iteratee[Array[Byte],Array[Byte]] = {
  limitTo100 &>> fillInMemory
}
```

Other `Traversable` methods exist including `Traversable.takeUpTo`, `Traversable.drop`.

Finally, you can compose different `Enumeratee` instances using the `compose` method, which has the symbolic equivalent `><>`. Note that any left input on the `Done` of the composed `Enumeratee` instances will be dropped. However, if you use `composeConcat` aliased `>+>`, any left input will be concatenated.


text:
// DOM-IGNORE-BEGIN

//DOM-IGNORE-END

#ifndef  _FSDEF__H
#define  _FSDEF__H

#include <stdint.h>
#include <stdbool.h>
#include "fileio.h"

#if defined __XC8__
#define PACKED
#else
#define PACKED __attribute__((packed))
#endif

// Private search parameters
typedef enum
{
    FILEIO_SEARCH_ENTRY_EMPTY = 0x01,
    FILEIO_SEARCH_ENTRY_MATCH = 0x02,
    FILEIO_SEARCH_PARTIAL_STRING_SEARCH = 0x04,
    FILEIO_SEARCH_ENTRY_ATTRIBUTES = 0x08
} FILEIO_SEARCH_TYPE;

typedef enum
{
    FILEIO_NAME_INVALID,
    FILEIO_NAME_SHORT,
    FILEIO_NAME_LONG,
    FILEIO_NAME_DOT
} FILEIO_NAME_TYPE;

typedef enum
{
    FILEIO_BUFFER_DATA,
    FILEIO_BUFFER_FAT
} FILEIO_BUFFER_ID;

#define FILEIO_DIRECTORY_ENTRIES_PER_SECTOR     0x0f        // Mask for the number of directory entries in a sector
#define FILEIO_DIRECTORY_ENTRY_SIZE             32          // Directory entry size, in bytes
#define FILEIO_DIRECTORY_ENTRY_EMPTY            0           // Value to indicate that a directory entry is empty
#define FILEIO_DIRECTORY_ENTRY_DELETED          0xE5        // Value to indicate that a directory entry has been deleted

#define FILEIO_FIXED_ROOT_DIRECTORY_CLUSTER_NUMBER      0   // Value of the root directory cluster for non-FAT32 file systems

#define FILEIO_CLUSTER_VALUE_EMPTY          0x0000          // FAT entry for an empty cluster
#define FILEIO_CLUSTER_VALUE_FAT12_EOF      0xfff           // End-of-file cluster value for FAT12
#define FILEIO_CLUSTER_VALUE_FAT16_EOF      0xfff8          // End-of-file cluster value for FAT16
#define FILEIO_CLUSTER_VALUE_FAT32_EOF      0x0ffffff8      // End-of-file cluster value for FAT32
#define FILEIO_CLUSTER_VALUE_FAT12_FAIL     0xffff          // Return value indicating failure for FAT12
#define FILEIO_CLUSTER_VALUE_FAT16_FAIL     0xffff          // Return value indicating failure for FAT16
#define FILEIO_CLUSTER_VALUE_FAT32_FAIL     0x0fffffff      // Return value indicating failure for FAT32
#define FILEIO_CLUSTER_VALUE_FAT12_END      0xff7           // Comparison value to determine if the firmware has reached the last allocatable cluster for FAT12
#define FILEIO_CLUSTER_VALUE_FAT16_END      0xfff7          // Comparison value to determine if the firmware has reached the last allocatable cluster for FAT16
#define FILEIO_CLUSTER_VALUE_FAT32_END      0x0ffffff7      // Comparison value to determine if the firmware has reached the last allocatable cluster for FAT32

#define FILEIO_MEDIA_SECTOR_MBR         0ul         // Master Boot Record sector number

#define FILEIO_FAT_GOOD_SIGN_0          0x55        // FAT signature byte 0
#define FILEIO_FAT_GOOD_SIGN_1          0xAA        // FAT signatury byte 1

typedef struct
{
    uint32_t dataBufferCachedSector;
    uint32_t fatBufferCachedSector;
    struct
    {
        unsigned dataBufferNeedsWrite : 1;
        unsigned fatBufferNeedsWrite : 1;
    } flags;
    void * driveOwner;
} FILEIO_BUFFER_STATUS;

// Structure containing information about a device
typedef struct
{
    uint32_t    firstPartitionSector;       // Logical block address of the first sector of the FAT partition on the device
    uint32_t    firstFatSector;             // Logical block address of the FAT
    uint32_t    firstRootSector;            // Logical block address of the root directory
    uint32_t    firstRootCluster;           // Cluster number of the root directory
    uint32_t    firstDataSector;            // Logical block address of the data section of the device.
    uint32_t    partitionClusterCount;      // The maximum number of clusters in the partition.
    uint32_t    sectorSize;                 // The size of a sector in bytes
    uint32_t    fatSectorCount;             // The number of sectors in the FAT
    uint8_t *   dataBuffer;                 // Address of the global data buffer used to read and write file information
    uint8_t *   fatBuffer;                  // Address of the fat buffer used to read and write sectors of the FAT
    FILEIO_BUFFER_STATUS * bufferStatusPtr;     // Pointer to a buffer status structure
    const FILEIO_DRIVE_CONFIG * driveConfig;    // Configuration information for the drive
    void *      mediaParameters;            // Parameters that describe which instance of the media to use (see [media].h for more information).
    uint16_t    rootDirectoryEntryCount;    // The maximum number of entries in the root directory.
    uint8_t     fatCopyCount;               // The number of copies of the FAT in the partition
    uint8_t     sectorsPerCluster;          // The number of sectors per cluster in the data region
    uint8_t     type;                       // The file system type of the partition (FAT12, FAT16 or FAT32)
    uint8_t     mount;                      // Device mount flag (true if disk was mounted successfully, false otherwise)
    uint8_t     error;                      // Last error that occurred for this drive
    char        driveId;
    uint32_t    currentCluster;             // Current cluster on the drive for file creation purposes.
} PACKED FILEIO_DRIVE;

typedef struct
{
    uint16_t currentEntry;
    uint32_t cluster;
    FILEIO_DRIVE * drive;
} FILEIO_DIRECTORY;

// Directory entry structure
typedef struct
{
    char name[FILEIO_FILE_NAME_LENGTH_8P3_NO_RADIX];        // File name and extension
    uint8_t attributes;                                     // File attributes
    uint8_t reserved0;                                      // Reserved byte
    uint8_t createTimeMs;                                   // Create time (millisecond field)
    uint16_t createTime;                                    // Create time (second, minute, hour field)
    uint16_t createDate;                                    // Create date
    uint16_t accessDate;                                    // Last access date
    uint16_t firstClusterHigh;                              // High word of the entry's first cluster number
    uint16_t writeTime;                                     // Last update time
    uint16_t writeDate;                                     // Last update date
    uint16_t firstClusterLow;                               // Low word of the entry's first cluster number
    uint32_t fileSize;                                      // The 32-bit file size
} FILEIO_DIRECTORY_ENTRY;

// Long File Name Entry
typedef struct
{
   uint8_t sequenceNumber;   // Sequence number,
   uint8_t namePart1[10];    // File name part 1
   uint8_t attributes;    // File attribute
   uint8_t type;		// LFN Type
   uint8_t checksum;     // Checksum
   uint16_t namePart2[6];    // File name part 2
   uint16_t reserved0;	// Reserved for future use
   uint16_t namePart3[2];     // File name part 3
} FILEIO_DIRECTORY_ENTRY_LFN;

// BIOS Parameter Block for a FAT12 partition
typedef struct {
    uint8_t jumpCommand[3];                 // Jump Command
    uint8_t oemName[8];                     // OEM name
    uint16_t bytesPerSector;                // Number of bytes per sector
    uint8_t sectorsPerCluster;              // Number of sectors per cluster
    uint16_t reservedSectorCount;           // Number of reserved sectors at the beginning of the partition
    uint8_t fatCount;                       // Number of FATs on the partition
    uint16_t rootDirectoryEntryCount;       // Number of root directory entries
    uint16_t totalSectors;                  // Total number of sectors
    uint8_t mediaDescriptor;                // Media descriptor
    uint16_t sectorsPerFat;                 // Number of sectors per FAT
    uint16_t sectorsPerTrack;               // Number of sectors per track
    uint16_t headCount;                     // Number of heads
    uint32_t hiddenSectorCount;             // Number of hidden sectors
    uint32_t reserved0;                     // Reserved space
    uint8_t driveNumber;                    // Drive number
    uint8_t reserved1;                      // Reserved space
    uint8_t bootSignature;                  // Boot signature - equal to 0x29
    uint8_t volumeId[4];                    // Volume ID
    uint8_t volLabel[11];                   // Volume Label
    uint8_t fileSystemType[8];              // File system type in ASCII. Not used for determination
} PACKED FILEIO_BIOS_PARAMETER_BLOCK_FAT12;

// BIOS Parameter Block for a FAT16 partition
typedef struct {
    uint8_t jumpCommand[3];                 // Jump Command
    uint8_t oemName[8];                     // OEM name
    uint16_t bytesPerSector;                // Number of bytes per sector
    uint8_t sectorsPerCluster;              // Number of sectors per cluster
    uint16_t reservedSectorCount;           // Number of reserved sectors at the beginning of the partition
    uint8_t fatCount;                       // Number of FATs on the partition
    uint16_t rootDirectoryEntryCount;       // Number of root directory entries
    uint16_t totalSectors16;                // Total number of sectors
    uint8_t mediaDescriptor;                // Media descriptor
    uint16_t sectorsPerFat;                 // Number of sectors per FAT
    uint16_t sectorsPerTrack;               // Number of sectors per track
    uint16_t headCount;                     // Number of heads
    uint32_t hiddenSectorCount;             // Number of hidden sectors
    uint32_t totalSectors32;                // Total sector count (32 bits)
    uint8_t driveNumber;                    // Drive number
    uint8_t reserved0;                      // Reserved space
    uint8_t bootSignature;                  // Boot signature - equal to 0x29
    uint8_t volumeId[4];                    // Volume ID
    uint8_t volumeLabel[11];                // Volume Label
    uint8_t fileSystemType[8];              // File system type in ASCII. Not used for determination
} PACKED FILEIO_BIOS_PARAMETER_BLOCK_FAT16;

// BIOS Parameter Block for a FAT32 parition
typedef struct {
    uint8_t jumpCommand[3];                 // Jump Command
    uint8_t oemName[8];                     // OEM name
    uint16_t bytesPerSector;                // Number of uint8_ts per sector
    uint8_t sectorsPerCluster;              // Number of sectors per cluster
    uint16_t reservedSectorCount;           // Number of reserved sectors at the beginning of the partition
    uint8_t fatCount;                       // Number of FATs on the partition
    uint16_t rootDirectoryEntryCount;       // Number of root directory entries
    uint16_t totalSectors16;                // Total number of sectors
    uint8_t  mediaDescriptor;               // Media descriptor
    uint16_t sectorsPerFat16;               // Number of sectors per FAT (16-bit)
    uint16_t sectorsPerTrack;               // Number of sectors per track
    uint16_t headCount;                     // Number of heads
    uint32_t hiddenSectorCount;             // Number of hidden sectors
    uint32_t totalSectors32;                // Total sector count (32 bits)
    uint32_t sectorsPerFat32;               // Sectors per FAT (32 bits)
    uint16_t mirroringFlags;                // Presently active FAT. Defined by bits 0-3 if bit 7 is 1.
    uint16_t fileSystemVersion;             // FAT32 filesystem version.  Should be 0:0
    uint32_t firstClusterRootDirectory;     // Start cluster of the root directory (should be 2)
    uint16_t fileSystemInformation;         // File system information
    uint16_t backupBootSector;              // Backup boot sector address.
    uint8_t  reserved0[12];                 // Reserved space
    uint8_t  driveNumber;                   // Drive number
    uint8_t  reserved1;                     // Reserved space
    uint8_t  bootSignature;                 // Boot signature - 0x29
    uint8_t  volumeId[4];                   // Volume ID
    uint8_t  volumeLabel[11];               // Volume Label
    uint8_t  fileSystemType[8];             // File system type in ASCII.  Not used for determination
} PACKED FILEIO_BIOS_PARAMETER_BLOCK_FAT32;

// A macro for the boot sector uint8_ts per sector value offset
#define BSI_BPS            11
// A macro for the boot sector sector per cluster value offset
#define BSI_SPC            13
// A macro for the boot sector reserved sector count value offset
#define BSI_RESRVSEC       14
// A macro for the boot sector FAT count value offset
#define BSI_FATCOUNT       16
// A macro for the boot sector root directory entry count value offset
#define BSI_ROOTDIRENTS    17
// A macro for the boot sector 16-bit total sector count value offset
#define BSI_TOTSEC16       19
// A macro for the boot sector sectors per FAT value offset
#define BSI_SPF            22
// A macro for the boot sector 32-bit total sector count value offset
#define BSI_TOTSEC32       32
// A macro for the boot sector boot signature offset
#define BSI_BOOTSIG        38
// A macro for the boot sector file system type string offset
#define BSI_FSTYPE         54
// A macro for the boot sector 32-bit sector per FAT value offset
#define  BSI_FATSZ32       36
// A macro for the boot sector start cluster of root directory value offset
#define  BSI_ROOTCLUS      44
//  A macro for the FAT32 boot sector boot signature offset
#define  BSI_FAT32_BOOTSIG 66
// A macro for the FAT32 boot sector file system type string offset
#define  BSI_FAT32_FSTYPE  82

// Structure of a partition table entry
typedef struct
{
    uint8_t bootDescriptor;                 // The boot descriptor (should be 0x00 in a non-bootable device)
    uint8_t chsFirstParitionSector[3];      // The cylinder-head-sector address of the first sector of the partition
    uint8_t fileSystemDescriptor;           // The file system descriptor
    uint8_t chsLastPartitionSector[3];      // The cylinder-head-sector address of the last sector of the partition
    uint32_t lbaFirstSector;                // The logical block address of the first sector of the partition
    uint32_t sectorCount;                   // The number of sectors in a partition
} PACKED FILEIO_MBR_PARTITION_TABLE_ENTRY;

// Strucure of a device's master boot record
typedef struct
{
    uint8_t bootCode[446];                          // Boot code
    FILEIO_MBR_PARTITION_TABLE_ENTRY partition0;    // The first partition table entry
    FILEIO_MBR_PARTITION_TABLE_ENTRY partition1;    // The second partition table entry
    FILEIO_MBR_PARTITION_TABLE_ENTRY partition2;    // The third partition table entry
    FILEIO_MBR_PARTITION_TABLE_ENTRY partition3;    // The fourth partition table entry
    uint8_t signature0;                             // MBR signature code - equal to 0x55
    uint8_t signature1;                             // MBR signature code - equal to 0xAA
} PACKED FILEIO_MASTER_BOOT_RECORD;

// Structure matching the configuration of a FAT boot sector
typedef struct
{
    // A union of different bios parameter blocks
    union
    {
        FILEIO_BIOS_PARAMETER_BLOCK_FAT32 fat32;
        FILEIO_BIOS_PARAMETER_BLOCK_FAT16 fat16;
        FILEIO_BIOS_PARAMETER_BLOCK_FAT12 fat12;
    } biosParameterBlock;
    uint8_t reserved[512-sizeof(FILEIO_BIOS_PARAMETER_BLOCK_FAT32)-2];      // Reserved space
    uint8_t signature0;                                                     // Boot sector signature code - equal to 0x55
    uint8_t signature1;                                                     // Boot sector signature code - equal to 0xAA
    } PACKED FILEIO_BOOT_SECTOR;

FILEIO_ERROR_TYPE FILEIO_LoadMBR (FILEIO_DRIVE * drive);
FILEIO_ERROR_TYPE FILEIO_LoadBootSector (FILEIO_DRIVE * drive);
uint32_t FILEIO_FullClusterNumberGet(FILEIO_DIRECTORY_ENTRY * entry);
uint32_t FILEIO_ClusterToSector(FILEIO_DRIVE * disk, uint32_t cluster);
FILEIO_DRIVE * FILEIO_CharToDrive (char c);
const char * FILEIO_CacheDirectory (FILEIO_DIRECTORY * dir, const char * path, bool createDirectories);
uint16_t FILEIO_FindNextDelimiter(const char * path);
FILEIO_RESULT FILEIO_DirectoryMakeSingle (FILEIO_DIRECTORY * dir, const char * path);
FILEIO_RESULT FILEIO_DirectoryChangeSingle (FILEIO_DIRECTORY * dir, const char * path);
int FILEIO_DirectoryRemoveSingle (FILEIO_DIRECTORY * directory, char * path);
void FILEIO_FormatShortFileName (const char * fileName, FILEIO_OBJECT * filePtr);
uint8_t FILEIO_FileNameTypeGet (const char * fileName, bool partialStringSearch);
bool FILEIO_ShortFileNameCompare (uint8_t * fileName1, uint8_t * fileName2, uint8_t mode);
uint32_t FILEIO_FATWrite (FILEIO_DRIVE *disk, uint32_t currentCluster, uint32_t value, uint8_t forceWrite);
uint32_t FILEIO_FATRead (FILEIO_DRIVE * disk, uint32_t currentCluster);
FILEIO_DIRECTORY_ENTRY * FILEIO_DirectoryEntryCache (FILEIO_DIRECTORY * directory, FILEIO_ERROR_TYPE * error, uint32_t * currentCluster, uint16_t * currentClusterOffset, uint16_t entryOffset);
bool FILEIO_FlushBuffer (FILEIO_DRIVE * disk, FILEIO_BUFFER_ID bufferId);
FILEIO_ERROR_TYPE FILEIO_EraseClusterChain (uint32_t cluster, FILEIO_DRIVE * disk);
FILEIO_ERROR_TYPE FILEIO_DirectoryEntryCreate (FILEIO_OBJECT * filePtr, uint8_t attributes, bool allocateDataCluster);
FILEIO_ERROR_TYPE FILEIO_ClusterAllocate (FILEIO_DRIVE * drive, uint32_t * cluster, bool eraseCluster);
FILEIO_ERROR_TYPE FILEIO_EraseCluster (FILEIO_DRIVE * drive, uint32_t cluster);
uint32_t FILEIO_FindEmptyCluster (FILEIO_DRIVE * drive);
uint32_t FILEIO_CreateFirstCluster (FILEIO_OBJECT * filePtr);
FILEIO_ERROR_TYPE FILEIO_FindShortFileName (FILEIO_DIRECTORY * directory, FILEIO_OBJECT * filePtr, uint8_t * fileName, uint32_t * currentCluster, uint16_t * currentClusterOffset, uint16_t entryOffset, uint16_t attributes, FILEIO_SEARCH_TYPE mode);
FILEIO_ERROR_TYPE FILEIO_EraseFile (FILEIO_OBJECT * filePtr, uint16_t * entryHandle, bool eraseData);
FILEIO_ERROR_TYPE FILEIO_DirectoryEntryFindEmpty (FILEIO_OBJECT * filePtr, uint16_t * entryOffset);
FILEIO_ERROR_TYPE FILEIO_DirectoryEntryPopulate(FILEIO_OBJECT * filePtr, uint16_t * entryHandle, uint8_t attributes, uint32_t cluster);
FILEIO_ERROR_TYPE FILEIO_NextClusterGet (FILEIO_OBJECT * fo, uint32_t count);
int FILEIO_DotEntryWrite (FILEIO_DRIVE * drive, uint32_t dot, uint32_t dotdot, FILEIO_TIMESTAMP * timeStamp);
void FILEIO_ShortFileNameConvert (char * newFileName, char * oldFileName);
bool FILEIO_IsClusterAllocated(FILEIO_DIRECTORY * directory, FILEIO_OBJECT * filePtr);
int FILEIO_GetSingleBuffer (FILEIO_DRIVE * drive);
FILEIO_ERROR_TYPE FILEIO_ForceRecache (FILEIO_DRIVE * disk);

#endif


text:
package me.vilsol.nmswrapper.wraps.unparsed;

import com.mojang.authlib.GameProfile;
import me.vilsol.nmswrapper.NMSWrapper;
import me.vilsol.nmswrapper.reflections.ReflectiveClass;
import me.vilsol.nmswrapper.reflections.ReflectiveMethod;

import java.io.File;

@ReflectiveClass(name = "GameProfileBanList")
public class NMSGameProfileBanList extends NMSJsonList {

    public NMSGameProfileBanList(Object nmsObject){
        super(nmsObject);
    }

    public NMSGameProfileBanList(File file){
        super("GameProfileBanList", new Object[]{File.class}, new Object[]{file});
    }

    /**
     * TODO Find correct name
     * @see net.minecraft.server.v1_9_R1.GameProfileBanList#a(java.lang.Object)
     */
    @ReflectiveMethod(name = "a", types = {Object.class})
    public String a(Object object){
        return (String) NMSWrapper.getInstance().exec(nmsObject, object);
    }

    /**
     * TODO Find correct name
     * @see net.minecraft.server.v1_9_R1.GameProfileBanList#b(com.mojang.authlib.GameProfile)
     */
    @ReflectiveMethod(name = "b", types = {GameProfile.class})
    public String b(GameProfile gameProfile){
        return (String) NMSWrapper.getInstance().exec(nmsObject, gameProfile);
    }

    /**
     * @see net.minecraft.server.v1_9_R1.GameProfileBanList#isBanned(com.mojang.authlib.GameProfile)
     */
    @ReflectiveMethod(name = "isBanned", types = {GameProfile.class})
    public boolean isBanned(GameProfile gameProfile){
        return (boolean) NMSWrapper.getInstance().exec(nmsObject, gameProfile);
    }

}


text:
namespace LinuxTracing {

class TracerListener {
 public:
  virtual ~TracerListener() = default;
  virtual void OnTid(pid_t tid) = 0;
  virtual void OnContextSwitchIn(const ContextSwitchIn& context_switch_in) = 0;
  virtual void OnContextSwitchOut(
      const ContextSwitchOut& context_switch_out) = 0;
  virtual void OnCallstack(const Callstack& callstack) = 0;
  virtual void OnFunctionCall(const FunctionCall& function_call) = 0;
};

}  // namespace LinuxTracing

#endif  // ORBIT_LINUX_TRACING_TRACER_LISTENER_H_


text:
[![Build Status](https://api.travis-ci.org/CrossKnowledge/SubConverterBundle.svg?branch=master)](https://travis-ci.org/CrossKnowledge/SubConverterBundle)
[![Code Climate](https://codeclimate.com/github/CrossKnowledge/SubConverterBundle.svg)](https://codeclimate.com/github/CrossKnowledge/SubConverterBundle)
[![Total Downloads](https://poser.pugx.org/crossknowledge/subconverter-bundle/downloads.svg)](https://packagist.org/packages/crossknowledge/subconverter-bundle)

CrossKnowledge SubConverter Bundle
===============================

The CrossKnowledge/SubConverterBundle aims to convert subtitles files from and to different formats.

Formats:

- SRT
- WebVTT
- TXT
- TTAF1

Installation
------------

Add the bundle to your project:
```bash
composer require crossknowledge/subconverter-bundle
```
Enable bundle in your kernel:
```php
class AppKernel	extends Kernel
{
  public function registerBundles()
  {
	  $bundles = array(
      ...
      new \CrossKnowledge\SubConverterBundle\CrossKnowledgeSubConverterBundle(),
		);
    ...
```

Now, to convert a subtitles file to a specific format, use can use the following service in your controller:
```php
  $this->get('crossknowledge.subconverterbundle.converter')->convert($inputFilePath, $outputFilePath, $outputFormat, $includeBom);
```

Example
-------

```php
$inputFilePath // "/tmp/my_subtitle.srt"
$outputFilePath // "/tmp/my_subtitle.webvtt"
$outputFormat // ['srt'|'webvtt'|'ttaf1'|'txt']
$includeBom // [true|false]
```

License
-------

This bundle is under the MIT license. See the complete license in the bundle:

    Resources/meta/LICENSE

About
-----

CrossKnowledgeSubConverterBundle is a [CrossKnowledge](https://crossknowledge.com) initiative.
See also the list of [contributors](https://github.com/CrossKnowledge/SubConverterBundle/contributors).
A couple of "distribution" (travis,readme.md, etc..) files are inspired from FriendsOfSymfony/FOSUserBundle's.

Contributions
-------------

Contributions are more than welcome.
We will try to integrate them. As long as there is no BC, anything can be suggested.

Reporting an issue or a feature request
---------------------------------------

Issues and feature requests are tracked in the [Github issue tracker](https://github.com/CrossKnowledge/SubConverterBundle/issues).

When reporting a bug, it may be a good idea to reproduce it in a basic project
built using the [Symfony Standard Edition](https://github.com/symfony/symfony-standard)
to allow developers of the bundle to reproduce the issue by simply cloning it
and following some steps.


text:
/*++

Module Name:

  TestDriver.h

Abstract:

  for Protocol Handler Boot Services Black Box Test

--*/

#ifndef TEST_DRIVER_H
#define TEST_DRIVER_H

#include "Efi.h"
#include <Library/EfiTestLib.h>
#include "ProtocolDefinition.h"

#define MAX_STRING_LEN      250

#include EFI_PROTOCOL_DEFINITION (DevicePath)
#include EFI_PROTOCOL_DEFINITION (DriverBinding)
#include EFI_PROTOCOL_DEFINITION (LoadedImage)
#include EFI_PROTOCOL_DEFINITION (PlatformDriverOverride)
#include EFI_PROTOCOL_DEFINITION (BusSpecificDriverOverride)

#include EFI_TEST_PROTOCOL_DEFINITION (TestProfileLibrary)

typedef struct {
  EFI_HANDLE                  Handle;
  EXTERNAL_DRIVER_PROTOCOL_1  ExProt1;
  EFI_STATUS                  *StatusArray;
  EFI_HANDLE                  *HandleArray;
  EFI_GUID                    *ProtGuidArray;
  UINTN                       ArrayCount;
  UINTN                       Count;
  EFI_HANDLE                  ChildHandle;
} TEST_DRIVER_PRIVATE_DATA;

typedef struct {
  EFI_HANDLE                  Handle;
  EXTERNAL_DRIVER_PROTOCOL_1  ExProt1;
  EFI_DRIVER_BINDING_PROTOCOL DriverBinding;
  EFI_STATUS                  *StatusArray;
  EFI_HANDLE                  *HandleArray;
  EFI_GUID                    *ProtGuidArray;
  UINTN                       ArrayCount;
  UINTN                       Count;
  EFI_HANDLE                  ChildHandle;
} DBINDING_DRIVER_PRIVATE_DATA;

#endif


text:
package lexer

import (
	"github.com/adampresley/sample-ini-parser/services/lexer/lexertoken"
)

/*
This lexer function emits a TOKEN_EQUAL_SIGN then returns
the lexer for value.
*/
func LexEqualSign(lexer *Lexer) LexFn {
	lexer.Pos += len(lexertoken.EQUAL_SIGN)
	lexer.Emit(lexertoken.TOKEN_EQUAL_SIGN)
	return LexValue
}