text:
package editor.gui.editor;

import java.awt.BorderLayout;
import java.awt.Dialog;
import java.awt.FlowLayout;
import java.awt.Window;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.lang.reflect.Type;
import java.text.SimpleDateFormat;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.concurrent.CancellationException;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.SwingWorker;

import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

import editor.collection.deck.Deck;
import editor.collection.export.CardListFormat;
import editor.gui.MainFrame;
import editor.util.ExceptionConsumer;
import editor.util.ProgressInputStream;

/**
 * This class controls the serialization and deserialization of a #Deck.  It can
 * serialize a deck, a sideboard, and a changelog, deserialize them, and import
 * a deck from an external file type.  Once a deck has been loaded, another one
 * cannot be loaded by the same instance of this class.
 *
 * @author Alec Roelke
 */
public class DeckSerializer implements JsonDeserializer<DeckSerializer>, JsonSerializer<DeckSerializer>
{
    /**
     * Format to display dates for changes made to a deck.
     */
    public static final SimpleDateFormat CHANGELOG_DATE = new SimpleDateFormat("MMMM d, yyyy HH:mm:ss");
    /**
     * Latest version of legacy save file.
     *
     * Change log:
     * 1. Added save version number
     * 2. Switched changelog from read/writeObject to read/writeUTF
     * 3. Allow multiple sideboards
     */
    private static final long SAVE_VERSION = 3;

    /**
     * This class is a worker for loading a deck.  Comes with a dialog that can
     * be used to show progress.
     *
     * @author Alec Roelke
     */
    private class LoadWorker extends SwingWorker<Void, Integer>
    {
        /**
         * Dialog containing the progress bar.
         */
        private JDialog dialog;
        /**
         * File to load the deck from.
         */
        private File file;
        /**
         * Progress bar to display progress to.
         */
        private JProgressBar progressBar;
        /**
         * Function to perform for loading the data.
         */
        private ExceptionConsumer<InputStream, Exception> background;

        /**
         * Create a new LoadWorker.
         *
         * @param f file to load the deck from
         * @param parent parent window of the progress dialog
         * @param bg function to perform for loading the data
         */
        public LoadWorker(File f, Window parent, ExceptionConsumer<InputStream, Exception> bg)
        {
            file = f;
            background = bg;

            dialog = new JDialog(null, Dialog.ModalityType.APPLICATION_MODAL);
            progressBar = new JProgressBar();
            JPanel progressPanel = new JPanel(new BorderLayout(0, 5));
            dialog.setContentPane(progressPanel);
            progressPanel.add(new JLabel("Opening " + f.getName() + "..."), BorderLayout.NORTH);
            progressPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
            progressPanel.add(progressBar, BorderLayout.CENTER);
            JPanel cancelPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener((e) -> cancel(false));
            cancelPanel.add(cancelButton);
            progressPanel.add(cancelPanel, BorderLayout.SOUTH);
            dialog.pack();
            dialog.setLocationRelativeTo(parent);

            progressBar.setMaximum((int)file.length());
        }

        /**
         * {@inheritDoc}
         * Load the deck, updating the progress bar all the while.
         */
        @Override
        protected Void doInBackground() throws Exception
        {
            try (var pis = new ProgressInputStream(new FileInputStream(file), (a, b) -> publish(b.intValue())))
            {
                background.accept(pis);
            }
            return null;
        }

        @Override
        protected void done()
        {
            dialog.dispose();
        }

        /**
         * Execute this LoadWorker and display the progress dialog.
         */
        public void executeAndDisplay()
        {
            super.execute();
            dialog.setVisible(true);
        }

        @Override
        protected void process(List<Integer> chunks)
        {
            progressBar.setValue(chunks.get(chunks.size() - 1));
        }
    }

    /** Changelog of the loaded deck. */
    private String changelog;
    /** The loaded deck. */
    private Deck deck;
    /** File to load the deck from or that the deck has been loaded from. */
    private File file;
    /** Whether or not the deck was imported from an external file type. */
    private boolean imported;
    /** User-defined notes for the deck. */
    private String notes;
    /** Sideboard for the loaded deck. */
    private Map<String, Deck> sideboard;

    /**
     * Create a new, empty DeckSerializer.  Use this to load a deck.
     */
    public DeckSerializer()
    {
        reset();
    }

    /**
     * Create a new DeckSerializer with the given deck, sideboard, and changelog
     * already loaded.  This cannot be used to load a deck, so use it to save one.
     *
     * @param d preloaded deck
     * @param s preloaded sideboards
     * @param n preloaded notes
     * @param c preloaded changelog
     */
    public DeckSerializer(Deck d, Map<String, Deck> s, String n, String c)
    {
        this();
        changelog = c;
        deck = d;
        sideboard = new LinkedHashMap<>(s);
        notes = n;
    }

    /**
     * @return true if the file that was used to open the deck can
     * be saved to, which is if it is defined and is of the native format for
     * this editor, and false otherwise.
     */
    public boolean canSaveFile()
    {
        return file != null && !imported;
    }

    /**
     * @return the changelog for the loaded deck.
     */
    public String changelog()
    {
        return changelog;
    }

    /**
     * @return the loaded deck.
     */
    public Deck deck()
    {
        return deck;
    }

    /**
     * @return the File corresponding to the saved or loaded deck.
     */
    public File file()
    {
        if (file == null)
            throw new NoSuchElementException("file not saved or loaded");
        return file;
    }

    /**
     * Import a list of cards from a nonstandard file.  If an error occurs during import,
     * this serializer is reset to an empty state.
     *
     * @param format format of the file
     * @param file file to import from
     * @param parent parent window used to display errors
     * @throws DeckLoadException if the deck could not be imported
     * @see CardListFormat
     */
    public void importList(CardListFormat format, File file, Window parent) throws DeckLoadException
    {
        if (!deck.isEmpty())
            throw new DeckLoadException(file, "deck already loaded");

        LoadWorker worker = new LoadWorker(file, parent, (s) -> {
            DeckSerializer loaded = format.parse(s);
            deck = loaded.deck;
            sideboard = loaded.sideboard;
            imported = true;
        });
        worker.executeAndDisplay();
        try
        {
            worker.get();
        }
        catch (CancellationException e)
        {
            reset();
        }
        catch (Exception e)
        {
            reset();
            throw new DeckLoadException(file, e);
        }
    }

    /**
     * Import a deck from a legacy file type.  If an error occurs during importing
     * the deck, this serializer is reset to an empty state.
     *
     * @param f File to load from
     * @param parent parent window used to display errors
     * @throws DeckLoadException if there is already a loaded deck
     */
    public void importLegacy(File f, Window parent) throws DeckLoadException, CancellationException
    {
        if (!deck.isEmpty())
            throw new DeckLoadException(file, "deck already loaded");

        long version;
        try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(f)))
        {
            version = ois.readLong();
        }
        catch (IOException e)
        {
            reset();
            throw new DeckLoadException(f, e);
        }
        LoadWorker worker = new LoadWorker(f, parent, (s) -> {
            // Assume that high bits in the first 64 bits are used by the serialization of a Deck
            // object and that SAVE_VERSION will never be that high.
            long v = version > SAVE_VERSION ? 0 : version;
            try (ObjectInputStream ois = new ObjectInputStream(s))
            {
                if (v > 0)
                    ois.readLong(); // Throw out first 64 bits that have already been read
                deck = editor.serialization.legacy.DeckDeserializer.readExternal(ois);
                if (v <= 2)
                    sideboard.put("Sideboard", editor.serialization.legacy.DeckDeserializer.readExternal(ois));
                else
                {
                    int boards = ois.readInt();
                    for (int i = 0; i < boards; i++)
                    {
                        String name = ois.readUTF();
                        sideboard.put(name, editor.serialization.legacy.DeckDeserializer.readExternal(ois));
                    }
                }
                changelog = v < 2 ? (String)ois.readObject() : ois.readUTF();
            }
        });
        worker.executeAndDisplay();
        try
        {
            worker.get();
        }
        catch (CancellationException e)
        {
            reset();
        }
        catch (Exception e)
        {
            reset();
            throw new DeckLoadException(f, e);
        }

        imported = true;
    }

    /**
     * Load a deck from a JSON deck file.  If an error occurs during loading the deck,
     * this serializer is reset to an empty state.
     *
     * @param f File to load from
     * @param parent parent window used to display errors
     * @throws DeckLoadException if there is already a loaded deck
     */
    public void load(File f, Window parent) throws DeckLoadException, CancellationException
    {
        if (!deck.isEmpty())
            throw new DeckLoadException(file, "deck already loaded");

        LoadWorker worker = new LoadWorker(f, parent, (s) -> {
            try (var bf = new BufferedReader(new InputStreamReader(s)))
            {
                DeckSerializer loaded = MainFrame.SERIALIZER.fromJson(bf, DeckSerializer.class);
                deck = loaded.deck;
                sideboard = loaded.sideboard;
                notes = loaded.notes;
                changelog = loaded.changelog;
            }
        });
        worker.executeAndDisplay();
        try
        {
            worker.get();
        }
        catch (CancellationException e)
        {
            reset();
        }
        catch (Exception e)
        {
            reset();
            throw new DeckLoadException(f, e);
        }

        file = f;
    }

    /**
     * @return The deck notes.
     */
    public String notes()
    {
        return notes;
    }

    /**
     * Clear the contents of this DeckSerializer so it can be reused.
     */
    private void reset()
    {
        changelog = "";
        deck = new Deck();
        file = null;
        notes = "";
        sideboard = new LinkedHashMap<>();
        imported = false;
    }

    /**
     * Save the deck to the given file.
     *
     * @param f file to save to
     * @throws IOException if the file could not be saved
     */
    public void save(File f) throws IOException
    {
        try (FileWriter writer = new FileWriter(f))
        {
            writer.write(MainFrame.SERIALIZER.toJson(this));
            file = f;
        }
    }

    /**
     * @return the sideboards of the loaded deck.
     */
    public Map<String, Deck> sideboards()
    {
        return sideboard;
    }

    @Override
    public JsonElement serialize(DeckSerializer src, Type typeOfSrc, JsonSerializationContext context)
    {
        JsonObject json = new JsonObject();
        json.add("main", context.serialize(src.deck));
        JsonArray side = new JsonArray();
        for (String n : src.sideboard.keySet())
        {
            JsonObject board = context.serialize(src.sideboard.get(n)).getAsJsonObject();
            board.addProperty("name", n);
            side.add(board);
        }
        json.add("sideboards", side);
        json.addProperty("notes", src.notes);
        json.addProperty("changelog", src.changelog);
        return json;
    }

    @Override
    public DeckSerializer deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
    {
        JsonObject obj = json.getAsJsonObject();
        Deck deck = context.deserialize(obj.get("main"), Deck.class);
        String notes = obj.has("notes") ? obj.get("notes").getAsString() : "";
        var sideboard = new LinkedHashMap<String, Deck>();
        for (JsonElement entry : obj.get("sideboards").getAsJsonArray())
            sideboard.put(entry.getAsJsonObject().get("name").getAsString(), context.deserialize(entry, Deck.class));
        String changelog = obj.get("changelog").getAsString();
        return new DeckSerializer(deck, sideboard, notes, changelog);
    }
}


text:
<resources>
    <string name="st_app_name_short" translatable="false">U4U</string>
    <string name="st_app_name">UBER for UBER</string>
    <string name="st_app_info">THE \nEASIEST \nWAY \nTO \nREQUEST \nUBER</string>
    <string name="st_request">REQUEST UBER</string>
    <string name="st_error">Error</string>
