text:
package leitor.feed.rss.lpiii.model.helper;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author victor
 */
public class Util {

        public static String getFromURL(String URL) throws MalformedURLException, IOException {
                URL url = new URL(URL);

                HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                conn.addRequestProperty("User-Agent", "Mozilla/4.76");

                int code = conn.getResponseCode();

                //TODO Tratar erro para code != 200

                BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));

                StringBuilder sb = new StringBuilder();
                String line;
                while ((line = rd.readLine()) != null) {
                        sb.append(line);
                }

                rd.close();

                conn.disconnect();

                return sb.toString();
        }

        public static Date timestampToDate(String timestamp) {
                DateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz",
                        Locale.ENGLISH);
                Date date = null;

                try {
                        date = formatter.parse(timestamp);
                } catch (ParseException ex) {
                        Logger.getLogger(Util.class.getName()).log(Level.SEVERE, null, ex);
                }

                return date;
        }

}


text:
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;

public partial class PagedDataList_Default : Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int totalOrders = (int)SqlHelper.ExecuteScalar(CommandType.StoredProcedure, "P_GetOrderNumber");
            AspNetPager1.RecordCount = totalOrders;
            bindData();
        }
    }

    void bindData()
    {
        DataList1.DataSource = SqlHelper.ExecuteReader(CommandType.StoredProcedure,ConfigurationManager.AppSettings["pagedSPName"],
            new SqlParameter("@startIndex", AspNetPager1.StartRecordIndex),
            new SqlParameter("@endIndex", AspNetPager1.EndRecordIndex));
        DataList1.DataBind();
    }
    protected void AspNetPager1_PageChanged(object src, EventArgs e)
    {
        bindData();
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.sleepycat.je.txn;

import java.io.FileNotFoundException;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.EnvironmentFailureException;
import com.sleepycat.je.dbi.DatabaseId;
import com.sleepycat.je.dbi.DatabaseImpl;
import com.sleepycat.je.dbi.EnvironmentFailureReason;
import com.sleepycat.je.dbi.EnvironmentImpl;
import com.sleepycat.je.log.LogEntryType;
import com.sleepycat.je.log.LogManager;
import com.sleepycat.je.log.WholeEntry;
import com.sleepycat.je.log.entry.LNLogEntry;
import com.sleepycat.je.tree.Key;
import com.sleepycat.je.utilint.DbLsn;
import com.sleepycat.je.utilint.VLSN;

/**
 * TxnChain supports Txn.rollback(), which undoes the write operations for a
 * given transaction to an arbitrary point. This is used by HA during the
 * syncup phase, and by recovery when it is processes a RollbackStart/End.
 *
 * In the JE log, the log entries that make up a transaction are chained, but
 * each entry refers only to its pre-transaction value, and doesn't know its
 * intra-txn previous value. For example, a log looks like this:
 *
 * lsn       key              abortlsn
 * 100       A/node 10        null_lsn (first instance of a record)
 *  .....  txn begins .....
 * 200       A'/node10        100
 * 300       A'delete/node10  100
 * 400       A new/node77     100
 * 500       B/node80         null_lsn
 *
 * When reading the log, we can find all the records in the transaction. This
 * chain exists:
 * 500->400->300->200->null_lsn
 *
 * To rollback to an arbitrary entry in the transaction, we need a chain of all
 * the records that occupied a given BIN slot during the transaction.
 * chain. The key, data, and comparators are used to determine which records
 * hash to the same slot, mimicking the btree itself.
 *
 * 500 -> null_lsn (reverts to no-record)
 * 400 -> 300      (reverts to previous deleted record in that slot)
 * 300 -> 200      (reverts to A', intermediate version of the record)
 * 200 -> 100      (reverts to original, pre-txn version)
 */
public class TxnChain {
    private final Map<DatabaseId, DatabaseImpl> undoDatabases;
    private final EnvironmentImpl envImpl;

    /* Write locks that are retained, from the preserved portion of the txn.*/
    private final Set<Long> remainingLockedNodes;

    /* List of log entries to be rolled back, from end to beginning of txn. */
    private final LinkedList<RevertInfo> revertList;

    /* The last applied VLSN in this txn, after rollback has occurred. */
    private VLSN lastValidVLSN;

    /*
     * Find the previous version for all entries in this transaction. Used by
     * recovery. This differs from the constructor used by syncup rollback
     * which is instigated by the txn. In this case, there is no cache of
     * DatabaseImpls.
     */
    public TxnChain(long lastLoggedLsn,
                    long txnId,
                    long matchpoint,
                    EnvironmentImpl envImpl)  {
        this(lastLoggedLsn, txnId, matchpoint, null, envImpl);
    }

    /*
     * Find the previous version for all entries in this transaction.
     * DatabaseImpls used during txn chain creation are taken from the
     * transaction's undoDatabases cache.
     */
    public TxnChain(long lastLoggedLsn,
                    long txnId,
                    long matchpoint,
                    Map<DatabaseId, DatabaseImpl> undoDatabases,
                    EnvironmentImpl envImpl)
        throws DatabaseException {

        this.envImpl = envImpl;
        this.undoDatabases = undoDatabases;

        LogManager logManager = envImpl.getLogManager();
        remainingLockedNodes = new HashSet<Long>();

        /*
         * keyToLsns holds lists of all intermediate versions, organized by
         * slot value. Using the header example, keyToLsns would hold this:
         *
         * (B)   -> 500
         * (A/A')-> 400, 300, 200
         */
        TreeMap<CompareSlot, LinkedList<Long>> keyToLsns =
            new TreeMap<CompareSlot, LinkedList<Long>>();

        /* The chain list will have an entry per entry in the transaction.*/
        LinkedList<VersionCalculator> chain =
            new LinkedList<VersionCalculator>();

        /*
         * Traverse this transaction's entire chain to record intermediate
         * versions.  Using the example in the header, traverse from lsn
         * 500->lsn 100.
         */
        long undoLsn = lastLoggedLsn;
        try {
            lastValidVLSN = VLSN.NULL_VLSN;
            while (undoLsn != DbLsn.NULL_LSN) {
                WholeEntry wholeEntry =
                    logManager.getLogEntryAllowInvisible(undoLsn);
                LNLogEntry undoEntry = (LNLogEntry) wholeEntry.getEntry();

                boolean isDupCount =  undoEntry.getLogType().equals
                    (LogEntryType.LOG_DUPCOUNTLN_TRANSACTIONAL);
                DatabaseImpl dbImpl = getDatabaseImpl(undoEntry.getDbId());

                try {

                    /*
                     * Add the LSN of the entry we're now perusing to the
                     * keyToLsns map.
                     */
                    CompareSlot entrySlot =
                        new CompareSlot(dbImpl, undoEntry.getKey(),
                                        undoEntry.getDupKey(), isDupCount);
                    LinkedList<Long> lsns = keyToLsns.get(entrySlot);

                    if (lsns == null) {
                        lsns = new LinkedList<Long>();
                        keyToLsns.put(entrySlot, lsns);
                    }
                    lsns.add(undoLsn);

                    /*
                     * If this is an entry that will be rolled back, save
                     * enough information to calculate the prev version.
                     */
                    if (DbLsn.compareTo(undoLsn, matchpoint) > 0) {
                        chain.add(new VersionCalculator
                                  (undoLsn,
                                   undoEntry.getAbortLsn(),
                                   undoEntry.getAbortKnownDeleted(),
                                   lsns));
                    } else {
                        remainingLockedNodes.add(undoEntry.getLN().getNodeId());
                        if (lastValidVLSN != null &&
                            lastValidVLSN.isNull() &&
                            wholeEntry.getHeader().getVLSN() != null &&
                            !wholeEntry.getHeader().getVLSN().isNull()) {
                            lastValidVLSN = wholeEntry.getHeader().getVLSN();
                        }
                    }

                    /* Move on to the previous log entry for this txn. */
                    undoLsn = undoEntry.getUserTxn().getLastLsn();
                } finally {
                    releaseDatabaseImpl(dbImpl);
                }
            }
        } catch (FileNotFoundException e) {
            throw EnvironmentFailureException.promote
                (envImpl, EnvironmentFailureReason.LOG_INTEGRITY,
                 "Problem finding intermediates for txn " + txnId +
                 " at lsn " + DbLsn.getNoFormatString(undoLsn), e);
        }

        /*
         * For all the entries to be rolled back, calculate the previous
         * version.
         */
        revertList = new LinkedList<RevertInfo>();
        for (VersionCalculator calculator : chain) {
            revertList.add(calculator.findPreviousVersion());
        }
    }

    /**
     * Hide the details of whether we are getting a databaseImpl from the txn's
     * cache, or whether we're fetching it from the dbMapTree at recovery.
     */
    private DatabaseImpl getDatabaseImpl(DatabaseId dbId) {
        if (undoDatabases != null) {
            return undoDatabases.get(dbId);
        }

        return envImpl.getDbTree().getDb(dbId);
    }

    /** Only needed if we are in recovery, and fetched the DatabaseImpl. */
    private void releaseDatabaseImpl(DatabaseImpl dbImpl) {
        if (undoDatabases == null) {
            envImpl.getDbTree().releaseDb(dbImpl);
        }
    }

    public Set<Long> getRemainingLockedNodes() {
        return remainingLockedNodes;
    }

    /**
     * Return information about the next item on the transaction chain and
     * remove it from the chain.
     */
    public RevertInfo pop() {
        return revertList.remove();
    }

    public VLSN getLastValidVLSN() {
        return lastValidVLSN;
    }

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

    public static class RevertInfo {
        public long revertLsn;
        public boolean revertKnownDeleted;

        RevertInfo(long revertLsn,
                   boolean revertKnownDeleted) {
            this.revertLsn = revertLsn;
            this.revertKnownDeleted = revertKnownDeleted;
        }

        @Override
        public String toString() {
            return "revertLsn=" + DbLsn.getNoFormatString(revertLsn) +
                " revertKD=" + revertKnownDeleted;
        }
    }

    /**
     * Finds the lsn and known deleted value for the previous version of a
     * given LN log entry. That previous version is whatever occupied its slot
     * in the tree before, which might or might not have the same node id. If
     * there are multiple items in the list, each item reverts to its successor
     * on the list. If there is only one item, then the item needs to revert to
     * its pre-txn value. Using the example above:
     *
     * (B) -> 500
     * entry 500 is the only thing on its list, it reverts to the pre-txn
     * version.
     *
     * (A/A') -> 400, 300, 200
     * entry 400 reverts to 300, and pops itself off the list.
     * entry 300 reverts to 200, and pops itself off the list.
     * entry 200 is the last thing on its list, it reverts to the pre-txn
     * version.
     */
    private static  class VersionCalculator {
        final long entryLsn;
        final long entryAbortLsn;
        final boolean entryAbortKnownDeleted;
        final LinkedList<Long> lsns;

        VersionCalculator(long entryLsn,
                          long entryAbortLsn,
                          boolean entryAbortKnownDeleted,
                          LinkedList<Long> lsns) {
            this.entryLsn = entryLsn;
            this.entryAbortLsn = entryAbortLsn;
            this.entryAbortKnownDeleted = entryAbortKnownDeleted;
            this.lsns = lsns;
        }

        RevertInfo findPreviousVersion() {
            Long topVersion = lsns.remove();
            assert(entryLsn == topVersion) :
            "entryLsn= " + DbLsn.getNoFormatString(entryLsn) +
                "topLsn= " + DbLsn.getNoFormatString(topVersion);

            if (lsns.size() == 0) {
                return new RevertInfo(entryAbortLsn,
                                      entryAbortKnownDeleted);
            }

            /*
             * The previous version is an intermediate version created by the
             * same txn.
             */
            return new RevertInfo(lsns.getFirst(),
                                  false /* abortKnownDeleted */);

        }
    }

    /**
     * Compare two keys using the appropriate btree and duplicate tree
     * comparator. Keys from different databases should never be equal.
     */
    private static class CompareSlot implements Comparable<CompareSlot> {
        private final DatabaseImpl dbImpl;
        private final byte[] key;
        private final byte[] data;
        private final DatabaseId dbId;
        private final boolean isDupCount;

        CompareSlot(DatabaseImpl dbImpl,
                    byte[] key,
                    byte[] data,
                    boolean isDupCount) {
            this.dbImpl = dbImpl;
            this.key = key;
            this.data = data;
            this.isDupCount = isDupCount;
            this.dbId = dbImpl.getId();
        }

        public int compareTo(CompareSlot other) {
            int dbCompare = dbId.compareTo(other.dbId);
            if (dbCompare != 0) {
                /* LNs are from different databases. */
                return dbCompare;
            }

            int keyCompare = Key.compareKeys(key, other.key,
                                             dbImpl.getBtreeComparator());
            if (keyCompare == 0) {
                if (dbImpl.getSortedDuplicates()) {
                    /*
                     * The keys compared as equal, but perhaps this is a
                     * DupCountLN, in which case we compare the count, or a
                     * duplicate LN, in which case we compare the data.
                     */
                    if (isDupCount && other.isDupCount) {
                        return keyCompare;
                    }
                    return Key.compareKeys(data, other.data,
                                           dbImpl.getDuplicateComparator());
                }

                /* No extenuating circumstances, the keys are the same. */
                return 0;
            }

            /* Keys not the same, return the result of the comparison */
            return keyCompare;
        }
    }
}


text:
"""
Daily cleanup job.

Can be run as a cronjob to clean out old data from the database (only expired
sessions at the moment).
"""

from django_extensions.management.jobs import DailyJob

class Job(DailyJob):
    help = "Cache (db) cleanup Job"

    def execute(self):
	from django.conf import settings
	import os

	if settings.CACHE_BACKEND.startswith('db://'):
	    os.environ['TZ'] = settings.TIME_ZONE
	    table_name = settings.CACHE_BACKEND[5:]
	    cursor = connection.cursor()
	    cursor.execute("DELETE FROM %s WHERE %s < UTC_TIMESTAMP()" % \
		(backend.quote_name(table_name), backend.quote_name('expires')))
	    transaction.commit_unless_managed()


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://localhost:8888/" />
<title>AddRemoveSetStyleNamesTest</title>

AddRemoveSetStyleNamesTest

	open
	run/com.vaadin.tests.components.AddRemoveSetStyleNamesTest?restartApplication

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	style1

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]#popupButton

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	style1

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VButton[1]/domChild[0]/domChild[0]

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-style2

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	style2

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]#popupButton

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-style2

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	style2

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-style1

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-style2

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	style2

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]#popupButton

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-style1

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-style2

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	style2

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VButton[1]/domChild[0]/domChild[0]

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-style1

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	style1

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-style2

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	style2

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]#popupButton

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-style1

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	style1

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-style2

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	style2

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VButton[2]/domChild[0]/domChild[0]

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-style1

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	thestyle

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-thestyle

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]#popupButton

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-style1

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-thestyle

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	thestyle

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VButton[2]/domChild[0]/domChild[0]

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	thestyle

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-thestyle

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]#popupButton

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-thestyle

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	thestyle

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VButton[2]/domChild[0]/domChild[0]

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	thestyle

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-thestyle

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	style1

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]#popupButton

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-thestyle

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	thestyle

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-style1

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-thestyle

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	thestyle

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]#popupButton

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-style1

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-thestyle

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	thestyle

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VButton[0]/domChild[0]/domChild[0]

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VButton[2]/domChild[0]/domChild[0]

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	style1

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	v-datefield-thestyle

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]
	thestyle

	mouseClick
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]#popupButton

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-style1

	assertCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	style1

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	v-datefield-popup-thestyle

	assertNotCSSClass
	vaadin=runcomvaadintestscomponentsAddRemoveSetStyleNamesTest::Root/VOverlay[0]
	thestyle


