text:
package io.loli.box.startup;

import java.io.IOException;

import org.glassfish.grizzly.http.server.CLStaticHttpHandler;
import org.glassfish.grizzly.http.server.HttpServer;
import org.glassfish.grizzly.http.server.NetworkListener;
import org.glassfish.grizzly.servlet.ServletRegistration;
import org.glassfish.grizzly.servlet.WebappContext;
import org.glassfish.jersey.servlet.ServletContainer;

/**
 * Created by 叶 on 2014/11/12.
 */
public class LoliBoxServer {

    private LoliBoxConfig config = null;

    private static final String JERSEY_SERVLET_CONTEXT_PATH = "";

    private HttpServer server = null;

    public LoliBoxServer() {
    }

    public LoliBoxServer(String[] args) {
        config = LoliBoxConfig.getInstance(args);
    }

    public void start() throws IOException {
        server = new HttpServer();
        NetworkListener nl = new NetworkListener("Lolibox", config.getAddress(), Integer.parseInt(config.getPort()));
        server.addListener(nl);
        // Add CLStaticHttpHandler to show static files
        server.getServerConfiguration().addHttpHandler(
            new CLStaticHttpHandler(ClasspathHelper.class.getClassLoader(), "/static/"), "/static");
        // Add StaticHttpHandler to show imgs
        server.getServerConfiguration().addHttpHandler(new LoliBoxStaticHttpHandler(config.getSavePath()), "/images");

        WebappContext context = new WebappContext("WebappContext", JERSEY_SERVLET_CONTEXT_PATH);

        // Initialize and register Jersey Servlet
        ServletRegistration registration = context.addServlet("ServletContainer", ServletContainer.class);
        registration.addMapping("/*");

        registration.setInitParameter("javax.ws.rs.Application", LoliBoxAppConfig.class.getName());

        context.deploy(server);
        server.start();
    }

    /**
     * Start server then blocking
     *
     * @throws IOException
     */
    public void startAndWait() throws IOException {
        start();
        System.in.read();
    }

    public static void main(String[] args) throws IOException {
        if (args.length == 1 && (("-h").equals(args[0]) || ("--help").equals(args[0]))) {
            return;
        }
        LoliBoxServer server = new LoliBoxServer(args);
        server.startAndWait();
    }

    public void stop() {
        server.shutdownNow();
    }

}


text:
namespace OTAPI.Callbacks.Terraria
{
    internal static partial class Main
    {
        /// <summary>
        /// This method is ran right before the call to checkXMas to allow
        /// cancelling of the function.
        /// </summary>
        /// <returns>True to continue on to vanilla code, otherwise false</returns>
        internal static bool Christmas()
        {
            var res = Hooks.Game.Christmas?.Invoke();
            if (res.HasValue) return res.Value == HookResult.Continue;
            return true;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef _PLATFORM_FLASH_H_
#define _PLATFORM_FLASH_H_

//
// On MSP430F2471 32kb internal flash memory is present
//
#define MSP430_FLASH_START 0x8000
#define MSP430_FLASH_END   0xFFE0 // End of the flash memory: interrupt vector start
#define MSP430_FLASH_1SIZE  (0xFFFF - MSP430_FLASH_START + 1)

// TODO: extended memory

//
// Flash segment size (this is the minimal flash area that can be erased)
//
#define MSP430_FLASH_SEGMENT_SIZE  512
//
// Flash block size (this is the maximal flash area that can be written at once)
//
#define MSP430_FLASH_BLOCK_SIZE    64

//
// Flash Information Memory range: 256 bytes in four 64-byte segments
//
#define MSP430_FLASH_INFOMEM_START 0x1000
#define MSP430_FLASH_INFOMEM_END   0x10FF
//
// Flash Information Memory segment size
//
#define MSP430_FLASH_INFOMEM_SEGMENT_SIZE  64

#endif


text:
<!DOCTYPE html>

<meta charset="UTF-8">
<title>Person Listeners</title>
<link rel="stylesheet"
	href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"
	integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ=="
	crossorigin="anonymous">

Camel-jbossdatagrid example

This example uses websockets to listen to events from the JBoss
		Data Grid via JBoss Fuse. When connected a table will appear below
		that is populated with events from the Data Grid (via websockets)

Persons are added by providing a CSV file that will be processed
		by JBoss Fuse

How to add persons via command line in a *NIX platform:

		$ echo "99,Diego,Maradona,75" >
			$incomingFolderPath/sample.csv

Or add a list of players in a CSV file like this:

		$ cp best-footballplayers-2015.csv $incomingFolderPath/

		Environment varialbe $incomingFolderPath should be set at build
			time see README.md for more details

	<button type="button" class="btn btn-default" id="connectButton"
		onclick="toogleConnect()">Connect</button>

				ID
				NAME
				AGE


text:
require('../proposals/global-this');

module.exports = require('./4');


text:
<?php

namespace AbelHalo\Titles;

use Illuminate\Support\Facades\Facade as BaseFacade;

class Facade extends BaseFacade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'titles';
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <parent>
        <artifactId>jetty-project</artifactId>
        <groupId>org.eclipse.jetty</groupId>
        <version>7.6.0-SNAPSHOT</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>jetty-websocket</artifactId>
    <name>Jetty :: Websocket</name>

    <properties>
        <bundle-symbolic-name>${project.groupId}.websocket</bundle-symbolic-name>
    </properties>

    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-server</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-util</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-io</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-http</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty.toolchain</groupId>
            <artifactId>jetty-test-helper</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>artifact-jar</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-jar</id>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <configuration>
                    <onlyAnalyze>org.eclipse.jetty.websocket.*</onlyAnalyze>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>


text:
package com.helger.xml.transform;

import java.util.Locale;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.helger.commons.annotation.Translatable;
import com.helger.commons.text.IMultilingualText;
import com.helger.commons.text.display.IHasDisplayText;
import com.helger.commons.text.resolve.DefaultTextResolver;
import com.helger.commons.text.util.TextHelper;

@Translatable
public enum EXMLTransformTexts implements IHasDisplayText
{
  TRANSFORMATION_WARNING ("Transformationswarnung", "Transformation warning"),
  TRANSFORMATION_ERROR ("Transformationsfehler", "Transformation error"),
  TRANSFORMATION_FATAL_ERROR ("Schwerer Transformationsfehler", "Transformation fatal error");

  private final IMultilingualText m_aTP;

  EXMLTransformTexts (@Nonnull final String sDE, @Nonnull final String sEN)
  {
    m_aTP = TextHelper.create_DE_EN (sDE, sEN);
  }

  @Nullable
  public String getDisplayText (@Nonnull final Locale aContentLocale)
  {
    return DefaultTextResolver.getTextStatic (this, m_aTP, aContentLocale);
  }

  @Nonnull
  public IMultilingualText getAsMLT ()
  {
    return m_aTP;
  }
}


text:
package org.tpc.expplus.common.block;

import org.tpc.expplus.ExpPlus;
import org.tpc.expplus.Properties;
import org.tpc.expplus.common.tile.TileExpGenerator;
import org.tpc.expplus.common.tile.TileExpGenerator.State;

import net.minecraft.block.SoundType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class BlockExpGenerator extends BlockExpPlus {

	static {
		ExpPlus.DEBUG("Loading class BlockExpGenerator!");
	}

	public BlockExpGenerator() {
		setCreativeTab(CreativeTabs.REDSTONE);
		setRegistryName(Properties.RESOURCE_BLOCK_EXPGENERATOR);
		setUnlocalizedName(Properties.NAME_EXPGENERATOR);
		setSoundType(SoundType.STONE);

		setHarvestLevel("pickaxe", 2);
	}

	@Override
	public TileEntity createNewTileEntity(World worldIn, int meta) {
		return new TileExpGenerator();
	}

	@Override
	public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
			EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
//		if (worldIn.isRemote)
//			return true;

		if (super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ)) {
			TileEntity tile = worldIn.getTileEntity(pos);
			if ((tile == null) || !(tile instanceof TileExpGenerator))
				return false;

			// Fix for minecraft not updating exp
			// ExpUtil.recalculateExp(playerIn);
			// playerIn.openGui(ExpPlus.instance, Properties.GUI_ID_EXPGENERATOR, worldIn, pos.getX(), pos.getY(), pos.getZ());
			TileExpGenerator generator = ((TileExpGenerator) tile);
			switch(generator.getState()) {
			case Activating:
			case Active:
				generator.setState(State.Deactivating);
				break;
			case Deactivating:
			case Inactive:
				generator.setState(State.Activating);
				break;
			}
			return true;
		}

		return false;
	}

	@Override
	public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) {
		if (worldIn.isRemote)
			return;

		TileEntity tile = worldIn.getTileEntity(pos);
		if ((tile == null) || !(tile instanceof TileExpGenerator))
			return;

		dropXpOnBlockBreak(worldIn, pos, ((TileExpGenerator) tile).getExperience());

		super.onBlockDestroyedByPlayer(worldIn, pos, state);
	}
}


text:
<?php
namespace Elastica\Test\Query;

use Elastica\Query\Type;
use Elastica\Test\Base as BaseTest;

class TypeTest extends BaseTest
{
    /**
     * @group unit
     */
    public function testSetType()
    {
        $typeQuery = new Type();
        $returnValue = $typeQuery->setType('type_name');
        $this->assertInstanceOf('Elastica\Query\Type', $returnValue);
    }

    /**
     * @group unit
     */
    public function testToArray()
    {
        $typeQuery = new Type('type_name');

        $expectedArray = array(
            'type' => array('value' => 'type_name'),
        );

        $this->assertEquals($expectedArray, $typeQuery->toArray());
    }
}


