text:
package madgik.exareme.master.engine.rmi;

import madgik.exareme.common.app.engine.AdpDBDMOperator;
import madgik.exareme.common.app.engine.AdpDBSelectOperator;
import madgik.exareme.common.schema.Index;
import madgik.exareme.common.schema.PhysicalTable;
import madgik.exareme.master.engine.AdpDBQueryScriptStatistics;
import madgik.exareme.master.engine.rmi.tree.ContainerTopology;
import madgik.exareme.master.engine.rmi.tree.TreeConcreteQueryGraph;
import madgik.exareme.master.queryProcessor.graph.ConcreteOperator;
import madgik.exareme.master.queryProcessor.graph.ConcreteQueryGraph;
import madgik.exareme.master.queryProcessor.optimizer.ContainerFilter;
import madgik.exareme.master.queryProcessor.optimizer.ContainerResources;
import madgik.exareme.master.queryProcessor.optimizer.SolutionSpace;
import madgik.exareme.master.queryProcessor.optimizer.scheduler.SchedulingResult;
import madgik.exareme.utils.association.Pair;
import madgik.exareme.worker.art.container.ContainerProxy;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;

/**
 * @author heraldkllapi
 */
public class StateData implements Serializable {
    private static final long serialVersionUID = 1L;
    public ArrayList<AdpDBSelectOperator> dbOps = null;
    public ArrayList<AdpDBDMOperator> dmOps = null;
    public ArrayList<Index> indexes = null;
    public ArrayList<PhysicalTable> intermediate = null;
    public ArrayList<PhysicalTable> results = null;
    public List<Pair<ConcreteOperator, Integer>> tableBindings = null;
    public HashMap<String, Integer> inputTableCount = null;
    public ConcreteQueryGraph graph = null;
    public HashMap<String, ConcreteOperator[]> tableProducers = null;
    public String resultTableName = null;
    public AdpDBQueryScriptStatistics statistics = null;
    public ContainerProxy[] proxies;
    public transient ContainerFilter contFilter;
    public ArrayList<ContainerResources> containers = null;
    public SolutionSpace space = null;
    public SchedulingResult result = null;
    public int[] containerTablePartCounts = null;

    // The following are for tree execution
    public TreeConcreteQueryGraph treeGraph = null;
    public ContainerTopology topology = null;

    public StateData() {
        dbOps = new ArrayList<AdpDBSelectOperator>();
        dmOps = new ArrayList<AdpDBDMOperator>();
        indexes = new ArrayList<Index>();
        intermediate = new ArrayList<PhysicalTable>();
        results = new ArrayList<PhysicalTable>();
        tableBindings = new LinkedList<Pair<ConcreteOperator, Integer>>();
        inputTableCount = new HashMap<String, Integer>();
        graph = new ConcreteQueryGraph();
        tableProducers = new HashMap<String, ConcreteOperator[]>();
        statistics = new AdpDBQueryScriptStatistics();
        containers = new ArrayList<ContainerResources>();
    }

    public final void shallowCopyFrom(StateData other) {
        dbOps = other.dbOps;
        dmOps = other.dmOps;
        indexes = other.indexes;
        intermediate = other.intermediate;
        results = other.results;
        tableBindings = other.tableBindings;
        inputTableCount = other.inputTableCount;
        graph = other.graph;
        tableProducers = other.tableProducers;
        resultTableName = other.resultTableName;
        statistics = other.statistics;
        proxies = other.proxies;
        contFilter = other.contFilter;
        containers = other.containers;
        space = other.space;
        result = other.result;
        containerTablePartCounts = other.containerTablePartCounts;
        treeGraph = other.treeGraph;
        topology = other.topology;
    }
}


text:
class CALauncherApp : public BApplication
{
	public:
						CALauncherApp();
						~CALauncherApp();
		virtual void 	ReadyToRun();
		virtual void 	AboutRequested();
	private:
		void			NewYearGreeting();
		CALauncherWindow		*MainWindow;
		BAlert			*AboutAlert;
		BAlert			*SpecialAlert;
		TPreferences	*app_settings;
};

#endif

redpajama_set_name: RedPajamaGithub


text:
package gamesoftitalia.bizbong;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.media.MediaPlayer;
import android.os.IBinder;
import android.os.Vibrator;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.google.gson.Gson;

import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.util.concurrent.ExecutionException;

import gamesoftitalia.bizbong.adapters.PagerAdapter;
import gamesoftitalia.bizbong.connessione.ProfiloAsync;
import gamesoftitalia.bizbong.entity.Impostazioni;
import gamesoftitalia.bizbong.entity.Profilo;
import gamesoftitalia.bizbong.service.MusicServiceBase;

public class HomeActivity extends AppCompatActivity {
    static final int READ_BLOCK_SIZE = 100;
    private ViewPager viewPager;
    private TabLayout tabLayout;
    private LinearLayout profiloButton;
    private ImageButton logoutButton;
    private ImageButton impostazioniButton;
    private static TextView nicknameText;
    private SharedPreferences sharedPreferences;
    private SharedPreferences.Editor editor;
    private Impostazioni entity;

    private Intent music=new Intent();
    private boolean audioAssociato;
    private MusicServiceBase mServ;

    private String nickname;
    private String profiloGson;
    private Profilo profilo;

    ServiceConnection Scon =new ServiceConnection(){
        /*implementazione metodi astratti*/
        public void onServiceConnected(ComponentName name, IBinder binder) {
            mServ = ((MusicServiceBase.ServiceBinder)binder).getService();
        }
        public void onServiceDisconnected(ComponentName name) {
            mServ = null;
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);
        caricaImpostazioni();

        //Shared
        sharedPreferences = getSharedPreferences("sessioneUtente", ProfiloActivity.MODE_PRIVATE);
        editor = sharedPreferences.edit();

        if(sharedPreferences.getAll().containsKey("nickname"))
            nickname = sharedPreferences.getAll().get("nickname").toString();

        try {
            profiloGson = new ProfiloAsync(HomeActivity.this).execute(nickname).get();
        } catch (InterruptedException | ExecutionException e) {
            e.printStackTrace();
        }
        profilo = new Gson().fromJson(profiloGson, Profilo.class);

        // String
        nicknameText = (TextView) findViewById(R.id.nicknameProfilo);
        if(sharedPreferences.getAll().containsKey("nickname"))
            nicknameText.setText(sharedPreferences.getAll().get("nickname").toString());

        //Music
        audioAssociato=entity.getAudio();
        if (audioAssociato){
            music.setClass(this, MusicServiceBase.class);
            bindService(music, Scon, Context.BIND_AUTO_CREATE);    //legare il servizio al contesto
            startService(music);
        }

        /*
        // Toolbar
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        */

        // TabLayout
        tabLayout = (TabLayout) findViewById(R.id.tab_layout);
        tabLayout.addTab(tabLayout.newTab().setText("Tab 1"));
        tabLayout.addTab(tabLayout.newTab().setText("Tab 2"));
        tabLayout.addTab(tabLayout.newTab().setText("Tab 3"));
        tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
        setupTabIcons();

        // ViewPager
        viewPager = (ViewPager) findViewById(R.id.pager);
        final PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager(), tabLayout.getTabCount(), profilo, entity);
        viewPager.setAdapter(adapter);
        viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
        tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                viewPager.setCurrentItem(tab.getPosition());
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });

        // Button
        profiloButton = (LinearLayout) findViewById(R.id.profiloButton);
        profiloButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(entity.getEffetti()==true) {
                    MediaPlayer mp = MediaPlayer.create(HomeActivity.this, R.raw.bottoni);
                    mp.start();
                }
                if(entity.getVibrazione()){
                    Vibrator g = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
                    g.vibrate(100);
                }
                Intent intent = new Intent(HomeActivity.this, ProfiloActivity.class);
                intent.putExtra("Impostazioni", (Serializable) entity);
                startActivity(intent);
            }
        });

        //Button impostazioni
        impostazioniButton = (ImageButton) findViewById(R.id.impostazioniButton);
        impostazioniButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(entity.getEffetti()==true) {
                    MediaPlayer mp = MediaPlayer.create(HomeActivity.this, R.raw.bottoni);
                    mp.start();
                }
                if(entity.getVibrazione()){
                    Vibrator g = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
                    g.vibrate(100);
                }
                Intent intent = new Intent(HomeActivity.this, ImpostazioniActivity.class);
                startActivity(intent);
            }
        });

        // ImageButton
        logoutButton = (ImageButton) findViewById(R.id.logoutButton);
        logoutButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(entity.getEffetti()==true) {
                    MediaPlayer mp = MediaPlayer.create(HomeActivity.this, R.raw.bottoni);
                    mp.start();
                }
                if(entity.getVibrazione()){
                    Vibrator g = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
                    g.vibrate(100);
                }
                // Editor clear all element
                editor.clear();
                editor.commit();

                // Restart MainActivity
                Intent intent = new Intent(HomeActivity.this, IntroActivity.class);
                startActivity(intent);
                finish();
            }
        });

    }

    private void setupTabIcons() {

        TextView tabUno = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tablayout, null);
        tabUno.setText("ONE");
        tabUno.setCompoundDrawablesWithIntrinsicBounds(0, R.mipmap.ic_home, 0, 0);
        tabLayout.getTabAt(0).setCustomView(tabUno);

        TextView tabDue = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tablayout, null);
        tabDue.setText("TWO");
        tabDue.setCompoundDrawablesWithIntrinsicBounds(0, R.mipmap.ic_challenge, 0, 0);
        tabLayout.getTabAt(1).setCustomView(tabDue);

        TextView tabTre = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tablayout, null);
        tabTre.setText("THREE");
        tabTre.setCompoundDrawablesWithIntrinsicBounds(0, R.mipmap.ic_pie_chart, 0, 0);
        tabLayout.getTabAt(2).setCustomView(tabTre);
    }

    private void caricaImpostazioni(){
        //stringa da dividere
        String imp=ReadBtn();

        //divisione stringa
        String[] i=imp.split("\\-");

        String lingua=i[0];
        String audioS=i[1];
        String effettiS=i[2];
        String vibrazioneS=i[3];

        //conversione stringhe
        boolean audio= Boolean.valueOf(audioS);             //String-->boolean
        boolean effetti= Boolean.valueOf(effettiS);         //String-->boolean
        boolean vibrazione= Boolean.valueOf(vibrazioneS);   //String-->boolean

        //oggetto impostazioni da avvalorare con i valori presi da file
        entity=new Impostazioni(lingua,audio,effetti,vibrazione);
    }

    private String ReadBtn() {
        String s="";
        try {
            FileInputStream fileIn=openFileInput("BizBong.txt");
            InputStreamReader InputRead= new InputStreamReader(fileIn);
            char[] inputBuffer= new char[READ_BLOCK_SIZE];
            int charRead;
            while ((charRead=InputRead.read(inputBuffer))>0) {
                String readstring=String.copyValueOf(inputBuffer,0,charRead);
                s +=readstring;
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
        return s;
    }

    @Override
    protected void onResume() {     /*quando l'app viene riattivata*/
        super.onResume();
        if (audioAssociato==true)
            if (mServ != null) {
                bindService(music, Scon, Context.BIND_AUTO_CREATE);
                mServ.resumeMusic();
            }
    };

    @Override
    protected void onPause() {            /*quando l'app va in background viene stoppato*/
        if (audioAssociato==true)
            if(mServ!=null){
                mServ.pauseMusic();
                unbindService(Scon);
            }
        super.onPause();
    }

    @Override
    protected void onDestroy() {
        try {
            audioAssociato = entity.getAudio();
            if (audioAssociato) {
                mServ.stopMusic();
                stopService(music);
                unbindService(Scon);   //togliere il contesto al servizio
            }
        } catch (NullPointerException | IllegalArgumentException e){}

        super.onDestroy();
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if ((keyCode == KeyEvent.KEYCODE_BACK)) {
            // Dialog
            AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
            LayoutInflater inflater = this.getLayoutInflater();
            final View dialogView = inflater.inflate(R.layout.dialog_close_app, null);
            dialogBuilder.setView(dialogView);

            final AlertDialog alertDialog = dialogBuilder.create();

            // Button Exit
            Button yesButton = (Button) dialogView.findViewById(R.id.yesButton);
            yesButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    android.os.Process.killProcess(android.os.Process.myPid());
                }
            });

            Button noButton = (Button) dialogView.findViewById(R.id.yesButton);
            noButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    alertDialog.dismiss();
                }
            });

            alertDialog.show();

            return false;

        }
        return super.onKeyDown(keyCode, event);
    }
}