</resources>

redpajama_set_name: RedPajamaGithub


text:
<?php
include_once('config.php');

$mysql_user_name = mysql_user_name;
$mysql_user_passwd = mysql_user_passwd;
$mysql_name = mysql_name;
$host = host;

$mysql = mysql_connect($host,$mysql_user_name,$mysql_user_passwd)
	or die('Nie mogę połączyć się z bazą danych: '.mysql_error());

mysql_select_db($mysql_name,$mysql)
	or die('Nie mogę wybrać bazy: '.mysql_error());

$contact_res = mysql_query('SELECT * FROM contact',$mysql)
	or die('Błędne zapytanie: '.mysql_error());

$contact_result = mysql_fetch_array($contact_res, MYSQL_ASSOC);

$firm_name = $_POST['firm_name'];
$firm_adress = $_POST['firm_adress'];
$firm_nip = $_POST['firm_nip'];
$firm_regon = $_POST['firm_regon'];
$firm_phone_one = $_POST['firm_phone_one'];
$firm_phone_two = $_POST['firm_phone_two'];
$firm_email = $_POST['firm_email'];

if(isset($_POST['save_contact']))
{
	$inquiry = "UPDATE contact SET firm_name = '".$firm_name."',adress = '".$firm_adress."',nip = '".$firm_nip."',regon = '".$firm_regon."',phone_one = '".$firm_phone_one."',phone_two = '".$firm_phone_two."',email = '".$firm_email."' ";
	$res = mysql_query($inquiry);
	if (!$res)
	{
		exit('Błąd w zapytaniu MySQL:
<'.$inquiry.'
'.mysql_error());
	}
	else
	{
		$updated = "
 Pomyślnie zaktualizowano.
";
	}
}
else
{
		echo '
Pozostaw Puste jeżeli nie chcesz wyświetlić na stronie.

';
		echo '<form action="admin.php?admin=contact" method="post">';
		echo 'Nazwa firmy:
<input type="text" name="firm_name" maxlength="150" size="50" value="'.$contact_result['firm_name'].'" />

';
		echo 'adres:
<input type="text" name="firm_adress" maxlength="150" size="50" value="'.$contact_result['adress'].'" />

';
		echo 'NIP:
<input type="text" name="firm_nip" maxlength="20" size="50" value="'.$contact_result['nip'].'" />

';
		echo 'REGON:
<input type="text" name="firm_regon" maxlength="20" size="50" value="'.$contact_result['regon'].'" />

';
		echo 'telefon 1:
<input type="text" name="firm_phone_one"  size="50" value="'.$contact_result['phone_one'].'" />

';
		echo 'telefon 2:
<input type="text" name="firm_phone_two" size="50" value="'.$contact_result['phone_two'].'"/>

';
		echo 'adres email:
<input type="text" name="firm_email" maxlength="50" size="50" value="'.$contact_result['email'].'"/>

';
		echo '<input type="submit" name="save_contact" value="Dodaj" />';
		echo '</form>';
}

?>

<?php
echo $updated;
mysql_close($mysql);
?>


text:
#ifndef _NATIVETHREAD_PRIV_H
#define _NATIVETHREAD_PRIV_H

#include <lauxlib.h>
#include <lualib.h>
#include <pthread.h>
#include <string.h>
#include "nativethread.h"

#endif /* _NATIVETHREAD_PRIV_H */


text:
"""Defines a model to store Twitter data."""

from google.appengine.ext import ndb

class TwitterConf(ndb.Model):
    """Stores Twitter configuration data."""
    consumer_key = ndb.StringProperty()
    consumer_secret = ndb.StringProperty()
    access_token_key = ndb.StringProperty()
    access_token_secret = ndb.StringProperty()


text:
    {{--chosen--}}
    <!--select下拉插件 chosen-->
    <link href="{{ asset('plugins/chosen/chosen.css') }}" rel="stylesheet">
    <script src="{{ asset('plugins/chosen/chosen.jquery.min.js') }}" type="text/javascript"></script>
    <script type="text/javascript">
    var config = {
        '.chosen-select'           : {},
        '.chosen-select-deselect'  : {allow_single_deselect:true},
        '.chosen-select-no-single' : {disable_search_threshold:10},
        '.chosen-select-no-results': {no_results_text:'暂无数据!'},
        '.chosen-select-width'     : {width:'95%'}
    }
    for (var selector in config) {
        $(selector).chosen(config[selector]);
    }
    </script>
    <!--select下拉插件 chosen-->


text:
Rails.application.routes.draw do
  get 'app/controllers/:id', to: 'coda_preview#mapped_by_file_name', constraints: { id: /.*/ }
  get 'app/assets/javascripts/:id', to: 'coda_preview#mapped_by_file_name', constraints: { id: /.*/ }
  get 'app/assets/stylesheets/:id', to: 'coda_preview#mapped_by_file_name', constraints: { id: /.*/ }
  get 'app/assets/helpers/:id', to: 'coda_preview#mapped_by_file_name', constraints: { id: /.*/ }
  get 'app/views/:id', to: 'coda_preview#mapped_by_folder_name', constraints: { id: /.*/ }
end


text:
package com.jivesoftware.example.destroyer;

/**
 * Created by mark.schisler on 4/30/14.
 */
public interface IDestroyable {
    void destroy();
}


text:
#include <linux/seq_file.h>
#include <linux/fs.h>
#include <linux/security.h>
#include <linux/module.h>
#include <linux/slab.h>

#include "tpm.h"
#include "tpm_eventlog.h"

static const char* tcpa_event_type_strings[] = {
	"PREBOOT",
	"POST CODE",
	"",
	"NO ACTION",
	"SEPARATOR",
	"ACTION",
	"EVENT TAG",
	"S-CRTM Contents",
	"S-CRTM Version",
	"CPU Microcode",
	"Platform Config Flags",
	"Table of Devices",
	"Compact Hash",
	"IPL",
	"IPL Partition Data",
	"Non-Host Code",
	"Non-Host Config",
	"Non-Host Info"
};

static const char* tcpa_pc_event_id_strings[] = {
	"",
	"SMBIOS",
	"BIS Certificate",
	"POST BIOS ",
	"ESCD ",
	"CMOS",
	"NVRAM",
	"Option ROM",
	"Option ROM config",
	"",
	"Option ROM microcode ",
	"S-CRTM Version",
	"S-CRTM Contents ",
	"POST Contents ",
	"Table of Devices",
};

/* returns pointer to start of pos. entry of tcg log */
static void *tpm_bios_measurements_start(struct seq_file *m, loff_t *pos)
{
	loff_t i;
	struct tpm_bios_log *log = m->private;
	void *addr = log->bios_event_log;
	void *limit = log->bios_event_log_end;
	struct tcpa_event *event;

	/* read over *pos measurements */
	for (i = 0; i < *pos; i++) {
		event = addr;

		if ((addr + sizeof(struct tcpa_event)) < limit) {
			if (event->event_type == 0 && event->event_size == 0)
				return NULL;
			addr += sizeof(struct tcpa_event) + event->event_size;
		}
	}

	/* now check if current entry is valid */
	if ((addr + sizeof(struct tcpa_event)) >= limit)
		return NULL;

	event = addr;

	if ((event->event_type == 0 && event->event_size == 0) ||
	    ((addr + sizeof(struct tcpa_event) + event->event_size) >= limit))
		return NULL;

	return addr;
}

static void *tpm_bios_measurements_next(struct seq_file *m, void *v,
					loff_t *pos)
{
	struct tcpa_event *event = v;
	struct tpm_bios_log *log = m->private;
	void *limit = log->bios_event_log_end;

	v += sizeof(struct tcpa_event) + event->event_size;

	/* now check if current entry is valid */
	if ((v + sizeof(struct tcpa_event)) >= limit)
		return NULL;

	event = v;

	if (event->event_type == 0 && event->event_size == 0)
		return NULL;

	if ((event->event_type == 0 && event->event_size == 0) ||
	    ((v + sizeof(struct tcpa_event) + event->event_size) >= limit))
		return NULL;

	(*pos)++;
	return v;
}

static void tpm_bios_measurements_stop(struct seq_file *m, void *v)
{
}

static int get_event_name(char *dest, struct tcpa_event *event,
			unsigned char * event_entry)
{
	const char *name = "";
	/* 41 so there is room for 40 data and 1 nul */
	char data[41] = "";
	int i, n_len = 0, d_len = 0;
	struct tcpa_pc_event *pc_event;

	switch(event->event_type) {
	case PREBOOT:
	case POST_CODE:
	case UNUSED:
	case NO_ACTION:
	case SCRTM_CONTENTS:
	case SCRTM_VERSION:
	case CPU_MICROCODE:
	case PLATFORM_CONFIG_FLAGS:
	case TABLE_OF_DEVICES:
	case COMPACT_HASH:
	case IPL:
	case IPL_PARTITION_DATA:
	case NONHOST_CODE:
	case NONHOST_CONFIG:
	case NONHOST_INFO:
		name = tcpa_event_type_strings[event->event_type];
		n_len = strlen(name);
		break;
	case SEPARATOR:
	case ACTION:
		if (MAX_TEXT_EVENT > event->event_size) {
			name = event_entry;
			n_len = event->event_size;
		}
		break;
	case EVENT_TAG:
		pc_event = (struct tcpa_pc_event *)event_entry;

		/* ToDo Row data -> Base64 */

		switch (pc_event->event_id) {
		case SMBIOS:
		case BIS_CERT:
		case CMOS:
		case NVRAM:
		case OPTION_ROM_EXEC:
		case OPTION_ROM_CONFIG:
		case S_CRTM_VERSION:
			name = tcpa_pc_event_id_strings[pc_event->event_id];
			n_len = strlen(name);
			break;
		/* hash data */
		case POST_BIOS_ROM:
		case ESCD:
		case OPTION_ROM_MICROCODE:
		case S_CRTM_CONTENTS:
		case POST_CONTENTS:
			name = tcpa_pc_event_id_strings[pc_event->event_id];
			n_len = strlen(name);
			for (i = 0; i < 20; i++)
				d_len += sprintf(&data[2*i], "%02x",
						pc_event->event_data[i]);
			break;
		default:
			break;
		}
	default:
		break;
	}

	return snprintf(dest, MAX_TEXT_EVENT, "[%.*s%.*s]",
			n_len, name, d_len, data);

}

static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v)
{
	struct tcpa_event *event = v;
	char *data = v;
	int i;

	for (i = 0; i < sizeof(struct tcpa_event) + event->event_size; i++)
		seq_putc(m, data[i]);

	return 0;
}

static int tpm_bios_measurements_release(struct inode *inode,
					 struct file *file)
{
	struct seq_file *seq = file->private_data;
	struct tpm_bios_log *log = seq->private;

	if (log) {
		kfree(log->bios_event_log);
		kfree(log);
	}

	return seq_release(inode, file);
}

static int tpm_ascii_bios_measurements_show(struct seq_file *m, void *v)
{
	int len = 0;
	char *eventname;
	struct tcpa_event *event = v;
	unsigned char *event_entry =
	    (unsigned char *) (v + sizeof(struct tcpa_event));

	eventname = kmalloc(MAX_TEXT_EVENT, GFP_KERNEL);
	if (!eventname) {
		printk(KERN_ERR "%s: ERROR - No Memory for event name\n ",
		       __func__);
		return -EFAULT;
	}

	seq_printf(m, "%2d ", event->pcr_index);

	/* 2nd: SHA1 */
	seq_printf(m, "%20phN", event->pcr_value);

	/* 3rd: event type identifier */
	seq_printf(m, " %02x", event->event_type);

	len += get_event_name(eventname, event, event_entry);

	/* 4th: eventname <= max + \'0' delimiter */
	seq_printf(m, " %s\n", eventname);

	kfree(eventname);
	return 0;
}