text:
<?xml version='1.0' encoding='UTF-8'?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:intelxdk="http://xdk.intel.com/ns/v1" id="not.yet.specified" version="0.0.1" android-versionCode="1">
<!--This file is generated by the Intel XDK. Do not edit this file as your edits will be lost.           -->
<!--To change the contents of this file, see the documentation on the intelxdk.config.additions.xml file.-->
<intelxdk:version value="1.0"/>
<intelxdk:cordova-cli version="4.1.2"/>
<name>IndoorNavigation</name>
<content src="index.html"/>
<access origin="*"/>
<preference name="android-minSdkVersion" value="14"/>
<preference name="android-targetSdkVersion" value="19"/>
<preference name="android-installLocation" value="auto"/>
<intelxdk:crosswalk version="10"/>
<!--creationInfo:{"src":"","projectTypeName":"com.intel.xdk.projecttype.webapp"}--></widget>


text:
package edu.usu.sdl.openstorefront.core.view;

/**
 *
 * @author dshurtleff
 */
public class RelationshipView
{
	public static final String ATTRIBUTE_TYPE_RELATION = "ATTRIBUTE_TYPE";
	public static final String ATTRIBUTE_CODE_RELATION = "ATTRIBUTE_CODE";

	public static final String ENTITY_TYPE_COMPONENT = "component";
	public static final String ENTITY_TYPE_ATTRIBUTE = "attribute";
	public static final String ENTITY_TYPE_TAG = "tag";
	public static final String ENTITY_TYPE_ORGANIZATION = "organization";

	private String key;
	private String name;
	private String entityType;
	private String relationType;
	private String relationshipLabel;
	private String targetKey;
	private String targetName;
	private String targetEntityType;

	public RelationshipView()
	{
	}

	public String getKey()
	{
		return key;
	}

	public void setKey(String key)
	{
		this.key = key;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getRelationType()
	{
		return relationType;
	}

	public void setRelationType(String relationType)
	{
		this.relationType = relationType;
	}

	public String getTargetKey()
	{
		return targetKey;
	}

	public void setTargetKey(String targetKey)
	{
		this.targetKey = targetKey;
	}

	public String getTargetName()
	{
		return targetName;
	}

	public void setTargetName(String targetName)
	{
		this.targetName = targetName;
	}

	public String getEntityType()
	{
		return entityType;
	}

	public void setEntityType(String entityType)
	{
		this.entityType = entityType;
	}

	public String getTargetEntityType()
	{
		return targetEntityType;
	}

	public void setTargetEntityType(String targetEntityType)
	{
		this.targetEntityType = targetEntityType;
	}

	public String getRelationshipLabel()
	{
		return relationshipLabel;
	}

	public void setRelationshipLabel(String relationshipLabel)
	{
		this.relationshipLabel = relationshipLabel;
	}

}


text:
  <grr-rapid-hunt-status flow-name="createHuntArgs.value.flow_name.value"
                         flow-args="createHuntArgs.value.flow_args"
                         client-rate="createHuntArgs.value.hunt_runner_args.value.client_rate.value"
                         is-eligible="controller.isRapidHuntEligible">
  </grr-rapid-hunt-status>