text:
<?php

/** */
namespace Organizations\Factory\Entity\Hydrator;

use Core\Entity\Hydrator\Factory\ImageSetHydratorFactory;
use Organizations\Options\OrganizationLogoOptions;

/**
 * ${CARET}
 *
 * @author Mathias Gelhausen <gelhausen@cross-solution.de>
 * @todo write test
 */
class LogoHydratorFactory extends ImageSetHydratorFactory
{
    protected function getOptionsName()
    {
        return OrganizationLogoOptions::class;
    }
}


text:
#include "res2h.h"
#include "checksum.h"
#include "res2hhelpers.h"
#include "stdfs.h"
#include "stdfshelpers.h"
#include "syshelpers.h"

#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

static bool beVerbose = false;
static bool useRecursion = false;
static bool useC = false;
static bool createBinary = false;
static bool appendFile = false;
static bool combineResults = false;
static stdfs::path commonHeaderFilePath;
static stdfs::path utilitiesFilePath;
static stdfs::path inFilePath;
static stdfs::path outFilePath;
static std::ofstream badOfStream; // we need this later as a default parameter...
static const std::string indent = "    ";

/// @brief Macro to do / print something if verbose output is on. Yes, this should probably be a template...
#define IF_BEVERBOSE(a)         \
    {                           \
        if (beVerbose) { (a); } \
    }

static void printVersion()
{
    std::cout << "res2h " << RES2H_VERSION_STRING << " - Load plain binary data and dump to a raw C/C++ array." << std::endl
              << std::endl;
}

static void printUsage()
{
    std::cout << "Usage: res2h INFILE/INDIR OUTFILE/OUTDIR [OPTIONS]" << std::endl;
    std::cout << "Valid OPTIONS:" << std::endl;
    std::cout << "-r Recurse into subdirectories below indir." << std::endl;
    std::cout << "-c Use .c files and C-arrays for storing the data definitions, else" << std::endl;
    std::cout << "   uses .cpp files and std::vector/std::map." << std::endl;
    std::cout << "-h HEADERFILE Puts all declarations in a common \"HEADERFILE\" using \"extern\"" << std::endl;
    std::cout << "   and includes that header file in the source files." << std::endl;
    std::cout << "-u SOURCEFILE Create utility functions and arrays in a .c/.cpp file." << std::endl;
    std::cout << "   Only makes sense in combination with -h" << std::endl;
    std::cout << "-1 Combine all converted files into one big .c/.cpp file (use with -u)." << std::endl;
    std::cout << "-b Compile binary archive outfile containing all infile(s). For reading in your" << std::endl;
    std::cout << "   software include res2hinterface.h/.cpp and consult the docs." << std::endl;
    std::cout << "-a Append infile to outfile. Can be used to append an archive to an executable." << std::endl;
    std::cout << "-v Be verbose." << std::endl;
    std::cout << "Examples:" << std::endl;
    std::cout << "res2h ./lenna.png ./resources/lenna_png.cpp (convert single file)" << std::endl;
    std::cout << "res2h ./data ./resources -s -h resources.h -u resources.cpp (convert directory)" << std::endl;
    std::cout << "res2h ./data ./resources/data.bin -b (convert directory to binary file)" << std::endl;
    std::cout << "res2h ./resources/data.bin ./program.exe -a (append archive to executable)" << std::endl;
}

static bool readArguments(const std::vector<std::string> &arguments)
{
    bool pastFiles = false;
    for (auto aIt = arguments.cbegin(); aIt != arguments.cend(); ++aIt)
    {
        // check what it is
        auto argument = *aIt;
        if (argument == "-a")
        {
            if (!commonHeaderFilePath.empty() || !utilitiesFilePath.empty())
            {
                std::cerr << "Option -a can not be combined with -h or -u" << std::endl;
                return false;
            }
            if (createBinary)
            {
                std::cerr << "Option -a can not be combined with -b" << std::endl;
                return false;
            }
            if (combineResults)
            {
                std::cerr << "Option -a can not be combined with -1" << std::endl;
                return false;
            }
            appendFile = true;
            pastFiles = true;
        }
        else if (argument == "-1")
        {
            // -u must be used for this to work. check if specified
            if (std::find(arguments.cbegin(), arguments.cend(), "-u") != arguments.cend())
            {
                combineResults = true;
                pastFiles = true;
                break;
            }
            if (!combineResults)
            {
                // -u not specified. complain to user.
                std::cerr << "Option -1 has to be combined with -u" << std::endl;
                return false;
            }
        }
        else if (argument == "-b")
        {
            if (!commonHeaderFilePath.empty() || !utilitiesFilePath.empty())
            {
                std::cerr << "Option -b can not be combined with -h or -u" << std::endl;
                return false;
            }
            if (appendFile)
            {
                std::cerr << "Option -b can not be combined with -a" << std::endl;
                return false;
            }
            if (combineResults)
            {
                std::cerr << "Warning: Creating binary archive. Option -1 ignored" << std::endl;
                return false;
            }
            createBinary = true;
            pastFiles = true;
        }
        else if (argument == "-c")
        {
            useC = true;
            pastFiles = true;
        }
        else if (argument == "-r")
        {
            useRecursion = true;
            pastFiles = true;
        }
        else if (argument == "-v")
        {
            beVerbose = true;
            pastFiles = true;
        }
        else if (argument == "-h")
        {
            if (createBinary)
            {
                std::cerr << "Option -h can not be combined with -b" << std::endl;
                return false;
            }
            if (appendFile)
            {
                std::cerr << "Option -h can not be combined with -a" << std::endl;
                return false;
            }
            // try getting next argument as header file name
            if (++aIt != arguments.cend())
            {
                commonHeaderFilePath = naiveLexicallyNormal(stdfs::path(*aIt));
                if (commonHeaderFilePath.empty())
                {
                    return false;
                }
            }
            else
            {
                std::cerr << "Option -h specified, but no file name found" << std::endl;
                return false;
            }
            pastFiles = true;
        }
        else if (argument == "-u")
        {
            if (createBinary)
            {
                std::cerr << "Option -u can not be combined with -b" << std::endl;
                return false;
            }
            if (appendFile)
            {
                std::cerr << "Option -u can not be combined with -a" << std::endl;
                return false;
            }
            // try getting next argument as utility file name++
            if (++aIt != arguments.cend())
            {
                utilitiesFilePath = naiveLexicallyNormal(stdfs::path(*aIt));
                if (utilitiesFilePath.empty())
                {
                    return false;
                }
            }
            else
            {
                std::cerr << "Option -u specified, but no file name found" << std::endl;
                return false;
            }
            if (!utilitiesFilePath.empty() && commonHeaderFilePath.empty())
            {
                std::cerr << "Warning: -u does not make much sense without -h..." << std::endl;
            }
            pastFiles = true;
        }
        // none of the options was matched until here...
        else if (!pastFiles)
        {
            // if no files/directories have been found yet this is probably a file/directory
            if (inFilePath.empty())
            {
                inFilePath = naiveLexicallyNormal(stdfs::path(argument));
                if (inFilePath.empty())
                {
                    return false;
                }
            }
            else if (outFilePath.empty())
            {
                outFilePath = naiveLexicallyNormal(stdfs::path(argument));
                if (outFilePath.empty())
                {
                    return false;
                }
                pastFiles = true;
            }
        }
        else
        {
            std::cerr << "Unknown argument \"" << argument << "\"" << std::endl;
            return false;
        }
    }
    return true;
}