static const struct seq_operations tpm_ascii_b_measurments_seqops = {
	.start = tpm_bios_measurements_start,
	.next = tpm_bios_measurements_next,
	.stop = tpm_bios_measurements_stop,
	.show = tpm_ascii_bios_measurements_show,
};

static const struct seq_operations tpm_binary_b_measurments_seqops = {
	.start = tpm_bios_measurements_start,
	.next = tpm_bios_measurements_next,
	.stop = tpm_bios_measurements_stop,
	.show = tpm_binary_bios_measurements_show,
};

static int tpm_ascii_bios_measurements_open(struct inode *inode,
					    struct file *file)
{
	int err;
	struct tpm_bios_log *log;
	struct seq_file *seq;

	log = kzalloc(sizeof(struct tpm_bios_log), GFP_KERNEL);
	if (!log)
		return -ENOMEM;

	if ((err = read_log(log)))
		goto out_free;

	/* now register seq file */
	err = seq_open(file, &tpm_ascii_b_measurments_seqops);
	if (!err) {
		seq = file->private_data;
		seq->private = log;
	} else {
		goto out_free;
	}

out:
	return err;
out_free:
	kfree(log->bios_event_log);
	kfree(log);
	goto out;
}

static const struct file_operations tpm_ascii_bios_measurements_ops = {
	.open = tpm_ascii_bios_measurements_open,
	.read = seq_read,
	.llseek = seq_lseek,
	.release = tpm_bios_measurements_release,
};

static int tpm_binary_bios_measurements_open(struct inode *inode,
					     struct file *file)
{
	int err;
	struct tpm_bios_log *log;
	struct seq_file *seq;

	log = kzalloc(sizeof(struct tpm_bios_log), GFP_KERNEL);
	if (!log)
		return -ENOMEM;

	if ((err = read_log(log)))
		goto out_free;

	/* now register seq file */
	err = seq_open(file, &tpm_binary_b_measurments_seqops);
	if (!err) {
		seq = file->private_data;
		seq->private = log;
	} else {
		goto out_free;
	}

out:
	return err;
out_free:
	kfree(log->bios_event_log);
	kfree(log);
	goto out;
}

static const struct file_operations tpm_binary_bios_measurements_ops = {
	.open = tpm_binary_bios_measurements_open,
	.read = seq_read,
	.llseek = seq_lseek,
	.release = tpm_bios_measurements_release,
};

static int is_bad(void *p)
{
	if (!p)
		return 1;
	if (IS_ERR(p) && (PTR_ERR(p) != -ENODEV))
		return 1;
	return 0;
}

struct dentry **tpm_bios_log_setup(char *name)
{
	struct dentry **ret = NULL, *tpm_dir, *bin_file, *ascii_file;

	tpm_dir = securityfs_create_dir(name, NULL);
	if (is_bad(tpm_dir))
		goto out;

	bin_file =
	    securityfs_create_file("binary_bios_measurements",
				   S_IRUSR | S_IRGRP, tpm_dir, NULL,
				   &tpm_binary_bios_measurements_ops);
	if (is_bad(bin_file))
		goto out_tpm;

	ascii_file =
	    securityfs_create_file("ascii_bios_measurements",
				   S_IRUSR | S_IRGRP, tpm_dir, NULL,
				   &tpm_ascii_bios_measurements_ops);
	if (is_bad(ascii_file))
		goto out_bin;

	ret = kmalloc(3 * sizeof(struct dentry *), GFP_KERNEL);
	if (!ret)
		goto out_ascii;

	ret[0] = ascii_file;
	ret[1] = bin_file;
	ret[2] = tpm_dir;

	return ret;

out_ascii:
	securityfs_remove(ascii_file);
out_bin:
	securityfs_remove(bin_file);
out_tpm:
	securityfs_remove(tpm_dir);
out:
	return NULL;
}

void tpm_bios_log_teardown(struct dentry **lst)
{
	int i;

	for (i = 0; i < 3; i++)
		securityfs_remove(lst[i]);
}


text:
echo "Enter the complete url at which links is going to be hosted"
read url

TMPFILE="`mktemp`"
TOOLSFILE="app/views/pages/tools.html.erb" # Assuming that we are in the 'links' app directory
sed "s@http://w.fieldsofview.in:3000@$url@g" $TOOLSFILE > $TMPFILE
mv -f $TMPFILE $TOOLSFILE

echo "Installed succesfully"


text:
Template.cards.helpers({
    'imagepath': function() {
        const quote = Template.instance().quotes.get();
        return quote.ImagePath;
    },
    'SupplierName': function() {
        const quote = Template.instance().quotes.get();
        return quote.SupplierName;
    },
    'FinalPremium': function() {
        const quote = Template.instance().quotes.get();
        return Common.addComma(quote.FinalPremium);
    },
    'IDV': function() {
        const quote = Template.instance().quotes.get();
        return Common.addComma(quote.Idv);
    },
    'Planname': function() {
        const quote = Template.instance().quotes.get();
        return quote.PlanName;
    },
    'GaragesInCity': function() {
        const quote = Template.instance().quotes.get();
        return quote.GaragesInCity;
    },
    'IsRSA': function() {
        const quote = Template.instance().quotes.get();
        if (quote && quote.AddOnFilters && (quote.AddOnFilters.IsRSA == true)) {
            return true;
        }
        return false;
    },
    'IsZD': function() {
        const quote = Template.instance().quotes.get();
        if (quote && quote.AddOnFilters && (quote.AddOnFilters.IsZD == true)) {
            return true;
        }

        return false;
    }
});

Template.cards.events({});

Template.cards.onCreated(function() {
    this.chatMessages = new ChatMessages();
    this.chatMessages.init(this.firstNode);
    this.quotes = new ReactiveVar();
    console.log('cards template');
    console.log(Template.currentData());
    this.quotes.set(Template.currentData());
});

Template.cards.rendered = function() {
    $('.flexslider').flexslider({
        animation: "slide",
        itemWidth: 225,
        itemMargin: 0,
        minItems: 0,
        maxItems: 50,
        move: 4,
        animationLoop: true,
        pauseOnAction: true,
        pauseOnHover: true,
        useCSS: false,
        slideshow: false,
        controlNav: false,
        prevText: ' ',
        nextText: ' '
    });
};


text:
using System;

namespace ExpressiveAnnotations.Analysis
{
    /// <summary>
    ///     Contains the location information related to some arbitrary data within associated text block.
    ///     <para>
    ///         Used for pointing exact parsing error location in specified expression.
    ///     </para>
    /// </summary>
    [Serializable]
    public class Location
    {
        /// <summary>
        ///     Initializes a new instance of the <see cref="Location" /> class.
        /// </summary>
        /// <param name="line">The line number.</param>
        /// <param name="column">The column number.</param>
        /// <exception cref="System.ArgumentOutOfRangeException"><c>line <= 0</c> or <c>column <= 0</c>.</exception>
        public Location(int line, int column)
        {
            if (line < 1)
                throw new ArgumentOutOfRangeException(nameof(line), "Line number should be positive.");
            if (column < 1)
                throw new ArgumentOutOfRangeException(nameof(column), "Column number should be positive.");

            Line = line;
            Column = column;
        }

        /// <summary>
        ///     Gets or sets the line number.
        /// </summary>
        public int Line { get; set; }

        /// <summary>
        ///     Gets or sets the column number.
        /// </summary>
        public int Column { get; set; }
    }
}


text:
<?php

/*
 * This file is part of the Active Collab User project.
 *
 * (c) A51 doo <info@activecollab.com>. All rights reserved.
 */

declare(strict_types=1);

namespace ActiveCollab\User\UserInterface;

use ActiveCollab\HumanNameParser\Parser as HumanNameParser;
use Exception;
use InvalidArgumentException;

trait ImplementationUsingFullName
{
    use FormatNameImplementation, JsonSerializeImplementation, OrganizationImplementation, UserIsImplementation;

    private $full_name_bits;

    public function getFirstName(): ?string
    {
        return $this->getFullNameBit('first');
    }

    private function getFullNameBit($first_or_last_name)
    {
        if (!in_array($first_or_last_name, ['first', 'last'])) {
            throw new InvalidArgumentException('First or last name expcected.');
        }

        if (empty($this->full_name_bits)) {
            $full_name = $this->getFullName();

            if (empty($full_name)) {
                list ($first_name, $last_name) = $this->getFirstAndLastNameFromEmail();

                if ($first_name && $last_name) {
                    $this->full_name_bits = (new HumanNameParser("$first_name $last_name"))->getArray();
                } else {
                    $this->full_name_bits = [
                        'first' => $first_name,
                    ];
                }
            } else {
                try {
                    $this->full_name_bits = (new HumanNameParser($full_name))->getArray();
                } catch (Exception $e) {
                    $this->full_name_bits = [
                        'first' => $full_name,
                    ];
                }
            }
        }

        return empty($this->full_name_bits[$first_or_last_name]) ? '' : $this->full_name_bits[$first_or_last_name];
    }

    public function getLastName(): ?string
    {
        return $this->getFullNameBit('last');
    }

    abstract public function getFullName(): ?string;
}


text:
package com.bookstore.controller.user;

import com.bookstore.bean.User;
import com.bookstore.controller.BaseController;
import com.bookstore.dao.OrderBookDAO;
import com.bookstore.dao.OrderDAO;
import com.bookstore.dao.UserDAO;
import com.bookstore.util.DbUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * Class DeleteController
 */
@WebServlet(urlPatterns="/users/delete/*")
public class DeleteController extends BaseUserController {
    @Override
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
        String[] pathInfo = request.getPathInfo().split("/");
        int resourceId;
        try {
            resourceId = Integer.parseInt(pathInfo[1]);
        } catch (Exception e) {
            forward404(request, response);
            return;
        }

        UserDAO userDAO = DbUtil.getDAO(UserDAO.class);
        OrderDAO orderDAO = DbUtil.getDAO(OrderDAO.class);
        OrderBookDAO orderBookDAO = DbUtil.getDAO(OrderBookDAO.class);

        // Cascade delete
        orderBookDAO.deleteByUser(resourceId);
        orderDAO.deleteByUser(resourceId);
        userDAO.delete(resourceId);

        flashSuccessMessage(request, "An item was deleted.");
        redirect(request, response, "/users");
    }
}


text:
<?php

namespace PHP_CodeSniffer\Standards\Squiz\Sniffs\Formatting;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Util\Tokens;

class OperatorBracketSniff implements Sniff
{

    /**
     * A list of tokenizers this sniff supports.
     *
     * @var array
     */
    public $supportedTokenizers = array(
                                   'PHP',
                                   'JS',
                                  );

    /**
     * Returns an array of tokens this test wants to listen for.
     *
     * @return array
     */
    public function register()
    {
        return Tokens::$operators;

    }//end register()