  <grr-semantic-value value="createHuntArgs"></grr-semantic-value>


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_int64_t_loop_84_bad.cpp
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805.label.xml
Template File: sources-sink-84_bad.tmpl.cpp
*/
/*
 * @description
 * CWE: 122 Heap Based Buffer Overflow
 * BadSource:  Allocate using new[] and set data pointer to a small buffer
 * GoodSource: Allocate using new[] and set data pointer to a large buffer
 * Sinks: loop
 *    BadSink : Copy int64_t array to data using a loop
 * Flow Variant: 84 Data flow: data passed to class constructor and destructor by declaring the class object on the heap and deleting it after use
 *
 * */
#ifndef OMITBAD

#include "std_testcase.h"
#include "CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_int64_t_loop_84.h"

namespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_int64_t_loop_84
{
CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_int64_t_loop_84_bad::CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_int64_t_loop_84_bad(int64_t * dataCopy)
{
    data = dataCopy;
    /* FLAW: Allocate using new[] and point data to a small buffer that is smaller than the large buffer used in the sinks */
    data = new int64_t[50];
}

CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_int64_t_loop_84_bad::~CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_int64_t_loop_84_bad()
{
    {
        int64_t source[100] = {0}; /* fill with 0's */
        {
            size_t i;
            /* POTENTIAL FLAW: Possible buffer overflow if data < 100 */
            for (i = 0; i < 100; i++)
            {
                data[i] = source[i];
            }
            printLongLongLine(data[0]);
            delete [] data;
        }
    }
}
}
#endif /* OMITBAD */


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NFCoreEx
{
    public abstract class NFIKernel
    {
		public abstract bool AddHeartBeat(NFIDENTID self, string strHeartBeatName, NFIHeartBeat.HeartBeatEventHandler handler, float fTime, NFIDataList valueList);

        public abstract bool FindHeartBeat(NFIDENTID self, string strHeartBeatName);

        public abstract bool RemoveHeartBeat(NFIDENTID self, string strHeartBeatName);

        public abstract bool UpDate(float fTime);

		public abstract NFIDataList GetObjectList();

        /////////////////////////////////////////////////////////////
		public abstract void RegisterPropertyCallback(NFIDENTID self, string strPropertyName, NFIProperty.PropertyEventHandler handler);

        public abstract void RegisterRecordCallback(NFIDENTID self, string strRecordName, NFIRecord.RecordEventHandler handler);

        public abstract void RegisterClassCallBack(string strClassName, NFIObject.ClassEventHandler handler);

		public abstract void RegisterEventCallBack(NFIDENTID self, int nEventID, NFIEvent.EventHandler handler, NFIDataList valueList);
        /////////////////////////////////////////////////////////////////

        public abstract NFIObject GetObject(NFIDENTID ident);

        public abstract NFIObject CreateObject(NFIDENTID self, int nContainerID, int nGroupID, string strClassName, string strConfigIndex, NFIDataList arg);

        public abstract bool DestroyObject(NFIDENTID self);

        public abstract bool FindProperty(NFIDENTID self, string strPropertyName);

        public abstract bool SetPropertyInt(NFIDENTID self, string strPropertyName, Int64 nValue);
        public abstract bool SetPropertyFloat(NFIDENTID self, string strPropertyName, float fValue);
        public abstract bool SetPropertyDouble(NFIDENTID self, string strPropertyName, double dValue);
        public abstract bool SetPropertyString(NFIDENTID self, string strPropertyName, string strValue);
        public abstract bool SetPropertyObject(NFIDENTID self, string strPropertyName, NFIDENTID objectValue);

        public abstract Int64 QueryPropertyInt(NFIDENTID self, string strPropertyName);
        public abstract float QueryPropertyFloat(NFIDENTID self, string strPropertyName);
        public abstract double QueryPropertyDouble(NFIDENTID self, string strPropertyName);
        public abstract string QueryPropertyString(NFIDENTID self, string strPropertyName);
        public abstract NFIDENTID QueryPropertyObject(NFIDENTID self, string strPropertyName);

        public abstract NFIRecord FindRecord(NFIDENTID self, string strRecordName);

        public abstract bool SetRecordInt(NFIDENTID self, string strRecordName, int nRow, int nCol, Int64 nValue);
        public abstract bool SetRecordFloat(NFIDENTID self, string strRecordName, int nRow, int nCol, float fValue);
        public abstract bool SetRecordDouble(NFIDENTID self, string strRecordName, int nRow, int nCol, double dwValue);
        public abstract bool SetRecordString(NFIDENTID self, string strRecordName, int nRow, int nCol, string strValue);
        public abstract bool SetRecordObject(NFIDENTID self, string strRecordName, int nRow, int nCol, NFIDENTID objectValue);

        public abstract Int64 QueryRecordInt(NFIDENTID self, string strRecordName, int nRow, int nCol);
        public abstract float QueryRecordFloat(NFIDENTID self, string strRecordName, int nRow, int nCol);
        public abstract double QueryRecordDouble(NFIDENTID self, string strRecordName, int nRow, int nCol);
        public abstract string QueryRecordString(NFIDENTID self, string strRecordName, int nRow, int nCol);
        public abstract NFIDENTID QueryRecordObject(NFIDENTID self, string strRecordName, int nRow, int nCol);

        public abstract int FindRecordRow(NFIDENTID self, string strRecordName, int nCol, int nValue);
        public abstract int FindRecordRow(NFIDENTID self, string strRecordName, int nCol, float fValue);
        public abstract int FindRecordRow(NFIDENTID self, string strRecordName, int nCol, double fValue);
        public abstract int FindRecordRow(NFIDENTID self, string strRecordName, int nCol, string strValue);
        public abstract int FindRecordRow(NFIDENTID self, string strRecordName, int nCol, NFIDENTID nValue);

    }
}


text:
package com.twitter.finatra.http.tests.integration.doeverything.main.domain

import com.twitter.finatra.request.QueryParam

case class RequestWithQueryParamSeqString(
  @QueryParam foo: Seq[String])

case class ResponseOfQueryParamSeqString(
  foo: Seq[String])

case class RequestWithQueryParamSeqLong(
  @QueryParam foo: Seq[Long])

case class ResponseOfQueryParamSeqLong(
  foo: Seq[Long])

case class RequestWithIntQueryParams(
  @QueryParam param: Seq[Int])

case class RequestWithShortQueryParams(
  @QueryParam param: Seq[Int])

case class RequestWithBooleanQueryParams(
  @QueryParam param: Seq[Boolean])

case class RequestWithOptionBooleanQueryParam(
  @QueryParam param: Option[Boolean])

case class RequestWithBooleanQueryParam(
  @QueryParam param: Boolean)

case class RequestWithCaseClassQueryParams(
  @QueryParam param: Seq[AnotherCaseClass])

case class AnotherCaseClass(
  foo: String)


text:
package io.cattle.platform.object.meta.impl;

import io.cattle.platform.object.meta.MapRelationship;
import io.cattle.platform.object.meta.Relationship;

public class MapRelationshipImpl implements MapRelationship {

    String name;
    Class<?> mappingType;
    Class<?> objectType;
    Relationship selfRelationship;
    Relationship otherRelationship;

    public MapRelationshipImpl(String name, Class<?> mappingType, Class<?> objectType, Relationship selfRelationship, Relationship otherRelationship) {
        super();
        this.name = name;
        this.mappingType = mappingType;
        this.objectType = objectType;
        this.selfRelationship = selfRelationship;
        this.otherRelationship = otherRelationship;
    }

    @Override
    public boolean isListResult() {
        return true;
    }

    @Override
    public RelationshipType getRelationshipType() {
        return RelationshipType.MAP;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public String getPropertyName() {
        return selfRelationship.getPropertyName();
    }

    @Override
    public Class<?> getObjectType() {
        return objectType;
    }

    @Override
    public Class<?> getMappingType() {
        return mappingType;
    }

    @Override
    public Relationship getSelfRelationship() {
        return selfRelationship;
    }

    @Override
    public Relationship getOtherRelationship() {
        return otherRelationship;
    }

}


text:
package com.lenzhao.framework.protocol;

import io.protostuff.LinkedBuffer;
import io.protostuff.ProtobufIOUtil;
import io.protostuff.Schema;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import com.lenzhao.framework.util.SchemaCache;

/**
 *Protobuf序列化封装的辅助类
 */
public class ProtobufSerializer implements ISerializer{

	private static final ProtobufSerializer INSTANCE = new ProtobufSerializer();

	private ProtobufSerializer() {
	}

	public static ISerializer getInstance() {
		return INSTANCE;
	}

	protected <T> int writeObject(LinkedBuffer buffer, T object,
			Schema<T> schema) {
		return ProtobufIOUtil.writeTo(buffer, object, schema);
	}

	protected <T> void parseObject(byte[] bytes, T template, Schema<T> schema) {
		ProtobufIOUtil.mergeFrom(bytes, template, schema);
	}