static bool convertFile(FileData &fileData, const stdfs::path &commonHeaderPath, std::ofstream &outStream = badOfStream, bool addHeader = true)
{
    if (!stdfs::exists(fileData.inPath))
    {
        std::cerr << "File \"" << fileData.inPath.string() << "\" does not exist" << std::endl;
        return false;
    }
    // try to open the input file
    std::ifstream inStream;
    inStream.open(fileData.inPath.string(), std::ios_base::in | std::ios_base::binary);
    if (!inStream.is_open() || !inStream.good())
    {
        std::cerr << "Failed to open file \"" << fileData.inPath.string() << "\" for reading" << std::endl;
        return false;
    }
    IF_BEVERBOSE(std::cout << "Converting input file " << fileData.inPath)
    // try getting size of data
    inStream.seekg(0, std::ios::end);
    fileData.size = static_cast<uint64_t>(inStream.tellg());
    inStream.seekg(0);
    // check if the caller passed an output stream and use that
    bool closeOutStream = false;
    if (!outStream.is_open() || !outStream.good())
    {
        if (!fileData.outPath.empty())
        {
            // try opening the output stream. truncate it when it exists
            outStream.open(fileData.outPath.string(), std::ofstream::out | std::ofstream::trunc);
        }
        else
        {
            std::cerr << "No output stream passed, but output path for \"" << fileData.inPath.filename().string() << "\" is empty! Skipping." << std::endl;
            return false;
        }
        closeOutStream = true;
    }
    if (!outStream.is_open() || !outStream.good())
    {
        std::cerr << "Failed to open file \"" << fileData.outPath.string() << "\" for writing" << std::endl;
        return false;
    }
    // check if caller wants to add a header
    if (addHeader)
    {
        // add message
        outStream << "// this file was auto-generated from \"" << fileData.inPath.filename().string() << "\" by res2h at " << currentDateAndTime() << std::endl
                  << std::endl;
        // add header include
        if (!commonHeaderPath.empty())
        {
            // common header path must be relative to destination directory
            stdfs::path relativeHeaderPath = naiveRelative(commonHeaderPath, fileData.outPath);
            outStream << "#include \"" << relativeHeaderPath.generic_string() << "\"" << std::endl
                      << std::endl;
        }
    }
    // create names for variables
    fileData.dataVariableName = fileData.outPath.filename().stem().string() + "_data";
    fileData.sizeVariableName = fileData.outPath.filename().stem().string() + "_size";
    // add size and data variable
    if (fileData.size <= UINT16_MAX)
    {
        outStream << "const uint16_t ";
    }
    else if (fileData.size <= UINT32_MAX)
    {
        outStream << "const uint32_t ";
    }
    else
    {
        outStream << "const uint64_t ";
    }
    outStream << fileData.sizeVariableName << " = " << std::dec << fileData.size << ";" << std::endl;
    outStream << "const uint8_t " << fileData.dataVariableName << "[" << std::dec << fileData.size << "] = {" << std::endl;
    outStream << indent; // first indent
    // now add content
    uint64_t breakCounter = 0;
    while (!inStream.eof())
    {
        // read byte from source
        unsigned char dataByte;
        inStream.read(reinterpret_cast<char *>(&dataByte), 1);
        // check if we have actually read something
        if (inStream.gcount() != 1 || inStream.eof())
        {
            // we failed to read. break the read loop and close the file.
            break;
        }
        // write to destination in hex with a width of 2 and '0' as padding. we do not use showbase, as it doesn't work with zero values
        outStream << "0x" << std::setw(2) << std::setfill('0') << std::hex << static_cast<unsigned int>(dataByte);
        // was this the last character?
        if (!inStream.eof() && fileData.size > static_cast<uint64_t>(inStream.tellg()))
        {
            // no. add comma.
            outStream << ",";
            // add break after 14 bytes and add indent again
            if (++breakCounter % 14 == 0)
            {
                outStream << std::endl
                          << indent;
            }
        }
    }
    // add closing curly braces
    outStream << std::endl
              << "};" << std::endl
              << std::endl;
    // close files
    if (closeOutStream)
    {
        outStream.close();
    }
    inStream.close();
    IF_BEVERBOSE(std::cout << " - succeeded." << std::endl)
    return true;
}

static bool createCommonHeader(const std::vector<FileData> &fileList, const stdfs::path &commonHeaderPath, bool addUtilityFunctions, bool useCConstructs)
{
    // try opening the output file. truncate it when it exists
    std::ofstream outStream;
    outStream.open(commonHeaderPath.generic_string(), std::ofstream::out | std::ofstream::trunc);
    if (!outStream.is_open() || !outStream.good())
    {
        std::cerr << "Failed to open file \"" << commonHeaderPath << "\" for writing" << std::endl;
        return false;
    }
    IF_BEVERBOSE(std::cout << std::endl
                           << "Creating common header " << commonHeaderPath)
    // add message
    outStream << "// this file was auto-generated by res2h at " << currentDateAndTime() << std::endl
              << std::endl;
    // add #pragma to only include once
    outStream << "#pragma once" << std::endl
              << std::endl;
    // add includes for C++
    if (!useCConstructs)
    {
        outStream << "#include <string>" << std::endl;
        if (addUtilityFunctions)
        {
            outStream << "#include <map>" << std::endl;
        }
        outStream << std::endl;
    }
    // add all files and check maximum size
    uint64_t maxSize = 0;
    for (const auto &fdIt : fileList)
    {
        // add size and data variable
        maxSize = maxSize < fdIt.size ? fdIt.size : maxSize;
        if (fdIt.size <= UINT16_MAX)
        {
            outStream << "extern const uint16_t ";
        }
        else if (fdIt.size <= UINT32_MAX)
        {
            outStream << "extern const uint32_t ";
        }
        else
        {
            outStream << "extern const uint64_t ";
        }
        outStream << fdIt.sizeVariableName << ";" << std::endl;
        outStream << "extern const uint8_t " << fdIt.dataVariableName << "[];" << std::endl
                  << std::endl;
    }
    // if we want utilities, add array
    if (addUtilityFunctions)
    {
        // add resource struct
        outStream << "struct Res2hEntry {" << std::endl;
        if (useCConstructs)
        {
            outStream << indent << "const char * relativeFileName;" << std::endl;
        }
        else
        {
            outStream << indent << "const std::string relativeFileName;" << std::endl;
        }
        //  add size member depending on the determined maximum file size
        if (maxSize <= UINT16_MAX)
        {
            outStream << indent << "const uint16_t size;" << std::endl;
        }
        else if (maxSize <= UINT32_MAX)
        {
            outStream << indent << "const uint32_t size;" << std::endl;
        }
        else
        {
            outStream << indent << "const uint64_t size;" << std::endl;
        }
        outStream << indent << "const uint8_t * data;" << std::endl;
        outStream << "};" << std::endl
                  << std::endl;
        // add list holding files
        outStream << "extern const uint32_t res2hNrOfFiles;" << std::endl;
        outStream << "extern const Res2hEntry res2hFiles[];" << std::endl
                  << std::endl;
        if (!useCConstructs)
        {
            // add additional std::map if C++
            outStream << "typedef const std::map<const std::string, const Res2hEntry> res2hMapType;" << std::endl;
            outStream << "extern res2hMapType res2hMap;" << std::endl;
        }
    }
    // close file
    outStream.close();
    IF_BEVERBOSE(std::cout << " - succeeded." << std::endl)
    return true;
}

static bool createUtilities(std::vector<FileData> &fileList, const stdfs::path &utilitiesPath, const stdfs::path &commonHeaderPath, bool useCConstructs, bool addFileData)
{
    // try opening the output file. truncate it when it exists
    std::ofstream outStream;
    outStream.open(utilitiesPath.generic_string(), std::ofstream::out | std::ofstream::trunc);
    if (!outStream.is_open() || !outStream.good())
    {
        std::cerr << "Failed to open file \"" << utilitiesPath << "\" for writing" << std::endl;
        return false;
    }
    IF_BEVERBOSE(std::cout << std::endl
                           << "Creating utilities file " << utilitiesPath)
    // add message
    outStream << "// this file was auto-generated by res2h at " << currentDateAndTime() << std::endl
              << std::endl;
    // create path to include file RELATIVE to this file
    stdfs::path relativePath = naiveRelative(commonHeaderPath, utilitiesPath);
    // include header file
    outStream << "#include \"" << relativePath.string() << "\"" << std::endl
              << std::endl;
    // if the data should go to this file too, add it
    if (addFileData)
    {
        for (auto &fd : fileList)
        {
            if (!convertFile(fd, commonHeaderFilePath, outStream, false))
            {
                std::cerr << "Failed to convert all files. Aborting" << std::endl;
                outStream.close();
                return false;
            }
        }
    }
    // begin data arrays. switch depending whether C or C++
    outStream << "const uint32_t res2hNrOfFiles = " << fileList.size() << ";" << std::endl;
    // add files
    outStream << "const Res2hEntry res2hFiles[res2hNrOfFiles] = {" << std::endl;
    outStream << indent; // first indent
    for (auto fdIt = fileList.cbegin(); fdIt != fileList.cend();)
    {
        outStream << "{\"" << fdIt->internalName << "\", " << fdIt->sizeVariableName << ", " << fdIt->dataVariableName << "}";
        // was this the last entry?
        ++fdIt;
        if (fdIt != fileList.cend())
        {
            // no. add comma.
            outStream << ",";
            // add break after every entry and add indent again
            outStream << std::endl
                      << indent;
        }
    }
    outStream << std::endl
              << "};" << std::endl;
    if (!useCConstructs)
    {
        // add files to map
        outStream << std::endl
                  << "res2hMapType::value_type mapTemp[] = {" << std::endl;
        outStream << indent;
        for (auto fdIt = fileList.cbegin(); fdIt != fileList.cend();)
        {
            outStream << "std::make_pair(\"" << fdIt->internalName << "\", res2hFiles[" << (fdIt - fileList.cbegin()) << "])";
            // was this the last entry?
            ++fdIt;
            if (fdIt != fileList.cend())
            {
                // no. add comma.
                outStream << ",";
                // add break after every entry and add indent again
                outStream << std::endl
                          << indent;
            }
        }
        outStream << std::endl
                  << "};" << std::endl
                  << std::endl;
        // create map
        outStream << "res2hMapType res2hMap(mapTemp, mapTemp + sizeof mapTemp / sizeof mapTemp[0]);" << std::endl;
    }
    // close file
    outStream.close();
    IF_BEVERBOSE(std::cout << " - succeeded." << std::endl)
    return true;
}