text:
<?php
class Language
{
    private $_ch;
    private $_output;
    public function translate($string,$forWhat,$what)
    {
        $jsonFormat = $this->curlReq("https://translate.yandex.net/api/v1.5/tr.json/translate",
                [
                    'key'=>Config::get('language','api_key'),
                    'text'=>$string,
                    'lang'=>$forWhat.'-'.$what,
                    'format'=>'plain'
                ]);
        $jsonFormat = json_decode($jsonFormat,true);
        if ($jsonFormat['code'] === 200)
            return $jsonFormat['text'][0];
        elseif ($jsonFormat['code'] === 401)
            return 'Geçersiz API Key';
        elseif ($jsonFormat['code'] === 402)
            return 'API Key Engellenmiş';
        elseif ($jsonFormat['code'] === 404)
            return 'Günlük Çeviri Limiti Aşıldı';
        elseif ($jsonFormat['code'] === 413)
            return 'Maksimum Metin Boyutu Aşıldı';
        elseif ($jsonFormat['code'] === 422)
            return 'Metin Çevrilemiyor';
        elseif ($jsonFormat['code'] === 501)
            return 'Belirtilen çeviri yönü desteklenmiyor';
    }
    private function curlReq($url,$data)
    {
        $this->_ch = curl_init($url);
        curl_setopt($this->_ch, CURLOPT_CUSTOMREQUEST, "GET");
        if (is_array($data))
            curl_setopt($this->_ch, CURLOPT_POSTFIELDS, http_build_query($data));
        curl_setopt($this->_ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($this->_ch, CURLOPT_SSL_VERIFYPEER, false);
        $this->_output = curl_exec($this->_ch);
        curl_close($this->_ch);
        return $this->_output;
    }
}


text:
package org.apache.sis.util.iso;

import java.util.Collections;
import org.opengis.util.Type;
import org.opengis.util.MemberName;
import org.opengis.util.NameSpace;
import org.apache.sis.internal.simple.SimpleAttributeType;

// Test imports
import org.junit.Test;
import org.apache.sis.test.TestCase;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.DependsOnMethod;

import static org.apache.sis.test.Assert.*;
import static org.apache.sis.test.TestUtilities.getSingleton;

/**
 * Tests the {@link DefaultRecordType} implementation.
 *
 * @author  Martin Desruisseaux (Geomatys)
 * @since   0.5
 * @version 0.5
 * @module
 */
@DependsOn(TypeNamesTest.class)
public final strictfp class DefaultRecordTypeTest extends TestCase {
    /** Value of {@link DefaultRecordType#getContainer()}.   */ private DefaultRecordSchema container;
    /** Value of {@link DefaultRecordType#getTypeName()}.    */ private DefaultTypeName     recordTypeName;
    /** Value of {@link DefaultRecordType#getMembers()}.     */ private DefaultMemberName   memberName;
    /** Value of {@link DefaultRecordType#getMemberTypes()}. */ private DefaultTypeName     memberTypeName;

    /**
     * Initializes the private fields.
     * This method shall be invoked only once per test.
     */
    private void init() {
        final DefaultNameSpace recordNamespace;
        final DefaultNameSpace memberNamespace;

        recordNamespace = new DefaultNameSpace (null, "MyNameSpace", ":", ":");
        recordTypeName  = new DefaultTypeName  (recordNamespace, "MyRecordType");
        memberNamespace = new DefaultNameSpace (recordNamespace, "MyRecordType", ":", ":");
        memberTypeName  = new DefaultTypeName  (new DefaultNameSpace(null, "gco", ":", ":"), "Integer");
        memberName      = new DefaultMemberName(memberNamespace, "aMember", memberTypeName);
        container       = new SerializableRecordSchema("MyNameSpace");
        assertEquals("MyNameSpace:MyRecordType:aMember", memberName.toFullyQualifiedName().toString());
    }

    /**
     * Creates a new record type from the current values of private fields.
     */
    private DefaultRecordType create() throws IllegalArgumentException {
        final Type memberType = new SimpleAttributeType<>(memberTypeName, Integer.class);
        return new DefaultRecordType(recordTypeName, container, Collections.singletonMap(memberName, memberType));
    }

    /**
     * Tests the construction of {@link DefaultRecordType}, and opportunistically tests
     * {@link DefaultRecordType#locate(MemberName)}.
     */
    @Test
    public void testConstructor() {
        init();
        final DefaultRecordType type = create();
        assertEquals("size", 1, type.size());
        assertEquals("baseValueClass", Integer.TYPE, type.baseValueClass());

        // Public properties
        assertSame("container",   container,      type.getContainer());
        assertSame("typeName",    recordTypeName, type.getTypeName());
        assertSame("members",     memberName,     getSingleton(type.getMembers()));
        assertSame("memberTypes", memberName,     getSingleton(type.getMemberTypes().keySet()));
        assertSame("memberTypes", memberTypeName, getSingleton(type.getMemberTypes().values()).getTypeName());
        assertSame("locate",      memberTypeName, type.locate(memberName));
        assertNull("locate",                      type.locate(new DefaultMemberName(null, "otherMember", memberTypeName)));
    }

    /**
     * Ensures that constructions of {@link DefaultRecordType} with
     * inconsistent arguments throw an exception.
     */
    @Test
    @DependsOnMethod("testConstructor")
    public void testArgumentChecks() {
        init();
        final DefaultTypeName  correctRecordName      = recordTypeName;
        final NameSpace        correctMemberNamespace = memberName.scope();
        final DefaultNameSpace wrongNamespace         = new DefaultNameSpace(null, "WrongNameSpace", ":", ":");
        /*
         * RecordType namespace validation.
         * Constructor shall require "MyNameSpace:MyRecordType".
         */
        recordTypeName = new DefaultTypeName(wrongNamespace, "MyRecordType");
        try {
            create();
            fail("Should have detected namespace mismatch.");
        } catch (IllegalArgumentException e) {
            final String message = e.getMessage();
            assertTrue(message, message.contains("MyNameSpace"));                 // Expected name.
            assertTrue(message, message.contains("WrongNameSpace:MyRecordType")); // Actual namespace.
        }
        /*
         * MemberName namespace validation.
         * Constructor shall require "MyNameSpace:MyRecordType:aMember".
         */
        recordTypeName = correctRecordName;
        memberName = new DefaultMemberName(wrongNamespace, "aMember", memberTypeName);
        try {
            create();
            fail("Should have detected namespace mismatch.");
        } catch (IllegalArgumentException e) {
            final String message = e.getMessage();
            assertTrue(message, message.contains("MyNameSpace:MyRecordType"));  // Expected name.
            assertTrue(message, message.contains("WrongNameSpace:aMember"));    // Actual namespace.
        }
        /*
         * MemberName type validation.
         */
        final DefaultTypeName otherType = new DefaultTypeName(memberTypeName.scope(), "Real");
        memberName = new DefaultMemberName(correctMemberNamespace, "aMember", otherType);
        try {
            create();
            fail("Should have detected type mismatch.");
        } catch (IllegalArgumentException e) {
            final String message = e.getMessage();
            assertTrue(message, message.contains("aMember"));
            assertTrue(message, message.contains("gco:Integer"));
        }
    }

    /**
     * Tests serialization of a {@code RecordType}.
     */
    @Test
    @DependsOnMethod("testConstructor")
    public void testSerialization() {
        init();
        synchronized (SerializableRecordSchema.class) {
            try {
                SerializableRecordSchema.INSTANCE = container;
                assertSerializedEquals(create());
            } finally {
                SerializableRecordSchema.INSTANCE = null;
            }
        }
    }
}


text:
import React, { Component } from 'react';
import {
  SafeAreaView,
  StyleSheet,
  TextInput,
  Platform,
  Text,
  FlatList,
  View,
  TouchableOpacity
} from 'react-native'
import { connect } from 'react-redux'
import { isIphoneX } from '../../utils/device'
import { selectPlayer, selectTeam } from '../../actions/actions'

class SearchBar extends Component {

    constructor(props) {
    super(props)

    this.state = {
      textInputFocused: false,
      playerSearchInput: '',
      suggestionListVisible: false,
      suggestionData: null
    }

    this._handleTextInputFocus = this._handleTextInputFocus.bind(this)
    this._handleTextInputBlur = this._handleTextInputBlur.bind(this)
    this._handleTextChange = this._handleTextChange.bind(this)
    this._renderItem = this._renderItem.bind(this)
  }

  _handleTextInputFocus() {
    this.setState({
      textInputFocused: true
    })
  }

  _handleTextInputBlur() {
    this.setState({
      textInputFocused: false
    })
  }

  _keyExtractor(item) {
    return item.personId
  }

  _renderItem({ item, index }) {
    const firstName = item.firstName
    const lastName = item.lastName
    const teamsPlayedOn = item.teams
    const currentTeamID = teamsPlayedOn.length > 0 ? teamsPlayedOn[teamsPlayedOn.length-1].teamId : null// get last item in teams array

    return(
      <TouchableOpacity style={[styles.defaultCenteredView, styles.suggestionCell]} onPress={() => this._selectPlayer(item)}>
        <Text style={styles.text}> {firstName} {lastName} </Text>
      </TouchableOpacity>
    )
  }

  _handleTextChange(input) {
    const suggestionListVisible = input === '' ? false : true

    if (input === '') {
      this.setState({
        suggestionData: null,
        suggestionListVisible: suggestionListVisible
      })
    } else {
      let suggested = this.props.playersInLeague.slice() // copy original data
      suggested = suggested.filter(player => {
        const playerName = player.firstName + ' ' + player.lastName
        return playerName.toLowerCase().includes(input) || playerName.includes(input)
      }).slice(0, 15), // show top 15 players from search input

      this.setState({
        suggestionData: suggested,
        suggestionListVisible: suggestionListVisible
      })
    }
  }

  _selectPlayer(player) {
    const selectedPlayer = {
      player: player
    }
    const selectedPlayerTeam = {
      teamID: player.teamId
    }

    this.props.selectPlayer(selectedPlayer)
    this.props.setTeam(selectedPlayerTeam)
    this.props.navigation.navigate('Player')
  }

  render() {
    return (
      <SafeAreaView
        style={styles.container}
      >
        <TextInput
          style={styles.input}
          autoCapitalize='none'
          autoCorrect={false}
          placeholder='Search for Player'
          placeholderTextColor='#828282'
          onFocus={this._handleTextInputFocus}
          onBlur={this._handleTextInputBlur}
          onChangeText={this._handleTextChange}
        />
        {
          this.state.suggestionListVisible && this.props.playersInLeague &&
          <View style={styles.suggestionList}>
            <FlatList
              data={this.state.suggestionData}
              keyExtractor={this._keyExtractor}
              renderItem={this._renderItem}
            />
          </View>
        }
      </SafeAreaView>
    );
  }
}

const styles = StyleSheet.create({
  text: {
    color: '#D3D3D3',
    fontSize: 14
  },
  container: {
    borderTopWidth: 1,
    borderBottomWidth: 1,
    borderBottomColor: '#000',
    borderTopColor: '#000',
    backgroundColor: '#111111'
  },
  input: {
    paddingLeft: 30,
    paddingRight: 20,
    marginTop: 5,
    marginLeft: 10,
    marginRight: 10,
    borderRadius: 5,
    overflow: 'hidden',
    backgroundColor: '#323232',
    fontSize: 18,
    color: '#D3D3D3',
    height: 40,
    ...Platform.select({
      ios: {
        height: 30,
      },
      android: {
        borderWidth: 0,
      },
    }),
  },
  searchIcon: {
    left: 16,
  },

  suggestionList: {
    position: 'absolute',
    height: 400,
    top: isIphoneX() ? 80 : 55,
    left: 10,
    right: 10,
    borderRadius: 2,
    justifyContent: 'center',
    backgroundColor: '#000000'
  },
  suggestionCell: {
    height: 60,
    justifyContent: 'center',
    borderBottomWidth: 1,
    borderBottomColor: '#E3E3E3',
    opacity: 0.8
  }
})

function mapStateToProps(state) {
  return {
    playersInLeague: state.league.playersInLeague
  }
}

function mapDispatchToProps(dispatch) {
  return {
    selectPlayer: (selectedPlayer) => dispatch(selectPlayer(selectedPlayer)),
    setTeam: (teamID) => dispatch(selectTeam(teamID))
  }
}

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(SearchBar)


text:
import { createActionCreator } from './ActionCreator';

import { Action } from 'redux';

export const selectRequestAction = createActionCreator<string>('request.detail.webServices.select');


text:
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import app, db, models
from hashlib import md5
import sys
import os

def upgrade():
    api.upgrade(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
    v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
    print('Current database version: ' + str(v))

if os.path.isfile("app.db"):
    upgrade()
else:
    db.create_all()
    if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
        api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
        api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
    else:
        api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO,
                            api.version(SQLALCHEMY_MIGRATE_REPO))

    upgrade()
    if len(sys.argv) == 1:
        raise SystemExit('Please specify a password')

    password = md5()
    password.update(sys.argv[1])

    found_admin = None
    for user in models.User.query.all():
        if user.call == 'admin':
            found_admin = user
    if found_admin:
        found_admin.password_hash = password.hexdigest()
        db.session.commit()
    else:
        admin = models.User(call='admin', email='triangulator@hph7wim.com', password_hash=password.hexdigest())
        db.session.add(admin)
        db.session.commit()

from werkzeug.contrib.fixers import ProxyFix
app.wsgi_app = ProxyFix(app.wsgi_app)
app.run(debug=True, host='0.0.0.0', port=8001)


text:
/*OHM*/

/* Package */
package Wayang.GUI.Glazier.Draw.GraphicDisplay.ToolTips;

/* Import */
import java.text.DecimalFormat;

/**
 * A subclass of ToolTipDetail for conjunction of forces.
 *
 * @author kumaresh
 * @version : "%I%, %G%"
 */
public class TooltipForConjunctionOfForces extends ToolTipDetail
{
    /* Variables */
    private String magRepulsionForceSp, magAttractionForceSp,
                   repulsorID, attractorID;