	protected <T> void parseObject(InputStream in, T template, Schema<T> schema) {
		try {
			ProtobufIOUtil.mergeFrom(in, template, schema);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public RpcRequest decodeRequest(InputStream inputStream)
			throws IOException {
		return decode(inputStream, new RpcRequest());
	}

	public void encodeResponse(OutputStream outputStream, RpcResponse result)
			throws  IOException {
		encode(outputStream, result);
	}

	public RpcResponse decodeResponse(InputStream inputStream)
			throws  IOException {
		return decode(inputStream, new RpcResponse());
	}

	public void encodeRequest(OutputStream outputStream, RpcRequest request)
			throws  IOException {
		encode(outputStream, request);
	}

	/**
	 * 将对象序列化为二进制流
	 * @param out
	 * @param object
	 * @throws java.io.IOException
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	private <T> void encode(OutputStream out, T object) throws IOException {
		LinkedBuffer buffer = LinkedBuffer.allocate();
		Schema schema = null;
		if (null == object) {
			schema = SchemaCache.getSchema(Object.class);
		} else {
			schema = SchemaCache.getSchema(object.getClass());
		}
		int length = writeObject(buffer, object, schema);
//		IOUtils.writeInt(out, length);
		LinkedBuffer.writeTo(out, buffer);
	}

	/**
	 * 将二进制流解析为对象
	 * @param in
	 * @param template
	 * @return
	 * @throws java.io.IOException
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	private <T> T decode(InputStream in, T template) throws IOException {
		Schema schema = SchemaCache.getSchema(template.getClass());
//		int length = IOUtils.readInt(in);
//		byte[] bytes = new byte[length];
//		IOUtils.readFully(in, bytes, 0, length);
		parseObject(in, template, schema);
		return template;
	}
}


text:
package org.mockito.internal.stubbing.defaultanswers;

import org.junit.Test;
import org.mockito.exceptions.verification.SmartNullPointerException;
import org.mockito.stubbing.Answer;
import org.mockitoutil.TestBase;

public class ReturnsSmartNullsTest extends TestBase {

    @Test
    public void shouldReturnTheUsualDefaultValuesForPrimitives() throws Throwable {
        Answer<Object> answer = new ReturnsSmartNulls();
        assertEquals(false  ,   answer.answer(invocationOf(HasPrimitiveMethods.class, "booleanMethod")));
        assertEquals((char) 0,  answer.answer(invocationOf(HasPrimitiveMethods.class, "charMethod")));
        assertEquals(0,         answer.answer(invocationOf(HasPrimitiveMethods.class, "intMethod")));
        assertEquals(0,         answer.answer(invocationOf(HasPrimitiveMethods.class, "longMethod")));
        assertEquals(0,         answer.answer(invocationOf(HasPrimitiveMethods.class, "floatMethod")));
        assertEquals(0,         answer.answer(invocationOf(HasPrimitiveMethods.class, "doubleMethod")));
    }

    interface Foo {
        Foo get();
        Foo withArgs(String oneArg, String otherArg);
    }

    @Test
    public void shouldReturnAnObjectThatFailsOnAnyMethodInvocationForNonPrimitives() throws Throwable {
        Answer<Object> answer = new ReturnsSmartNulls();

        Foo smartNull = (Foo) answer.answer(invocationOf(Foo.class, "get"));

        try {
            smartNull.get();
            fail();
        } catch (SmartNullPointerException expected) {}
    }

    @Test
    public void shouldReturnAnObjectThatAllowsObjectMethods() throws Throwable {
        Answer<Object> answer = new ReturnsSmartNulls();

        Foo smartNull = (Foo) answer.answer(invocationOf(Foo.class, "get"));

        assertContains("SmartNull returned by", smartNull + "");
        assertContains("foo.get()", smartNull + "");
    }

    @Test
    public void shouldPrintTheParametersWhenCallingAMethodWithArgs() throws Throwable {
    	Answer<Object> answer = new ReturnsSmartNulls();

    	Foo smartNull = (Foo) answer.answer(invocationOf(Foo.class, "withArgs", "oompa", "lumpa"));

        assertContains("foo.withArgs", smartNull + "");
        assertContains("oompa", smartNull + "");
        assertContains("lumpa", smartNull + "");
    }

    @Test
	public void shouldPrintTheParametersOnSmartNullPointerExceptionMessage() throws Throwable {
    	Answer<Object> answer = new ReturnsSmartNulls();

        Foo smartNull = (Foo) answer.answer(invocationOf(Foo.class, "withArgs", "oompa", "lumpa"));

        try {
            smartNull.get();
            fail();
        } catch (SmartNullPointerException e) {
        	assertContains("oompa", e.getMessage());
        	assertContains("lumpa", e.getMessage());
        }
	}
}


text:
bootstrap-version
=========

## Some words at the beginning

I am learning Bootstrap these days and I am now trying to practice my Bootstrap skills
while improving my previous web project. Display of my previous work is too simple.

See code on my [GitHub][2]

## Pages that I've finished

* Home page
* Login Page
* Sign-up Page
* More in the future ...

## Some Screenshots

* Home Page

![test1](/bootstrap-version/images/home.png)

* Login

![test2](/bootstrap-version/images/loginB.png)

* Sign-up

![test3](/bootstrap-version/images/signupB.png)

## Ending

Keep learning Bootstrap ^_^

[startupjing]:    http://startupjing.github.io  "startupjing"

[2]: https://github.com/startupjing/employee-management


text:
package org.wildfly.camel.test.common.aws;

import org.junit.Assert;

import com.amazonaws.services.ec2.AmazonEC2Client;
import com.amazonaws.services.ec2.AmazonEC2ClientBuilder;
import com.amazonaws.services.ec2.model.Subnet;

public class EC2Utils {

    // Attach Policy: AmazonEC2FullAccess
    public static AmazonEC2Client createEC2Client() {
        BasicCredentialsProvider credentials = BasicCredentialsProvider.standard();
        AmazonEC2Client client = !credentials.isValid() ? null : (AmazonEC2Client)
                AmazonEC2ClientBuilder.standard()
                .withCredentials(credentials)
                .withRegion("eu-west-1")
                .build();
        return client;
    }

    public static String getSubnetId(AmazonEC2Client ec2Client) {
        Subnet subnet = null;
        for (Subnet aux : ec2Client.describeSubnets().getSubnets()) {
            System.out.println();
            if (aux.getState().equals("available") && aux.getAvailabilityZone().startsWith("eu-west-1")) {
                subnet = aux;
                break;
            }
        }
        Assert.assertNotNull("Subnet not null", subnet);
        return subnet.getSubnetId();
    }
}


text:
export function B() {}

export class Klass {
  static NUM: number = 4;
}
B();
let x = new Klass();
let y = Klass.NUM;
let z: Klass = x;


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

      <link rel="stylesheet" href="./../../helpwin.css">
      <title>MATLAB File Help: prtDataSetClass/getData</title>

            MATLAB File Help: prtDataSetClass/getData

prtDataSetClass/getData

  data = getData(dataSet)
   Return dataSet.data

Method Details

            Defining Class
            prtDataSetInMem

            Access
            public

            Sealed
            false

            Static
            false


text:
all: less trans

less: static/css/bootstrap.min.css static/css/material.min.css

static/css/bootstrap.min.css: static/bootstrap/*.less static/bootstrap/mixins/*.less
	lessc -x static/bootstrap/bootstrap.less > static/css/bootstrap.min.css

static/css/material.min.css: static/material/*.less
	lessc -x static/material/material.less > static/css/material.min.css

static/css/ripples.min.css: static/material/ripples.less
	lessc -x static/material/ripples.less > static/css/ripples.min.css

TRANS_TARGET=$(shell find -iname "messages.po")

trans: $(patsubst %/messages.po,%/messages.mo,$(TRANS_TARGET))

%/messages.mo: %/messages.po
	opencc -c opencc-t2s.json -i translations/zh_HK/LC_MESSAGES/messages.po -o translations/zh_CN/LC_MESSAGES/messages.po
	pybabel compile --directory translations/ --domain messages

%/messages.po: messages.pot
	pybabel update --input-file messages.pot --output-dir translations/ --domain messages

messages.pot: templates/*.html templates/includes/*.html babel.cfg
	pybabel extract --mapping babel.cfg --output messages.pot ./

.PHONY: less all trans


text:
//
//  NSData+Addition.h
//  FWFoundation
//
//  Created by kazuya kawaguchi on 2011-05-29
//  Copyright 2011 kazuya kawaguchi & frapwings All rights reserved.
//

#import <Foundation/Foundation.h>

/*!
 * @category NSData(Addition)
 * @abstract
 *  This category is extended the NSData.
 * @discussion
 *  TODO: write description ...
 *
 * @availability
 *  FWFoundatoin 0.1
 */
@interface NSData (Addition)

/*!
 * @method md5Hash
 * @abstract
 *  Calculate the md5 hash of this data using CC_MD5.
 * @discussion
 *  TODO: write description ...
 *
 * @result An encryped string by md5.
 * @availability
 *  FWFoundatoin 0.1
 */
- (NSString *)md5Hash;

/*!
 * @method sha1Hash
 * @abstract
 *  Calculate the md5 hash of this data using CC_SHA1.
 * @discussion
 *  TODO: write description ...
 *
 * @result An encryped string by sha1.
 * @availability
 *  FWFoundatoin 0.1
 */
- (NSString *)sha1Hash;

@end


text:
<?php

namespace Mascame\Artificer\Middleware;

use Closure;

class JavaScriptMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        \Blade::directive('phpToJS', function () {
            return "<?php echo \Mascame\Artificer\Support\JavaScript::transform(); ?>";
        });

        return $next($request);
    }
}


text:
#include <allegro.h>
#include <stdio.h>
#include "../agup/agup.h"
#include "../main.h"	//For declaration of eof_click_changes_dialog_focus
#include "proc.h"

#ifdef USEMEMWATCH
#include "../memwatch.h"
#endif

#define EOF_MSG_BUTTONFOCUS D_USER
//Allegro's GUI system reserves bit flags 0 through 6 for its own use, the others are available for
//program use.  Define a bitflag for use to filter dialog focus changing events that use the mouse
//click from those that don't

int eof_verified_edit_proc(int msg, DIALOG *d, int c)
{
	int i;
	char * string = NULL;
	int key_list[32] = {KEY_BACKSPACE, KEY_DEL, KEY_LEFT, KEY_RIGHT, KEY_UP, KEY_DOWN, KEY_ESC, KEY_ENTER};
	int match = 0;
	unsigned c2 = (unsigned)c;	//Force cast this to unsigned because Splint is incapable of avoiding a false positive detecting it as negative despite assertions proving otherwise

	if(msg == MSG_CHAR)
	{
		for(i = 0; i < 8; i++)
		{	//Check each of the pre-defined allowable keys
			if(c2 >> 8 == key_list[i])			//If the input is permanently allowed
			{
				return d_agup_edit_proc(msg, d, c2);	//Immediately allow the input character to be returned
			}
		}

		/* see if key is an allowed key */
		string = (char *)(d->dp2);
		if(string == NULL)	//If the accepted characters list is NULL for some reason
			match = 1;	//Implicitly accept the input character instead of allowing a crash
		else
		{
			for(i = 0; string[i] != '\0'; i++)	//Search all characters of the accepted characters list
			{
				if(string[i] == (c & 0xff))
				{
					match = 1;
					break;
				}
			}
		}

		if(!match)			//If there was no match
			return D_USED_CHAR;	//Drop the character
	}
	if(msg == MSG_WANTFOCUS)
	{	//If this field wants focus
		if(!eof_click_changes_dialog_focus)
		{	//If the user preference to require a mouse click to change field focus is not enabled
			return d_agup_edit_proc(msg,d,c);	//Allow the dialog system to carry out normal logic
		}
		if(d->flags & EOF_MSG_BUTTONFOCUS)
		{	//If a custom button focus flag was set by the click event
			d->flags &= ~EOF_MSG_BUTTONFOCUS;	//Clear it
			return D_WANTFOCUS;	//And have the dialog system switch input focus
		}
		return D_O_K;	//Otherwise deny it, because simply mousing over it can cause this message
	}
	if(msg == MSG_CLICK)
	{	//If this field is explicitly clicked on
		d->flags |= EOF_MSG_BUTTONFOCUS;	//Set this custom flag to indicate a mouse click initiated the WANTFOCUS message
		return d_agup_edit_proc(msg,d,c);	//Allow the dialog system to carry out the click processing
	}

	return d_agup_edit_proc(msg, d, c);	//Allow the input character to be returned
}


text:
package com.malalaoshi.android.common.pay.api;

import com.malalaoshi.android.core.network.api.BaseApi;
import com.malalaoshi.android.entity.OrderStatusModel;

/**
 * 请求订单状态
 * Created by tianwei on 4/17/16.
 */
public class OrderStatusApi extends BaseApi {

    private static final String URL_ORDER_STATUS = "/api/v1/orders/%s";

    @Override
    protected String getPath() {
        return URL_ORDER_STATUS;
    }

    public OrderStatusModel getOrderStatus(String orderId) throws Exception {
        String url = String.format(getPath(), orderId);
        return httpGet(url, OrderStatusModel.class);
    }

}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using MoonSharp.Interpreter.Debugging;

namespace MoonSharp.Interpreter.Execution.VM
{
    internal class Instruction
    {
        internal string Name;
        internal int NumVal;
        internal int NumVal2;
        internal OpCode OpCode;
        internal SourceRef SourceCodeRef;
        internal SymbolRef Symbol;
        internal SymbolRef[] SymbolList;
        internal DynValue Value;

        internal Instruction(SourceRef sourceref)
        {
            SourceCodeRef = sourceref;
        }