    /**
     * Processes this test, when one of its tokens is encountered.
     *
     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
     * @param int                         $stackPtr  The position of the current token in the
     *                                               stack passed in $tokens.
     *
     * @return void
     */
    public function process(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        if ($phpcsFile->tokenizerType === 'JS' && $tokens[$stackPtr]['code'] === T_PLUS) {
            // JavaScript uses the plus operator for string concatenation as well
            // so we cannot accurately determine if it is a string concat or addition.
            // So just ignore it.
            return;
        }

        // If the & is a reference, then we don't want to check for brackets.
        if ($tokens[$stackPtr]['code'] === T_BITWISE_AND && $phpcsFile->isReference($stackPtr) === true) {
            return;
        }

        // There is one instance where brackets aren't needed, which involves
        // the minus sign being used to assign a negative number to a variable.
        if ($tokens[$stackPtr]['code'] === T_MINUS) {
            // Check to see if we are trying to return -n.
            $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
            if ($tokens[$prev]['code'] === T_RETURN) {
                return;
            }

            $number = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
            if ($tokens[$number]['code'] === T_LNUMBER || $tokens[$number]['code'] === T_DNUMBER) {
                $previous = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
                if ($previous !== false) {
                    $isAssignment = in_array($tokens[$previous]['code'], Tokens::$assignmentTokens);
                    $isEquality   = in_array($tokens[$previous]['code'], Tokens::$equalityTokens);
                    $isComparison = in_array($tokens[$previous]['code'], Tokens::$comparisonTokens);
                    if ($isAssignment === true || $isEquality === true || $isComparison === true) {
                        // This is a negative assignment or comparison.
                        // We need to check that the minus and the number are
                        // adjacent.
                        if (($number - $stackPtr) !== 1) {
                            $error = 'No space allowed between minus sign and number';
                            $phpcsFile->addError($error, $stackPtr, 'SpacingAfterMinus');
                        }

                        return;
                    }
                }
            }
        }//end if

        $previousToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true, null, true);
        if ($previousToken !== false) {
            // A list of tokens that indicate that the token is not
            // part of an arithmetic operation.
            $invalidTokens = array(
                              T_COMMA,
                              T_COLON,
                              T_OPEN_PARENTHESIS,
                              T_OPEN_SQUARE_BRACKET,
                              T_OPEN_SHORT_ARRAY,
                              T_CASE,
                             );

            if (in_array($tokens[$previousToken]['code'], $invalidTokens) === true) {
                return;
            }
        }

        // Tokens that are allowed inside a bracketed operation.
        $allowed = array(
                    T_VARIABLE,
                    T_LNUMBER,
                    T_DNUMBER,
                    T_STRING,
                    T_WHITESPACE,
                    T_NS_SEPARATOR,
                    T_THIS,
                    T_SELF,
                    T_OBJECT_OPERATOR,
                    T_DOUBLE_COLON,
                    T_OPEN_SQUARE_BRACKET,
                    T_CLOSE_SQUARE_BRACKET,
                    T_MODULUS,
                    T_NONE,
                   );

        $allowed += Tokens::$operators;

        $lastBracket = false;
        if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) {
            $parenthesis = array_reverse($tokens[$stackPtr]['nested_parenthesis'], true);
            foreach ($parenthesis as $bracket => $endBracket) {
                $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($bracket - 1), null, true);
                $prevCode  = $tokens[$prevToken]['code'];

                if ($prevCode === T_ISSET) {
                    // This operation is inside an isset() call, but has
                    // no bracket of it's own.
                    break;
                }

                if ($prevCode === T_STRING || $prevCode === T_SWITCH) {
                    // We allow simple operations to not be bracketed.
                    // For example, ceil($one / $two).
                    for ($prev = ($stackPtr - 1); $prev > $bracket; $prev--) {
                        if (in_array($tokens[$prev]['code'], $allowed) === true) {
                            continue;
                        }

                        if ($tokens[$prev]['code'] === T_CLOSE_PARENTHESIS) {
                            $prev = $tokens[$prev]['parenthesis_opener'];
                        } else {
                            break;
                        }
                    }

                    if ($prev !== $bracket) {
                        break;
                    }

                    for ($next = ($stackPtr + 1); $next < $endBracket; $next++) {
                        if (in_array($tokens[$next]['code'], $allowed) === true) {
                            continue;
                        }

                        if ($tokens[$next]['code'] === T_OPEN_PARENTHESIS) {
                            $next = $tokens[$next]['parenthesis_closer'];
                        } else {
                            break;
                        }
                    }

                    if ($next !== $endBracket) {
                        break;
                    }
                }//end if

                if (in_array($prevCode, Tokens::$scopeOpeners) === true) {
                    // This operation is inside a control structure like FOREACH
                    // or IF, but has no bracket of it's own.
                    // The only control structure allowed to do this is SWITCH.
                    if ($prevCode !== T_SWITCH) {
                        break;
                    }
                }

                if ($prevCode === T_OPEN_PARENTHESIS) {
                    // These are two open parenthesis in a row. If the current
                    // one doesn't enclose the operator, go to the previous one.
                    if ($endBracket < $stackPtr) {
                        continue;
                    }
                }

                $lastBracket = $bracket;
                break;
            }//end foreach
        }//end if

        if ($lastBracket === false) {
            // It is not in a bracketed statement at all.
            $this->addMissingBracketsError($phpcsFile, $stackPtr);
            return;
        } else if ($tokens[$lastBracket]['parenthesis_closer'] < $stackPtr) {
            // There are a set of brackets in front of it that don't include it.
            $this->addMissingBracketsError($phpcsFile, $stackPtr);
            return;
        } else {
            // We are enclosed in a set of bracket, so the last thing to
            // check is that we are not also enclosed in square brackets
            // like this: ($array[$index + 1]), which is invalid.
            $brackets = array(
                         T_OPEN_SQUARE_BRACKET,
                         T_CLOSE_SQUARE_BRACKET,
                        );

            $squareBracket = $phpcsFile->findPrevious($brackets, ($stackPtr - 1), $lastBracket);
            if ($squareBracket !== false && $tokens[$squareBracket]['code'] === T_OPEN_SQUARE_BRACKET) {
                $closeSquareBracket = $phpcsFile->findNext($brackets, ($stackPtr + 1));
                if ($closeSquareBracket !== false && $tokens[$closeSquareBracket]['code'] === T_CLOSE_SQUARE_BRACKET) {
                    $this->addMissingBracketsError($phpcsFile, $stackPtr);
                }
            }

            return;
        }//end if

        $lastAssignment = $phpcsFile->findPrevious(Tokens::$assignmentTokens, $stackPtr, null, false, null, true);
        if ($lastAssignment !== false && $lastAssignment > $lastBracket) {
            $this->addMissingBracketsError($phpcsFile, $stackPtr);
        }

    }//end process()

    /**
     * Add and fix the missing brackets error.
     *
     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
     * @param int                         $stackPtr  The position of the current token in the
     *                                               stack passed in $tokens.
     *
     * @return void
     */
    public function addMissingBracketsError($phpcsFile, $stackPtr)
    {
        $error = 'Arithmetic operation must be bracketed';
        $fix   = $phpcsFile->addFixableError($error, $stackPtr, 'MissingBrackets');

        if ($fix === false) {
            return;
        }

        $tokens = $phpcsFile->getTokens();

        $allowed = array(
                    T_VARIABLE        => true,
                    T_LNUMBER         => true,
                    T_DNUMBER         => true,
                    T_STRING          => true,
                    T_WHITESPACE      => true,
                    T_THIS            => true,
                    T_SELF            => true,
                    T_OBJECT_OPERATOR => true,
                    T_DOUBLE_COLON    => true,
                    T_MODULUS         => true,
                    T_ISSET           => true,
                    T_ARRAY           => true,
                    T_NONE            => true,
                   );

        // Find the first token in the expression.
        for ($before = ($stackPtr - 1); $before > 0; $before--) {
            // Special case for plus operators because we can't tell if they are used
            // for addition or string contact. So assume string concat to be safe.
            if ($phpcsFile->tokenizerType === 'JS' && $tokens[$before]['code'] === T_PLUS) {
                break;
            }

            if (isset(Tokens::$emptyTokens[$tokens[$before]['code']]) === true
                || isset(Tokens::$operators[$tokens[$before]['code']]) === true
                || isset(Tokens::$castTokens[$tokens[$before]['code']]) === true
                || isset($allowed[$tokens[$before]['code']]) === true
            ) {
                continue;
            }

            if ($tokens[$before]['code'] === T_CLOSE_PARENTHESIS) {
                $before = $tokens[$before]['parenthesis_opener'];
                continue;
            }

            if ($tokens[$before]['code'] === T_CLOSE_SQUARE_BRACKET) {
                $before = $tokens[$before]['bracket_opener'];
                continue;
            }

            break;
        }//end for

        $before = $phpcsFile->findNext(Tokens::$emptyTokens, ($before + 1), null, true);

        // Find the last token in the expression.
        for ($after = ($stackPtr + 1); $after < $phpcsFile->numTokens; $after++) {
            // Special case for plus operators because we can't tell if they are used
            // for addition or string contact. So assume string concat to be safe.
            if ($phpcsFile->tokenizerType === 'JS' && $tokens[$after]['code'] === T_PLUS) {
                break;
            }

            if (isset(Tokens::$emptyTokens[$tokens[$after]['code']]) === true
                || isset(Tokens::$operators[$tokens[$after]['code']]) === true
                || isset(Tokens::$castTokens[$tokens[$after]['code']]) === true
                || isset($allowed[$tokens[$after]['code']]) === true
            ) {
                continue;
            }

            if ($tokens[$after]['code'] === T_OPEN_PARENTHESIS) {
                $after = $tokens[$after]['parenthesis_closer'];
                continue;
            }

            if ($tokens[$after]['code'] === T_OPEN_SQUARE_BRACKET) {
                $after = $tokens[$after]['bracket_closer'];
                continue;
            }

            break;
        }//end for

        $after = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($after - 1), null, true);

        // Can only fix this error if both tokens are available for fixing.
        // Adding one bracket without the other will create parse errors.
        $phpcsFile->fixer->beginChangeset();
        $phpcsFile->fixer->replaceToken($before, '('.$tokens[$before]['content']);
        $phpcsFile->fixer->replaceToken($after, $tokens[$after]['content'].')');
        $phpcsFile->fixer->endChangeset();

    }//end addMissingBracketsError()

}//end class


text:
<?php
use Zend\ServiceManager\ServiceManager;
use Zend\Mvc\Service\ServiceManagerConfig;
use Zend\Db\Adapter\Adapter;
use Zend\Loader\AutoloaderFactory;
use Zend\Loader\StandardAutoloader;

/**
 *
 */
class Bootstrap
{
    static function getModulePath()
    {
        //mudar o caminho do módulo
        return __DIR__ . '/../../../module/Admin';
    }

    static public function go()
    {
        //@todo verificar se não existe uma constante indicando o diretório raiz do projeto
        chdir(dirname(__DIR__ . '/../../../..'));

        include 'init_autoloader.php';

        define('ZF2_PATH', realpath('vendor/zendframework/zendframework/library'));

        $path = array(
            ZF2_PATH,
            get_include_path(),
        );
        set_include_path(implode(PATH_SEPARATOR, $path));

        require_once  'Zend/Loader/AutoloaderFactory.php';
        require_once  'Zend/Loader/StandardAutoloader.php';

        // setup autoloader
        AutoloaderFactory::factory(
            array(
                'Zend\Loader\StandardAutoloader' => array(
                    StandardAutoloader::AUTOREGISTER_ZF => true,
                    StandardAutoloader::ACT_AS_FALLBACK => false,
                    StandardAutoloader::LOAD_NS => array(
                        'Core' => getcwd() . '/module/Core/src/Core'
                    )
                )
            )
        );
    }
}

Bootstrap::go();


text:
if which gpg >/dev/null 2>&1; then
  export GPG_TTY=$(tty)
  gpg-connect-agent /bye

  echo UPDATESTARTUPTTY | gpg-connect-agent >/dev/null