static bool createBlob(const std::vector<FileData> &fileList, const stdfs::path &filePath)
{
    // try opening the output file. truncate it when it exists
    std::fstream outStream;
    outStream.open(filePath.string(), std::ofstream::out | std::ofstream::binary | std::ofstream::trunc);
    if (!outStream.is_open() || !outStream.good())
    {
        std::cerr << "Failed to open file \"" << filePath.string() << "\" for writing" << std::endl;
        return false;
    }
    const auto nrOfEntries = static_cast<uint32_t>(fileList.size());
    // check if a 64bit archive is needed, or 32bits suffice
    uint64_t directorySize = 0;
    uint64_t maxDataSize = 0;
    uint64_t dataSize = 0;
    for (const auto &file : fileList)
    {
        dataSize += file.size;
        maxDataSize = maxDataSize < file.size ? file.size : maxDataSize;
        directorySize += file.internalName.size();
    }
    // now take worst case header and fixed directory size into account and check if we need 32 or 64 bit
    const bool mustUse64Bit = maxDataSize > UINT32_MAX || (RES2H_HEADER_SIZE_64 + directorySize + nrOfEntries * RES2H_DIRECTORY_SIZE_64 + dataSize + sizeof(uint64_t)) > UINT32_MAX;
    IF_BEVERBOSE(std::cout << std::endl
                           << "Creating binary " << (mustUse64Bit ? "64" : "32") << "bit archive " << filePath << std::endl)
    // now that we know how many bits, add the correct amount of data for the fixed directory entries to the variable
    directorySize += nrOfEntries * (mustUse64Bit ? RES2H_DIRECTORY_SIZE_64 : RES2H_DIRECTORY_SIZE_32);
    // add magic number to file
    outStream.write(reinterpret_cast<const char *>(&RES2H_MAGIC_BYTES), sizeof(RES2H_MAGIC_BYTES) - 1);
    // add version and format flag to file
    const uint32_t fileVersion = RES2H_ARCHIVE_VERSION;
    const uint32_t fileFlags = mustUse64Bit ? 64 : 32;
    outStream.write(reinterpret_cast<const char *>(&fileVersion), sizeof(uint32_t));
    outStream.write(reinterpret_cast<const char *>(&fileFlags), sizeof(uint32_t));
    // add dummy archive size to file
    uint64_t archiveSize = 0;
    outStream.write(reinterpret_cast<const char *>(&archiveSize), (mustUse64Bit ? sizeof(uint64_t) : sizeof(uint32_t)));
    // add number of directory entries to file
    outStream.write(reinterpret_cast<const char *>(&nrOfEntries), sizeof(uint32_t));
    // calculate data start offset behind directory
    uint64_t dataStart = mustUse64Bit ? RES2H_HEADER_SIZE_64 : RES2H_HEADER_SIZE_32;
    dataStart += directorySize;
    // add directory for all files
    for (const auto &file : fileList)
    {
        // add size of name
        if (file.internalName.size() > UINT16_MAX)
        {
            std::cerr << "File name \"" << file.internalName << "\" is too long" << std::endl;
            outStream.close();
            return false;
        }
        const auto nameSize = static_cast<uint16_t>(file.internalName.size());
        outStream.write(reinterpret_cast<const char *>(&nameSize), sizeof(uint16_t));
        // add name
        outStream.write(reinterpret_cast<const char *>(&file.internalName[0]), nameSize);
        // add flags
        const uint32_t entryFlags = 0;
        outStream.write(reinterpret_cast<const char *>(&entryFlags), sizeof(uint32_t));
        uint64_t fileChecksum = 0;
        try
        {
            fileChecksum = mustUse64Bit ? calculateFletcher<uint64_t>(file.inPath.string()) : calculateFletcher<uint32_t>(file.inPath.string());
        }
        catch (const std::runtime_error &e)
        {
            std::cerr << "Failed to calculate file checksum: " << e.what() << std::endl;
            return false;
        }
        // add data size, offset from file start to start of data and checksum
        outStream.write(reinterpret_cast<const char *>(&file.size), (mustUse64Bit ? sizeof(uint64_t) : sizeof(uint32_t)));
        outStream.write(reinterpret_cast<const char *>(&dataStart), (mustUse64Bit ? sizeof(uint64_t) : sizeof(uint32_t)));
        outStream.write(reinterpret_cast<const char *>(&fileChecksum), (mustUse64Bit ? sizeof(uint64_t) : sizeof(uint32_t)));
        IF_BEVERBOSE(std::cout << "Creating directory entry for \"" << file.internalName << "\"" << std::endl)
        IF_BEVERBOSE(std::cout << "Data starts at " << std::dec << std::showbase << dataStart << " bytes" << std::endl)
        IF_BEVERBOSE(std::cout << "Size is " << std::dec << file.size << " bytes" << std::endl)
        IF_BEVERBOSE(std::cout << "Fletcher" << (mustUse64Bit ? "64" : "32") << " checksum is " << std::hex << std::showbase << fileChecksum << std::endl)
        // now add size of this entries data to start offset for next data block
        dataStart += file.size;
    }
    // add data for all files
    for (const auto &file : fileList)
    {
        // try to open file
        std::ifstream inStream;
        inStream.open(file.inPath.string(), std::ios_base::in | std::ios_base::binary);
        if (!inStream.is_open() || !inStream.good())
        {
            std::cerr << "Failed to open file \"" << file.inPath.string() << "\" for reading" << std::endl;
            outStream.close();
            return false;
        }
        IF_BEVERBOSE(std::cout << "Adding data for \"" << file.internalName << "\"" << std::endl)
        uint64_t overallDataSize = 0;
        // copy data from input to output file
        while (!inStream.eof() && inStream.good())
        {
            std::array<uint8_t, 4096> buffer{};
            std::streamsize readSize = sizeof(buffer);
            try
            {
                // try reading data from input file
                inStream.read(reinterpret_cast<char *>(buffer.data()), sizeof(buffer));
            }
            catch (const std::ios_base::failure & /*e*/)
            {
                // if something other that EOF happended, this is a serious error
                if (!inStream.eof())
                {
                    std::cerr << "While reading file \"" << file.inPath.string() << "\"" << std::endl;
                    outStream.close();
                    return false;
                }
            }
            readSize = inStream.gcount();
            // write to output file and increase size of overall data read
            outStream.write(reinterpret_cast<const char *>(buffer.data()), readSize);
            overallDataSize += static_cast<uint64_t>(readSize);
        }
        // close input file
        inStream.close();
        // check if the file was completely read
        if (overallDataSize != file.size)
        {
            std::cerr << "Failed to completely copy file \"" << file.inPath.string() << "\" to binary data" << std::endl;
            outStream.close();
            return false;
        }
    }
    // final archive size is current size + checksum. write size to the header now
    archiveSize = static_cast<uint64_t>(outStream.tellg()) + (mustUse64Bit ? sizeof(uint64_t) : sizeof(uint32_t));
    outStream.seekg(RES2H_OFFSET_ARCHIVE_SIZE);
    outStream.write(reinterpret_cast<const char *>(&archiveSize), (mustUse64Bit ? sizeof(uint64_t) : sizeof(uint32_t)));
    // close file
    outStream.close();
    IF_BEVERBOSE(std::cout << "Binary archive creation succeeded." << std::endl)
    IF_BEVERBOSE(std::cout << "Archive has " << std::dec << archiveSize << " bytes." << std::endl)
    // calculate checksum of whole file and append to file
    uint64_t checksum = 0;
    try
    {
        checksum = mustUse64Bit ? calculateFletcher<uint64_t>(filePath.string()) : calculateFletcher<uint32_t>(filePath.string());
    }
    catch (const std::runtime_error &e)
    {
        std::cerr << "Failed to calculate archive checksum: " << e.what() << std::endl;
        return false;
    }
    outStream.open(filePath.string(), std::ofstream::out | std::ofstream::binary | std::ofstream::app);
    if (!outStream.is_open() || !outStream.good())
    {
        std::cerr << "Failed to open file \"" << filePath.string() << "\" for writing" << std::endl;
        return false;
    }
    outStream.seekg(0, std::ios::end);
    outStream.write(reinterpret_cast<const char *>(&checksum), (mustUse64Bit ? sizeof(uint64_t) : sizeof(uint32_t)));
    outStream.close();
    IF_BEVERBOSE(std::cout << "Archive Fletcher" << (mustUse64Bit ? "64" : "32") << " checksum is " << std::hex << std::showbase << checksum << "." << std::endl)
    return true;
}

int main(int argc, const char *argv[])
{
    printVersion();
    // copy all arguments except program name to vector
    std::vector<std::string> arguments;
    for (int i = 1; i < argc; ++i)
    {
        arguments.emplace_back(std::string(argv[i]));
    }
    // check number of arguments and if all arguments can be read
    if (argc < 3 || !readArguments(arguments))
    {
        printUsage();
        return 2;
    }
    // check if the input path exist
    if (!stdfs::exists(inFilePath))
    {
        std::cerr << "Invalid input file/directory " << inFilePath << std::endl;
        return 1;
    }
    if (createBinary)
    {
        // check if argument 2 is a file
        if (stdfs::is_directory(outFilePath))
        {
            std::cerr << "Output must be a file if -b is used" << std::endl;
            return 1;
        }
    }
    else if (appendFile)
    {
        // check if argument 2 is a file
        if (stdfs::is_directory(outFilePath))
        {
            std::cerr << "Output must be a file if -a is used" << std::endl;
            return 1;
        }
    }
    else if (stdfs::is_directory(inFilePath) != stdfs::is_directory(outFilePath))
    {
        // check if output directory exists
        if (stdfs::is_directory(outFilePath) && !stdfs::exists(outFilePath))
        {
            std::cerr << "Invalid output directory " << outFilePath << std::endl;
            return 1;
        }
        // check if arguments 1 and 2 are both files or both directories
        std::cerr << "Input and output file must be both either a file or a directory" << std::endl;
        return 1;
    }
    if (appendFile)
    {
        // append file a to b
        try
        {
            appendFileContent(outFilePath, inFilePath);
        }
        catch (const std::runtime_error &e)
        {
            std::cerr << "Failed to append data to executable: " << e.what() << std::endl;
            return 1;
        }
    }
    else
    {
        // build list of files to process
        std::vector<FileData> fileList;
        if (stdfs::is_directory(inFilePath))
        {
            // both files are directories, build file ist
            fileList = getFileData(inFilePath, inFilePath, useRecursion);
            if (fileList.empty())
            {
                std::cerr << "Found no files to convert" << std::endl;
                return 1;
            }
            fileList = naiveSortByInPath(fileList);
            fileList = generateOutputPaths(fileList, inFilePath, outFilePath, useC, beVerbose);
        }
        else
        {
            // just add single input/output file
            FileData temp;
            temp.inPath = inFilePath;
            temp.outPath = outFilePath;
            temp.internalName = inFilePath.filename().string(); // remove all, but the file name and extension
            IF_BEVERBOSE(std::cout << "Found input file " << inFilePath << std::endl)
            IF_BEVERBOSE(std::cout << "Internal name will be \"" << temp.internalName << "\"" << std::endl)
            IF_BEVERBOSE(std::cout << "Output path is " << temp.outPath << std::endl)
            // get file size
            try
            {
                temp.size = static_cast<uint64_t>(stdfs::file_size(inFilePath));
                IF_BEVERBOSE(std::cout << "Size is " << temp.size << " bytes." << std::endl)
            }
            catch (const stdfs::filesystem_error &e)
            {
                std::cerr << "Failed to get size of " << inFilePath << ": " << e.what() << std::endl;
                temp.size = 0;
            }
            fileList.push_back(temp);
        }
        // does the user want an binary file?
        if (createBinary)
        {
            // yes. build it.
            if (!createBlob(fileList, outFilePath))
            {
                std::cerr << "Failed to convert to binary file" << std::endl;
                return 1;
            }
        }
        else
        {
            // FIXME: Clang-tidy complains that the following functions can throw an exception
            // That is not caught before the end of main(). Make sure they don't.
            try
            {
                // no. convert files to .c/.cpp. loop through list, converting files
                for (auto fdIt = fileList.begin(); fdIt != fileList.cend(); ++fdIt)
                {
                    if (!convertFile(*fdIt, commonHeaderFilePath))
                    {
                        std::cerr << "Failed to convert all files. Aborting" << std::endl;
                        return 1;
                    }
                }
                // do we need to write a header file?
                if (!commonHeaderFilePath.empty())
                {
                    if (!createCommonHeader(fileList, commonHeaderFilePath, !utilitiesFilePath.empty(), useC))
                    {
                        std::cerr << "Failed to create common header file" << std::endl;
                        return 1;
                    }
                    // do we need to create utilities?
                    if (!utilitiesFilePath.empty())
                    {
                        if (!createUtilities(fileList, utilitiesFilePath, commonHeaderFilePath, useC, combineResults))
                        {
                            std::cerr << "Failed to create utilities file" << std::endl;
                            return 1;
                        }
                    }
                }
            }
            catch (...)
            {
            }
        }
    }
    // profit!!!
    std::cout << "res2h succeeded." << std::endl;
    return 0;
}