    /**
     * Constructs a TooltipForConjunctionOfForces to provide
     * details.
     *
     * @param magRepulsionForceSp
     * @param magAttractionForceSp
     * @param repulsorID
     * @param attractorID
     */
    public TooltipForConjunctionOfForces
           (String magRepulsionForceSp,
            String magAttractionForceSp,
            String repulsorID,
            String attractorID)
    {
        this.magRepulsionForceSp = magRepulsionForceSp;
        this.magAttractionForceSp = magAttractionForceSp;
        this.repulsorID = repulsorID;
        this.attractorID = attractorID;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getAnnotationDetails()
    {
        DecimalFormat forceFormat;
        StringBuilder detail;

        forceFormat = new DecimalFormat("####E0");

        detail = new StringBuilder("Fig" +
                        getGraphicDisplay().getInstructor().getFigID() +
                        " is ");

        detail.append("attracted by Fig" + attractorID +
                      "with magnitude " +
                      forceFormat.format(new Double(magAttractionForceSp)
                                                    .doubleValue()) +
                      " and " +
                      "repulsed by Fig" + repulsorID +
                      "with magnitude " +
                      forceFormat.format(new Double(magRepulsionForceSp)
                                                    .doubleValue()));

        return(detail.toString());
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public StringBuilder getToolTip()
    {
        return(new StringBuilder(
               "Ascription:
" +
               "Repulsor: " + repulsorID + "
" +
               "Repulsion Mag: " + magRepulsionForceSp + "
" +
               "Attractor: " + attractorID + "
" +
               "Attraction Mag: " + magAttractionForceSp + "
"));
    }
}


text:
//===-- tsan_interface_java.cc --------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of ThreadSanitizer (TSan), a race detector.
//
//===----------------------------------------------------------------------===//

#include "tsan_interface_java.h"
#include "tsan_rtl.h"
#include "tsan_mutex.h"
#include "sanitizer_common/sanitizer_internal_defs.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_placement_new.h"
#include "sanitizer_common/sanitizer_stacktrace.h"
#include "sanitizer_common/sanitizer_procmaps.h"

using namespace __tsan;  // NOLINT

const jptr kHeapAlignment = 8;

namespace __tsan {

struct JavaContext {
  const uptr heap_begin;
  const uptr heap_size;

  JavaContext(jptr heap_begin, jptr heap_size)
      : heap_begin(heap_begin)
      , heap_size(heap_size) {
  }
};

class ScopedJavaFunc {
 public:
  ScopedJavaFunc(ThreadState *thr, uptr pc)
      : thr_(thr) {
    Initialize(thr_);
    FuncEntry(thr, pc);
  }

  ~ScopedJavaFunc() {
    FuncExit(thr_);
    // FIXME(dvyukov): process pending signals.
  }

 private:
  ThreadState *thr_;
};

static u64 jctx_buf[sizeof(JavaContext) / sizeof(u64) + 1];
static JavaContext *jctx;

}  // namespace __tsan

#define SCOPED_JAVA_FUNC(func) \
  ThreadState *thr = cur_thread(); \
  const uptr caller_pc = GET_CALLER_PC(); \
  const uptr pc = StackTrace::GetCurrentPc(); \
  (void)pc; \
  ScopedJavaFunc scoped(thr, caller_pc); \
/**/

void __tsan_java_init(jptr heap_begin, jptr heap_size) {
  SCOPED_JAVA_FUNC(__tsan_java_init);
  DPrintf("#%d: java_init(%p, %p)\n", thr->tid, heap_begin, heap_size);
  CHECK_EQ(jctx, 0);
  CHECK_GT(heap_begin, 0);
  CHECK_GT(heap_size, 0);
  CHECK_EQ(heap_begin % kHeapAlignment, 0);
  CHECK_EQ(heap_size % kHeapAlignment, 0);
  CHECK_LT(heap_begin, heap_begin + heap_size);
  jctx = new(jctx_buf) JavaContext(heap_begin, heap_size);
}

int  __tsan_java_fini() {
  SCOPED_JAVA_FUNC(__tsan_java_fini);
  DPrintf("#%d: java_fini()\n", thr->tid);
  CHECK_NE(jctx, 0);
  // FIXME(dvyukov): this does not call atexit() callbacks.
  int status = Finalize(thr);
  DPrintf("#%d: java_fini() = %d\n", thr->tid, status);
  return status;
}

void __tsan_java_alloc(jptr ptr, jptr size) {
  SCOPED_JAVA_FUNC(__tsan_java_alloc);
  DPrintf("#%d: java_alloc(%p, %p)\n", thr->tid, ptr, size);
  CHECK_NE(jctx, 0);
  CHECK_NE(size, 0);
  CHECK_EQ(ptr % kHeapAlignment, 0);
  CHECK_EQ(size % kHeapAlignment, 0);
  CHECK_GE(ptr, jctx->heap_begin);
  CHECK_LE(ptr + size, jctx->heap_begin + jctx->heap_size);

  OnUserAlloc(thr, pc, ptr, size, false);
}

void __tsan_java_free(jptr ptr, jptr size) {
  SCOPED_JAVA_FUNC(__tsan_java_free);
  DPrintf("#%d: java_free(%p, %p)\n", thr->tid, ptr, size);
  CHECK_NE(jctx, 0);
  CHECK_NE(size, 0);
  CHECK_EQ(ptr % kHeapAlignment, 0);
  CHECK_EQ(size % kHeapAlignment, 0);
  CHECK_GE(ptr, jctx->heap_begin);
  CHECK_LE(ptr + size, jctx->heap_begin + jctx->heap_size);

  ctx->metamap.FreeRange(thr->proc(), ptr, size);
}

void __tsan_java_move(jptr src, jptr dst, jptr size) {
  SCOPED_JAVA_FUNC(__tsan_java_move);
  DPrintf("#%d: java_move(%p, %p, %p)\n", thr->tid, src, dst, size);
  CHECK_NE(jctx, 0);
  CHECK_NE(size, 0);
  CHECK_EQ(src % kHeapAlignment, 0);
  CHECK_EQ(dst % kHeapAlignment, 0);
  CHECK_EQ(size % kHeapAlignment, 0);
  CHECK_GE(src, jctx->heap_begin);
  CHECK_LE(src + size, jctx->heap_begin + jctx->heap_size);
  CHECK_GE(dst, jctx->heap_begin);
  CHECK_LE(dst + size, jctx->heap_begin + jctx->heap_size);
  CHECK_NE(dst, src);
  CHECK_NE(size, 0);

  // Assuming it's not running concurrently with threads that do
  // memory accesses and mutex operations (stop-the-world phase).
  ctx->metamap.MoveMemory(src, dst, size);

  // Move shadow.
  u64 *s = (u64*)MemToShadow(src);
  u64 *d = (u64*)MemToShadow(dst);
  u64 *send = (u64*)MemToShadow(src + size);
  uptr inc = 1;
  if (dst > src) {
    s = (u64*)MemToShadow(src + size) - 1;
    d = (u64*)MemToShadow(dst + size) - 1;
    send = (u64*)MemToShadow(src) - 1;
    inc = -1;
  }
  for (; s != send; s += inc, d += inc) {
    *d = *s;
    *s = 0;
  }
}

jptr __tsan_java_find(jptr *from_ptr, jptr to) {
  SCOPED_JAVA_FUNC(__tsan_java_find);
  DPrintf("#%d: java_find(&%p, %p)\n", *from_ptr, to);
  CHECK_EQ((*from_ptr) % kHeapAlignment, 0);
  CHECK_EQ(to % kHeapAlignment, 0);
  CHECK_GE(*from_ptr, jctx->heap_begin);
  CHECK_LE(to, jctx->heap_begin + jctx->heap_size);
  for (uptr from = *from_ptr; from < to; from += kHeapAlignment) {
    MBlock *b = ctx->metamap.GetBlock(from);
    if (b) {
      *from_ptr = from;
      return b->siz;
    }
  }
  return 0;
}

void __tsan_java_finalize() {
  SCOPED_JAVA_FUNC(__tsan_java_finalize);
  DPrintf("#%d: java_mutex_finalize()\n", thr->tid);
  AcquireGlobal(thr, 0);
}

void __tsan_java_mutex_lock(jptr addr) {
  SCOPED_JAVA_FUNC(__tsan_java_mutex_lock);
  DPrintf("#%d: java_mutex_lock(%p)\n", thr->tid, addr);
  CHECK_NE(jctx, 0);
  CHECK_GE(addr, jctx->heap_begin);
  CHECK_LT(addr, jctx->heap_begin + jctx->heap_size);

  MutexCreate(thr, pc, addr, true, true, true);
  MutexLock(thr, pc, addr);
}

void __tsan_java_mutex_unlock(jptr addr) {
  SCOPED_JAVA_FUNC(__tsan_java_mutex_unlock);
  DPrintf("#%d: java_mutex_unlock(%p)\n", thr->tid, addr);
  CHECK_NE(jctx, 0);
  CHECK_GE(addr, jctx->heap_begin);
  CHECK_LT(addr, jctx->heap_begin + jctx->heap_size);

  MutexUnlock(thr, pc, addr);
}

void __tsan_java_mutex_read_lock(jptr addr) {
  SCOPED_JAVA_FUNC(__tsan_java_mutex_read_lock);
  DPrintf("#%d: java_mutex_read_lock(%p)\n", thr->tid, addr);
  CHECK_NE(jctx, 0);
  CHECK_GE(addr, jctx->heap_begin);
  CHECK_LT(addr, jctx->heap_begin + jctx->heap_size);

  MutexCreate(thr, pc, addr, true, true, true);
  MutexReadLock(thr, pc, addr);
}

void __tsan_java_mutex_read_unlock(jptr addr) {
  SCOPED_JAVA_FUNC(__tsan_java_mutex_read_unlock);
  DPrintf("#%d: java_mutex_read_unlock(%p)\n", thr->tid, addr);
  CHECK_NE(jctx, 0);
  CHECK_GE(addr, jctx->heap_begin);
  CHECK_LT(addr, jctx->heap_begin + jctx->heap_size);

  MutexReadUnlock(thr, pc, addr);
}

void __tsan_java_mutex_lock_rec(jptr addr, int rec) {
  SCOPED_JAVA_FUNC(__tsan_java_mutex_lock_rec);
  DPrintf("#%d: java_mutex_lock_rec(%p, %d)\n", thr->tid, addr, rec);
  CHECK_NE(jctx, 0);
  CHECK_GE(addr, jctx->heap_begin);
  CHECK_LT(addr, jctx->heap_begin + jctx->heap_size);
  CHECK_GT(rec, 0);

  MutexCreate(thr, pc, addr, true, true, true);
  MutexLock(thr, pc, addr, rec);
}

int __tsan_java_mutex_unlock_rec(jptr addr) {
  SCOPED_JAVA_FUNC(__tsan_java_mutex_unlock_rec);
  DPrintf("#%d: java_mutex_unlock_rec(%p)\n", thr->tid, addr);
  CHECK_NE(jctx, 0);
  CHECK_GE(addr, jctx->heap_begin);
  CHECK_LT(addr, jctx->heap_begin + jctx->heap_size);

  return MutexUnlock(thr, pc, addr, true);
}

void __tsan_java_acquire(jptr addr) {
  SCOPED_JAVA_FUNC(__tsan_java_acquire);
  DPrintf("#%d: java_acquire(%p)\n", thr->tid, addr);
  CHECK_NE(jctx, 0);
  CHECK_GE(addr, jctx->heap_begin);
  CHECK_LT(addr, jctx->heap_begin + jctx->heap_size);

  Acquire(thr, caller_pc, addr);
}

void __tsan_java_release(jptr addr) {
  SCOPED_JAVA_FUNC(__tsan_java_release);
  DPrintf("#%d: java_release(%p)\n", thr->tid, addr);
  CHECK_NE(jctx, 0);
  CHECK_GE(addr, jctx->heap_begin);
  CHECK_LT(addr, jctx->heap_begin + jctx->heap_size);

  Release(thr, caller_pc, addr);
}

void __tsan_java_release_store(jptr addr) {
  SCOPED_JAVA_FUNC(__tsan_java_release);
  DPrintf("#%d: java_release_store(%p)\n", thr->tid, addr);
  CHECK_NE(jctx, 0);
  CHECK_GE(addr, jctx->heap_begin);
  CHECK_LT(addr, jctx->heap_begin + jctx->heap_size);

  ReleaseStore(thr, caller_pc, addr);
}


text:
#ifndef UNISTD_H
#define UNISTD_H

extern char *optarg;
extern int optind, opterr, optopt;
int getopt(int nargc, char *const nargv[], const char *ostr);

#include "../../src/Win32_Interop/Win32_FDAPI.h"
#define close(...) FDAPI_close(__VA_ARGS__)

#endif /* UNISTD_H */


text:
define(function () {
  return function getIndex(parent, child) {
    function isPresent(d) { return d > -1; }
    function indexPosition(d, i) {
      if (d.length > 1) { return i; }
      return d;
    }
    function filterDown(d) {
      if (Array.isArray(d) && !d.length) { return -1; }
      return d;
    }

    var index = parent.datum()
    .map(function (datum) {
      var isArray = Array.isArray(child.datum());
      var target = isArray ? child.datum() : [child.datum()];

      return target.map(function (d) {
        return datum.indexOf(d);
      }).filter(isPresent);
    })
    .map(indexPosition)
    .map(filterDown)
    .filter(isPresent)[0];

    if (Array.isArray(index)) { return index[0]; }

    return index;
  };
});


text:
/* global Backbone, Mustache, _, $, Notes */
(function (Backbone, Mustache, _, $, Notes) {
  'use strict';

  // Setting the required notes templates
  var templates = {
    view: '
' +
            '
Note {{id}}
' +
            '
' +
              '
{{text}}
' +
                '<button class="note-action-edit">edit</button>' +
                '<button class="note-action-destroy">destroy</button>' +
            '
' +
          '
',
    edit: '
' +
            '
Note {{id}}
' +
            '
' +
              '<textarea class="note-data-text">{{text}}</textarea>' +
              '<button class="note-action-save">save</button>' +
              '<button class="note-action-cancel">cancel</button>' +
            '
' +
          '
',
    create: '
' +
              '
' +
                '<textarea class="note-data-text" placeholder="{{text}}"></textarea>' +
                '
' +
                '<button class="note-action-create">Add</button>' +
              '
' +
            '
'
  };
  // Creating a model to be the notes parent
  var User = Backbone.Model.extend({
    defaults: {
      name: 'unnamed user'
    },
    // the model must have a urlRoot assigned because this model is not
    //  within a collection
    urlRoot: 'users/'
  });

  var user = new User({
    id: 1,
    name: 'John Doe'
  });

  var userNotes = Notes.init({
    parentModel: user,
    listElement: $('#notes-list'),
    createElement: $('#notes-create'),
    templates: templates
  });
  /* eslint-disable no-console */
  // listening triggers
  userNotes.view.list.on('note:create', function () {
    console.log('note created');
  });
  userNotes.view.list.on('note:destroy', function () {
    console.log('note destroyed');
  });
  userNotes.view.list.on('note:cancel', function () {
    console.log('note cancelled');
  });
  userNotes.view.list.on('note:save', function () {
    console.log('note saved');
  });
  /* eslint-enable no-console */
})(Backbone, Mustache, _, $, Notes);


text:
<! DOCTYPE HTML>

		<meta charset = "UTF-8" />
		<link rel="shortcut icon" href="../assets/breezylogo.ico" type="image/x-icon"/>

		<link rel="stylesheet" type="text/css" href="semantic/dist/semantic.min.css">
		<link href='https://fonts.googleapis.com/css?family=Happy+Monkey' rel='stylesheet' type='text/css'>

		<link rel="stylesheet" type="text/css" href="css/signin.css"/>
		<title>BreezyTalk</title>

			Welcome Back!

			 Username
			<input type ="text"
				   id = "myName"
				   value ="Pick a name!" />

			 Password
			<input type ="password"
				   id = "myPwd"
				   value ="secret" />

		<button class="ui huge green button"> Log In </button>
		 Forgot Password?


text:
namespace System
{
    typedef std::pair<uint32_t, std::unique_ptr<IfInterface>> IfInterfaceMapEntry;
    typedef std::map<IfInterfaceMapEntry> RouteToIfInterfaceMap;
    class IfInterfaceManager
    {
    public:
        IfInterfaceManager()
        {
        }

        Error findIfInterface(const Network::IpAddressV4 &route, IfInterface &ifInterface);
        Error addIfInterface(const Network::IpAddressV4 &route, IfInterface &ifInterface);
        Error removeIfInterface(const Network::IpAddressV4 &route);
    private:
        RouteToIfInterfaceMap m_routeToIfInterfaceMap;
    };
}

#endif


text:
import thriftpy
from thriftpy.rpc import make_server

sequence_thrift = thriftpy.load("sequence.thrift", module_name="sequence_thrift")

class GetSequenceService(object):

    def getnum(self, req):
        """
        返回请求的数串
        :param req:
        :return:
        """
        res = sequence_thrift.SequenceResponse()
        res.num = req.num
        print req.num
        return res

server = make_server(sequence_thrift.Sequence, GetSequenceService(), '127.0.0.1', 6001)

server.serve()


text:
#pragma once
#include <aws/elasticache/ElastiCache_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSStreamFwd.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/elasticache/model/AutomaticFailoverStatus.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Xml
{
  class XmlNode;
} // namespace Xml
} // namespace Utils
namespace ElastiCache
{
namespace Model
{

  /**
   *
A member of a Global datastore. It contains the Replication Group Id, the
   * Amazon region and the role of the replication group.

See Also:

   * AWS
   * API Reference

   */
  class AWS_ELASTICACHE_API GlobalReplicationGroupMember
  {
  public:
    GlobalReplicationGroupMember();
    GlobalReplicationGroupMember(const Aws::Utils::Xml::XmlNode& xmlNode);
    GlobalReplicationGroupMember& operator=(const Aws::Utils::Xml::XmlNode& xmlNode);

    void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const;
    void OutputToStream(Aws::OStream& oStream, const char* location) const;

    /**
     *
The replication group id of the Global datastore member.

     */
    inline const Aws::String& GetReplicationGroupId() const{ return m_replicationGroupId; }

    /**
     *
The replication group id of the Global datastore member.

     */
    inline bool ReplicationGroupIdHasBeenSet() const { return m_replicationGroupIdHasBeenSet; }

    /**
     *
The replication group id of the Global datastore member.

     */
    inline void SetReplicationGroupId(const Aws::String& value) { m_replicationGroupIdHasBeenSet = true; m_replicationGroupId = value; }

    /**
     *
The replication group id of the Global datastore member.

     */
    inline void SetReplicationGroupId(Aws::String&& value) { m_replicationGroupIdHasBeenSet = true; m_replicationGroupId = std::move(value); }

    /**
     *
The replication group id of the Global datastore member.

     */
    inline void SetReplicationGroupId(const char* value) { m_replicationGroupIdHasBeenSet = true; m_replicationGroupId.assign(value); }

    /**
     *
The replication group id of the Global datastore member.

     */
    inline GlobalReplicationGroupMember& WithReplicationGroupId(const Aws::String& value) { SetReplicationGroupId(value); return *this;}

    /**
     *
The replication group id of the Global datastore member.

     */
    inline GlobalReplicationGroupMember& WithReplicationGroupId(Aws::String&& value) { SetReplicationGroupId(std::move(value)); return *this;}

    /**
     *
The replication group id of the Global datastore member.

     */
    inline GlobalReplicationGroupMember& WithReplicationGroupId(const char* value) { SetReplicationGroupId(value); return *this;}

    /**
     *
The Amazon region of the Global datastore member.

     */
    inline const Aws::String& GetReplicationGroupRegion() const{ return m_replicationGroupRegion; }

    /**
     *
The Amazon region of the Global datastore member.

     */
    inline bool ReplicationGroupRegionHasBeenSet() const { return m_replicationGroupRegionHasBeenSet; }

    /**
     *
The Amazon region of the Global datastore member.

     */
    inline void SetReplicationGroupRegion(const Aws::String& value) { m_replicationGroupRegionHasBeenSet = true; m_replicationGroupRegion = value; }

    /**
     *
The Amazon region of the Global datastore member.

     */
    inline void SetReplicationGroupRegion(Aws::String&& value) { m_replicationGroupRegionHasBeenSet = true; m_replicationGroupRegion = std::move(value); }

    /**
     *
The Amazon region of the Global datastore member.

     */
    inline void SetReplicationGroupRegion(const char* value) { m_replicationGroupRegionHasBeenSet = true; m_replicationGroupRegion.assign(value); }

    /**
     *
The Amazon region of the Global datastore member.

     */
    inline GlobalReplicationGroupMember& WithReplicationGroupRegion(const Aws::String& value) { SetReplicationGroupRegion(value); return *this;}

    /**
     *
The Amazon region of the Global datastore member.

     */
    inline GlobalReplicationGroupMember& WithReplicationGroupRegion(Aws::String&& value) { SetReplicationGroupRegion(std::move(value)); return *this;}

    /**
     *
The Amazon region of the Global datastore member.

     */
    inline GlobalReplicationGroupMember& WithReplicationGroupRegion(const char* value) { SetReplicationGroupRegion(value); return *this;}

    /**
     *
Indicates the role of the replication group, primary or secondary.

     */
    inline const Aws::String& GetRole() const{ return m_role; }

    /**
     *
Indicates the role of the replication group, primary or secondary.

     */
    inline bool RoleHasBeenSet() const { return m_roleHasBeenSet; }

    /**
     *
Indicates the role of the replication group, primary or secondary.

     */
    inline void SetRole(const Aws::String& value) { m_roleHasBeenSet = true; m_role = value; }

    /**
     *
Indicates the role of the replication group, primary or secondary.

     */
    inline void SetRole(Aws::String&& value) { m_roleHasBeenSet = true; m_role = std::move(value); }

    /**
     *
Indicates the role of the replication group, primary or secondary.

     */
    inline void SetRole(const char* value) { m_roleHasBeenSet = true; m_role.assign(value); }

    /**
     *
Indicates the role of the replication group, primary or secondary.

     */
    inline GlobalReplicationGroupMember& WithRole(const Aws::String& value) { SetRole(value); return *this;}

    /**
     *
Indicates the role of the replication group, primary or secondary.

     */
    inline GlobalReplicationGroupMember& WithRole(Aws::String&& value) { SetRole(std::move(value)); return *this;}

    /**
     *
Indicates the role of the replication group, primary or secondary.

     */
    inline GlobalReplicationGroupMember& WithRole(const char* value) { SetRole(value); return *this;}

    /**
     *
Indicates whether automatic failover is enabled for the replication
     * group.

     */
    inline const AutomaticFailoverStatus& GetAutomaticFailover() const{ return m_automaticFailover; }

    /**
     *
Indicates whether automatic failover is enabled for the replication
     * group.

     */
    inline bool AutomaticFailoverHasBeenSet() const { return m_automaticFailoverHasBeenSet; }

    /**
     *
Indicates whether automatic failover is enabled for the replication
     * group.

     */
    inline void SetAutomaticFailover(const AutomaticFailoverStatus& value) { m_automaticFailoverHasBeenSet = true; m_automaticFailover = value; }

    /**
     *
Indicates whether automatic failover is enabled for the replication
     * group.

     */
    inline void SetAutomaticFailover(AutomaticFailoverStatus&& value) { m_automaticFailoverHasBeenSet = true; m_automaticFailover = std::move(value); }

    /**
     *
Indicates whether automatic failover is enabled for the replication
     * group.

     */
    inline GlobalReplicationGroupMember& WithAutomaticFailover(const AutomaticFailoverStatus& value) { SetAutomaticFailover(value); return *this;}

    /**
     *
Indicates whether automatic failover is enabled for the replication
     * group.

     */
    inline GlobalReplicationGroupMember& WithAutomaticFailover(AutomaticFailoverStatus&& value) { SetAutomaticFailover(std::move(value)); return *this;}

    /**
     *
The status of the membership of the replication group.

     */
    inline const Aws::String& GetStatus() const{ return m_status; }

    /**
     *
The status of the membership of the replication group.

     */
    inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; }

    /**
     *
The status of the membership of the replication group.

     */
    inline void SetStatus(const Aws::String& value) { m_statusHasBeenSet = true; m_status = value; }

    /**
     *
The status of the membership of the replication group.

     */
    inline void SetStatus(Aws::String&& value) { m_statusHasBeenSet = true; m_status = std::move(value); }

    /**
     *
The status of the membership of the replication group.

     */
    inline void SetStatus(const char* value) { m_statusHasBeenSet = true; m_status.assign(value); }

    /**
     *
The status of the membership of the replication group.

     */
    inline GlobalReplicationGroupMember& WithStatus(const Aws::String& value) { SetStatus(value); return *this;}

    /**
     *
The status of the membership of the replication group.

     */
    inline GlobalReplicationGroupMember& WithStatus(Aws::String&& value) { SetStatus(std::move(value)); return *this;}

    /**
     *
The status of the membership of the replication group.

     */
    inline GlobalReplicationGroupMember& WithStatus(const char* value) { SetStatus(value); return *this;}

  private:

    Aws::String m_replicationGroupId;
    bool m_replicationGroupIdHasBeenSet;

    Aws::String m_replicationGroupRegion;
    bool m_replicationGroupRegionHasBeenSet;

    Aws::String m_role;
    bool m_roleHasBeenSet;

    AutomaticFailoverStatus m_automaticFailover;
    bool m_automaticFailoverHasBeenSet;

    Aws::String m_status;
    bool m_statusHasBeenSet;
  };

} // namespace Model
} // namespace ElastiCache
} // namespace Aws


text:
{% extends "_layouts/base.html" %}

{% block page_title %}SEADS - Home{% endblock %}
{% block page_class %}home-page{% endblock %}
{% block content %}

{% include "base/navbar.html" %}