fi


text:
<?php

namespace Integrated\Common\ContentType\Form\Custom\Type;

use Integrated\Common\ContentType\Form\Custom\TypeInterface;

/**
 * @author Jeroen van Leeuwen <jeroen@e-active.nl>
 */
class Registry implements RegistryInterface
{
    /**
     * @var TypeInterface[]
     */
    protected $types = [];

    /**
     * {@inheritdoc}
     */
    public function add(TypeInterface $type)
    {
        $this->types[spl_object_hash($type)] = $type;

        return $this;
    }

    /**
     * {@inheritdoc}
     */
    public function has(TypeInterface $type)
    {
        return \array_key_exists(spl_object_hash($type), $this->types);
    }

    /**
     * @return TypeInterface[]
     */
    public function getIterator()
    {
        return new \ArrayIterator($this->types);
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="tests/bootstrap.php" colors="true">
    <testsuites>
        <testsuite name="agent-suite">
            <directory suffix='.php'>tests/agent/</directory>
            <directory suffix=".php">vendor/</directory>
        </testsuite>
    </testsuites>
</phpunit>


text:
#include "BufferedNormalMap3DTest.h"
#include <Carna/base/BufferedNormalMap3D.h>

// ----------------------------------------------------------------------------------
// BufferedNormalMap3DTest
// ----------------------------------------------------------------------------------

void BufferedNormalMap3DTest::initTestCase()
{
}

void BufferedNormalMap3DTest::cleanupTestCase()
{
}

void BufferedNormalMap3DTest::init()
{
    static_assert( std::numeric_limits< base::NormalMap3DInt8::BufferedVectorComponent >::is_signed, "Type conflict detected." );
    static_assert( sizeof( base::NormalMap3DInt8::BufferedVectorComponent ) == 1, "Type conflict detected." );
}

void BufferedNormalMap3DTest::cleanup()
{
    normals.reset();
}

void BufferedNormalMap3DTest::test_instantiation()
{
    const base::math::Vector3ui size( 3, 3, 3 );
    normals.reset( new base::NormalMap3DInt8( size ) );
}

void BufferedNormalMap3DTest::test_bufferComponentToNormalComponent()
{
    QVERIFY( base::NormalMap3DInt8::decodeComponent( -1 ) < 0 );
    QVERIFY( base::NormalMap3DInt8::decodeComponent(  0 ) > 0 );

    QCOMPARE( base::NormalMap3DInt8::decodeComponent( -128 ), -1.f );
    QCOMPARE( base::NormalMap3DInt8::decodeComponent( +127 ), +1.f );
}

void BufferedNormalMap3DTest::test_normalComponentToBufferComponent()
{
    QCOMPARE( static_cast< int >( base::NormalMap3DInt8::encodeComponent(  0 ) ),   -1 );
    QCOMPARE( static_cast< int >( base::NormalMap3DInt8::encodeComponent( -1 ) ), -128 );
    QCOMPARE( static_cast< int >( base::NormalMap3DInt8::encodeComponent( +1 ) ), +127 );
}


text:
module WaveFile
  # Provides the ability to write data to a wave file.
  #
  # When a Writer is constructed it can be given a block. All samples should be written inside this
  # block, and when the block exits the file will automatically be closed:
  #
  #    Writer.new("my_file.wav", Format.new(:mono, :pcm_16, 44100)) do |writer|
  #      # Write sample data here
  #    end
  #
  # If no block is given, you'll need to manually close the Writer when done. The underlaying
  # file will not be valid or playable until close is called.
  #
  #    writer = Writer.new("my_file.wav", Format.new(:mono, :pcm_16, 44100))
  #    # Write sample data here
  #    writer.close
  class Writer

    # Padding value written to the end of chunks whose payload is an odd number of bytes. The RIFF
    # specification requires that each chunk be aligned to an even number of bytes, even if the byte
    # count is an odd number.
    #
    # See http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Docs/riffmci.pdf, page 11.
    EMPTY_BYTE = "\000"    # :nodoc:

    # The number of bytes at the beginning of a wave file before the sample data in the data chunk
    # starts, assuming this canonical format:
    #
    # RIFF Chunk Header (12 bytes)
    # Format Chunk (16 bytes for PCM, 18 bytes for floating point)
    # FACT Chunk (0 bytes for PCM, 12 bytes for floating point)
    # Data Chunk Header (8 bytes)
    #
    # All wave files written by Writer use this canonical format.
    CANONICAL_HEADER_BYTE_LENGTH = {:pcm => 36, :float => 50}    # :nodoc:

    # Returns a constructed Writer object which is available for writing sample data to the specified
    # file (via the write method). When all sample data has been written, the Writer should be closed.
    # Note that the wave file being written to will NOT be valid (and playable in other programs) until
    # the Writer has been closed.
    #
    # If a block is given to this method, sample data can be written inside the given block. When the
    # block terminates, the Writer will be automatically closed (and no more sample data can be written).
    #
    # If no block is given, then sample data can be written until the close method is called.
    def initialize(file_name, format)
      @file_name = file_name
      @file = File.open(file_name, "wb")
      @format = format

      @total_sample_frames = 0
      @pack_code = PACK_CODES[format.sample_format][format.bits_per_sample]

      # Note that the correct sizes for the RIFF and data chunks can't be determined
      # until all samples have been written, so this header as written will be incorrect.
      # When close is called, the correct sizes will be re-written.
      write_header(0)

      if block_given?
        begin
          yield(self)
        ensure
          close
        end
      end
    end

    # Appends the sample data in the given Buffer to the end of the wave file.
    #
    # Returns the number of sample frames that have been written to the file so far.
    # Raises IOError if the Writer has been closed.
    def write(buffer)
      samples = buffer.convert(@format).samples

      if @format.bits_per_sample == 24 && @format.sample_format == :pcm
        samples.flatten.each do |sample|
          @file.syswrite([sample].pack("lX"))
        end
      else
        @file.syswrite(samples.flatten.pack(@pack_code))
      end

      @total_sample_frames += samples.length
    end

    # Returns true if the Writer is closed, and false if it is open and available for writing.
    def closed?
      @file.closed?
    end

    # Closes the Writer. After a Writer is closed, no more sample data can be written to it.
    #
    # Note that the wave file will NOT be valid until this method is called. The wave file
    # format requires certain information about the amount of sample data, and this can't be
    # determined until all samples have been written. (This method doesn't need to be called
    # when passing a block to Writer.new, as this method will automatically be called when
    # the block exits).
    #
    # Returns nothing.
    # Raises IOError if the Writer is already closed.
    def close
      # The RIFF specification requires that each chunk be aligned to an even number of bytes,
      # even if the byte count is an odd number. Therefore if an odd number of bytes has been
      # written, write an empty padding byte.
      #
      # See http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Docs/riffmci.pdf, page 11.
      bytes_written = @total_sample_frames * @format.block_align
      if bytes_written.odd?
        @file.syswrite(EMPTY_BYTE)
      end

      # We can't know what chunk sizes to write for the RIFF and data chunks until all
      # samples have been written, so go back to the beginning of the file and re-write
      # those chunk headers with the correct sizes.
      @file.sysseek(0)
      write_header(@total_sample_frames)

      @file.close
    end

    # Returns a Duration instance for the number of sample frames that have been written so far
    def total_duration
      Duration.new(@total_sample_frames, @format.sample_rate)
    end

    # Returns the name of the Wave file that is being written to
    attr_reader :file_name

    # Returns a Format object describing the Wave file being written (number of channels, sample
    # format and bits per sample, sample rate, etc.)
    attr_reader :format

    # Returns the number of samples (per channel) that have been written to the file so far.
    # For example, if 1000 "left" samples and 1000 "right" samples have been written to a stereo file,
    # this will return 1000.
    attr_reader :total_sample_frames

  private

    # Writes the RIFF chunk header, format chunk, and the header for the data chunk. After this
    # method is called the file will be "queued up" and ready for writing actual sample data.
    def write_header(sample_frame_count)
      sample_data_byte_count = sample_frame_count * @format.block_align

      # Write the header for the RIFF chunk
      header = CHUNK_IDS[:riff]
      header += [CANONICAL_HEADER_BYTE_LENGTH[@format.sample_format] + sample_data_byte_count].pack(UNSIGNED_INT_32)
      header += WAVEFILE_FORMAT_CODE

      # Write the format chunk
      header += CHUNK_IDS[:format]
      header += [FORMAT_CHUNK_BYTE_LENGTH[@format.sample_format]].pack(UNSIGNED_INT_32)
      header += [FORMAT_CODES[@format.sample_format]].pack(UNSIGNED_INT_16)
      header += [@format.channels].pack(UNSIGNED_INT_16)
      header += [@format.sample_rate].pack(UNSIGNED_INT_32)
      header += [@format.byte_rate].pack(UNSIGNED_INT_32)
      header += [@format.block_align].pack(UNSIGNED_INT_16)
      header += [@format.bits_per_sample].pack(UNSIGNED_INT_16)
      if @format.sample_format == :float
        header += [0].pack(UNSIGNED_INT_16)
      end

      # Write the FACT chunk, if necessary
      unless @format.sample_format == :pcm
        header += CHUNK_IDS[:fact]
        header += [4].pack(UNSIGNED_INT_32)
        header += [sample_frame_count].pack(UNSIGNED_INT_32)
      end

      # Write the header for the data chunk
      header += CHUNK_IDS[:data]
      header += [sample_data_byte_count].pack(UNSIGNED_INT_32)

      @file.syswrite(header)
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jdbc="http://www.springframework.org/schema/jdbc"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="
         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
         http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <context:component-scan base-package="org.apache.camel.spring.interceptor"/>
    <tx:annotation-driven transaction-manager="txManager"/>

    <!-- datasource to the database -->
    <jdbc:embedded-database id="dataSource" type="DERBY">
    	<jdbc:script location="classpath:sql/init.sql" />
    </jdbc:embedded-database>

    <!-- spring transaction manager -->
    <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"/>
    </bean>

    <!-- bean for book business logic -->
    <bean id="bookService" class="org.apache.camel.spring.interceptor.AnnotatedBookServiceImpl"/>

    <camelContext xmlns="http://camel.apache.org/schema/spring">
        <routeBuilder ref="annotatedRoute"/>
    </camelContext>

    <bean id="annotatedRoute" class="org.apache.camel.spring.interceptor.AnnotatedRoute"/>

    <bean id="annotatedConsumer" class="org.apache.camel.spring.interceptor.AnnotatedConsumeImpl"/>

</beans>


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.jerry.maven</groupId>
  <artifactId>MavenSecond</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <dependencies>
  	<dependency>
  		<groupId>com.jerry.maven</groupId>
  		<artifactId>MavenFirst</artifactId>
  		  <version>0.0.1-SNAPSHOT</version>
  	</dependency>
  </dependencies>

</project>


text:
package org.kaaproject.kaa.client.channel;

import java.nio.ByteBuffer;

import org.junit.Test;
import org.kaaproject.kaa.client.channel.impl.ChannelRuntimeException;
import org.kaaproject.kaa.client.channel.impl.transports.DefaultConfigurationTransport;
import org.kaaproject.kaa.client.configuration.ConfigurationHashContainer;
import org.kaaproject.kaa.client.configuration.ConfigurationProcessor;
import org.kaaproject.kaa.client.persistence.KaaClientState;
import org.kaaproject.kaa.client.schema.SchemaProcessor;
import org.kaaproject.kaa.common.TransportType;
import org.kaaproject.kaa.common.endpoint.gen.ConfigurationSyncRequest;
import org.kaaproject.kaa.common.endpoint.gen.ConfigurationSyncResponse;
import org.kaaproject.kaa.common.endpoint.gen.SyncResponseStatus;
import org.mockito.Mockito;

public class DefaultConfigurationTransportTest {

    @Test(expected = ChannelRuntimeException.class)
    public void testSyncNegative() {
        KaaClientState clientState = Mockito.mock(KaaClientState.class);
        ConfigurationTransport transport = new DefaultConfigurationTransport();
        transport.setClientState(clientState);
        transport.sync();
    }

    @Test
    public void testSync() {
        KaaChannelManager channelManager = Mockito.mock(KaaChannelManager.class);
        KaaClientState clientState = Mockito.mock(KaaClientState.class);

        ConfigurationTransport transport = new DefaultConfigurationTransport();
        transport.setChannelManager(channelManager);
        transport.setClientState(clientState);
        transport.sync();

        Mockito.verify(channelManager, Mockito.times(1)).sync(TransportType.CONFIGURATION);
    }

    @Test
    public void testCreateRequest() {
        ConfigurationHashContainer hashContainer = Mockito.mock(ConfigurationHashContainer.class);
        KaaClientState clientState = Mockito.mock(KaaClientState.class);

        ConfigurationTransport transport = new DefaultConfigurationTransport();
        transport.createConfigurationRequest();
        transport.setConfigurationHashContainer(hashContainer);
        transport.createConfigurationRequest();
        transport.setClientState(clientState);

        ConfigurationSyncRequest request = transport.createConfigurationRequest();

        Mockito.verify(hashContainer, Mockito.times(1)).getConfigurationHash();
    }

    @Test
    public void testOnConfigurationResponse() throws Exception {
        KaaClientState clientState = Mockito.mock(KaaClientState.class);
        SchemaProcessor schemaProcessor = Mockito.mock(SchemaProcessor.class);
        ConfigurationProcessor configProcessor = Mockito.mock(ConfigurationProcessor.class);

        ConfigurationSyncResponse response = new ConfigurationSyncResponse();
        response.setResponseStatus(SyncResponseStatus.DELTA);

        KaaChannelManager channelManagerMock = Mockito.mock(KaaChannelManager.class);

        ConfigurationTransport transport = new DefaultConfigurationTransport();
        transport.setChannelManager(channelManagerMock);
        transport.onConfigurationResponse(response);
        transport.setClientState(clientState);
        transport.onConfigurationResponse(response);
        transport.setConfigurationProcessor(configProcessor);
        transport.onConfigurationResponse(response);
        transport.setSchemaProcessor(schemaProcessor);
        transport.onConfigurationResponse(response);

        response.setConfDeltaBody(ByteBuffer.wrap(new byte[] { 1, 2, 3 }));
        transport.onConfigurationResponse(response);
        response.setConfSchemaBody(ByteBuffer.wrap(new byte[] { 1, 2, 3 }));
        transport.onConfigurationResponse(response);

        Mockito.verify(schemaProcessor, Mockito.times(1)).loadSchema(Mockito.eq(ByteBuffer.wrap(new byte[] { 1, 2, 3 })));
        Mockito.verify(configProcessor, Mockito.times(2)).processConfigurationData(Mockito.eq(ByteBuffer.wrap(new byte[] { 1, 2, 3 })), Mockito.eq(false));
    }

}


text:
using System;

namespace YamlDotNet.Core.Events
{
	/// <summary>
	/// Specifies the style of a mapping.
	/// </summary>
	public enum MappingStyle
	{
		/// <summary>
		/// Let the emitter choose the style.
		/// </summary>
		Any,

		/// <summary>
		/// The block mapping style.
		/// </summary>
		Block,

		/// <summary>
		/// The flow mapping style.
		/// </summary>
		Flow
	}
}


text:
package it.unibo.cesop.demo;

import it.unibo.cesop.demo.model.Document;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocumentList;
import spark.ModelAndView;
import spark.Request;
import spark.Response;
import spark.template.jade.JadeTemplateEngine;
import java.net.MalformedURLException;
import java.time.Duration;
import java.time.Instant;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static spark.Spark.*;

public class Programma {

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

        //Set Java Spark server port
        port(8080);

        //Set static file folder
        staticFileLocation("/public/css");

        //URL Solr
        final SolrClient server = new HttpSolrClient.Builder("http://137.204.57.106:8983/solr/VisionTestCurriculumCollection").build();

        get("/", (request, response) -> {
            Map<String, String> model = new HashMap<>();
            model.put("message", "Hello Jade!");
            return new ModelAndView(model, "index"); // located in resources/templates directory
        }, new JadeTemplateEngine());

        post("/cerca", (Request request, Response response) -> {
            //Start time
            Instant start = Instant.now();
            Map<String, Object> model = new HashMap<>();
            //Retrieve parameters
            String cerca = request.queryParams("cerca");
            String tipo =  request.queryParams("tipo");
            Integer livello =  Integer.parseInt(request.queryParams("livello"));

            //Flag for enabling detailed print
            boolean mode = Boolean.FALSE;
            //Flag for distinguishing competenze to epserienze
            final boolean mode1 = tipo.equals("Competenze") ?  Boolean.TRUE : Boolean.FALSE;

            //Set solr query
            final String wildCard= "http\\:\\/\\/www.cesop.it\\/ontologies\\/";
            SolrQuery query = new SolrQuery();
            String squery;
            if (livello == 2) {
                squery = String.format("%s_ancestors_labels_t:%s OR %s_parent_labels_t:%s OR %s_label_t:%s", tipo, cerca, tipo, cerca, tipo, cerca);
                mode = Boolean.TRUE;
            } else if (livello == 1){
                squery = String.format("%s_parent_labels_t:%s OR %s_label_t:%s", tipo, cerca, tipo, cerca);
                mode = Boolean.TRUE;
            } else {
                squery = String.format("%s:%s",tipo, cerca);
            }
            query.setRows(Integer.MAX_VALUE);
            query.setQuery(squery);
            //query.addFilterQuery("Cognome:"+ cerca);

            //Get results
            QueryResponse rsp = server.query(query);
            SolrDocumentList docs = rsp.getResults();
            List<Document> beans = rsp.getBeans(Document.class);

            Instant stop = Instant.now();
            Duration duration = Duration.between(start, stop);
            double seconds = (double)duration.getNano() / 1000000000.0;
            //Model attributes
            model.put("message", cerca);
            model.put("total", String.format("%.3f", seconds));
            model.put("nris", beans.size());
            model.put("documents", beans);
            model.put("mode", mode);
            model.put("mode1", mode1);

            return new ModelAndView(model, "cerca"); // located in resources/templates directory
        }, new JadeTemplateEngine());

    }
}


text:
function creating_space_for_postprocessing(pp_directory, sim_type, model_name)
% Create the appropriate folder structure for the postprocessed data to go.
% If data is already present and the no_skip option has been selected then the
% old data is moved to another folder.
%
% Example: creating_space_for_postprocessing('wake', model_name)
if exist(pp_directory, 'dir') == 7
    disp(['Moving old ', sim_type, ' postprocessing data for ',model_name])
    old_store = ['old_data', datestr(now,30)];
    mkdir('pp_link', old_store)
    movefile(pp_directory, fullfile('pp_link', old_store))
end %if
disp(['Creating ', sim_type, ' postprocessing folder for ',model_name])
[~] = system(['mkdir ', pp_directory]);


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>LJN - Create Control</title>
    <meta name="description" content="LJN - Create Control">
    <meta name="viewport" content="width=device-width">