        public override string ToString()
        {
            var append = OpCode.ToString().ToUpperInvariant();

            var usage = (int) OpCode.GetFieldUsage();

            if (usage != 0)
                append += GenSpaces();

            if ((OpCode == OpCode.FuncMeta) ||
                ((usage & ((int) InstructionFieldUsage.NumValAsCodeAddress)) ==
                 (int) InstructionFieldUsage.NumValAsCodeAddress))
                append += " " + NumVal.ToString("X8");
            else if ((usage & ((int) InstructionFieldUsage.NumVal)) != 0)
                append += " " + NumVal;

            if ((usage & ((int) InstructionFieldUsage.NumVal2)) != 0)
                append += " " + NumVal2;

            if ((usage & ((int) InstructionFieldUsage.Name)) != 0)
                append += " " + Name;

            if ((usage & ((int) InstructionFieldUsage.Value)) != 0)
                append += " " + PurifyFromNewLines(Value);

            if ((usage & ((int) InstructionFieldUsage.Symbol)) != 0)
                append += " " + Symbol;

            if (((usage & ((int) InstructionFieldUsage.SymbolList)) != 0) && (SymbolList != null))
                append += " " + string.Join(",", SymbolList.Select(s => s.ToString()).ToArray());

            return append;
        }

        private string PurifyFromNewLines(DynValue Value)
        {
            if (Value == null)
                return "";

            return Value.ToString().Replace('\n', ' ').Replace('\r', ' ');
        }

        private string GenSpaces()
        {
            return new string(' ', 10 - OpCode.ToString().Length);
        }

        internal void WriteBinary(BinaryWriter wr, int baseAddress, Dictionary<SymbolRef, int> symbolMap)
        {
            wr.Write((byte) OpCode);

            var usage = (int) OpCode.GetFieldUsage();

            if ((usage & ((int) InstructionFieldUsage.NumValAsCodeAddress)) ==
                (int) InstructionFieldUsage.NumValAsCodeAddress)
                wr.Write(NumVal - baseAddress);
            else if ((usage & ((int) InstructionFieldUsage.NumVal)) != 0)
                wr.Write(NumVal);

            if ((usage & ((int) InstructionFieldUsage.NumVal2)) != 0)
                wr.Write(NumVal2);

            if ((usage & ((int) InstructionFieldUsage.Name)) != 0)
                wr.Write(Name ?? "");

            if ((usage & ((int) InstructionFieldUsage.Value)) != 0)
                DumpValue(wr, Value);

            if ((usage & ((int) InstructionFieldUsage.Symbol)) != 0)
                WriteSymbol(wr, Symbol, symbolMap);

            if ((usage & ((int) InstructionFieldUsage.SymbolList)) != 0)
            {
                wr.Write(SymbolList.Length);
                for (var i = 0; i < SymbolList.Length; i++)
                    WriteSymbol(wr, SymbolList[i], symbolMap);
            }
        }

        private static void WriteSymbol(BinaryWriter wr, SymbolRef symbolRef, Dictionary<SymbolRef, int> symbolMap)
        {
            var id = (symbolRef == null) ? -1 : symbolMap[symbolRef];
            wr.Write(id);
        }

        private static SymbolRef ReadSymbol(BinaryReader rd, SymbolRef[] deserializedSymbols)
        {
            var id = rd.ReadInt32();

            if (id < 0) return null;
            return deserializedSymbols[id];
        }

        internal static Instruction ReadBinary(SourceRef chunkRef, BinaryReader rd, int baseAddress, Table envTable,
            SymbolRef[] deserializedSymbols)
        {
            var that = new Instruction(chunkRef);

            that.OpCode = (OpCode) rd.ReadByte();

            var usage = (int) that.OpCode.GetFieldUsage();

            if ((usage & ((int) InstructionFieldUsage.NumValAsCodeAddress)) ==
                (int) InstructionFieldUsage.NumValAsCodeAddress)
                that.NumVal = rd.ReadInt32() + baseAddress;
            else if ((usage & ((int) InstructionFieldUsage.NumVal)) != 0)
                that.NumVal = rd.ReadInt32();

            if ((usage & ((int) InstructionFieldUsage.NumVal2)) != 0)
                that.NumVal2 = rd.ReadInt32();

            if ((usage & ((int) InstructionFieldUsage.Name)) != 0)
                that.Name = rd.ReadString();

            if ((usage & ((int) InstructionFieldUsage.Value)) != 0)
                that.Value = ReadValue(rd, envTable);

            if ((usage & ((int) InstructionFieldUsage.Symbol)) != 0)
                that.Symbol = ReadSymbol(rd, deserializedSymbols);

            if ((usage & ((int) InstructionFieldUsage.SymbolList)) != 0)
            {
                var len = rd.ReadInt32();
                that.SymbolList = new SymbolRef[len];

                for (var i = 0; i < that.SymbolList.Length; i++)
                    that.SymbolList[i] = ReadSymbol(rd, deserializedSymbols);
            }

            return that;
        }

        private static DynValue ReadValue(BinaryReader rd, Table envTable)
        {
            var isnull = !rd.ReadBoolean();

            if (isnull) return null;

            var dt = (DataType) rd.ReadByte();

            switch (dt)
            {
                case DataType.Nil:
                    return DynValue.NewNil();
                case DataType.Void:
                    return DynValue.Void;
                case DataType.Boolean:
                    return DynValue.NewBoolean(rd.ReadBoolean());
                case DataType.Number:
                    return DynValue.NewNumber(rd.ReadDouble());
                case DataType.String:
                    return DynValue.NewString(rd.ReadString());
                case DataType.Table:
                    return DynValue.NewTable(envTable);
                default:
                    throw new NotSupportedException(string.Format("Unsupported type in chunk dump : {0}", dt));
            }
        }

        private void DumpValue(BinaryWriter wr, DynValue value)
        {
            if (value == null)
            {
                wr.Write(false);
                return;
            }

            wr.Write(true);
            wr.Write((byte) value.Type);

            switch (value.Type)
            {
                case DataType.Nil:
                case DataType.Void:
                case DataType.Table:
                    break;
                case DataType.Boolean:
                    wr.Write(value.Boolean);
                    break;
                case DataType.Number:
                    wr.Write(value.Number);
                    break;
                case DataType.String:
                    wr.Write(value.String);
                    break;
                default:
                    throw new NotSupportedException(string.Format("Unsupported type in chunk dump : {0}", value.Type));
            }
        }

        internal void GetSymbolReferences(out SymbolRef[] symbolList, out SymbolRef symbol)
        {
            var usage = (int) OpCode.GetFieldUsage();

            symbol = null;
            symbolList = null;

            if ((usage & ((int) InstructionFieldUsage.Symbol)) != 0)
                symbol = Symbol;

            if ((usage & ((int) InstructionFieldUsage.SymbolList)) != 0)
                symbolList = SymbolList;
        }
    }
}


text:
package eu.broth.intellilab.ui;

import com.intellij.ui.table.JBTable;
import eu.broth.intellilab.model.GitlabClient;
import eu.broth.intellilab.model.GitlabIssue;

import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import java.util.Collections;
import java.util.List;

/**
 * @author Bastian Roth
 * @version 08.04.2014
 */
public class IssuesTable extends JBTable {

	private GitlabClient client;

	private IssuesTableModel model;

	public IssuesTable() {
		setDefaultRenderer(GitlabIssue.class, new IssueRenderer());
	}

	public void setClient(GitlabClient client) {
		this.client = client;
	}

	public void setIssues(List<GitlabIssue> issues) {
		if (model == null) {
			model = new IssuesTableModel();
			setModel(model);

			TableColumnModel columnModel = getColumnModel();
			columnModel.getColumn(0).setMaxWidth(80);
			columnModel.getColumn(1).setPreferredWidth(350);
			columnModel.getColumn(2).setPreferredWidth(150);
			columnModel.getColumn(3).setPreferredWidth(80);
			columnModel.getColumn(4).setPreferredWidth(80);

			TableColumn stateColumn = columnModel.getColumn(5);
			stateColumn.setCellEditor(new IssueStateEditor());
			stateColumn.setMinWidth(80);
			stateColumn.setMaxWidth(80);
		} else {
			model.setIssues(issues);
		}
	}

	private class IssuesTableModel extends AbstractTableModel {

		final String[] COLS = new String[]{"ID", "Summary", "Labels", "Assigned to", "Created by", ""};

		private List<GitlabIssue> issues;

		public IssuesTableModel() {
			this.issues = Collections.emptyList();
		}

		public void setIssues(List<GitlabIssue> issues) {
			if (issues == null)
				this.issues = Collections.emptyList();
			else
				this.issues = issues;
			fireTableDataChanged();
		}

		@Override
		public int getRowCount() {
			return issues.size();
		}

		@Override
		public int getColumnCount() {
			return COLS.length;
		}

		@Override
		public String getColumnName(int column) {
			return COLS[column];
		}

		@Override
		public Object getValueAt(int rowIndex, int columnIndex) {
			return issues.get(rowIndex);
		}

		@Override
		public Class<?> getColumnClass(int columnIndex) {
			return GitlabIssue.class;
		}

		@Override
		public boolean isCellEditable(int rowIndex, int columnIndex) {
			return columnIndex == 5;
		}