        {% if user.is_authenticated %}

Hello, {{ user.username }}!

        {% else %}

Hello, World!

        {% endif %}

This is a template for an informational website. Since we plan on having our data public, this will serve as the portal. Login authentication is supported to validate users.

Dashboard »

Heading

Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.

View details »

Heading

Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.

View details »

Heading

Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.

View details »

{% endblock %}


text:
<?php

namespace CAII\PublicacionesBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class PublicacionType extends AbstractType
{
        /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('doi')
            ->add('paginas')
            ->add('titulo')
            ->add('tituloLibro')
            ->add('fecha','date', array( 'years' => range(date('Y') - 25, date('Y') + 20),
                                                'required'=> false,
                                                'empty_value'  => '',
                ))
            ->add('enlace')
            ->add('tipo_Reporte')
            ->add('ciudad')
            ->add('congreso')
            ->add('issn')
            ->add('capitulo')
            ->add('isbn')
            ->add('mostrar')
            ->add('journal')
            ->add('volumen')
            ->add('editorial')
            ->add('serie')
            ->add('edicion')
            ->add('escuela')
            ->add('idiomaIngles')
            ->add('TipoPublicacion')
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'CAII\PublicacionesBundle\Entity\Publicacion'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'caii_publicacionesbundle_publicacion';
    }
}


text:
"""Unittests for functional upsample operations."""

import unittest
import jax
import jax.numpy as jn
import numpy as np

import objax

def shaparange(s):
    return jn.arange(np.prod(s), dtype=float).reshape(s)

class TestUpsample(unittest.TestCase):
    methods = ['nearest', 'linear', 'bilinear', 'trilinear', 'triangle', 'cubic',
               'bicubic', 'tricubic', 'lanczos3', 'lanczos5']