    <link rel="stylesheet" href="css/normalize.css">
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" href="css/bootstrap.min.css" />
    <link rel="stylesheet" href="css/bootstrap-responsive.min.css" />

LJN - Create Template

            Template Name:
            <input type="text" id="TemplateName" placeholder="Enter name of template here" />
            <input type="button" id="GenerateTemplate" value="Generate Template" />

                Control to create:
                <select id="Controls">
                    <option value="radio">Radio</option>
                    <option value="comment">Comment</option>
                    <option value="date">Date</option>
                    <option value="warning">Warning</option>
                    <option value="textbox">Text Box</option>
                </select>

                    <input type="button" id="AddControl" value="Add Control" />

                <input type="hidden" id="ControlIndex" />

                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Modal header

                    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
                    <button id="AddLJNControl" class="btn btn-primary">Save changes</button>

                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Your LJN Template

                        Here is your code file: CodeGeneration

                        Here is your xml file: XML Generate

                    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>


text:
namespace cpp_client
{

namespace newtonian
{

/// <summary>
/// This is the header file for building your Newtonian AI
/// </summary>
class AI : public Base_ai
{
public:
    /// <summary>
    /// This is a reference to the Game object itself, it contains all the information about the current game
    /// </summary>
    Game game;

    /// <summary>
    /// This is a pointer to your AI's player. This AI class is not a player, but it should command this Player.
    /// </summary>
    Player player;

    //<<-- Creer-Merge: class variables -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
    // You can add additional class variables here.
    //<<-- /Creer-Merge: class variables -->>

    /// <summary>
    /// This returns your AI's name to the game server.
    /// Replace the string name.
    /// </summary>
    /// <returns>The name of your AI.</returns>
    virtual std::string get_name() const override;

    /// <summary>
    /// This is automatically called when the game first starts, once the game objects are created
    /// </summary>
    virtual void start() override;

    /// <summary>
    /// This is automatically called when the game ends.
    /// </summary>
    /// <param name="won">true if you won, false otherwise</param>
    /// <param name="reason">An explanation for why you either won or lost</param>
    virtual void ended(bool won, const std::string& reason) override;

    /// <summary>
    /// This is automatically called the game (or anything in it) updates
    /// </summary>
    virtual void game_updated() override;

    /// <summary>
    /// This is called every time it is this AI.player's turn.
    /// </summary>
    /// <returns>Represents if you want to end your turn. True means end your turn, False means to keep your turn going and re-call this function.</returns>
    bool run_turn();

    // <<-- Creer-Merge: methods -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
    // You can add additional methods here.
    // <<-- /Creer-Merge: methods -->>

/// A very basic path finding algorithm (Breadth First Search) that when given a starting Tile, will return a valid path to the goal Tile.
/// <param name="start">the starting Tile</param>
/// <param name="goal">the goal Tile</param>
/// <return>A List of Tiles representing the path, the the first element being a valid adjacent Tile to the start, and the last element being the goal. Or an empty list if no path found.</return>
std::vector<Tile> find_path(const Tile& start, const Tile& goal);

    // ####################
    // Don't edit these!
    // ####################
    /// \cond FALSE
    virtual std::string invoke_by_name(const std::string& name,
                                       const std::unordered_map<std::string, Any>& args) override;
    virtual void set_game(Base_game* ptr) override;
    virtual void set_player(std::shared_ptr<Base_object> obj) override;
    virtual void print_win_loss_info() override;
    /// \endcond
    // ####################
    // Don't edit these!
    // ####################

};

} // NEWTONIAN

} // cpp_client

#endif // GAMES_NEWTONIAN_AI_HPP


text:
#pragma once

namespace Zero
{
	class IProxy;
	class IStub;

	class IPacket
	{
	public:
		IPacket();
		virtual ~IPacket();

		virtual void Attach(IProxy* proxy, IStub* stub) = 0;
		virtual void AttachProxy(IProxy* proxy) = 0;
		virtual void AttachStub(IStub* stub) = 0;
		virtual void DetachProxy(IProxy* proxy) = 0;
		virtual void DetachStub(IStub* stub) = 0;