text:
(function( global, factory ) {
	if ( typeof module === "object" && typeof module.exports === "object" ) {
		// CMD
		// all dependencies need to passed as parameters manually,
		// will not require here.
		module.exports = factory;
	} else if ( typeof define === 'function' && define.amd ) {
        // AMD. Register as parrot
		// TODO how to define the jquery plugin here?
        define('parrot', ['jquery', 'jsface', 'moment', 'react', 'react-dom'], factory);
	} else {
		// in browser, global is window.
		// all dependencies were loaded already.
		// bootstrap and jquery's plugin are all attached to jquery,
		// expose $pt and all components to window.
		factory(global, jQuery, jsface, moment, React, ReactDOM);
	}
}(typeof window !== "undefined" ? window : this, function(window, jQuery, jsface, moment, React, ReactDOM, DONT_EXPOSE_PARROT_TO_GLOBAL) {
	var _pt = window.$pt;
	var $pt = {};
	window.$pt = $pt;

	var browser = jQuery.browser;
	var deparam = jQuery.deparam;

	$pt.noConflict = function() {
		window.$pt = _pt;
		return $pt;
	};

	// insert all source code here
	// parrot body here

	// reset to old $pt
	if (typeof DONT_EXPOSE_PARROT_TO_GLOBAL != 'undefined' && DONT_EXPOSE_PARROT_TO_GLOBAL === true) {
		window.$pt = _pt;
	}
	return $pt;
}));


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TravelAgent.Web.admin.data
{
    public partial class Product_Holiday : System.Web.UI.Page
    {
        private static readonly TravelAgent.BLL.LineHoliday HolidayBll = new TravelAgent.BLL.LineHoliday();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                if (Request["tag"] != null)
                {
                    string strTag = Request["tag"];
                    if (strTag == "holiday_save")//目的地设置
                    {
                        int holiday_editid = Convert.ToInt32(Request["hidId"]);
                        TravelAgent.Model.LineHoliday model = new TravelAgent.Model.LineHoliday();
                        model.holidayName = Request["txtThemeName"];
                        model.holidaybgurl = Request["txtImgUrl"];

                        try
                        {
                            if (holiday_editid != 0)
                            {
                                model.Id = holiday_editid;
                                HolidayBll.Update(model);
                            }
                            else
                            {
                                HolidayBll.Add(model);
                            }
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "holiday_delete")
                    {
                        int holidayid = Convert.ToInt32(Request["holidayid"]);
                        try
                        {
                            HolidayBll.Delete(holidayid);
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                }
            }
        }
    }
}


text:
""" Git Versioning Script

Will transform stdin to expand some keywords with git version/author/date information.

Specify --clean to remove this information before commit.

Setup:

1. Copy versioning.py into your git repository

2. Run:

 git config filter.versioning.smudge 'python versioning.py'
 git config filter.versioning.clean  'python versioning.py --clean'
 echo 'version.py filter=versioning' >> .gitattributes
 git add versioning.py

3. add a version.py file with this contents:

 __version__ = ""
 __author__ = ""
 __email__ = ""
 __date__ = ""

"""

import sys
import subprocess
import re

def main():
    clean = False
    if len(sys.argv) > 1:
        if sys.argv[1] == '--clean':
            clean = True

    # initialise empty here. Otherwise: forkbomb through the git calls.
    subst_list = {
        "version": "",
        "date": "",
        "author": "",
        "email": ""
    }

    if not clean:
        p = subprocess.Popen(['git','describe','--always'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
        version,err=p.communicate()
        p = subprocess.Popen(['git','log','--pretty=format:"%ad"','-1'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
        date,err=p.communicate()
        p = subprocess.Popen(['git','log','--pretty=format:"%an"','-1'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
        author,err=p.communicate()
        p = subprocess.Popen(['git','log','--pretty=format:"%ae"','-1'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
        email,err=p.communicate()

        subst_list = {
            "version": version.strip().strip('\"'),
            "date": date.strip().strip('\"'),
            "author": author.strip().strip('\"'),
            "email": email.strip().strip('\"')
        }
        for k, v in subst_list.iteritems():
            #v = re.sub(r'[\n\r\t"\']', "", v)
            #rexp = "__%s__\s*=[\s'\"]+" % k
            #line = re.sub(rexp, "__%s__ = \"%s\"\n" % (k, v), line)
            #print line
            #sys.stdout.write(line)
            line = '__%s__=\"%s\"' % (k,v)
            print line

if __name__ == "__main__":
    main()


text:
package gov.va.escreening.form;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;

public class UserEditViewFormBean implements Serializable {

    private static final long serialVersionUID = 1L;

    private Integer userId;

    @Size(max = 30, message = "Login ID must be 30 characters or less")
    @NotEmpty(message = "Login ID is required")
    private String loginId;
    @NotNull(message = "Role is required")
    private Integer selectedRoleId;
    @NotNull(message = "Status is required")
    private Integer selectedUserStatusId;
    @Size(min = 8, max = 50, message = "Password must be at least 8 characters and less than 50 characters")
    @Pattern(regexp = "^.*(?=.{8,})(?!.*\\s)(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@!#$%&?^*()]).*$", message = "Password must contain at least one digit, one uppercase letter, and one lowercase letter, one special character (@!#$%&?^*()), and be at least 8 characters.")
    private String password;
    private String passwordConfirmed;

    @Size(max = 30, message = "First Name must be 30 characters or less")
    @NotEmpty(message = "First Name is required")
    private String firstName;
    @Size(max = 30, message = "Middle Name must be 30 characters or less")
    private String middleName;

    @Size(max = 30, message = "Last Name must be 30 characters or less")
    @NotEmpty(message = "Last Name is required")
    private String lastName;

    @Size(max = 50, message = "Email Address must be 50 characters or less")
    @NotEmpty(message = "Email Address is required")
    @Email(message = "Email Address must be a valid email address format")
    private String emailAddress;
    @Size(max = 50, message = "Alternate Email Address must be 50 characters or less")
    @Email(message = "Alternate Email Address must be a valid email address format")
    private String emailAddress2;

    @Size(max = 20, message = "Phone Number must be 20 characters or less")
    @NotEmpty(message = "Phone Number is required")
    private String phoneNumber;
    @Size(max = 10, message = "Phone Number Extension must be 10 characters or less")
    private String phoneNumberExt;
    @Size(max = 20, message = "Alternate Phone Number must be 20 characters or less")
    private String phoneNumber2;
    @Size(max = 10, message = "Alternate Phone Number Extensin must be 10 characters or less")
    private String phoneNumber2Ext;

    private String vistaDuz;
    private String vistaVpid;
    private String vistaDivision;
    private Boolean cprsVerified;
    private Date datePasswordChanged;
    private Date lastLoginDate;
    private Date dateCreated;
    private Boolean isCreateMode;
    private List<Integer> selectedProgramIdList = new ArrayList<Integer>();

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getLoginId() {
        return loginId;
    }

    public void setLoginId(String loginId) {
        this.loginId = loginId;
    }

    public Integer getSelectedRoleId() {
        return selectedRoleId;
    }

    public void setSelectedRoleId(Integer selectedRoleId) {
        this.selectedRoleId = selectedRoleId;
    }

    public Integer getSelectedUserStatusId() {
        return selectedUserStatusId;
    }

    public void setSelectedUserStatusId(Integer selectedUserStatusId) {
        this.selectedUserStatusId = selectedUserStatusId;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPasswordConfirmed() {
        return passwordConfirmed;
    }

    public void setPasswordConfirmed(String passwordConfirmed) {
        this.passwordConfirmed = passwordConfirmed;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getMiddleName() {
        return middleName;
    }

    public void setMiddleName(String middleName) {
        this.middleName = middleName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getEmailAddress() {
        return emailAddress;
    }

    public void setEmailAddress(String emailAddress) {
        this.emailAddress = emailAddress;
    }

    public String getEmailAddress2() {
        return emailAddress2;
    }

    public void setEmailAddress2(String emailAddress2) {
        this.emailAddress2 = emailAddress2;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getPhoneNumberExt() {
        return phoneNumberExt;
    }

    public void setPhoneNumberExt(String phoneNumberExt) {
        this.phoneNumberExt = phoneNumberExt;
    }

    public String getPhoneNumber2() {
        return phoneNumber2;
    }

    public void setPhoneNumber2(String phoneNumber2) {
        this.phoneNumber2 = phoneNumber2;
    }

    public String getPhoneNumber2Ext() {
        return phoneNumber2Ext;
    }

    public void setPhoneNumber2Ext(String phoneNumber2Ext) {
        this.phoneNumber2Ext = phoneNumber2Ext;
    }

    public String getVistaDuz() {
        return vistaDuz;
    }

    public void setVistaDuz(String vistaDuz) {
        this.vistaDuz = vistaDuz;
    }

    public String getVistaVpid() {
        return vistaVpid;
    }

    public void setVistaVpid(String vistaVpid) {
        this.vistaVpid = vistaVpid;
    }

    public String getVistaDivision() {
        return vistaDivision;
    }

    public void setVistaDivision(String vistaDivision) {
        this.vistaDivision = vistaDivision;
    }

    public Boolean getCprsVerified() {
        return cprsVerified;
    }

    public void setCprsVerified(Boolean cprsVerified) {
        this.cprsVerified = cprsVerified;
    }

    public Date getDatePasswordChanged() {
        return datePasswordChanged;
    }

    public void setDatePasswordChanged(Date datePasswordChanged) {
        this.datePasswordChanged = datePasswordChanged;
    }

    public Date getLastLoginDate() {
        return lastLoginDate;
    }

    public void setLastLoginDate(Date lastLoginDate) {
        this.lastLoginDate = lastLoginDate;
    }

    public Date getDateCreated() {
        return dateCreated;
    }

    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    public Boolean getIsCreateMode() {
        return isCreateMode;
    }

    public void setIsCreateMode(Boolean isCreateMode) {
        this.isCreateMode = isCreateMode;
    }

    public List<Integer> getSelectedProgramIdList() {
        return selectedProgramIdList;
    }

    public void setSelectedProgramIdList(List<Integer> selectedProgramIdList) {
        this.selectedProgramIdList = selectedProgramIdList;
    }

    public UserEditViewFormBean() {
        // default constructor
    }

}


text:
<?php

namespace Spatie\Activitylog\Test;

use CreateActivityLogTable;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Encryption\Encrypter;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Schema;
use Orchestra\Testbench\TestCase as OrchestraTestCase;
use Spatie\Activitylog\ActivitylogServiceProvider;
use Spatie\Activitylog\Models\Activity;
use Spatie\Activitylog\Test\Models\Article;
use Spatie\Activitylog\Test\Models\User;

abstract class TestCase extends OrchestraTestCase
{
    public function setUp(): void
    {
        $this->checkCustomRequirements();

        parent::setUp();

        $this->setUpDatabase();
    }

    protected function checkCustomRequirements()
    {
        collect($this->getAnnotations())->filter(function ($location) {
            return in_array('!Travis', Arr::get($location, 'requires', []));
        })->each(function ($location) {
            getenv('TRAVIS') && $this->markTestSkipped('Travis will not run this test.');
        });
    }

    protected function getPackageProviders($app)
    {
        return [
            ActivitylogServiceProvider::class,
        ];
    }

    public function getEnvironmentSetUp($app)
    {
        $app['config']->set('activitylog.database_connection', 'sqlite');
        $app['config']->set('database.default', 'sqlite');
        $app['config']->set('database.connections.sqlite', [
            'driver' => 'sqlite',
            'database' => ':memory:',
        ]);

        $app['config']->set('auth.providers.users.model', User::class);
        $app['config']->set('app.key', 'base64:'.base64_encode(
            Encrypter::generateKey($app['config']['app.cipher'])
        ));
    }

    protected function setUpDatabase()
    {
        $this->createActivityLogTable();

        $this->createTables('articles', 'users');
        $this->seedModels(Article::class, User::class);
    }

    protected function createActivityLogTable()
    {
        include_once __DIR__.'/../migrations/create_activity_log_table.php.stub';

        (new CreateActivityLogTable())->up();
    }

    protected function createTables(...$tableNames)
    {
        collect($tableNames)->each(function (string $tableName) {
            Schema::create($tableName, function (Blueprint $table) use ($tableName) {
                $table->increments('id');
                $table->string('name')->nullable();
                $table->string('text')->nullable();
                $table->timestamps();
                $table->softDeletes();

                if ($tableName === 'articles') {
                    $table->integer('user_id')->unsigned()->nullable();
                    $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
                    $table->text('json')->nullable();
                    $table->decimal('price')->nullable();
                }
            });
        });
    }

    protected function seedModels(...$modelClasses)
    {
        collect($modelClasses)->each(function (string $modelClass) {
            foreach (range(1, 0) as $index) {
                $modelClass::create(['name' => "name {$index}"]);
            }
        });
    }

    public function getLastActivity(): ?Activity
    {
        return Activity::all()->last();
    }

    public function markTestAsPassed()
    {
        $this->assertTrue(true);
    }

    public function isLaravel6OrLower(): bool
    {
        $majorVersion = (int) substr(App::version(), 0, 1);

        return $majorVersion <= 6;
    }
}


text:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-app_3_0.xsd"
	version="3.0">

	<display-name>mastermanager</display-name>

	<!-- There are three means to configure Wickets configuration mode and they
		are tested in the order given. 1) A system property: -Dwicket.configuration
		2) servlet specific <init-param> 3) context specific <context-param> The
		value might be either "development" (reloading when templates change) or
		"deployment". If no configuration is found, "development" is the default. -->

	<filter>
		<filter-name>wicket.mastermanager</filter-name>
		<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
		<init-param>
			<param-name>applicationClassName</param-name>
			<param-value>de.master.manager.mastermanager.WicketApplication</param-value>
		</init-param>
		<init-param>
			<param-name>configuration</param-name>
			<param-value>deployment</param-value>
		</init-param>
	</filter>

	<filter-mapping>
		<filter-name>wicket.mastermanager</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<!--<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/applicationContext.xml</param-value>
	</context-param>-->

	<context-param>
					<param-name>contextConfigLocation</param-name>
		<param-value>classpath:applicationContext.xml</param-value>
	</context-param>

	<listener>
		<listener-class>
                     org.springframework.web.context.ContextLoaderListener
                </listener-class>
	</listener>
</web-app>


text:
<?php
/**
 * @file
 * Contains \Drupal\social_media_aggregator\Form\SocialMediaAggregatorForm.
 */

namespace Drupal\example\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * Implements an example form.
 */
class SocialMediaAggregatorForm extends FormBase {

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'social_media_aggregator_admin';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $form['social_media_aggregator_admin'] = array(
      '#type' => 'tel',
      '#title' => $this->t('Your phone number'),
    );
    $form['actions']['#type'] = 'actions';
    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => $this->t('Save'),
      '#button_type' => 'primary',
    );
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function validateForm(array &$form, FormStateInterface $form_state) {
    if (strlen($form_state->getValue('social_media_aggregator_admin')) < 3) {
      $form_state->setErrorByName('social_media_aggregator_admin', $this->t('The phone number is too short. Please enter a full phone number.'));
    }
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    drupal_set_message($this->t('Your phone number is @number', array('@number' => $form_state->getValue('social_media_aggregator_admin'))));
  }

}
?>


text:
import {Controller} from '@hotwired/stimulus';
import 'regenerator-runtime/runtime'

export default class extends Controller {

    static targets = ["ids", "selector", "checkAll", "unCheckAll", "selectedCount"]
    static values = {
        footSelectedTemplate: String
    }

    connect() {
        if (!this.hasIdsTarget) {
            return;
        }
        this.idsTarget.value = '[]';
        this.selectorTargets.forEach(selector => {
            selector.checked = false;
        });
    }

    selectId(event) {
        if (!event.target.dataset.entityId) {
            return;
        }
        const eventId = parseInt(event.target.dataset.entityId);
        const ids = this.getIds();

        if (ids.includes(eventId)) {
            this.removeId(eventId);
            return;
        }

        this.addId(eventId);
    }

    tableTargetChanged() {
        this.syncSelectedIds();
        this.updateSelectedCount();
    }

    checkAll() {
        this.selectorTargets.forEach(selector => {
            if (selector.checked) {
                return;
            }
            this.addId(parseInt(selector.dataset.entityId));
            selector.checked = true;
        });
        this.checkAllTarget.classList.add('hidden');
        this.unCheckAllTarget.classList.remove('hidden');
    }

    unCheckAll() {
        this.selectorTargets.forEach(selector => {
            this.removeId(parseInt(selector.dataset.entityId));
            selector.checked = false;
        });
        this.checkAllTarget.classList.remove('hidden');
        this.unCheckAllTarget.classList.add('hidden');
    }

    hasId(id) {
        let ids = this.getIds();
        return ids.includes(id)
    }

    addId(id) {
        let ids = this.getIds();
        ids.push(id);
        this.idsTarget.value = JSON.stringify(ids);
        this.updateSelectedCount();
    }

    removeId(id) {
        let ids = this.getIds();
        ids = ids.filter(function (value, index, arr) {
            return value != id;
        })
        this.idsTarget.value = JSON.stringify(ids);
        this.updateSelectedCount();
        if (ids.length == 0) {
            this.checkAllTarget.classList.remove('hidden');
            this.unCheckAllTarget.classList.add('hidden');
        }
    }

    updateSelectedCount() {
        const count = this.getIds().length;

        if (count === 0) {
            this.selectedCountTarget.classList.add('hidden');
            return;
        }

        this.selectedCountTarget.classList.remove('hidden');
        this.selectedCountTarget.innerHTML = this.footSelectedTemplateValue.replace('{count}', count);
    }

    syncSelectedIds() {
        let ids = this.getIds();
        this.selectorTargets.forEach(selector => {
            selector.checked = ids.includes(parseInt(selector.dataset.entityId));
        });

    }

    async doAction(event) {
        event.preventDefault();

        let ids = this.getIds();
        if (ids.length == 0) {
            alert('no selection');
            return;
        }
        let formData = new FormData;
        ids.forEach(id => {
            formData.append('ids[]', id);
        });
        await fetch(event.target.getAttribute('href'), {
            method: 'POST',
            body: formData
        }) .then(async response => {
            if (response.status == 200) {
                let data = await response.json();
                if (data.reload) {
                    window.location.reload();
                }
                if (data.redirect) {
                    window.location.href = data.redirect;
                }
                if (data.url) {
                    window.location.href = data.url;
                }
                if (!data.reload && !data.redirect) {
                    console.warn('Batch Action Controller should return json data with reload or redirect information');
                }
            } else {
                alert('error. please try again');
            }
        });
    }

    getIds() {
        return JSON.parse(this.idsTarget.value);
    }
}


text:
title: "Pragmatics Aware Querying in Heterogeneous Knowledge Graphs"
collection: talks
type: "Talk"
permalink: /talks/2016-02-12-talk-1
venue: "AAAI 2016"
date: 2016-02-12
location: "Phoenix, Arizona"
---

Knowledge Graphs with rich schemas can allow for complex querying. My thesis focuses on providing accessible Knowledge using Gricean notions of _Cooperative Answering_ as a motivation. More specifically, using  _Query Reformulations_, _Data Awareness_, and a _Pragmatic Context_, along with the results they can become more responsive in the context of user requirements.

Download the **PDF** version of the talk [here](https://N00bsie.github.io/files/Pragmatics_Aware_Querying.pdf)

Download the **PDF** version of the poster for the talk [here](https://N00bsie.github.io/files/AAAI-DC-16_poster.pdf)


text:
module.exports = {

  // Service name used in header. Eg: 'Renew your passport'
  serviceName: "Register a vehicle",

  // Default port that prototype runs on
  port: '3008',

  // Enable or disable password protection on production
  useAuth: 'true'

};


text:
namespace Bloggable.Web.Infrastructure.Extensions
{
    using System.Net;
    using System.Web;

    public static class HttpResponseBaseExtensions
    {
        public static bool IsError(this HttpResponseBase response) =>
            response.StatusCode >= (int)HttpStatusCode.BadRequest;
    }
}


text:
<?php

declare(strict_types=1);

namespace OpenTelemetry\Tests\Unit\SDK\Trace;

use OpenTelemetry\API\Trace\TraceStateInterface;
use OpenTelemetry\SDK\Trace\SamplingResult;
use PHPUnit\Framework\TestCase;

/**
 * @covers OpenTelemetry\SDK\Trace\SamplingResult
 */
class SamplingResultTest extends TestCase
{
    /**
     * @dataProvider provideAttributesAndLinks
     */
    public function test_attributes_and_links_getters($attributes, $traceState): void
    {
        $result = new SamplingResult(SamplingResult::DROP, $attributes, $traceState);

        $this->assertSame($attributes, $result->getAttributes());
        $this->assertSame($traceState, $result->getTraceState());
    }

    /**
     * Provide different sets of data to test SamplingResult constructor and getters
     */
    public function provideAttributesAndLinks(): array
    {
        return [
            [
                ['foo' => 'bar'],
                $this->createMock(TraceStateInterface::class),
            ],
            [
                [],
                null,
            ],
        ];
    }
}


text:
package edu.mit.streamjit.impl.interp;

import com.google.common.collect.Iterators;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;

/**
 * ArrayChannel is a Channel implementation backed by a resizable array,
 * analogous to ArrayList.  This implementation is not synchronized.
 *
 * @param <E> the type of elements in this channel
 * @author Jeffrey Bosboom <jbosboom@csail.mit.edu>
 * @since 11/19/2012
 */
public class ArrayChannel<E> implements Channel<E> {
	/**
	 * The default buffer capacity.  Most Java collections choose 16, at least
	 * in the JRE I'm looking at, but we might want something different.
	 */
	private static final int DEFAULT_CAPACITY = 16;
	/**
	 * The growth factor for reallocating the underlying array.  Java
	 * collections vary between 1.5 and 2.
	 */
	private static final double GROWTH_FACTOR = 2;
	/**
	 * The buffer holding elements in the channel.  Elements [head, tail) are
	 * in the channel; other elements are null.  Note that this buffer is
	 * managed circularly, and at least one element is empty before and after
	 * each method executes.
	 */
	private E[] buffer;
	/**
	 * The index of the first element in this channel (the element returned by
	 * pop() or peek(0)), or an arbitrary number equal to tail if the channel
	 * is empty.
	 */
	private int head;
	/**
	 * One greater than the index of the last element in this channel (that is,
	 * the index where an element would be added by push()), or an arbitrary
	 * number equal to head if the channel is empty.
	 */
	private int tail;

	/**
	 * Constructs an empty ArrayChannel with the default capacity.
	 */
	public ArrayChannel() {
		this(DEFAULT_CAPACITY);
	}

	/**
	 * Constructs an empty ArrayChannel with the given initial capacity.
	 * @param capacity the new ArrayChannel's initial capacity
	 */
	@SuppressWarnings("unchecked")
	public ArrayChannel(int capacity) {
		if (capacity < 0)
			throw new IllegalArgumentException();
		capacity = Math.min(capacity, DEFAULT_CAPACITY);
		buffer = (E[])new Object[capacity+1];
	}

	/**
	 * Constructs a ArrayChannel containing the given elements.  The elements are
	 * copied into the channel; the given array is not modified.
	 * @param initialElements the initial elements
	 */
	public ArrayChannel(E[] initialElements) {
		this(Arrays.asList(initialElements));
	}

	/**
	 * Constructs a ArrayChannel containing the given elements.  The elements are
	 * copied into the channel; the given collection is not modified.
	 * @param initialElements the initial elements
	 */
	public ArrayChannel(Collection<? extends E> initialElements) {
		this(initialElements.size() + 1);
		for (E e : initialElements)
			buffer[tail++] = e;
	}

	/* Basic operations */

	@Override
	public E peek(int index) {
		if (index < 0 || index > size())
			throw new IndexOutOfBoundsException(String.format("index %d, size %d", index, size()));
		//Compute the physical index.
		int physicalIndex = head + index;
		if (physicalIndex >= buffer.length)
			physicalIndex -= buffer.length;
		return buffer[physicalIndex];
	}

	@Override
	public void push(E element) {
		if (head == increment(tail))
			expandCapacity();
		buffer[tail] = element;
		tail = increment(tail);
	}

	@Override
	public E pop() {
		if (isEmpty())
			throw new NoSuchElementException("Channel is empty");
		E retval = buffer[head];
		//Help the garbage collector recognize this element as garbage.
		buffer[head] = null;
		head = increment(head);
		return retval;
	}

	@Override
	public int size() {
		int size = tail - head;
		if (size < 0)
			size += buffer.length;
		return size;
	}

	@Override
	public boolean isEmpty()  {
		return head == tail;
	}

	/* Transitioning to other representations (compiler, debugging) */

	/**
	 * Returns the current capacity of this channel (the number of elements it
	 * can hold without triggering a reallocation).
	 * @return the channel's capacity
	 */
	public int getCapacity() {
		return buffer.length - 1;
	}

	public void ensureCapacity(int capacity) {
		if (capacity > getCapacity())
			setLength(capacity+1);
	}

	/**
	 * Trims the capacity of this channel to its current size, to reduce memory
	 * consumption.
	 */
	public void trimToSize() {
		if (isEmpty())
			setLength(2);
		else
			setLength(size()+1);
	}

	@Override
	public Iterator<E> iterator() {
		return new Iterator<E>() {
			private int position = head;
			@Override
			public boolean hasNext() {
				return position != tail;
			}
			@Override
			public E next() {
				if (!hasNext())
					throw new NoSuchElementException();
				E retval = buffer[position];
				position = increment(position);
				return retval;
			}
			@Override
			public void remove() {
				//We could support remove() for a prefix of the elements
				//returned by next() (i.e., once you call next() twice in a row,
				//you can't remove() anymore).
				throw new UnsupportedOperationException("Not supported.");
			}
		};
	}

	@Override
	public String toString() {
		return Iterators.toString(iterator());
	}

	/* Helper methods */

	/**
	 * Returns the index logically one greater than the given index, wrapping
	 * around the buffer size as required.
	 * @param index the index to increment
	 * @return the next index
	 */
	private int increment(int index) {
		++index;
		//TODO: we could trade the branch for a division by using % instead.
		if (index == buffer.length)
			index = 0;
		return index;
	}

	/**
	 * Grow the buffer based on the growth factor.
	 */
	private void expandCapacity() {
		int oldLength = buffer.length;
		int newLength = (int)Math.ceil(oldLength * GROWTH_FACTOR);
		if (newLength <= 0)
			newLength = Integer.MAX_VALUE; //Good luck allocating that much...
		assert newLength >= buffer.length;
		setLength(newLength);
	}

	/**
	 * Sets the circular buffer's length.  Note that capacity is one less than
	 * the length.
	 * @param newLength the new buffer length
	 */
	private void setLength(int newLength) {
		int size = size();
		assert newLength >= size + 1;
		int oldLength = buffer.length;
		@SuppressWarnings("unchecked")
		E[] newBuffer = (E[])new Object[newLength];
		//Copy over the elements in the correct order.
		if (tail >= head)
			System.arraycopy(buffer, head, newBuffer, 0, size);
		else {
			System.arraycopy(buffer, head, newBuffer, 0, oldLength-head);
			System.arraycopy(buffer, 0, newBuffer, oldLength-head, tail);
		}
		head = 0;
		tail = size;
		buffer = newBuffer;
		assert size() == size;
	}
}


text:
module EvilScaffold
  ModelParams = EvilScaffold.add_generator do
    def self.prepare config ; (config.names << :params) if config.for?(:create) || config.for?(:new) ; end # this dependency is also expressed in #create and in #new

    def self.install config
      return unless config.for? :params
      config.install <<ACTION, __FILE__, __LINE__
        # by default permits all attrs, override if you need to be more selective about your attributes
        # def sanitise_for_create attrs
        #   attrs.permit!
        # end

        # override if you're working with subclasses and you need to pick the right one (eg from params)
        def get_model_class
          #{config.model_class_name}
        end

        # override if you have a special way to create new instances. Used by #new and by #create actions
        def build_new_#{config.model_name}
          @#{config.model_name} = get_model_class.new #{config.model_name}_params
        end

        def default_#{config.model_name}_params
          ActionController::Parameters.new({}).permit!
        end

        def #{config.model_name}_params
          @__#{config.model_name}_params ||= (params[:#{config.model_name}].present? ? params[:#{config.model_name}].permit! : default_#{config.model_name}_params)
        end
ACTION
    end
  end
end


text:
#ifndef OPHIDIAN_CIRCUIT_NETLIST_H
#define OPHIDIAN_CIRCUIT_NETLIST_H

#include <ophidian/entity_system/EntitySystem.h>
#include <ophidian/entity_system/Aggregation.h>
#include <ophidian/entity_system/Composition.h>
#include <ophidian/circuit/StandardCells.h>
#include <unordered_map>

namespace ophidian::circuit
{
    class CellInstance :
        public entity_system::EntityBase
    {
    public:
        using entity_system::EntityBase::EntityBase;
    };

    class PinInstance :
        public entity_system::EntityBase
    {
    public:
        using entity_system::EntityBase::EntityBase;
    };

    class Net :
        public entity_system::EntityBase
    {
    public:
        using entity_system::EntityBase::EntityBase;
    };

    class Input :
        public entity_system::EntityBase
    {
    public:
        using entity_system::EntityBase::EntityBase;
    };

    class Output :
        public entity_system::EntityBase
    {
    public:
        using entity_system::EntityBase::EntityBase;
    };

    /*! A flatten Netlist */
    class Netlist final
    {
    public:
        using CellNotifier = entity_system::EntitySystem<CellInstance>::NotifierType;
        using PinNotifier = entity_system::EntitySystem<PinInstance>::NotifierType;
        using NetNotifier = entity_system::EntitySystem<Net>::NotifierType;

        using cell_instance_type = CellInstance;
        using cell_instance_name_type = std::string;
        using cell_instance_container_type = entity_system::EntitySystem<cell_instance_type>;

        using pin_instance_type = PinInstance;
        using pin_instance_name_type = std::string;
        using pin_instance_container_type = entity_system::EntitySystem<pin_instance_type>;

        using net_type = Net;
        using net_name_type = std::string;
        using net_container_type = entity_system::EntitySystem<net_type>;

        using input_pad_type = Input;
        using input_pad_name_type   = std::string;
        using input_pad_container_type = entity_system::EntitySystem<Input>;

        using output_pad_type = Output;
        using output_pad_name_type   = std::string;
        using output_pad_container_type = entity_system::EntitySystem<Output>;

        using cell_instance_pins_view_type = entity_system::Association<CellInstance, PinInstance>::Parts;

        using net_pins_view_type = entity_system::Association<Net, PinInstance>::Parts;

        using std_cell_type = StandardCells::cell_type;
        using std_cell_pin_type = StandardCells::pin_type;

        //! Construct Netlist
        Netlist() = default;

        //! Delete coppy constructor
        Netlist(const Netlist &) = delete;
        Netlist & operator =(const Netlist &) = delete;

        //! Move Constructor
        Netlist(Netlist &&) = delete;
        Netlist& operator=(Netlist &&) = delete;

        // Element access
        cell_instance_type find_cell_instance(const cell_instance_name_type& cellName) const;

        pin_instance_type find_pin_instance(const pin_instance_name_type& pinName) const;

        net_type find_net(const net_name_type& netName) const;

        cell_instance_name_type& name(const cell_instance_type& cell);
        const cell_instance_name_type& name(const cell_instance_type& cell) const;

        pin_instance_name_type& name(const pin_instance_type& pin);
        const pin_instance_name_type& name(const pin_instance_type& pin) const;

        net_name_type& name(const net_type& net);
        const net_name_type& name(const net_type& net) const;

        cell_instance_type cell(const pin_instance_type& pin) const;

        cell_instance_pins_view_type pins(const cell_instance_type& cell) const;

        net_pins_view_type pins(const net_type& net) const;

        pin_instance_type pin(const input_pad_type& input) const;

        pin_instance_type pin(const output_pad_type& output) const;

        net_type net(const pin_instance_type& pin) const;

        input_pad_type input(const pin_instance_type& pin) const;

        output_pad_type output(const pin_instance_type& pin) const;

        std_cell_type std_cell(const cell_instance_type& cell) const;

        std_cell_pin_type std_cell_pin(const pin_instance_type& pin) const;

        // Iterators
        cell_instance_container_type::const_iterator begin_cell_instance() const noexcept;
        cell_instance_container_type::const_iterator end_cell_instance() const noexcept;

        pin_instance_container_type::const_iterator begin_pin_instance() const noexcept;
        pin_instance_container_type::const_iterator end_pin_instance() const noexcept;

        net_container_type::const_iterator begin_net() const noexcept;
        net_container_type::const_iterator end_net() const noexcept;

        input_pad_container_type::const_iterator begin_input_pad() const noexcept;
        input_pad_container_type::const_iterator end_input_pad() const noexcept;

        output_pad_container_type::const_iterator begin_output_pad() const noexcept;
        output_pad_container_type::const_iterator end_output_pad() const noexcept;

        // Capacity
        cell_instance_container_type::size_type size_cell_instance() const noexcept;
        pin_instance_container_type::size_type size_pin_instance() const noexcept;
        net_container_type::size_type size_net() const noexcept;
        input_pad_container_type::size_type size_input_pad() const noexcept;
        output_pad_container_type::size_type size_output_pad() const noexcept;

        cell_instance_container_type::size_type capacity_cell_instance() const noexcept;
        pin_instance_container_type::size_type capacity_pin_instance() const noexcept;
        net_container_type::size_type capacity_net() const noexcept;

        void reserve_cell_instance(cell_instance_container_type::size_type size);
        void reserve_pin_instance(pin_instance_container_type::size_type size);
        void reserve_net(net_container_type::size_type size);

        void shrink_to_fit();

        // Modifiers
        cell_instance_type add_cell_instance(const cell_instance_name_type& cellName);

        pin_instance_type add_pin_instance(const pin_instance_name_type& pinName);

        net_type add_net(const net_name_type& netName);

        input_pad_type add_input_pad(const pin_instance_type& pin);

        output_pad_type add_output_pad(const pin_instance_type& pin);

        void erase(const cell_instance_type& cell);
        void erase(const pin_instance_type& pin);
        void erase(const net_type& net);

        void connect(const net_type& net, const pin_instance_type& pin);
        void connect(const cell_instance_type& cell, const pin_instance_type& pin);
        void connect(const cell_instance_type& cell, const std_cell_type& std_cell);
        void connect(const pin_instance_type& pin, const std_cell_pin_type& std_cell);

        void disconnect(const pin_instance_type& pin);

        template <typename Value>
        entity_system::Property<CellInstance, Value> make_property_cell_instance() const noexcept
        {
            return entity_system::Property<CellInstance, Value>(m_cells);
        }

        template <typename Value>
        entity_system::Property<PinInstance, Value> make_property_pin_instance() const noexcept
        {
            return entity_system::Property<PinInstance, Value>(m_pins);
        }

        template <typename Value>
        entity_system::Property<Net, Value> make_property_net() const noexcept
        {
            return entity_system::Property<Net, Value>(m_nets);
        }

        template <typename Value>
        entity_system::Aggregation<Net, Value> make_aggregation_net(entity_system::EntitySystem<Value> & parts) const noexcept
        {
            return entity_system::Aggregation<Net, Value>(m_nets, parts);
        }

        template <typename Value>
        entity_system::Property<Input, Value> make_property_input_pad() const noexcept
        {
            return entity_system::Property<Input, Value>(m_input_pads);
        }

        template <typename Value>
        entity_system::Property<Output, Value> make_property_output_pad() const noexcept
        {
            return entity_system::Property<Output, Value>(m_output_pads);
        }

        entity_system::EntitySystem<CellInstance>::NotifierType * notifier_cell_instance() const noexcept;
        entity_system::EntitySystem<PinInstance>::NotifierType * notifier_pin_instance() const noexcept;
        entity_system::EntitySystem<Net>::NotifierType * notifier_net() const noexcept;
        entity_system::EntitySystem<Input>::NotifierType * notifier_input_pad() const noexcept;
        entity_system::EntitySystem<Output>::NotifierType * notifier_output_pad() const noexcept;

    private:
        entity_system::EntitySystem<CellInstance>             m_cells{};
        entity_system::EntitySystem<PinInstance>              m_pins{};
        entity_system::EntitySystem<Net>                      m_nets{};
        entity_system::EntitySystem<Input>                    m_input_pads{};
        entity_system::EntitySystem<Output>                   m_output_pads{};
        entity_system::Property<CellInstance, std::string>    m_cell_names{m_cells};
        entity_system::Property<PinInstance, std::string>     m_pin_names{m_pins};
        entity_system::Property<Net, std::string>             m_net_names{m_nets};
        std::unordered_map<std::string, CellInstance>         m_name_to_cell{};
        std::unordered_map<std::string, PinInstance>          m_name_to_pin{};
        std::unordered_map<std::string, Net>                  m_name_to_net{};
        entity_system::Aggregation<Net, PinInstance>          m_net_to_pins{m_nets, m_pins};

        entity_system::Composition<CellInstance, PinInstance> m_cell_to_pins{m_cells, m_pins};
        entity_system::Composition<PinInstance, Input>        m_pin_to_input_pad{m_pins, m_input_pads};
        entity_system::Composition<PinInstance, Output>       m_pin_to_output_pad{m_pins, m_output_pads};

        entity_system::Property<CellInstance, Cell>           m_cell_instance_to_std_cell{m_cells};
        entity_system::Property<PinInstance, Pin>             m_pin_instance_to_std_cell_pin{m_pins};
    };
}

#endif // OPHIDIAN_CIRCUIT_NETLIST_H


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>4. Release Notes — Presto 0.54 Documentation</title>

    <link rel="stylesheet" href="_static/presto.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />

    <link rel="top" title="Presto 0.54 Documentation" href="index.html" />
    <link rel="next" title="4.1. Release 0.54" href="release/release-0.54.html" />
    <link rel="prev" title="3.8. SHOW FUNCTIONS" href="sql/show-functions.html" />

        Presto 0.54 Documentation

4. Release Notes

        « 3.8. SHOW FUNCTIONS

        4.1. Release 0.54 »

4. Release Notes

4.1. Release 0.54

        « 3.8. SHOW FUNCTIONS

        4.1. Release 0.54 »

        © Copyright 2013, Facebook.
      Created using Sphinx 1.1.3.


text:
namespace Bridge.Pixi.Loaders
{
	[External]
	[Name("PIXI.loaders.Resource.LOAD_TYPE")]
	[Enum(Emit.Name)]
	public enum ResourceLoadType
	{
		[Name("XHR")]
		XMLHttpRequest,

		[Name("IMAGE")]
		Image,

		[Name("AUDIO")]
		Audio,

		[Name("VIDEO")]
		Video
	}
}


text:
package org.apache.camel.component.xchange;

import java.io.IOException;
import java.util.List;

import org.knowm.xchange.Exchange;
import org.knowm.xchange.ExchangeSpecification;
import org.knowm.xchange.currency.CurrencyPair;
import org.knowm.xchange.dto.meta.ExchangeMetaData;
import org.knowm.xchange.exceptions.ExchangeException;
import org.knowm.xchange.service.account.AccountService;
import org.knowm.xchange.service.marketdata.MarketDataService;
import org.knowm.xchange.service.trade.TradeService;

import si.mazi.rescu.SynchronizedValueFactory;

// Wraps the exchange to avoid anem collision with the camel exchange
public class XChange implements Exchange {

    private final Exchange delegate;

    public XChange(Exchange delegate) {
        this.delegate = delegate;
    }

    public ExchangeSpecification getExchangeSpecification() {
        return delegate.getExchangeSpecification();
    }

    public ExchangeMetaData getExchangeMetaData() {
        return delegate.getExchangeMetaData();
    }

    public List<CurrencyPair> getExchangeSymbols() {
        return delegate.getExchangeSymbols();
    }

    public SynchronizedValueFactory<Long> getNonceFactory() {
        return delegate.getNonceFactory();
    }

    public ExchangeSpecification getDefaultExchangeSpecification() {
        return delegate.getDefaultExchangeSpecification();
    }

    public void applySpecification(ExchangeSpecification exchangeSpecification) {
        delegate.applySpecification(exchangeSpecification);
    }

    public MarketDataService getMarketDataService() {
        return delegate.getMarketDataService();
    }

    public TradeService getTradeService() {
        return delegate.getTradeService();
    }

    public AccountService getAccountService() {
        return delegate.getAccountService();
    }

    public void remoteInit() throws IOException, ExchangeException {
        delegate.remoteInit();
    }
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

/*=============================================================
**
** Source:  loadlibrarya.c
**
** Purpose: Positive test the LoadLibrary API.
**          Call LoadLibrary to map a module into the calling
**          process address space(DLL file)
**
**
**============================================================*/
#include <palsuite.h>

/* SHLEXT is defined only for Unix variants */

#if defined(SHLEXT)
#define ModuleName    "librotor_pal"SHLEXT
#else
#define ModuleName    "rotor_pal.dll"
#endif

int __cdecl main(int argc, char *argv[])
{
    HMODULE ModuleHandle;
    int err;

    /* Initialize the PAL environment */
    err = PAL_Initialize(argc, argv);
    if(0 != err)
    {
        ExitProcess(FAIL);
    }

    /* load a module */
    ModuleHandle = LoadLibrary(ModuleName);
    if(!ModuleHandle)
    {
        Fail("Failed to call LoadLibrary API!\n");
    }

    /* decrement the reference count of the loaded dll */
    err = FreeLibrary(ModuleHandle);
    if(0 == err)
    {
        Fail("\nFailed to all FreeLibrary API!\n");
    }

    PAL_Terminate();
    return PASS;
}