    def test_upsample2d(self):
        x = shaparange((2, 3, 10, 30))
        shape = x.shape
        for method in self.methods:
            y = objax.functional.core.ops.upsample_2d(x, (2, 3), method)
            output = jax.image.resize(x.transpose([0, 2, 3, 1]),
                                      shape=(shape[0], shape[2] * 2, shape[3] * 3, shape[1]),
                                      method=method).transpose([0, 3, 1, 2])
            self.assertEqual(y.tolist(), output.tolist())

    def test_interpolate(self):
        x = shaparange((1, 3, 2, 3, 10, 30))
        shape = x.shape
        for method in self.methods:
            output = 2
            y = objax.functional.core.ops.interpolate(x, scale_factor=output, mode=method)
            self.assertEqual(y.shape, (shape[0], *(jn.array(shape[1:])) * output))
            output = (2, 2, 2)
            y = objax.functional.core.ops.interpolate(x, scale_factor=output, mode=method)
            self.assertEqual(y.shape, (*shape[:len(shape) - len(output)],
                                       *(jn.array(shape[len(shape) - len(output):]) * jn.array(output))))
            output = (2, 2, 2, 2)
            y = objax.functional.core.ops.interpolate(x, scale_factor=output, mode=method)
            self.assertEqual(y.shape, (*shape[:len(shape) - len(output)],
                                       *(jn.array(shape[len(shape) - len(output):]) * jn.array(output))))
            output = 2
            y = objax.functional.core.ops.interpolate(x, size=output, mode=method)
            self.assertEqual(y.shape, (*shape[:-1], output))
            output = (2, 2, 2)
            y = objax.functional.core.ops.interpolate(x, size=output, mode=method)
            self.assertEqual(y.shape, (*shape[:len(shape) - len(output)], *output))
            output = (2, 2, 2, 2)
            y = objax.functional.core.ops.interpolate(x, size=output, mode=method)
            self.assertEqual(y.shape, (*shape[:len(shape) - len(output)], *output))

if __name__ == '__main__':
    unittest.main()


text:
package org.springframework.boot.logging.log4j2;

import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.config.DefaultConfiguration;
import org.apache.logging.log4j.core.impl.Log4jLogEvent;
import org.apache.logging.log4j.core.pattern.ThrowablePatternConverter;
import org.junit.jupiter.api.Test;

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

/**
 * Tests for {@link WhitespaceThrowablePatternConverter}.
 *
 * @author Vladimir Tsanev
 */
class WhitespaceThrowablePatternConverterTests {

	private final ThrowablePatternConverter converter = WhitespaceThrowablePatternConverter
			.newInstance(new DefaultConfiguration(), new String[] {});

	@Test
	void noStackTrace() {
		LogEvent event = Log4jLogEvent.newBuilder().build();
		StringBuilder builder = new StringBuilder();
		this.converter.format(event, builder);
		assertThat(builder.toString()).isEqualTo("");
	}

	@Test
	void withStackTrace() {
		LogEvent event = Log4jLogEvent.newBuilder().setThrown(new Exception()).build();
		StringBuilder builder = new StringBuilder();
		this.converter.format(event, builder);
		assertThat(builder.toString()).startsWith(System.lineSeparator()).endsWith(System.lineSeparator());
	}

}


text:
package codec

import (
	"strconv"
	"unsafe"

	// Link against the snappy library. This is explicit because we are
	// not using any Go symbols from this library.
	_ "github.com/cockroachdb/c-snappy"
	"github.com/gogo/protobuf/proto"
)

// #cgo CPPFLAGS: -I ../../../c-snappy/internal
// #cgo darwin LDFLAGS: -Wl,-undefined -Wl,dynamic_lookup
// #cgo !darwin LDFLAGS: -Wl,-unresolved-symbols=ignore-all
//
// #include <stdlib.h>
// #include <snappy-c.h>
//
// snappy_status snappy_encode(const char* input,
//                             size_t input_length,
//                             void** compressed,
//                             size_t* compressed_length) {
//   *compressed_length = snappy_max_compressed_length(input_length);
//   *compressed = malloc(*compressed_length);
//   snappy_status status = snappy_compress(input, input_length, *compressed, compressed_length);
//   if (status != SNAPPY_OK) {
//     free(*compressed);
//   }
//   return status;
// }
//
// snappy_status snappy_decode(const char* compressed,
//                             size_t compressed_length,
//                             void** uncompressed,
//                             size_t* uncompressed_length) {
//   snappy_status status = snappy_uncompressed_length(compressed, compressed_length, uncompressed_length);
//   if (status != SNAPPY_OK) {
//     return status;
//   }
//   *uncompressed = malloc(*uncompressed_length);
//   status = snappy_uncompress(compressed, compressed_length, *uncompressed, uncompressed_length);
//   if (status != SNAPPY_OK) {
//     free(*uncompressed);
//   }
//   return status;
// }
import "C"

type snappyError int

var errText = map[snappyError]string{
	errOK:             "ok",
	errInvalidInput:   "invalid input",
	errBufferTooSmall: "buffer too small",
}

func (e snappyError) Error() string {
	s := errText[e]
	if s == "" {
		return "snappy errno " + strconv.Itoa(int(e))
	}
	return s
}

var (
	errOK             = snappyError(0)
	errInvalidInput   = snappyError(1)
	errBufferTooSmall = snappyError(2)
)

// snappyEncode compresses the byte array src and sends the compressed
// data to w.
func snappyEncode(src []byte, w func([]byte) error) error {
	if len(src) == 0 {
		return w(nil)
	}

	var dLen C.size_t
	var dst unsafe.Pointer

	cerr := C.snappy_encode((*C.char)(unsafe.Pointer(&src[0])), C.size_t(len(src)),
		&dst, &dLen)
	if cerr != C.SNAPPY_OK {
		return snappyError(cerr)
	}

	err := w(unsafeSlice(dst, dLen))
	C.free(dst)
	return err
}

// snappyDecode uncompresses the byte array src and unmarshals the
// uncompressed data into m.
func snappyDecode(src []byte, uncompressedSize uint32, m proto.Message) error {
	if len(src) == 0 {
		return nilSafeUnmarshal(nil, m)
	}

	var dLen C.size_t
	var dst unsafe.Pointer

	cerr := C.snappy_decode((*C.char)(unsafe.Pointer(&src[0])),
		C.size_t(len(src)), &dst, &dLen)
	if cerr != C.SNAPPY_OK {
		return snappyError(cerr)
	}

	// We call through directly to proto.Unmarshal so that we don't have
	// to allocate a slice for "dst" or have some awkward interface
	// where the caller has to deallocate "dst".
	err := nilSafeUnmarshal(unsafeSlice(dst, dLen), m)
	C.free(dst)
	return err
}

func unsafeSlice(p unsafe.Pointer, n C.size_t) []byte {
	const maxLen = 0x7fffffff
	return (*[maxLen]byte)(p)[:n:n]
}


text:
from __future__ import absolute_import, unicode_literals

from django.core.urlresolvers import reverse
from django.db.models.signals import post_delete, post_save

from wagtail.contrib.wagtailfrontendcache.utils import purge_url_from_cache
from wagtail.wagtailcore.models import get_page_models
from wagtail.wagtailcore.signals import page_published, page_unpublished
from wagtail.wagtaildocs.models import get_document_model
from wagtail.wagtailimages.models import get_image_model

from .utils import get_base_url

def purge_page_from_cache(instance, **kwargs):
    base_url = get_base_url()
    purge_url_from_cache(base_url + reverse('wagtailapi_v1:pages:detail', args=(instance.id, )))

def purge_image_from_cache(instance, **kwargs):
    if not kwargs.get('created', False):
        base_url = get_base_url()
        purge_url_from_cache(base_url + reverse('wagtailapi_v1:images:detail', args=(instance.id, )))

def purge_document_from_cache(instance, **kwargs):
    if not kwargs.get('created', False):
        base_url = get_base_url()
        purge_url_from_cache(base_url + reverse('wagtailapi_v1:documents:detail', args=(instance.id, )))

def register_signal_handlers():
    Image = get_image_model()
    Document = get_document_model()