		virtual void NeedImplement(StringA pkname) = 0;
		virtual RemoteID GetSelfRemoteID() = 0;

	protected:
		virtual void NeedDefine(Int16 pkid) = 0;
		bool Recv(const CPackOption &pkOption, const Zero::PacketType pkType, CRecvedMessage& RecvMsg, const CSafeArray<IStub*>& arrStub);
		void SendCS(const Zero::RemoteID remote, const UInt32 cev, const UInt32 prv, const Zero::String na, const UInt16 np, const Int32 authkey, const UInt16 nps, ArrByte* pDummy, bool rcm, bool rcc, Guid ck, const Zero::RemoteID selfID, bool ms, Guid mk);
		virtual intptr_t Send(const RemoteID remote, CPackOption &pkOption, CMessage& msg, const bool bForceInternal = false);
		friend IProxy;
	};

	class IProxy
	{
	public:
		IPacket* m_owner;
		bool PacketSend(const RemoteID remote, CPackOption& pkOption, CMessage &msg);
		IProxy();
		virtual ~IProxy();
	};
	class IStub
	{
	public:
		IPacket *m_owner;
		virtual bool ProcessMsg(CRecvedMessage& rm) = 0;
		IStub();
		virtual ~IStub();
	};
}


text:
module Questionable
  class Assignment < ActiveRecord::Base
    attr_accessible :question_id, :subject, :subject_id, :subject_type, :position

    belongs_to :question, :dependent => :destroy
    belongs_to :subject, :polymorphic => true

    has_many :answers, :dependent => :destroy
    has_many :answered_options, :through => :answers, :source => :option

    scope :category, lambda { |category| includes(:question).where("questionable_questions.category #{category.nil? ? 'IS ' : ' = '} ?", category) }

    def self.with_subject(subject)
      if subject.kind_of?(Symbol) or subject.kind_of?(String)
        assignments = Questionable::Assignment.where(:subject_type => subject)
      else
        assignments = Questionable::Assignment.where(:subject_type => subject.class.to_s, :subject_id => subject.id)
      end

      assignments.order(:position)
    end

    def answers_for_user(user, rating_id)
      if rating_id.nil?
        self.answers.where(user_id: user.id)
      else
        self.answers.where(user_id: user.id, rating_id: rating_id)
      end
    end

    # for ActiveAdmin
    def display_name
      "#{self.subject_type}#{self.subject_id}: #{self.question.title}"
    end

  end # End Assignment
end


text:
/// @file ifc_thread_psr.cpp

#include "stdafx.h"
#include "ifc_thread_psr.h"
#include "ifc_sysutils.h"
#include "ifc_exceptions.h"
#include "ifc_errmsgs.h"

namespace ifc
{

///////////////////////////////////////////////////////////////////////////////
// CThreadProcessor::CWorkerThread

CThreadProcessor::CWorkerThread::CWorkerThread(CThreadProcessor& Processor) :
	m_Processor(Processor)
{
	SetFreeOnTerminate(false);
}

//-----------------------------------------------------------------------------

void CThreadProcessor::CWorkerThread::Execute()
{
	while (!GetTerminated())
	{
		try
		{
			m_Processor.m_SleepController.NeedSleep() = true;
			m_Processor.Process();
		}
		catch (...)
		{
			m_Processor.m_SleepController.NeedSleep() = true;
		}

		if (m_Processor.m_SleepController.NeedSleep())
			m_Processor.m_SleepController.Sleep(m_Processor.m_SleepController.SleepMSecs());
	}
}

///////////////////////////////////////////////////////////////////////////////
// CThreadProcessor::CSleepController

CThreadProcessor::CSleepController::CSleepController() :
	m_bNeedSleep(true),
	m_nSleepMSecs(DEF_THREAD_PSR_SHEEP_MSECS)
{
	m_hSleepEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
}

CThreadProcessor::CSleepController::~CSleepController()
{
	CloseHandle(m_hSleepEvent);
}

//-----------------------------------------------------------------------------

void CThreadProcessor::CSleepController::Sleep(int nMilliseconds)
{
	if (nMilliseconds != 0)
		::WaitForSingleObject(m_hSleepEvent, nMilliseconds);
	ResetEvent(m_hSleepEvent);
}

//-----------------------------------------------------------------------------

void CThreadProcessor::CSleepController::InterruptSleep()
{
	SetEvent(m_hSleepEvent);
}

///////////////////////////////////////////////////////////////////////////////
// CThreadProcessor

CThreadProcessor::CThreadProcessor() :
	m_pWorkerThread(NULL)
{
	// nothing
}

//-----------------------------------------------------------------------------

CThreadProcessor::~CThreadProcessor()
{
	Stop();
}

//-----------------------------------------------------------------------------

void CThreadProcessor::Start()
{
	if (!m_pWorkerThread)
	{
		m_pWorkerThread = new CWorkerThread(*this);
		m_pWorkerThread->Run();
	}
}

//-----------------------------------------------------------------------------

void CThreadProcessor::Stop()
{
	if (m_pWorkerThread)
	{
		m_SleepController.InterruptSleep();
		BeforeTerminate();
		m_pWorkerThread->Terminate();
		m_pWorkerThread->WaitFor();
		delete m_pWorkerThread;
		m_pWorkerThread = NULL;
	}
}

///////////////////////////////////////////////////////////////////////////////
// CDaemonJob

CDaemonJob::CDaemonJob() :
	m_pJobPsr(NULL),
	m_nLastProcTicks(0),
	m_nProcessCount(0),
	m_nDelay(0),
	m_nInterval(0)
{
	// nothing
}

///////////////////////////////////////////////////////////////////////////////
// CDaemonJobPsr

CDaemonJobPsr::CDaemonJobPsr() :
	m_JobList(false, true),
	m_AddList(true, true)
{
	const int LOOP_INTERVAL = 1;   // ms
	m_SleepController.SleepMSecs() = LOOP_INTERVAL;
}

//-----------------------------------------------------------------------------

CDaemonJobPsr::~CDaemonJobPsr()
{
	Terminate();
}

//-----------------------------------------------------------------------------

void CDaemonJobPsr::BeforeTerminate()
{
	for (int i = m_JobList.GetCount() - 1; i >= 0; i--)
		m_JobList[i]->BeforeTerminate();
}

//-----------------------------------------------------------------------------

void CDaemonJobPsr::Process()
{
	while (true)
	{
		CDaemonJob *pJob = m_AddList.Extract(0);
		if (pJob)
			m_JobList.Add(pJob);
		else
			break;
	}

	UINT nCurTicks = GetTickCount();
	for (int i = m_JobList.GetCount() - 1; i >= 0; i--)
	{
		CDaemonJob& Job = *(m_JobList[i]);

		if (Job.m_nLastProcTicks == 0)
			Job.m_nLastProcTicks = nCurTicks;

		if (Job.m_nProcessCount == 0 && GetTickDiff(Job.m_nLastProcTicks, nCurTicks) < Job.m_nDelay)
			continue;

		if (Job.m_nProcessCount == 0 || GetTickDiff(Job.m_nLastProcTicks, nCurTicks) >= Job.m_nInterval)
		{
			Job.m_nLastProcTicks = nCurTicks;
			try
			{
				Job.Process();
			}
			catch (IFC_EXCEPT_OBJ e)
			{
				IFC_DELETE_MFC_EXCEPT_OBJ(e);
			}
			catch (...)
			{}

			Job.m_nProcessCount++;
		}
	}
}

//-----------------------------------------------------------------------------

void CDaemonJobPsr::AddJob(CDaemonJob *pJob)
{
	if (pJob)
	{
		pJob->m_pJobPsr = this;
		m_AddList.Add(pJob);
	}
}

//-----------------------------------------------------------------------------

void CDaemonJobPsr::Terminate()
{
	Stop();
	m_JobList.Clear();
	m_AddList.Clear();
}

///////////////////////////////////////////////////////////////////////////////

} // namespace ifc


text:
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Performance of Numeric Generators</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../../../index.html" title="Spirit 2.5.2">
<link rel="up" href="../performance_measurements.html" title="Performance Measurements">
<link rel="prev" href="../performance_measurements.html" title="Performance Measurements">
<link rel="next" href="numeric_performance/int_performance.html" title="Comparing the performance of a single int_ generator">

Home
Libraries
People
FAQ
More

Performance
        of Numeric Generators

Comparing
          the performance of a single int_ generator

Comparing
          the performance of a single double_ generator

Comparing
          the performance of a sequence of several generators

Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


text:
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
			  android:orientation="horizontal"
			  android:background="@color/form_cell_background"
			  android:padding="@dimen/cell_padding"
			  android:layout_width="match_parent"
			  android:layout_height="wrap_content">

	<CheckBox
			android:layout_width="fill_parent"
			android:layout_height="wrap_content"
			android:checked="false"
			android:id="@+id/checkBox"/>
</LinearLayout>


text:
using HttpConflictException = Saklient.Errors.HttpConflictException;

namespace Saklient.Cloud.Errors
{

	/// <summary>要求された操作を行えません。同一ゾーン内の他のリソースが既にこのリソースを使用中です。
	/// </summary>
	public class ResUsedInZoneException : HttpConflictException
	{