		@Override
		public void setValueAt(Object value, int rowIndex, int columnIndex) {
			if (value instanceof GitlabIssue.Transition) {
				GitlabIssue.Transition transition = (GitlabIssue.Transition) value;
				GitlabIssue issue = issues.get(rowIndex);
				client.performIssueTransition(issue, transition);
			}
		}
	}

}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="16dp"
    android:gravity="center"
    >
    <TextView
        android:id="@+id/album_pic"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:drawableTop="@mipmap/bg_get_pic_big"
        android:drawablePadding="12dp"
        android:text="相册选取"
        android:padding="32dp"
        android:gravity="center"
        android:background="#FFFFFF"
        android:textSize="18sp"
        android:textColor="#666666"
        />
	<TextView
        android:id="@+id/camera_pic"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:drawableTop="@mipmap/bg_take_pic_big"
        android:drawablePadding="12dp"
        android:text="相机拍照"
        android:padding="32dp"
        android:gravity="center"
        android:background="#FFFFFF"
        android:textSize="18sp"
        android:textColor="#666666"
        />
</LinearLayout>


text:
using Starcounter;

namespace Products
{
    partial class MasterPage : Json
    {
    }
}


text:
title: "Week 6: Responsive Markup and Images"
date: 2018-10-01 12:00:00
description: "HTML 5 Markup, Web fonts, flexible images, responsive design using media queries, work on Fonts & Media Queries assignment"
assignment: Fonts and Media Queries
reading:

In Class - Finishing Understanding the CSS Box Model (Part 2)
Responsive Web Design - Ch. 1 Our Responsive Web, Ch. 2 The Flexible Grid, Ch. 3 Flexible Images, Ch. 4 Media Queries

due: CSS Basics 2
part: "1"
layout: wide
current: no
semester: fall-2018
slides: "/class/slides/6/6-Slides-RWD.pdf"
status: blog-post-date--past

---

## Outline

* CSS Introduction
* Mobile First
* Discuss: [Obtaining Client Feedback Without Mockups by Matt Griffin](http://alistapart.com/article/responsive-comping-obtaining-signoff-with-mockups)
* Style Tiles
* Hands On - Sketch
* Discuss CSS Basics Assignment - In Class Work on Assignment


text:
import os
import sys
import subprocess

#
# Assume that this is run from the SOS directory
#
def set_environment(home = "/home/test"):
    os.environ['SOSROOT'] = home + "/sos-2x/trunk"  # this path might need to be modified on a user basis
    os.environ['SOSTOOLDIR'] = home + "/local"      # as might this path
    os.environ['SOSMSPTOOLDIR'] = os.environ['SOSTOOLDIR']
    os.environ['PATH'] = home + os.environ['SOSTOOLDIR'] + "/bin:" + os.environ['PATH']
    os.chdir(os.environ['SOSROOT'])

#
# Helper function to log the output of a make
#
def build_and_log(dir, command="", out="/dev/null", err="/dev/null"):
    out_f = open(out, "w")
    err_f = open(err, "w")
    cmd_make = ["make", "-C", dir, command]
    print cmd_make
    subprocess.call(cmd_make, stdout=out_f, stderr=err_f)

#
# Helper function to clean up the source tree
#
def clean(dir):
    cmd_clean = ["make", "-C", "clean", dir]
    null = open("/dev/null", "w")
    print cmd_clean
    subprocess.call(cmd_clean, stdout=null, stderr=null)

#
# Find all modules in the 'base_dir' subtree.
#
# This function assumes that any directory located under base_dir containing a
# Makefile is a valid module build location.  Output from the build is stored
# into a file named based on the directory containing the Makefile (so modules
# with in directories the same end name may become hidden).
#
def find_modules(base_dir):

    module_dirs = []

    # Find the candidate module locations
    for root, dirs, files in os.walk(base_dir):
        if 'Makefile' in files:
            module_dirs.append(root)

    return module_dirs

#
# Build modules
#
def build_modules(target, module_dirs):

    # Build the candidate modules
    for module_dir in module_dirs:

        module_name = os.path.basename(module_dir)
        stdout = module_name + ".good.tmp"
        stderr = module_name + ".bad.tmp"
        clean(module_dir)
        build_and_log(module_dir, target, stdout, stderr)
        clean(module_dir)

#
# Builds specific tools used by SOS.  Currently builds:
#   sos_server
#   sos_tool
#
def build_tools():

    # Build sos_server
    path = "tools/sos_server/bin"
    command = "x86"
    stdout = "sos_server.good.tmp"
    stderr = "sos_server.bad.tmp"
    clean(path)
    build_and_log(path, command, stdout, stderr)
    clean(path)

    # Build sos_tool
    path = "tools/sos_tool"
    command = "emu"
    stdout = "sos_tool.good.tmp"
    stderr = "sos_tool.bad.tmp"
    clean(path)
    build_and_log(path, command, stdout, stderr)
    clean(path)

#
# Build SOS kernels that are commonly deployed on embedded nodes.  Currently
# builds:
#   blank
#
def build_embedded(target):

    # Build base
    path = "config/blank"
    command = target
    stdout = target + ".good.tmp"
    stderr = target + ".bad.tmp"
    clean(path)
    build_and_log(path, command, stdout, stderr)
    clean(path)

#
# Function to ignore bogus errors in the build logs.  Returns true if the line
# can be safely ignored.
#
def ignore_line(line, whitelist):

    # Check if the line can be ignored
    for ignore in whitelist:
        if ignore in line:
            return True

    # Note that the line can not be ignored
    return False

#
# Combine related log files into a single large log file.  Empty files are
# ignored.
#
def combine_files(dir, pattern, out_file, file_title=""):
    import fnmatch

    # Error messages that we know are okay
    whitelist = ['dos2unix', 'make: Entering directory', 'avr-gcc -E', \
            'cilly.asm.exe --', 'make: Leaving directory']

    out = open(out_file, 'w')
    files = []

    # Make list of files
    for file in os.listdir(dir):
        if fnmatch.fnmatch(file, pattern):
            files.append(os.path.join(dir, file))

    # Concatenate files
    for file in files:

        # Read file into a buffer and then to file if buffer is not empty
        buff = []
        tmp_file = open(file)

        for line in tmp_file:
            if(ignore_line(line, whitelist) or line == '\n'):
                continue
            else:
                buff.append(line)

        if len(buff) > 0:
            out.write(file.split('.')[1][1:] + ": " + file_title + '\n')
            for line in buff:
                out.write(line)
            out.write('\n')

    out.close()

#
# Example usage
#
if __name__ == '__main__':

    #
    # Set environment for testing
    #
    set_environment(sys.argv[1])

    #
    # Find modules that we are interested in
    #
    module_dirs = find_modules("modules")

    #
    # Filter the modules we want to test
    #
    skip_list = [\
            'module_template',\
            'VM',\
            'vire',\
            ];

    modules = []
    for module_dir in module_dirs:
        if not ignore_line(module_dir, skip_list):
            modules.append(module_dir)
        else:
            print "Ignoring module located in: " + module_dir

    build_tools()
    build_embedded('mica2')
    build_embedded('micaz')
    build_embedded('sim')
    build_modules('mica2', modules)

    # Generate diagnostic files
    combine_files('.', '*.bad.tmp', 'build_fail.txt', 'Build Errors')

    # Send diagnostics to stdout
    error = open('build_fail.txt', 'r')
    print("SOS BUILD STATUS:\n")
    for line in error:
        print line,
    error.close()

    # Clean up the mess
    for word in os.listdir("."):
        if word.endswith("bad.tmp") \
                or word.endswith("good.tmp") \
                or word.endswith("check.tmp"):
            subprocess.call(["rm", word])


text:
package org.apache.solr.cloud.api.collections;

import static org.apache.solr.common.cloud.DocCollection.CollectionStateProps.DOC_ROUTER;
import static org.apache.solr.common.cloud.ZkStateReader.REPLICATION_FACTOR;
import static org.apache.solr.common.params.ShardParams._ROUTE_;

import java.util.Map;
import org.apache.lucene.tests.util.TestUtil;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.cloud.SolrCloudTestCase;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.common.cloud.Replica;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

/** Tests the Custom Sharding API. */
public class CustomCollectionTest extends SolrCloudTestCase {

  private static final int NODE_COUNT = 4;

  @BeforeClass
  public static void setupCluster() throws Exception {
    configureCluster(NODE_COUNT).addConfig("conf", configset("cloud-dynamic")).configure();
  }

  @Before
  public void ensureClusterEmpty() throws Exception {
    cluster.deleteAllCollections();
  }

  @Test
  // 12-Jun-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 21-May-2018
  public void testCustomCollectionsAPI() throws Exception {

    final String collection = "implicitcoll";
    int replicationFactor = TestUtil.nextInt(random(), 0, 3) + 2;

    CollectionAdminRequest.createCollectionWithImplicitRouter(
            collection, "conf", "a,b,c", replicationFactor)
        .process(cluster.getSolrClient());

    DocCollection coll = getCollectionState(collection);
    assertEquals("implicit", ((Map) coll.get(DOC_ROUTER)).get("name"));
    assertNotNull(coll.getStr(REPLICATION_FACTOR));
    assertNull(
        "A shard of a Collection configured with implicit router must have null range",
        coll.getSlice("a").getRange());

    new UpdateRequest()
        .add("id", "6")
        .add("id", "7")
        .add("id", "8")
        .withRoute("a")
        .commit(cluster.getSolrClient(), collection);

    assertEquals(
        3,
        cluster.getSolrClient().query(collection, new SolrQuery("*:*")).getResults().getNumFound());
    assertEquals(
        0,
        cluster
            .getSolrClient()
            .query(collection, new SolrQuery("*:*").setParam(_ROUTE_, "b"))
            .getResults()
            .getNumFound());
    assertEquals(
        3,
        cluster
            .getSolrClient()
            .query(collection, new SolrQuery("*:*").setParam(_ROUTE_, "a"))
            .getResults()
            .getNumFound());

    cluster.getSolrClient().deleteByQuery(collection, "*:*");
    cluster.getSolrClient().commit(collection, true, true);
    assertEquals(
        0,
        cluster.getSolrClient().query(collection, new SolrQuery("*:*")).getResults().getNumFound());

    new UpdateRequest()
        .add("id", "9")
        .add("id", "10")
        .add("id", "11")
        .withRoute("c")
        .commit(cluster.getSolrClient(), collection);

    assertEquals(
        3,
        cluster.getSolrClient().query(collection, new SolrQuery("*:*")).getResults().getNumFound());
    assertEquals(
        0,
        cluster
            .getSolrClient()
            .query(collection, new SolrQuery("*:*").setParam(_ROUTE_, "a"))
            .getResults()
            .getNumFound());
    assertEquals(
        3,
        cluster
            .getSolrClient()
            .query(collection, new SolrQuery("*:*").setParam(_ROUTE_, "c"))
            .getResults()
            .getNumFound());

    // Testing CREATESHARD
    CollectionAdminRequest.createShard(collection, "x").process(cluster.getSolrClient());
    waitForState(
        "Expected shard 'x' to be active",
        collection,
        (n, c) -> {
          if (c.getSlice("x") == null) return false;
          for (Replica r : c.getSlice("x")) {
            if (r.getState() != Replica.State.ACTIVE) return false;
          }
          return true;
        });

    new UpdateRequest().add("id", "66", _ROUTE_, "x").commit(cluster.getSolrClient(), collection);
    // TODO - the local state is cached and causes the request to fail with 'unknown shard'
    // assertEquals(1, cluster.getSolrClient().query(collection, new
    // SolrQuery("*:*").setParam(_ROUTE_, "x")).getResults().getNumFound());

  }

  @Test
  public void testRouteFieldForImplicitRouter() throws Exception {

    int replicationFactor = TestUtil.nextInt(random(), 0, 3) + 2;
    String shard_fld = "shard_s";

    final String collection = "withShardField";

    CollectionAdminRequest.createCollectionWithImplicitRouter(
            collection, "conf", "a,b,c,d", replicationFactor)
        .setRouterField(shard_fld)
        .process(cluster.getSolrClient());

    new UpdateRequest()
        .add("id", "6", shard_fld, "a")
        .add("id", "7", shard_fld, "a")
        .add("id", "8", shard_fld, "b")
        .commit(cluster.getSolrClient(), collection);

    assertEquals(
        3,
        cluster.getSolrClient().query(collection, new SolrQuery("*:*")).getResults().getNumFound());
    assertEquals(
        1,
        cluster
            .getSolrClient()
            .query(collection, new SolrQuery("*:*").setParam(_ROUTE_, "b"))
            .getResults()
            .getNumFound());
    assertEquals(
        2,
        cluster
            .getSolrClient()
            .query(collection, new SolrQuery("*:*").setParam(_ROUTE_, "a"))
            .getResults()
            .getNumFound());
  }

  @Test
  public void testRouteFieldForHashRouter() throws Exception {
    String collectionName = "routeFieldColl";
    int numShards = 4;
    int replicationFactor = 2;
    String shard_fld = "shard_s";

    CollectionAdminRequest.createCollection(collectionName, "conf", numShards, replicationFactor)
        .setRouterField(shard_fld)
        .process(cluster.getSolrClient());

    cluster.waitForActiveCollection(collectionName, numShards, numShards * replicationFactor);

    new UpdateRequest()
        .add("id", "6", shard_fld, "a")
        .add("id", "7", shard_fld, "a")
        .add("id", "8", shard_fld, "b")
        .commit(cluster.getSolrClient(), collectionName);

    assertEquals(
        3,
        cluster
            .getSolrClient()
            .query(collectionName, new SolrQuery("*:*"))
            .getResults()
            .getNumFound());
    assertEquals(
        2,
        cluster
            .getSolrClient()
            .query(collectionName, new SolrQuery("*:*").setParam(_ROUTE_, "a"))
            .getResults()
            .getNumFound());
    assertEquals(
        1,
        cluster
            .getSolrClient()
            .query(collectionName, new SolrQuery("*:*").setParam(_ROUTE_, "b"))
            .getResults()
            .getNumFound());
    assertEquals(
        0,
        cluster
            .getSolrClient()
            .query(collectionName, new SolrQuery("*:*").setParam(_ROUTE_, "c"))
            .getResults()
            .getNumFound());

    cluster.getSolrClient().deleteByQuery(collectionName, "*:*");
    cluster.getSolrClient().commit(collectionName);

    cluster
        .getSolrClient()
        .add(collectionName, new SolrInputDocument("id", "100", shard_fld, "c!doc1"));
    cluster.getSolrClient().commit(collectionName);
    assertEquals(
        1,
        cluster
            .getSolrClient()
            .query(collectionName, new SolrQuery("*:*").setParam(_ROUTE_, "c!"))
            .getResults()
            .getNumFound());
  }

  @Test
  public void testCreateShardRepFactor() throws Exception {
    final String collectionName = "testCreateShardRepFactor";
    CollectionAdminRequest.createCollectionWithImplicitRouter(collectionName, "conf", "a,b", 1)
        .process(cluster.getSolrClient());

    CollectionAdminRequest.createShard(collectionName, "x").process(cluster.getSolrClient());

    waitForState(
        "Not enough active replicas in shard 'x'",
        collectionName,
        (n, c) -> {
          return c.getSlice("x").getReplicas().size() == 1;
        });
  }
}


text:
.. _uid:

UID-Related Extras
==================

.. autoclass:: properties.extras.HasUID
    :members: validate_uid, load, serialize, deserialize

.. autoclass:: properties.extras.Pointer


text:
require 'test/unit'
require 'pathname'
require 'fileutils'
require 'extensions/kernel' if defined?(require_relative).nil?
require_relative '../../../../../lib/Core/CompilerTask/Teardown/All'
require_relative '../../../../../lib/Core/Compiler'

module WebBlocks
  module Core
    module Test
      module Unit
        module Core
          module CompilerTask
            module Teardown

              class Core < ::Test::Unit::TestCase

                def setup

                  @base_directory = Pathname.new(__FILE__).realpath.parent + '.test'
                  @components_directory = 'bower_components'
                  FileUtils.rm_rf @base_directory
                  FileUtils.mkdir @base_directory
                  FileUtils.mkdir @base_directory + @components_directory
                  FileUtils.mkdir @base_directory + @components_directory + 'WebBlocks-core'

                end

                def teardown

                  FileUtils.rm_rf @base_directory

                end

                def test_run

                  begin

                    compiler = OpenStruct.new
                    compiler.base_directory = @base_directory
                    compiler.components_directory = @base_directory + @components_directory

                    # monkey-patch and save original version
                    command_method = ::WebBlocks::Core::Support::Bower.method(:command)
                    ::WebBlocks::Core::Support::Bower.class_eval do
                      def self.command str
                        raise str
                      end
                    end

                    ::WebBlocks::Core::CompilerTask::Teardown::Core.new(compiler).run

                    # should never get here - but if we do, then need to fail
                    assert false

                  rescue RuntimeError => command

                    assert File.exists?(@base_directory) == true
                    assert File.exists?(@base_directory + @components_directory) == true
                    assert File.exists?(@base_directory + @components_directory + 'WebBlocks-core') == false
                    assert command.to_s == 'cache clean'

                  ensure

                    # revert monkey-patch to original version
                    ::WebBlocks::Core::Support::Bower.class_eval do
                      define_method(command_method.name, &command_method)
                    end

                  end

                end

              end

            end
          end
        end
      end
    end
  end
end


text:
<?php

namespace OpenOrchestra\Backoffice\Tests\Form\Type\Component;

use OpenOrchestra\Backoffice\GeneratePerimeter\GeneratePerimeterManager;
use OpenOrchestra\BaseBundle\Tests\AbstractTest\AbstractBaseTestCase;
use Phake;

/**
 * Class GeneratePerimeterManagerTest
 */
class GeneratePerimeterManagerTest extends AbstractBaseTestCase
{
    protected $manager;

    /**
     * Set up the test
     */
    public function setUp()
    {
        $this->manager = new GeneratePerimeterManager();
    }

    /**
     * Test generatePerimeters
     */
    public function testGeneratePerimeters()
    {
        $key0 = 'fakeKey0';
        $perimeter0 = array('fakePerimeter0');
        $strategy0 = Phake::mock('OpenOrchestra\Backoffice\GeneratePerimeter\Strategy\GeneratePerimeterStrategyInterface');
        Phake::when($strategy0)->getType()->thenReturn($key0);
        Phake::when($strategy0)->generatePerimeter(Phake::anyParameters())->thenReturn($perimeter0);
        Phake::when($strategy0)->getPerimeterConfiguration(Phake::anyParameters())->thenReturn($perimeter0);
        $this->manager->addStrategy($strategy0);

        $key1 = 'fakeKey1';
        $perimeter1 = array('fakePerimeter1');
        $strategy1 = Phake::mock('OpenOrchestra\Backoffice\GeneratePerimeter\Strategy\GeneratePerimeterStrategyInterface');
        Phake::when($strategy1)->getType()->thenReturn($key1);
        Phake::when($strategy1)->generatePerimeter(Phake::anyParameters())->thenReturn($perimeter1);
        Phake::when($strategy1)->getPerimeterConfiguration(Phake::anyParameters())->thenReturn($perimeter1);
        $this->manager->addStrategy($strategy1);

        $this->assertEquals(array($key0 => $perimeter0, $key1 => $perimeter1), $this->manager->generatePerimeters('siteId'));
        $this->assertEquals(array($key0 => $perimeter0, $key1 => $perimeter1), $this->manager->getPerimetersConfiguration('siteId'));
    }
}


text:
<?php

use console\base\Migration;

/**
 * Class m201119_123859_convert_timestamp_columns
 */
class m201119_123859_convert_timestamp_columns extends Migration {

	/**
	 * {@inheritdoc}
	 */
	public function safeUp() {
		$this->convertTimestampToDatetime('{{%issue}}', 'date', 'signing_at');
		$this->convertTimestampToDatetime('{{%issue}}', 'accident_at');
		$this->convertTimestampToDatetime('{{%issue}}', 'stage_change_at');
	}

	/**
	 * {@inheritdoc}
	 */
	public function safeDown() {
		return true;
	}

}


text:
package fr.mncc.showcase.landingpage.client;

import com.google.gwt.core.client.EntryPoint;
import fr.mncc.minus.routes.client.Route;
import fr.mncc.minus.routes.client.Router;
import fr.mncc.showcase.shared.client.CustomRoute;
import fr.mncc.showcase.shared.client.assets.ShowcaseConstants;

/**
 * Entry point classes define onModuleLoad()
 */
public class ModuleEntryPoint implements EntryPoint {

    /**
     * This is the entry point method.
     */
    @Override
    public void onModuleLoad() {

        // Launch router
        Router router = new Router();

        // Declare new routes
        Route routeLandingPage =
            new CustomRoute(ShowcaseConstants.INSTANCE.landingPageToken(), new LandingPage());

        // On routing failure redirect user to #!/home
        router.setFallback(routeLandingPage);

        // Register a few routes
        router.add(routeLandingPage);

        // Listen to History change events
        router.listen();

        // Try to redirect user to the current url address
        // On failure, redirect user to #!/landingpage
        router.loadFromBookmark("!/" + ShowcaseConstants.INSTANCE.landingPageToken());
    }
}


text:
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Routing;

namespace RoutingWebSite;

// For by tests for dynamic routing to pages/controllers
public class StartupForDynamic
{
    public void ConfigureServices(IServiceCollection services)
    {
        services
            .AddMvc()
            .AddNewtonsoftJson();

        services.AddTransient<Transformer>();
        services.AddScoped<TestResponseGenerator>();
        services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();

        // Used by some controllers defined in this project.
        services.Configure<RouteOptions>(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
    }

    public void Configure(IApplicationBuilder app)
    {
        app.UseRouting();
        app.UseEndpoints(endpoints =>
        {
            endpoints.MapDynamicControllerRoute<Transformer>("v1/dynamic/{**slug}", new DynamicVersion { Version = "V1" });
            endpoints.MapDynamicControllerRoute<Transformer>("v2/dynamic/{**slug}", new DynamicVersion { Version = "V2" });
            endpoints.MapDynamicPageRoute<Transformer>("v1/dynamicpage/{**slug}", new DynamicVersion { Version = "V1" });
            endpoints.MapDynamicPageRoute<Transformer>("v2/dynamicpage/{**slug}", new DynamicVersion { Version = "V2" });

            endpoints.MapControllerRoute("link", "link_generation/{controller}/{action}/{id?}");
        });

        app.Map("/afterrouting", b => b.Run(c =>
        {
            return c.Response.WriteAsync("Hello from middleware after routing");
        }));
    }

    private class Transformer : DynamicRouteValueTransformer
    {
        // Turns a format like `controller=Home,action=Index` into an RVD
        public override ValueTask<RouteValueDictionary> TransformAsync(HttpContext httpContext, RouteValueDictionary values)
        {
            var kvps = ((string)values["slug"]).Split(",");

            var results = new RouteValueDictionary();
            foreach (var kvp in kvps)
            {
                var split = kvp.Replace("%2F", "/", StringComparison.OrdinalIgnoreCase).Split("=");
                results[split[0]] = split[1];
            }

            results["version"] = ((DynamicVersion)State).Version;

            return new ValueTask<RouteValueDictionary>(results);
        }

        public override ValueTask<IReadOnlyList<Endpoint>> FilterAsync(HttpContext httpContext, RouteValueDictionary values, IReadOnlyList<Endpoint> endpoints)
        {
            var version = ((DynamicVersion)State).Version;
            if (version == "V2" && version == (string)values["version"])
            {
                // For v1 routes this transformer will work fine, for v2 routes, it will filter them.
                return new ValueTask<IReadOnlyList<Endpoint>>(Array.Empty<Endpoint>());
            }
            return base.FilterAsync(httpContext, values, endpoints);
        }
    }
}


text:
package org.thingsplode.synapse.proxy.handlers;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageEncoder;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
import java.util.List;
import java.util.UUID;
import org.thingsplode.synapse.MessageIdGeneratorStrategy;
import org.thingsplode.synapse.core.CommandResult;
import org.thingsplode.synapse.core.MediaType;
import org.thingsplode.synapse.proxy.EndpointProxy;
import org.thingsplode.synapse.util.Util;

/**
 *
 * @author Csaba Tamas
 */
public class CommandResult2WsEncoder extends MessageToMessageEncoder<CommandResult> {

    private final MessageIdGeneratorStrategy messageIdGeneratorStrategy;

    public CommandResult2WsEncoder(MessageIdGeneratorStrategy messageIdGeneratorStrategy) {
        if (messageIdGeneratorStrategy != null) {
            this.messageIdGeneratorStrategy = messageIdGeneratorStrategy;
        } else {
            this.messageIdGeneratorStrategy = () -> UUID.randomUUID().toString();
        }
    }

    @Override
    protected void encode(ChannelHandlerContext ctx, CommandResult msg, List<Object> out) throws Exception {
        if (Util.isEmpty(msg.getHeader().getMsgId())) {
            msg.getHeader().setMsgId(messageIdGeneratorStrategy.getNextId());
        }
        String result = EndpointProxy.SERIALIZATION_SERVICE.getSerializer(MediaType.APPLICATION_JSON).marshallToWireformat(msg);
        out.add(new TextWebSocketFrame(result));
    }

}


text:
"""Yet another couple of examples on do/undo feauture."""

import tables

def setUp(filename):
    # Create an HDF5 file
    fileh = tables.openFile(filename, mode = "w", title="Undo/Redo demo")
    # Create some nodes in there
    fileh.createGroup("/", "agroup", "Group 1")
    fileh.createGroup("/agroup", "agroup2", "Group 2")
    fileh.createArray("/", "anarray", [1, 2], "Array 1")
    # Enable undo/redo.
    fileh.enableUndo()
    return fileh

def tearDown(fileh):
    # Disable undo/redo.
    fileh.disableUndo()
    # Close the file
    fileh.close()

def demo_6times3marks():
    """Checking with six ops and three marks"""

    # Initialize the data base with some nodes
    fileh = setUp("undo-redo-6times3marks.h5")

    # Create a new array
    fileh.createArray('/', 'otherarray1', [3, 4], "Another array 1")
    fileh.createArray('/', 'otherarray2', [4, 5], "Another array 2")
    # Put a mark
    fileh.mark()
    fileh.createArray('/', 'otherarray3', [5, 6], "Another array 3")
    fileh.createArray('/', 'otherarray4', [6, 7], "Another array 4")
    # Put a mark
    fileh.mark()
    fileh.createArray('/', 'otherarray5', [7, 8], "Another array 5")
    fileh.createArray('/', 'otherarray6', [8, 9], "Another array 6")
    # Unwind just one mark
    fileh.undo()
    assert "/otherarray1" in fileh
    assert "/otherarray2" in fileh
    assert "/otherarray3" in fileh
    assert "/otherarray4" in fileh
    assert "/otherarray5" not in fileh
    assert "/otherarray6" not in fileh
    # Unwind another mark
    fileh.undo()
    assert "/otherarray1" in fileh
    assert "/otherarray2" in fileh
    assert "/otherarray3" not in fileh
    assert "/otherarray4" not in fileh
    assert "/otherarray5" not in fileh
    assert "/otherarray6" not in fileh
    # Unwind all marks
    fileh.undo()
    assert "/otherarray1" not in fileh
    assert "/otherarray2" not in fileh
    assert "/otherarray3" not in fileh
    assert "/otherarray4" not in fileh
    assert "/otherarray5" not in fileh
    assert "/otherarray6" not in fileh
    # Redo until the next mark
    fileh.redo()
    assert "/otherarray1" in fileh
    assert "/otherarray2" in fileh
    assert "/otherarray3" not in fileh
    assert "/otherarray4" not in fileh
    assert "/otherarray5" not in fileh
    assert "/otherarray6" not in fileh
    # Redo until the next mark
    fileh.redo()
    assert "/otherarray1" in fileh
    assert "/otherarray2" in fileh
    assert "/otherarray3" in fileh
    assert "/otherarray4" in fileh
    assert "/otherarray5" not in fileh
    assert "/otherarray6" not in fileh
    # Redo until the end
    fileh.redo()
    assert "/otherarray1" in fileh
    assert "/otherarray2" in fileh
    assert "/otherarray3" in fileh
    assert "/otherarray4" in fileh
    assert "/otherarray5" in fileh
    assert "/otherarray6" in fileh

    # Tear down the file
    tearDown(fileh)

def demo_manyops():
    """Checking many operations together """

    # Initialize the data base with some nodes
    fileh = setUp("undo-redo-manyops.h5")

    # Create an array
    fileh.createArray(fileh.root, 'anarray3', [3], "Array title 3")
    # Create a group
    fileh.createGroup(fileh.root, 'agroup3', "Group title 3")
    # /anarray => /agroup/agroup3/
    newNode = fileh.copyNode('/anarray3', '/agroup/agroup2')
    newNode = fileh.copyChildren('/agroup', '/agroup3', recursive=1)
    # rename anarray
    fileh.renameNode('/anarray', 'anarray4')
    # Move anarray
    newNode = fileh.copyNode('/anarray3', '/agroup')
    # Remove anarray4
    fileh.removeNode('/anarray4')
    # Undo the actions
    fileh.undo()
    assert '/anarray4' not in fileh
    assert '/anarray3' not in fileh
    assert '/agroup/agroup2/anarray3' not in fileh
    assert '/agroup3' not in fileh
    assert '/anarray4' not in fileh
    assert '/anarray' in fileh

    # Redo the actions
    fileh.redo()
    # Check that the copied node exists again in the object tree.
    assert '/agroup/agroup2/anarray3' in fileh
    assert '/agroup/anarray3' in fileh
    assert '/agroup3/agroup2/anarray3' in fileh
    assert '/agroup3/anarray3' not in fileh
    assert fileh.root.agroup.anarray3 is newNode
    assert '/anarray' not in fileh
    assert '/anarray4' not in fileh

    # Tear down the file
    tearDown(fileh)

if __name__ == '__main__':

    # run demos
    demo_6times3marks()
    demo_manyops()


text:
package pinger_http

import (
	"flags"
	"github.com/refiito/timeoutclient"
	"time"
)

const connectTimeout = time.Duration(2 * time.Second)

var Client = timeoutclient.NewTimeoutClient(connectTimeout, time.Duration(*flags.PeriodSeconds)*time.Second)


text:
package com.connorhaigh.jalopy.core;

import java.io.DataOutputStream;
import java.lang.reflect.Constructor;

import com.connorhaigh.jalopy.exceptions.ServerException;
import com.connorhaigh.jalopy.http.Request;

public class Mapping
{
	/**
	 * Creates a new mapping.
	 * @param name the name of the request type
	 * @param handler the handler responsible
	 * @throws SecurityException if the permissions are not available
	 * @throws NoSuchMethodException if the handler class does not have the respective methods
	 */
	public Mapping(String name, Class<? extends Handler> handler) throws NoSuchMethodException, SecurityException
	{
		this.name = name;

		this.handler = handler;
		this.constructor = this.handler.getDeclaredConstructor(Server.class, Request.class, DataOutputStream.class);
	}

	/**
	 * Creates the handler this mapping represents.
	 * @param server the owning server
	 * @param requestHeader the received request
	 * @param dataOutputStream the data output stream of the request
	 * @return the handler instance
	 * @throws ServerException if the handler could not be instantiated
	 */
	public Handler createHandler(Server server, Request request, DataOutputStream dataOutputStream) throws ServerException
	{
		try
		{
			return this.constructor.newInstance(server, request, dataOutputStream);
		}
		catch (Exception exception)
		{
			throw new ServerException("Could not create handler");
		}
	}

	/**
	 * Returns the request type of this mapping.
	 * @return the request type
	 */
	public String getName()
	{
		return this.name;
	}

	/**
	 * Returns the handler for this mapping.
	 * @return the handler
	 */
	public Class<? extends Handler> getHandler()
	{
		return this.handler;
	}

	private String name;

	private Class<? extends Handler> handler;
	private Constructor<? extends Handler> constructor;
}


text:
Provides basic CLI utilitaries for Chunk Stories.
Doubles as a plugin example


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

//
/*=============================================================================
**
**
**
** Purpose: Enum to represent the different thread states
**
**
=============================================================================*/

namespace System.Threading
{
    [Serializable]
    [Flags]
    public enum ThreadState
    {
        /*=========================================================================
        ** Constants for thread states.
        =========================================================================*/
        Running = 0,
        StopRequested = 1,
        SuspendRequested = 2,
        Background = 4,
        Unstarted = 8,
        Stopped = 16,
        WaitSleepJoin = 32,
        Suspended = 64,
        AbortRequested = 128,
        Aborted = 256
    }
}