    for model in get_page_models():
        page_published.connect(purge_page_from_cache, sender=model)
        page_unpublished.connect(purge_page_from_cache, sender=model)

    post_save.connect(purge_image_from_cache, sender=Image)
    post_delete.connect(purge_image_from_cache, sender=Image)
    post_save.connect(purge_document_from_cache, sender=Document)
    post_delete.connect(purge_document_from_cache, sender=Document)

def unregister_signal_handlers():
    Image = get_image_model()
    Document = get_document_model()

    for model in get_page_models():
        page_published.disconnect(purge_page_from_cache, sender=model)
        page_unpublished.disconnect(purge_page_from_cache, sender=model)

    post_save.disconnect(purge_image_from_cache, sender=Image)
    post_delete.disconnect(purge_image_from_cache, sender=Image)
    post_save.disconnect(purge_document_from_cache, sender=Document)
    post_delete.disconnect(purge_document_from_cache, sender=Document)


text:
package go_config

import (
	"bytes"
	"encoding/json"
	"fmt"
	toml "github.com/pelletier/go-toml"
	yaml "gopkg.in/yaml.v2"
	"io"
)

type ConfigType int

type ConfigParseError struct {
	err error
}

const (
	JSON ConfigType = iota
	YAML
	TOML
)

func (pe ConfigParseError) Error() string {
	return fmt.Sprintf("Config parsing error: %s", pe.err.Error())
}

func ReadConfig(in io.Reader, ct ConfigType, c map[string]interface{}) error {
	buf := new(bytes.Buffer)
	_, err := buf.ReadFrom(in)
	if err != nil {
		return err
	}

	switch ct {
	case JSON:
		decoder := json.NewDecoder(buf)
		decoder.UseNumber()
		if err := decoder.Decode(&c); err != nil {
			return ConfigParseError{err}
		}
	case YAML:
		if err := yaml.Unmarshal(buf.Bytes(), &c); err != nil {
			return ConfigParseError{err}
		}
	case TOML:
		tree, err := toml.LoadReader(buf)
		if err != nil {
			return ConfigParseError{err}
		}
		tomlMap := tree.ToMap()
		for k, v := range tomlMap {
			c[k] = v
		}
	}

	return nil
}


text:
<div class="page-title-container" style="background-image:url('<?php echo the_post_thumbnail_url('mr_page_title_bar');?>')">

<?php echo ___("All posts by", "merryrestaurant"); ?> "<?php echo get_the_author_meta("display_name")?>"


text:
Hello world

nylas is cool.

nylas://plugins?test=stuff

nylas:plugins?test=stuff

nylas://plugins?test=stuff

Don't you like nylas?


text:
package org.apache.spark.sql.execution.datasources

import org.apache.hadoop.fs.Path

import org.apache.spark.sql.catalyst.expressions.Expression
import org.apache.spark.sql.sources.Filter
import org.apache.spark.sql.types.StructType

import com.github.lightcopy.testutil.UnitTestSuite
import com.github.lightcopy.testutil.implicits._

// Test catalog to check internal methods
private[datasources] class TestIndex extends MetastoreIndex {
  private var internalIndexFilters: Seq[Filter] = Nil
  override def tablePath(): Path = ???
  override def partitionSchema: StructType = ???
  override def indexSchema: StructType = ???
  override def dataSchema: StructType = ???
  override def setIndexFilters(filters: Seq[Filter]) = {
    internalIndexFilters = filters
  }
  override def indexFilters: Seq[Filter] = internalIndexFilters
  override def listFilesWithIndexSupport(
      partitionFilters: Seq[Expression],
      dataFilters: Seq[Expression],
      indexFilters: Seq[Filter]): Seq[PartitionDirectory] = ???
  override def inputFiles: Array[String] = ???
  override def sizeInBytes: Long = ???
}

class MetastoreIndexSuite extends UnitTestSuite {
  test("provide sequence of path based on table path") {
    val catalog = new TestIndex() {
      override def tablePath(): Path = new Path("test")
    }

    catalog.rootPaths should be (Seq(new Path("test")))
  }

  test("when using listFiles directly supply empty index filter") {
    var indexSeq: Seq[Filter] = null
    var filterSeq: Seq[Expression] = null
    val catalog = new TestIndex() {
      override def listFilesWithIndexSupport(
          partitionFilters: Seq[Expression],
          dataFilters: Seq[Expression],
          indexFilters: Seq[Filter]): Seq[PartitionDirectory] = {
        indexSeq = indexFilters
        filterSeq = partitionFilters
        Seq.empty
      }
    }

    catalog.listFiles(Seq.empty, Seq.empty)
    indexSeq should be (Nil)
    filterSeq should be (Nil)
  }

  test("refresh should be no-op by default") {
    val catalog = new TestIndex()
    catalog.refresh()
  }
}


text:
package it.musichub.server.library.model;

import java.io.File;
import java.io.IOException;

import org.fourthline.cling.support.model.PersonWithRole;
import org.fourthline.cling.support.model.Res;
import org.fourthline.cling.support.model.item.MusicTrack;
import org.seamless.util.MimeType;

import com.mpatric.mp3agic.ID3v1;
import com.mpatric.mp3agic.ID3v2;
import com.mpatric.mp3agic.InvalidDataException;
import com.mpatric.mp3agic.Mp3File;
import com.mpatric.mp3agic.UnsupportedTagException;

import it.musichub.server.library.utils.FileUtils;

public class SongFactory {

	public static Song fromFilePath(String path, String baseFolderPath) throws UnsupportedTagException, InvalidDataException, IOException{
		Song song = new Song();
		File file = new File(path);
		Mp3File mp3file = new Mp3File(path);
		song.setPath(mp3file.getFilename());
		song.setRelativePath(FileUtils.getRelativePath(file, new File(baseFolderPath)));
		song.setFilename(FileUtils.extractFilename(mp3file.getFilename()));
		song.setFile(file);
		song.setSize(mp3file.getLength());
		song.setLastModified(file.lastModified());
		song.setLength(mp3file.getLengthInSeconds());
		song.setBitrate(mp3file.getBitrate());
		song.setVbr(mp3file.isVbr());

		String title = null;
		String artist = null;
		String album = null;
		Integer year = null;
		String track = null;
		String genre = null;
		Integer rating = null;
		byte[] albumImage = null;
		String albumImageMimeType = null;
		if (mp3file.hasId3v1Tag()){
			song.setId3v1(true);
			ID3v1 tag = mp3file.getId3v1Tag();

			if (mp3file.hasId3v2Tag()){
				song.setId3v2(true);
				ID3v2 tagv2 = mp3file.getId3v2Tag();
				tag = tagv2;
				if (tagv2.getWmpRating() > -1)
					rating = tagv2.getWmpRating();
				if (tagv2.getAlbumImage() != null){
					albumImage = tagv2.getAlbumImage();
					albumImageMimeType = tagv2.getAlbumImageMimeType();
				}
			}
			title = tag.getTitle();
			artist = tag.getArtist();
			album = tag.getAlbum();
			year = parseInt(tag.getYear());
			track = tag.getTrack();
			genre = tag.getGenreDescription();
		}else{
			//caso senza id3
			String extension = FileUtils.extractExtension(song.getFilename());
			title = song.getFilename().substring(0, song.getFilename().lastIndexOf(extension));
		}
		song.setTitle(title);
		song.setArtist(artist);
		song.setAlbumTitle(album);
		song.setYear(year);
		song.setTrack(track);
		song.setGenre(genre);
		song.setRating(rating);
		song.setAlbumImage(albumImage);
		song.setAlbumImageMimeType(albumImageMimeType);

		return song;
	}

	private static Integer parseInt(String yearString){
		Integer year = null;
		try {
			year = Integer.parseInt(yearString);
		} catch (NumberFormatException e){
			//Nothing to do
		}
		return year;
	}