		/// <summary>
		/// <param name="status" />
		/// <param name="code" />
		/// <param name="message" />
		/// </summary>
		public ResUsedInZoneException(long status, string code=null, string message="") : base(status, code, message == null || message == "" ? "要求された操作を行えません。同一ゾーン内の他のリソースが既にこのリソースを使用中です。" : message)
		{
			/*!base!*/;
		}

	}

}


text:
@echo off
if not exist .instdist goto scons
rm -rf .instdist
:scons
scons UNICODE=yes NSIS_MAX_STRLEN=8196 NSIS_CONFIG_LOG=yes dist | tee mkru.out
if exist .instdist goto copyfiles
:copyfiles


text:
*> \brief  DSYEVD computes the eigenvalues and, optionally, the left and/or right eigenvectors for SY matrices
*
*  =========== DOCUMENTATION ===========
*
* Online html documentation available at
*            http://www.netlib.org/lapack/explore-html/
*
*> \htmlonly
*> Download DSYEVD + dependencies
*>
*> [TGZ]
*>
*> [ZIP]
*>
*> [TXT]
*> \endhtmlonly
*
*  Definition:
*  ===========
*
*       SUBROUTINE DSYEVD( JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, IWORK,
*                          LIWORK, INFO )
*
*       .. Scalar Arguments ..
*       CHARACTER          JOBZ, UPLO
*       INTEGER            INFO, LDA, LIWORK, LWORK, N
*       ..
*       .. Array Arguments ..
*       INTEGER            IWORK( * )
*       DOUBLE PRECISION   A( LDA, * ), W( * ), WORK( * )
*       ..
*
*
*> \par Purpose:
*  =============
*>
*> \verbatim
*>
*> DSYEVD computes all eigenvalues and, optionally, eigenvectors of a
*> real symmetric matrix A. If eigenvectors are desired, it uses a
*> divide and conquer algorithm.
*>
*> The divide and conquer algorithm makes very mild assumptions about
*> floating point arithmetic. It will work on machines with a guard
*> digit in add/subtract, or on those binary machines without guard
*> digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or
*> Cray-2. It could conceivably fail on hexadecimal or decimal machines
*> without guard digits, but we know of none.
*>
*> Because of large use of BLAS of level 3, DSYEVD needs N**2 more
*> workspace than DSYEVX.
*> \endverbatim
*
*  Arguments:
*  ==========
*
*> \param[in] JOBZ
*> \verbatim
*>          JOBZ is CHARACTER*1
*>          = 'N':  Compute eigenvalues only;
*>          = 'V':  Compute eigenvalues and eigenvectors.
*> \endverbatim
*>
*> \param[in] UPLO
*> \verbatim
*>          UPLO is CHARACTER*1
*>          = 'U':  Upper triangle of A is stored;
*>          = 'L':  Lower triangle of A is stored.
*> \endverbatim
*>
*> \param[in] N
*> \verbatim
*>          N is INTEGER
*>          The order of the matrix A.  N >= 0.
*> \endverbatim
*>
*> \param[in,out] A
*> \verbatim
*>          A is DOUBLE PRECISION array, dimension (LDA, N)
*>          On entry, the symmetric matrix A.  If UPLO = 'U', the
*>          leading N-by-N upper triangular part of A contains the
*>          upper triangular part of the matrix A.  If UPLO = 'L',
*>          the leading N-by-N lower triangular part of A contains
*>          the lower triangular part of the matrix A.
*>          On exit, if JOBZ = 'V', then if INFO = 0, A contains the
*>          orthonormal eigenvectors of the matrix A.
*>          If JOBZ = 'N', then on exit the lower triangle (if UPLO='L')
*>          or the upper triangle (if UPLO='U') of A, including the
*>          diagonal, is destroyed.
*> \endverbatim
*>
*> \param[in] LDA
*> \verbatim
*>          LDA is INTEGER
*>          The leading dimension of the array A.  LDA >= max(1,N).
*> \endverbatim
*>
*> \param[out] W
*> \verbatim
*>          W is DOUBLE PRECISION array, dimension (N)
*>          If INFO = 0, the eigenvalues in ascending order.
*> \endverbatim
*>
*> \param[out] WORK
*> \verbatim
*>          WORK is DOUBLE PRECISION array,
*>                                         dimension (LWORK)
*>          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
*> \endverbatim
*>
*> \param[in] LWORK
*> \verbatim
*>          LWORK is INTEGER
*>          The dimension of the array WORK.
*>          If N <= 1,               LWORK must be at least 1.
*>          If JOBZ = 'N' and N > 1, LWORK must be at least 2*N+1.
*>          If JOBZ = 'V' and N > 1, LWORK must be at least
*>                                                1 + 6*N + 2*N**2.
*>
*>          If LWORK = -1, then a workspace query is assumed; the routine
*>          only calculates the optimal sizes of the WORK and IWORK
*>          arrays, returns these values as the first entries of the WORK
*>          and IWORK arrays, and no error message related to LWORK or
*>          LIWORK is issued by XERBLA.
*> \endverbatim
*>
*> \param[out] IWORK
*> \verbatim
*>          IWORK is INTEGER array, dimension (MAX(1,LIWORK))
*>          On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK.
*> \endverbatim
*>
*> \param[in] LIWORK
*> \verbatim
*>          LIWORK is INTEGER
*>          The dimension of the array IWORK.
*>          If N <= 1,                LIWORK must be at least 1.
*>          If JOBZ  = 'N' and N > 1, LIWORK must be at least 1.
*>          If JOBZ  = 'V' and N > 1, LIWORK must be at least 3 + 5*N.
*>
*>          If LIWORK = -1, then a workspace query is assumed; the
*>          routine only calculates the optimal sizes of the WORK and
*>          IWORK arrays, returns these values as the first entries of
*>          the WORK and IWORK arrays, and no error message related to
*>          LWORK or LIWORK is issued by XERBLA.
*> \endverbatim
*>
*> \param[out] INFO
*> \verbatim
*>          INFO is INTEGER
*>          = 0:  successful exit
*>          < 0:  if INFO = -i, the i-th argument had an illegal value
*>          > 0:  if INFO = i and JOBZ = 'N', then the algorithm failed
*>                to converge; i off-diagonal elements of an intermediate
*>                tridiagonal form did not converge to zero;
*>                if INFO = i and JOBZ = 'V', then the algorithm failed
*>                to compute an eigenvalue while working on the submatrix
*>                lying in rows and columns INFO/(N+1) through
*>                mod(INFO,N+1).
*> \endverbatim
*
*  Authors:
*  ========
*
*> \author Univ. of Tennessee
*> \author Univ. of California Berkeley
*> \author Univ. of Colorado Denver
*> \author NAG Ltd.
*
*> \ingroup doubleSYeigen
*
*> \par Contributors:
*  ==================
*>
*> Jeff Rutter, Computer Science Division, University of California
*> at Berkeley, USA \n
*>  Modified by Francoise Tisseur, University of Tennessee \n
*>  Modified description of INFO. Sven, 16 Feb 05. \n

*>
*  =====================================================================
      SUBROUTINE DSYEVD( JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, IWORK,
     $                   LIWORK, INFO )
*
*  -- LAPACK driver routine --
*  -- LAPACK is a software package provided by Univ. of Tennessee,    --
*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
*
*     .. Scalar Arguments ..
      CHARACTER          JOBZ, UPLO
      INTEGER            INFO, LDA, LIWORK, LWORK, N
*     ..
*     .. Array Arguments ..
      INTEGER            IWORK( * )
      DOUBLE PRECISION   A( LDA, * ), W( * ), WORK( * )
*     ..
*
*  =====================================================================
*
*     .. Parameters ..
      DOUBLE PRECISION   ZERO, ONE
      PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
*     ..
*     .. Local Scalars ..
*
      LOGICAL            LOWER, LQUERY, WANTZ
      INTEGER            IINFO, INDE, INDTAU, INDWK2, INDWRK, ISCALE,
     $                   LIOPT, LIWMIN, LLWORK, LLWRK2, LOPT, LWMIN
      DOUBLE PRECISION   ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
     $                   SMLNUM
*     ..
*     .. External Functions ..
      LOGICAL            LSAME
      INTEGER            ILAENV
      DOUBLE PRECISION   DLAMCH, DLANSY
      EXTERNAL           LSAME, DLAMCH, DLANSY, ILAENV
*     ..
*     .. External Subroutines ..
      EXTERNAL           DLACPY, DLASCL, DORMTR, DSCAL, DSTEDC, DSTERF,
     $                   DSYTRD, XERBLA
*     ..
*     .. Intrinsic Functions ..
      INTRINSIC          MAX, SQRT
*     ..
*     .. Executable Statements ..
*
*     Test the input parameters.
*
      WANTZ = LSAME( JOBZ, 'V' )
      LOWER = LSAME( UPLO, 'L' )
      LQUERY = ( LWORK.EQ.-1 .OR. LIWORK.EQ.-1 )
*
      INFO = 0
      IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
         INFO = -1
      ELSE IF( .NOT.( LOWER .OR. LSAME( UPLO, 'U' ) ) ) THEN
         INFO = -2
      ELSE IF( N.LT.0 ) THEN
         INFO = -3
      ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
         INFO = -5
      END IF
*
      IF( INFO.EQ.0 ) THEN
         IF( N.LE.1 ) THEN
            LIWMIN = 1
            LWMIN = 1
            LOPT = LWMIN
            LIOPT = LIWMIN
         ELSE
            IF( WANTZ ) THEN
               LIWMIN = 3 + 5*N
               LWMIN = 1 + 6*N + 2*N**2
            ELSE
               LIWMIN = 1
               LWMIN = 2*N + 1
            END IF
            LOPT = MAX( LWMIN, 2*N +
     $                  N*ILAENV( 1, 'DSYTRD', UPLO, N, -1, -1, -1 ) )
            LIOPT = LIWMIN
         END IF
         WORK( 1 ) = LOPT
         IWORK( 1 ) = LIOPT
*
         IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN
            INFO = -8
         ELSE IF( LIWORK.LT.LIWMIN .AND. .NOT.LQUERY ) THEN
            INFO = -10
         END IF
      END IF
*
      IF( INFO.NE.0 ) THEN
         CALL XERBLA( 'DSYEVD', -INFO )
         RETURN
      ELSE IF( LQUERY ) THEN
         RETURN
      END IF
*
*     Quick return if possible
*
      IF( N.EQ.0 )
     $   RETURN
*
      IF( N.EQ.1 ) THEN
         W( 1 ) = A( 1, 1 )
         IF( WANTZ )
     $      A( 1, 1 ) = ONE
         RETURN
      END IF
*
*     Get machine constants.
*
      SAFMIN = DLAMCH( 'Safe minimum' )
      EPS = DLAMCH( 'Precision' )
      SMLNUM = SAFMIN / EPS
      BIGNUM = ONE / SMLNUM
      RMIN = SQRT( SMLNUM )
      RMAX = SQRT( BIGNUM )
*
*     Scale matrix to allowable range, if necessary.
*
      ANRM = DLANSY( 'M', UPLO, N, A, LDA, WORK )
      ISCALE = 0
      IF( ANRM.GT.ZERO .AND. ANRM.LT.RMIN ) THEN
         ISCALE = 1
         SIGMA = RMIN / ANRM
      ELSE IF( ANRM.GT.RMAX ) THEN
         ISCALE = 1
         SIGMA = RMAX / ANRM
      END IF
      IF( ISCALE.EQ.1 )
     $   CALL DLASCL( UPLO, 0, 0, ONE, SIGMA, N, N, A, LDA, INFO )
*
*     Call DSYTRD to reduce symmetric matrix to tridiagonal form.
*
      INDE = 1
      INDTAU = INDE + N
      INDWRK = INDTAU + N
      LLWORK = LWORK - INDWRK + 1
      INDWK2 = INDWRK + N*N
      LLWRK2 = LWORK - INDWK2 + 1
*
      CALL DSYTRD( UPLO, N, A, LDA, W, WORK( INDE ), WORK( INDTAU ),
     $             WORK( INDWRK ), LLWORK, IINFO )
*
*     For eigenvalues only, call DSTERF.  For eigenvectors, first call
*     DSTEDC to generate the eigenvector matrix, WORK(INDWRK), of the
*     tridiagonal matrix, then call DORMTR to multiply it by the
*     Householder transformations stored in A.
*
      IF( .NOT.WANTZ ) THEN
         CALL DSTERF( N, W, WORK( INDE ), INFO )
      ELSE
         CALL DSTEDC( 'I', N, W, WORK( INDE ), WORK( INDWRK ), N,
     $                WORK( INDWK2 ), LLWRK2, IWORK, LIWORK, INFO )
         CALL DORMTR( 'L', UPLO, 'N', N, N, A, LDA, WORK( INDTAU ),
     $                WORK( INDWRK ), N, WORK( INDWK2 ), LLWRK2, IINFO )
         CALL DLACPY( 'A', N, N, WORK( INDWRK ), N, A, LDA )
      END IF
*
*     If matrix was scaled, then rescale eigenvalues appropriately.
*
      IF( ISCALE.EQ.1 )
     $   CALL DSCAL( N, ONE / SIGMA, W, 1 )
*
      WORK( 1 ) = LOPT
      IWORK( 1 ) = LIOPT
*
      RETURN
*
*     End of DSYEVD
*
      END


text:
namespace System.Configuration
{
    internal class ConfigurationValue
    {
        internal PropertySourceInfo SourceInfo;
        internal object Value;

        internal ConfigurationValueFlags ValueFlags;

        internal ConfigurationValue(object value, ConfigurationValueFlags valueFlags, PropertySourceInfo sourceInfo)
        {
            Value = value;
            ValueFlags = valueFlags;
            SourceInfo = sourceInfo;
        }
    }
}