	/**
	 * Verifica se il parsing della canzone è aggiornato
	 *
	 * @return
	 */
	public static boolean isSongUpdated(Song s){
		//approssimazione: verifico size e lastModified
		Long existingSize = s.getSize();
		Long existingLastModified = s.getLastModified();

		File newFile = new File(s.getPath());
		Long newSize = newFile.length();
		Long newLastModified = newFile.lastModified();

		if (existingSize != null && existingSize.equals(newSize)){
			if (existingLastModified != null && existingLastModified.equals(newLastModified)){
				return true;
			}
		}

		return false;
	}

}


text:
+++
title = "May 2017 Meetup"
date = "2017-05-29"
year = "2017"
draft = false
tags = ["golang", "user group", "meetup", "edmonton", "yeg"]
description = "Generation dep"
+++

Meetup [#39](https://github.com/edmontongo/presentations/issues/64). Please **RSVP** at [Meetup](https://www.meetup.com/startupedmonton/events/237438348/).

We get started at 6:30 pm.

{{< mh2 "Sponsors" >}}

Venue provided by [Startup Edmonton](https://www.startupedmonton.com/).

Food sponsored by [Bellstone Engineering](https://bellstone.ca/).

{{< mh2 "Talks" >}}

{{< mh3 "Code Generation" >}}

[Gerrit Renker](https://github.com/grrtrr) ([slides](https://talks.godoc.org/github.com/edmontongo/presentations/2017-05/code-generation/code_generation.slide))

{{< mh2 "dep" >}}

[Nathan Youngman](https://github.com/nathany) ([slides](https://talks.godoc.org/github.com/edmontongo/presentations/2017-05/dep/dep.slide))

{{< mh2 "Activities" >}}

- Kick the tires on [dep](https://github.com/golang/dep), now that [the manifest files are considered stable](https://sdboyer.io/dep-status/2017-05-29/). Bring your laptop and a Go project if you have one.

{{< mh2 "Events" >}}

- [Monthly Hack Day](https://www.meetup.com/startupedmonton/events/qvnfrlywjbfb/) - Jun 3
- [GopherCon](https://gophercon.com/) July 12-15
- Edmonton Go Meetup - [June](/meetup/2017-06/)


text:
@class GCDAsyncSocket;

@interface EchoServerAppDelegate : NSObject <NSApplicationDelegate>
{
	dispatch_queue_t socketQueue;

	GCDAsyncSocket *listenSocket;
	NSMutableArray *connectedSockets;

	BOOL isRunning;

	IBOutlet id logView;
	IBOutlet id portField;
	IBOutlet id startStopButton;

	NSWindow *__unsafe_unretained window;
}

@property (unsafe_unretained) IBOutlet NSWindow *window;

- (IBAction)startStop:(id)sender;

@end


text:
<readable><title>3415809168_af9dabdba5</title><content>
A dog is running while another dog behind it carries a tennis ball .
A dog runs with another dog in the background holding a ball in its mouth .
Two black and white dogs running in a field .
Two black and white dogs walking on dirt , one of which has a ball in its mouth .
Two dogs are running in the dirt , one with a ball in its mouth .
</content></readable>


text:
package org.hdiv.application;

import javax.servlet.ServletContext;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;

/**
 * ServletContext's Wrapper class
 *
 * @author Roberto Velasco
 * @see org.springframework.beans.factory.BeanFactoryAware
 */
public class ApplicationHDIV implements IApplication, BeanFactoryAware {

	private ServletContext application;

	/**
	 * The root interface for accessing a Spring bean container.
	 *
	 * @see org.springframework.beans.factory.BeanFactory
	 */
	private BeanFactory beanFactory;

	public ServletContext getApplication() {
		return application;
	}

	public void setApplication(ServletContext application) {
		this.application = application;
	}

	/**
	 * Return an instance, which may be shared or independent, of the given bean
	 * name. This method allows a Spring BeanFactory to be used as a replacement for
	 * the Singleton or Prototype design pattern.
	 *

	 * Callers may retain references to returned objects in the case of Singleton
	 * beans.
	 *

	 * Translates aliases back to the corresponding canonical bean name. Will ask the
	 * parent factory if the bean cannot be found in this factory instance.
	 *
	 * @param name the name of the bean to return
	 * @return the instance of the bean
	 * @throws NoSuchBeanDefinitionException if there is no bean definition with the
	 *             specified name
	 * @throws BeansException if the bean could not be obtained
	 */
	public Object getBean(String name) {
		return this.beanFactory.getBean(name);
	}

	/**
	 * Callback that supplies the owning factory to a bean instance. Invoked after
	 * population of normal bean properties but before an init callback like
	 * InitializingBean's afterPropertiesSet or a custom init-method.
	 *
	 * @param beanFactory owning BeanFactory (may not be null). The bean can
	 *            immediately call methods on the factory.
	 */
	public void setBeanFactory(BeanFactory beanFactory) {
		this.beanFactory = beanFactory;
	}

}


text:
package org.hisrc.jsonix.jsonschema;

public class JsonSchemaKeywords {
	private JsonSchemaKeywords() {
	}

	public static final String id = "id";
	public static final String $ref = "$ref";
	public static final String $schema = "$schema";

	public static final String definitions = "definitions";

	// array

	public static final String items = "items";
	public static final String additionalItems = "additionalItems";
	public static final String minItems = "minItems";
	public static final String maxItems = "maxItems";
	public static final String uniqueItems = "uniqueItems";

	// number and integer

	public static final String minimum = "minimum";
	public static final String exclusiveMinimum = "exclusiveMinimum";
	public static final String maximum = "maximum";
	public static final String exclusiveMaximum = "exclusiveMaximum";
	public static final String multipleOf = "multipleOf";

	// object

	public static final String properties = "properties";
	public static final String additionalProperties = "additionalProperties";
	public static final String patternProperties = "patternProperties";
	public static final String required = "required";
	public static final String minProperties = "minProperties";
	public static final String maxProperties = "maxProperties";
	public static final String dependencies = "dependencies";

	// base

	public static final String _enum = "enum";
	public static final String allOf = "allOf";
	public static final String anyOf = "anyOf";
	public static final String oneOf = "oneOf";
	public static final String not = "not";
	public static final String title = "title";
	public static final String description = "description";
	public static final String _default = "default";
	public static final String format = "format";

	// string
	public static final String pattern = "pattern";
	public static final String minLength = "minLength";
	public static final String maxLength = "maxLength";

	public static final String type = "type";
}


text:
/**
 * This is the application's run setup.
 * @memberOf Application Module
 * @namespace Application Run
 */

/**
 * @name config
 * @desc Setup the application.
 * @param $rootScope
 * @param $state
 * @param authenticationService
 * @memberOf Application Module.Application Run
 * @ngInject
 */
var run = function (/*$rootScope, $state*/) {
}

export default run;


text:
package org.sakaiproject.nakamura.lifecycle;

import com.google.inject.Scopes;

import org.osgi.framework.BundleContext;
import org.sakaiproject.nakamura.api.registry.RegistryService;
import org.sakaiproject.nakamura.guice.AbstractOsgiModule;

/**
 * Configuration module for persistence bindings.
 */
public class ActivatorModule extends AbstractOsgiModule {

  public ActivatorModule(BundleContext bundleContext) {
    super(bundleContext);
  }

  /**
   * {@inheritDoc}
   *
   * @see com.google.inject.AbstractModule#configure()
   */
  @Override
  protected void configure() {
    super.configure();

    // we need the registry service.
    bind(RegistryService.class).toProvider(importService(RegistryService.class)).in(Scopes.SINGLETON);

  }

}


text:
详情请点击:

[Part1](http://just1n.net/2015/11/angular-minimal-login-with-token-by-aspnetwebapi-part1)

[Part2](http://just1n.net/2015/11/angular-minimal-login-with-token-by-aspnetwebapi-part2)


text:
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

# Arrow Developer Scripts

This directory contains scripts useful to developers when packaging,
testing, or committing to Arrow.

Merging a pull request requires being a committer on the project. In addition
you need to have linked your GitHub and ASF accounts on
https://gitbox.apache.org/setup/ to be able to push to GitHub as the main
remote.

* How to merge a Pull request:

```
git remote add apache git@github.com:apache/arrow.git
```

run the following command

```
dev/merge_arrow_pr.py
```

This uses the GitHub REST API; if you encounter rate limit issues, you may set
a `ARROW_GITHUB_API_TOKEN` environment variable to use a Personal Access Token.

Note:

* The directory name of your Arrow git clone must be called arrow
* Without jira-python installed you'll have to close the JIRA manually

example output:
```
Which pull request would you like to merge? (e.g. 34):
```
Type the pull request number (from https://github.com/apache/arrow/pulls) and hit enter.
```
=== Pull Request #X ===
title	Blah Blah Blah
source	repo/branch
target	master
url	https://api.github.com/repos/apache/arrow/pulls/X

Proceed with merging pull request #3? (y/n):
```
If this looks good, type y and hit enter.
```
From git-wip-us.apache.org:/repos/asf/arrow.git
 * [new branch]      master     -> PR_TOOL_MERGE_PR_3_MASTER
Switched to branch 'PR_TOOL_MERGE_PR_3_MASTER'

Merge complete (local ref PR_TOOL_MERGE_PR_3_MASTER). Push to apache? (y/n):
```
A local branch with the merge has been created.
type y and hit enter to push it to apache master
```
Counting objects: 67, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (26/26), done.
Writing objects: 100% (36/36), 5.32 KiB, done.
Total 36 (delta 17), reused 0 (delta 0)
To git-wip-us.apache.org:/repos/arrow-mr.git
   b767ac4..485658a  PR_TOOL_MERGE_PR_X_MASTER -> master
Restoring head pointer to b767ac4e
Note: checking out 'b767ac4e'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at b767ac4... Update README.md
Deleting local branch PR_TOOL_MERGE_PR_X
Deleting local branch PR_TOOL_MERGE_PR_X_MASTER
Pull request #X merged!
Merge hash: 485658a5

Would you like to pick 485658a5 into another branch? (y/n):
```
For now just say n as we have 1 branch

## Verifying Release Candidates

We have provided a script to assist with verifying release candidates:

```shell
bash dev/release/verify-release-candidate.sh 0.7.0 0
```

Currently this only works on Linux (patches to expand to macOS welcome!). Read
the script for information about system dependencies.

On Windows, we have a script that verifies C++ and Python (requires Visual
Studio 2015):

```
dev/release/verify-release-candidate.bat apache-arrow-0.7.0.tar.gz
```

### Verifying the JavaScript release

For JavaScript-specific releases, use a different verification script:

```shell
bash dev/release/js-verify-release-candidate.sh 0.7.0 0
```
# Integration testing

Build the following base image used by multiple tests:

```shell
docker build -t arrow_integration_xenial_base -f docker_common/Dockerfile.xenial.base .
```

## HDFS C++ / Python support

```shell
run_docker_compose.sh hdfs_integration
```

## Apache Spark Integration Tests

Tests can be run to ensure that the current snapshot of Java and Python Arrow
works with Spark. This will run a docker image to build Arrow C++
and Python in a Conda environment, build and install Arrow Java to the local
Maven repositiory, build Spark with the new Arrow artifact, and run Arrow
related unit tests in Spark for Java and Python. Any errors will exit with a
non-zero value. To run, use the following command:

```shell
./run_docker_compose.sh spark_integration

```

Alternatively, you can build and run the Docker images seperately. If you
already are building Spark, these commands will map your local Maven repo
to the image and save time by not having to download all dependencies. These
should be run in a directory one level up from your Arrow repository:

```shell
docker build -f arrow/dev/spark_integration/Dockerfile -t spark-arrow .
docker run -v $HOME/.m2:/root/.m2 spark-arrow
```

NOTE: If the Java API has breaking changes, a patched version of Spark might
need to be used to successfully build.


text:
The Nginx module for adding cookie flag
==========

[![License](http://img.shields.io/badge/license-BSD-brightgreen.svg)](https://github.com/Airis777/nginx_cookie_flag_module/blob/master/LICENSE)

The Nginx module for adding cookie flag

## Dependencies
* [nginx](http://nginx.org)

## Compatibility
* 1.11.x (last tested: 1.11.2)

Earlier versions is not tested.

## Installation

1. Clone the git repository.

  ```
  git clone git://github.com:AirisX/nginx_cookie_flag_module.git
  ```

2. Add the module to the build configuration by adding
  `--add-module=/path/to/nginx_cookie_flag_module`
   or
  `--add-dynamic-module=/path/to/nginx_cookie_flag_module`

3. Build the nginx binary.

4. Install the nginx binary.

## Synopsis

```Nginx
location / {
    set_cookie_flag Secret HttpOnly secure SameSite;
    set_cookie_flag * HttpOnly;
    set_cookie_flag SessionID SameSite=Lax secure;
    set_cookie_flag SiteToken SameSite=Strict;
}
```

## Description
This module for Nginx allows to set the flags "**HttpOnly**", "**secure**" and "**SameSite**" for cookies in the "*Set-Cookie*" upstream response headers.
The register of letters for the flags doesn't matter as it will be converted to the correct value. The order of cookie declaration among multiple directives doesn't matter too.
It is possible to set a default value using symbol "*". In this case flags will be added to the all cookies if no other value for them is overriden.

## Directives

### set_cookie_flag

-| -
--- | ---
**Syntax**  | **set_cookie_flag** \<cookie_name\|*\> [HttpOnly] [secure] [SameSite\|SameSite=[Lax\|Strict]];
**Default** | -
**Context** | server, location

Description: Add flag to desired cookie.

## Author
Anton Saraykin [<Airisenator@gmail.com>]


text:
<!DOCTYPE html>

    <title>404 Error Page 1 | Unify - Responsive Website Template</title>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="shortcut icon" href="favicon.ico">

    <link rel='stylesheet' type='text/css' href='//fonts.googleapis.com/css?family=Open+Sans:400,300,600&subset=cyrillic,latin'>

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

    <link rel="stylesheet" href="assets/css/pages/page_404_error1.css">

    <link rel="stylesheet" href="assets/css/custom.css">

                404
                That's an error!

The requested URL was not found on this server.
 That's all we know.


text:
ServletRequestWrapperGetReader_1Test test PASSED

GenericRequestWrapper:getInputStream

GenericRequestWrapper:getReader


text:
package gnu.text;
import java.text.Format;
import java.text.FieldPosition;
import java.io.Writer;

public class CaseConvertFormat extends ReportFormat
{
  // 'U' - convert to uppercase.
  // 'L' - convert to lowercase.
  // 'C' - capitalize each word
  // 'T' - capitalize first word, lowercase rest.
  char code;

  Format baseFormat;

  public CaseConvertFormat(Format baseFormat, char action)
  {
    this.baseFormat = baseFormat;
    this.code = action;
  }

  public Format getBaseFormat() { return baseFormat; }
  public void setBaseFormat(Format baseFormat) { this.baseFormat = baseFormat;}

  public int format(Object[] args, int start, Writer dst, FieldPosition fpos)
    throws java.io.IOException
  {
    StringBuffer sbuf = new StringBuffer(100);
    int result = format(baseFormat, args, start, sbuf, fpos);
    int len = sbuf.length();
    char prev = ' ';
    for (int i = 0;  i < len;  i++)
      {
	char ch = sbuf.charAt(i);
	if (code == 'U')
	  ch = Character.toUpperCase(ch);
	else if ((code == 'T' && i == 0)
		 || (code == 'C' && ! Character.isLetterOrDigit(prev)))
	  ch = Character.toTitleCase(ch);
	else
	  ch = Character.toLowerCase(ch);
	prev = ch;
	dst.write(ch);
      }
    return result;
  }
}


text:
/**
 *  The global metadata types used by our STM implementations are defined in
 *  this file, along with many of the types used by the TxThread object of
 *  logging the progress of a transaction.
 */

#ifndef METADATA_HPP__
#define METADATA_HPP__

#include <stm/config.h>
#include "stm/MiniVector.hpp"
#include "stm/BitFilter.hpp"

namespace stm
{
  // forward declare for avoiding a SunCC issue
  NORETURN void UNRECOVERABLE(const char*);

  /**
   *  Many of our data structures benefit from having a cap on the number of
   *  threads.  Here we set that cap at 256
   */
  static const unsigned MAX_THREADS = 256;

  /**
   *  Forward declare the TxThread type, so we can use it in some of our
   *  metadata types
   */
  struct TxThread;

  /**
   *  A scope_t is an opaque type used by an API to unwind.
   */
  typedef void scope_t;

  /**
   *  id_version_t uses the msb as the lock bit.  If the msb is zero, treat
   *  the word as a version number.  Otherwise, treat it as a struct with the
   *  lower 8 bits giving the ID of the lock-holding thread.
   */
  union id_version_t
  {
      struct
      {
          // ensure msb is lock bit regardless of platform
#if defined(STM_CPU_X86) /* little endian */
          uintptr_t id:(8*sizeof(uintptr_t))-1;
          uintptr_t lock:1;
#else /* big endian (probably SPARC) */
          uintptr_t lock:1;
          uintptr_t id:(8*sizeof(uintptr_t))-1;
#endif
      } fields;
      uintptr_t all; // read entire struct in a single load
  };

  /**
   * When we acquire an orec, we may ultimately need to reset it to its old
   * value (if we abort).  Saving the old value with the orec is an easy way to
   * support this need without having exta logging in the descriptor.
   */
  struct orec_t
  {
      volatile id_version_t v; // current version number or lockBit + ownerId
      volatile uintptr_t    p; // previous version number
  };

  /**
   *  Nano requires that we log not just the orec address, but also its value
   */
  struct nanorec_t
  {
      orec_t* o;   // address of the orec
      uintptr_t v; // value of the orec
      nanorec_t(orec_t* _o, uintptr_t _v) : o(_o), v(_v) { }
  };

  /**
   *  TLRW-style algorithms don't use orecs, but instead use "byte locks".
   *  This is the type of a byte lock.  We have 32 bits for the lock, and
   *  then 60 bytes corresponding to 60 named threads.
   *
   *  NB: We don't support more than 60 threads in ByteLock-based algorithms.
   *      If you have more than that many threads, you should use adaptivity
   *      to switch to a different algorithm.
   */
  struct bytelock_t
  {
      volatile uint32_t      owner;      // no need for more than 32 bits
      volatile unsigned char reader[CACHELINE_BYTES - sizeof(uint32_t)];

      /**
       *  Setting the read byte is platform-specific, so we make it a method
       *  of the bytelock_t
       *
       *  NB: implemented in algs.hpp, so that it is visible where needed,
       *      but not visible globally
       */
      void set_read_byte(uint32_t id);
  };

  /**
   *  Padded word-sized value for keeping a value in its own cache line
   */
  struct pad_word_t
  {
      volatile uintptr_t val;
      char pad[CACHELINE_BYTES-sizeof(uintptr_t)];
  };

  /**
   * a reader record (rrec) holds bits representing up to MAX_THREADS reader
   * transactions
   *
   *  NB: methods are implemented in algs.hpp, so that they are visible where
   *      needed, but not visible globally
   */
  struct rrec_t
  {
      /*** MAX_THREADS bits, to represent MAX_THREADS readers */
      static const uint32_t BUCKETS = MAX_THREADS / (8*sizeof(uintptr_t));
      static const uint32_t BITS    = 8*sizeof(uintptr_t);
      volatile uintptr_t    bits[BUCKETS];

      /*** set a bit */
      void setbit(unsigned slot);

      /*** test a bit */
      bool getbit(unsigned slot);

      /*** unset a bit */
      void unsetbit(unsigned slot);

      /*** combine test and set */
      bool setif(unsigned slot);

      /*** bitwise or */
      void operator |= (rrec_t& rhs);
  };

  /**
   *  If we want to do an STM with RSTM-style visible readers, this lets us
   *  have an owner and a bunch of readers in a single struct, instead of via
   *  separate orec and rrec tables.  Note that these data structures do not
   *  have nice alignment
   */
  struct bitlock_t
  {
      volatile uintptr_t owner;    // this is the single wrter
      rrec_t             readers;  // large bitmap for readers
  };

  /**
   *  In order to avoid a circular dependency, we need to declare some
   *  WriteSet support here.
   */
  class WordLoggingWriteSetEntry;
  class ByteLoggingWriteSetEntry;
#if defined(STM_WS_WORDLOG)
  typedef WordLoggingWriteSetEntry WriteSetEntry;
#elif defined(STM_WS_BYTELOG)
  typedef ByteLoggingWriteSetEntry WriteSetEntry;
#else
#   error WriteSet logging granularity configuration error.
#endif

  /**
   *  Common TypeDefs
   */
  typedef MiniVector<orec_t*>      OrecList;     // vector of orecs
  typedef MiniVector<rrec_t*>      RRecList;     // vector of rrecs
  typedef MiniVector<bytelock_t*>  ByteLockList; // vector of bytelocks
  typedef MiniVector<bitlock_t*>   BitLockList;  // vector of bitlocks
  typedef BitFilter<1024>          filter_t;     // flat 1024-bit Bloom filter
  typedef MiniVector<nanorec_t>    NanorecList;  // <orec,val> pairs
  typedef MiniVector<void*>        AddressList;  // for the mmpolicy

  /**
   *  These are for counting consecutive aborts in a histogram.  We use them
   *  for measuring toxic transactions.  Note that there is special support
   *  for counting how many times an hourglass transaction commits or aborts.
   */
  struct toxic_histogram_t
  {
      /*** the highest number of consec aborts > 16 */
      uint32_t max;

      /*** how many hourglass commits occurred? */
      uint32_t hg_commits;

      /*** how many hourglass aborts occurred? */
      uint32_t hg_aborts;

      /*** histogram with 0-16 + overflow */
      uint32_t buckets[18];

      /*** on commit, update the appropriate bucket */
      void onCommit(uint32_t aborts);

      /*** simple printout */
      void dump();

      /*** on hourglass commit */
      void onHGCommit();

      /*** on hourglass abort() */
      void onHGAbort();

      /*** simple constructor */
      toxic_histogram_t() : max(0), hg_commits(0), hg_aborts(0)
      {
          for (int i = 0; i < 18; ++i)
              buckets[i] = 0;
      }
  };

  /**
   *  When STM_COUNTCONSEC_YES is not set, we don't do anything for these
   *  events
   */
  struct toxic_nop_t
  {
      void onCommit(uint32_t) { }
      void dump()             { }
      void onHGCommit()       { }
      void onHGAbort()        { }
  };

#ifdef STM_COUNTCONSEC_YES
  typedef toxic_histogram_t toxic_t;
#else
  typedef toxic_nop_t toxic_t;
#endif

} // namespace stm

#endif // METADATA_HPP__


text:
/*
  ByteBuffer.h - A circular buffer implementation for Arduino
  Created by Sigurdur Orn, July 19, 2010.  siggi@mit.edu
  Updated by GreyGnome (aka Mike Schwager) Thu Feb 23 17:25:14 CST 2012
  	added the putString() method and the fillError variable.
	added the checkError() and resetError() methods.  The checkError() method resets the fillError variable
	to false as a side effect.
	added the ByteBuffer(unsigned int buf_size) constructor.
	added the init() method, and had the constructor call it automagically.
	protected certain sections of the code with cli()/sei() calls, for safe use by interrupts.
	Also made the capacity, position, length, and fillError variables volatile, for safe use by interrupts.
 */

#ifndef ByteBuffer_h
#define ByteBuffer_h

#if defined(ARDUINO) && ARDUINO >= 100
  #include <Arduino.h>
#else
  #include <WProgram.h>
#endif
//#include <util/atomic.h>

#define DEFAULTBUFSIZE 32
class ByteBuffer
{
public:
	ByteBuffer() {
		init();
	};
	ByteBuffer(unsigned int buf_size) {
		init(buf_size);
	};

	// This method initializes the datastore of the buffer to a certain size.
	void init(unsigned int buf_size);

	// This method initializes the datastore of the buffer to the default size.
	void init();

	// This method resets the buffer into an original state (with no data)
	void clear();

	// This method resets the fillError variable to false.
	void resetError();

	// This method tells you if your buffer overflowed at some time since the last
	// check.  The error state will be reset to false.
	boolean checkError();

	// This releases resources for this buffer, after this has been called the buffer should NOT be used
	void deAllocate();

	// Returns how much space is used in the buffer
	int getSize();

	// Returns the maximum capacity of the buffer
	int getCapacity();

	// This method returns the byte that is located at index in the buffer but doesn't modify the buffer like the get methods (doesn't remove the retured byte from the buffer)
	byte peek(unsigned int index);

	//
	// Put methods, either a regular put in back or put in front
	//
	uint8_t putInFront(byte in);
	uint8_t put(byte in);
	uint8_t putString(char *in);

	void putIntInFront(int in);
	void putInt(int in);

	void putHex(uint8_t in);
	void putDec(uint8_t in);
	void putDec(int8_t in);

	void putLongInFront(long in);
	void putLong(long in);

	void putFloatInFront(float in);
	void putFloat(float in);

	//
	// Get methods, either a regular get from front or from back
	//
	byte get();
	byte getFromBack();

	int getInt();
	int getIntFromBack();

	long getLong();
	long getLongFromBack();

	float getFloat();
	float getFloatFromBack();

private:
	byte* data;

	volatile unsigned int capacity;
	volatile unsigned int position;
	volatile unsigned int length;
	volatile boolean fillError;
};

#endif