text:
package org.javamoney.calc.common;

import org.junit.Test;

import javax.money.MonetaryException;

import static org.junit.Assert.*;

/**
 * Tests for doubling time.
 */
public class DoublingTimeSimpleTest {

    /**
     * Values are taken from: {@code http://www.financeformulas.net/Doubling-Time-Simple-Interest.html#calcHeader}
     *
     * @throws Exception the exception
     */
    @Test
    public void calculate() throws Exception {
        assertEquals(11.72332942555686, DoublingTimeSimple.calculate(Rate.of(0.0853)).doubleValue(), 0.0d);
        assertEquals(2.0, DoublingTimeSimple.calculate(Rate.of(0.5)).doubleValue(), 0.0d);
        assertEquals(1.0, DoublingTimeSimple.calculate(Rate.of(1)).doubleValue(), 0.0d);
        assertEquals(22.22222222222222, DoublingTimeSimple.calculate(Rate.of(0.045)).doubleValue(), 0.0d);
    }

    /**
     * Calculate invalid.
     */
    @Test(expected = MonetaryException.class)
    public void calculate_Invalid(){
        DoublingTimeSimple.calculate(Rate.of(0));
    }
}


text:
package com.mall.search.dao.impl;

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

import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.mall.search.constant.SearchItemSolrNames;
import com.mall.search.dao.SearchDao;
import com.mall.search.pojo.SearchItem;
import com.mall.search.pojo.SearchResult;

@Repository
public class SearchDaoImpl implements SearchDao {

	@Autowired
	private SolrClient solrClient;

	@Override
	public SearchResult search(SolrQuery query) throws Exception {

		QueryResponse response = solrClient.query(query);
		SolrDocumentList documentList = response.getResults();
		List<SearchItem> itemList = new ArrayList<>();

		for (SolrDocument solrDocument : documentList) {
			SearchItem item = new SearchItem();
			item.setId((String) solrDocument.get("id"));

			Map<String, Map<String, List<String>>> highlighting = response.getHighlighting();
			List<String> list = highlighting.get(solrDocument.get("id")).get(SearchItemSolrNames.ITEM_TITLE);
			String itemTitle;
			if (list != null && list.size() > 0) {
				itemTitle = list.get(0);
			} else {
				itemTitle = (String) solrDocument.get(SearchItemSolrNames.ITEM_TITLE);
			}

			item.setTitle(itemTitle);
			item.setCategoryName((String) solrDocument.get(SearchItemSolrNames.ITEM_CATEGORY_NAME));
			item.setImage((String) solrDocument.get(SearchItemSolrNames.ITEM_IMAGE));
			item.setPrice((Long) solrDocument.get(SearchItemSolrNames.ITEM_PRICE));
			item.setSellPoint((String) solrDocument.get(SearchItemSolrNames.ITEM_SELL_POINT));

			itemList.add(item);
		}

		SearchResult searchResult = new SearchResult();
		searchResult.setItemList(itemList);
		searchResult.setRecordCount(documentList.getNumFound());

		return searchResult;
	}

}

redpajama_set_name: RedPajamaGithub


text:
package photon

import (
	"log"
	"os"
	"strconv"
	"strings"
	"testing"

	"k8s.io/kubernetes/pkg/cloudprovider"
	"k8s.io/kubernetes/pkg/types"
	"k8s.io/kubernetes/pkg/util/rand"
)

func configFromEnv() (TestVM string, TestFlavor string, cfg PCConfig, ok bool) {
	var IgnoreCertificate bool
	var OverrideIP bool
	var err error
	cfg.Global.CloudTarget = os.Getenv("PHOTON_TARGET")
	cfg.Global.Tenant = os.Getenv("PHOTON_TENANT")
	cfg.Global.Project = os.Getenv("PHOTON_PROJECT")
	if os.Getenv("PHOTON_IGNORE_CERTIFICATE") != "" {
		IgnoreCertificate, err = strconv.ParseBool(os.Getenv("PHOTON_IGNORE_CERTIFICATE"))
	} else {
		IgnoreCertificate = false
	}
	if err != nil {
		log.Fatal(err)
	}
	cfg.Global.IgnoreCertificate = IgnoreCertificate
	if os.Getenv("PHOTON_OVERRIDE_IP") != "" {
		OverrideIP, err = strconv.ParseBool(os.Getenv("PHOTON_OVERRIDE_IP"))
	} else {
		OverrideIP = false
	}
	if err != nil {
		log.Fatal(err)
	}
	cfg.Global.OverrideIP = OverrideIP

	TestVM = os.Getenv("PHOTON_TEST_VM")
	if os.Getenv("PHOTON_TEST_FLAVOR") != "" {
		TestFlavor = os.Getenv("PHOTON_TEST_FLAVOR")
	} else {
		TestFlavor = ""
	}
	if err != nil {
		log.Fatal(err)
	}

	ok = (cfg.Global.CloudTarget != "" &&
		cfg.Global.Tenant != "" &&
		cfg.Global.Project != "" &&
		TestVM != "")

	return
}

func TestReadConfig(t *testing.T) {
	_, err := readConfig(nil)
	if err == nil {
		t.Errorf("Should fail when no config is provided: %s", err)
	}

	cfg, err := readConfig(strings.NewReader(`
[Global]
target = 0.0.0.0
ignoreCertificate = true
tenant = tenant
project = project
overrideIP = false
`))
	if err != nil {
		t.Fatalf("Should succeed when a valid config is provided: %s", err)
	}

	if cfg.Global.CloudTarget != "0.0.0.0" {
		t.Errorf("incorrect photon target ip: %s", cfg.Global.CloudTarget)
	}

	if cfg.Global.Tenant != "tenant" {
		t.Errorf("incorrect tenant: %s", cfg.Global.Tenant)
	}

	if cfg.Global.Project != "project" {
		t.Errorf("incorrect project: %s", cfg.Global.Project)
	}
}

func TestNewPCCloud(t *testing.T) {
	_, _, cfg, ok := configFromEnv()
	if !ok {
		t.Skipf("No config found in environment")
	}

	_, err := newPCCloud(cfg)
	if err != nil {
		t.Fatalf("Failed to create new Photon client: %s", err)
	}
}

func TestInstances(t *testing.T) {
	testVM, _, cfg, ok := configFromEnv()
	if !ok {
		t.Skipf("No config found in environment")
	}
	NodeName := types.NodeName(testVM)

	pc, err := newPCCloud(cfg)
	if err != nil {
		t.Fatalf("Failed to create new Photon client: %s", err)
	}

	i, ok := pc.Instances()
	if !ok {
		t.Fatalf("Instances() returned false")
	}

	externalId, err := i.ExternalID(NodeName)
	if err != nil {
		t.Fatalf("Instances.ExternalID(%s) failed: %s", testVM, err)
	}
	t.Logf("Found ExternalID(%s) = %s\n", testVM, externalId)

	nonExistingVM := types.NodeName(rand.String(15))
	externalId, err = i.ExternalID(nonExistingVM)
	if err == cloudprovider.InstanceNotFound {
		t.Logf("VM %s was not found as expected\n", nonExistingVM)
	} else if err == nil {
		t.Fatalf("Instances.ExternalID did not fail as expected, VM %s was found", nonExistingVM)
	} else {
		t.Fatalf("Instances.ExternalID did not fail as expected, err: %v", err)
	}

	instanceId, err := i.InstanceID(NodeName)
	if err != nil {
		t.Fatalf("Instances.InstanceID(%s) failed: %s", testVM, err)
	}
	t.Logf("Found InstanceID(%s) = %s\n", testVM, instanceId)

	instanceId, err = i.InstanceID(nonExistingVM)
	if err == cloudprovider.InstanceNotFound {
		t.Logf("VM %s was not found as expected\n", nonExistingVM)
	} else if err == nil {
		t.Fatalf("Instances.InstanceID did not fail as expected, VM %s was found", nonExistingVM)
	} else {
		t.Fatalf("Instances.InstanceID did not fail as expected, err: %v", err)
	}

	addrs, err := i.NodeAddresses(NodeName)
	if err != nil {
		t.Fatalf("Instances.NodeAddresses(%s) failed: %s", testVM, err)
	}
	t.Logf("Found NodeAddresses(%s) = %s\n", testVM, addrs)
}

func TestVolumes(t *testing.T) {
	testVM, testFlavor, cfg, ok := configFromEnv()
	if !ok {
		t.Skipf("No config found in environment")
	}

	pc, err := newPCCloud(cfg)
	if err != nil {
		t.Fatalf("Failed to create new Photon client: %s", err)
	}

	NodeName := types.NodeName(testVM)

	volumeOptions := &VolumeOptions{
		CapacityGB: 2,
		Tags:       nil,
		Name:       "kubernetes-test-volume-" + rand.String(10),
		Flavor:     testFlavor}

	pdID, err := pc.CreateDisk(volumeOptions)
	if err != nil {
		t.Fatalf("Cannot create a Photon persistent disk: %v", err)
	}

	err = pc.AttachDisk(pdID, NodeName)
	if err != nil {
		t.Fatalf("Cannot attach persistent disk(%s) to VM(%s): %v", pdID, testVM, err)
	}

	_, err = pc.DiskIsAttached(pdID, NodeName)
	if err != nil {
		t.Fatalf("Cannot attach persistent disk(%s) to VM(%s): %v", pdID, testVM, err)
	}

	err = pc.DetachDisk(pdID, NodeName)
	if err != nil {
		t.Fatalf("Cannot detach persisten disk(%s) from VM(%s): %v", pdID, testVM, err)
	}

	err = pc.DeleteDisk(pdID)
	if err != nil {
		t.Fatalf("Cannot delete persisten disk(%s): %v", pdID, err)
	}
}


text:
namespace Nine.Application
{
    using System.Linq;
    using Windows.Security.Credentials;

    public class PasswordStore : IPasswordStore
    {
        private readonly string _resourceName;
        private readonly PasswordVault _vault = new PasswordVault();

        public PasswordStore() : this(null) { }
        public PasswordStore(string resourceName) { _resourceName = resourceName ?? "DefaultResource"; }

        public string Retrieve(string key)
        {
            var password = _vault.Retrieve(_resourceName, key);
            if (password == null) return null;

            password.RetrievePassword();
            return password.Password;
        }

        public string[] RetrieveAllKeys()
        {
            return _vault.RetrieveAll().Select(p => p.UserName).ToArray();
        }

        public void Store(string userName, string password)
        {
            _vault.Add(new PasswordCredential(_resourceName, userName, password));
        }

        public void Remove(string key)
        {
            var password = _vault.Retrieve(_resourceName, key);
            if (password != null) _vault.Remove(password);
        }
    }
}


text:
.. _spider_cache:

Spider Cache
============

There is cache built in the spider. It could be helpful on development stage.
When you need to scrape same documents for many times to check the results
and to fix bugs. Also you can crawl whole web-site, put it into cache and
then work only with cache.

Keep in mind that if the web-site is large, millions of web pages then working
with cache could be slower than working with live web-site. This is because of
limited disk I/O where the cache storage is hosted.

Also keep in mind the the spider cache is very simple:

* it allows to cache only GET requests
* it does not allow to differentiate documents with same URL but
    different cookies/headers
* it does not support max-age and other cache headers

.. _spider_cache_backends:

Spider Cache Backends
---------------------

You can choose what storage to use for the cache. You can use mongodb, mysql
and postgresql.

MongoDB example:

.. code:: python

    bot = ExampleSpider()
    bot.setup_cache(backend='mongo', database='some-database')
    bot.run()

In this example the spider is configured to use mongodb as cache storage.
The name of database is "some-database". The name of collection would
be "cache".

All arguments except `backend`, `database` and `use_compression` go to
database connection constructor. You can setup database name, host name, port,
authorization arguments and other things.

Example of custom host name and port for mongodb connection::

.. code:: python

    bot = SomeSpider()
    bot.setup_cache(backend='mongo', port=7777, host='mongo.localhost')

.. _spider_cache_compression:

Cache Compression
-----------------

By default cache compression is enabled. That means that all documents placed in
the cache are compressed with gzip library. Compression decreases the disk space
required to store the cache and increases the CPU load (a bit).


text:
* ## Style
  * 4 spaces, no tabs
  * up to 80 columns
  * single space around operators
  * no spaces in the end-of-line
  * indent function arguments on column
  * indent structure fields on column
  * scope: open on same line, except function body, which is on a new line.
  * indent multiple consecutive assignments on the column
  * 2 space lines between types and prototypes (header files)
  * 1 space line between functions (source files)

* ## Naming convention:
  * lower case, underscores
  * names must begin with ucp_/uct_/ucs_/ucm_
  * macro names must begin with UCP_/UCT_/UCS_/UCM_
  * an output argument which is a pointer to a user variable has _p suffix
  * value types (e.g struct types, integer types) have _t suffix
  * pointer to structs, which are used as API handles, have _h suffix
  * macro arguments begin with _ (e.g _value) to avoid confusion with variables
  * no leading underscores in function names
  * ### Header file name suffixes:
     * _fwd.h   for a files with a types/function forward declarations
     * _types.h if contains a type declarations
     * .inl     for inline functions
     * _def.h   with a preprocessor macros

* ## C++
  * used only for unit testing
  * lower-case class names (same as stl/boost)

* ## Include order:
   1. config.h
   2. specific internal header
   3. UCX headers
   4. system headers

* ## Doxygen
  * all interface H/C files should have doxygen documentation.

* ## Error handling
  * all internal error codes must be ucs_status_t
  * a function which returns error should print a log message
  * the function which prints the log message is the first one which decides which
    error it is. If a functions returns an error because it's callee returned
    erroneous ucs_status_t, it does not have to print a log message.
  * destructors are not able to propagate error code to the caller because they
    return void. also, users are not ready to handle errors during cleanup flow.
    therefore a destructor should handle an error by printing a warning or an
    error message.

* ## Testing
  * every major feature or bugfix must be accompanied with a unit test. In case
    of a fix, the test should fail without the fix.

* ## Logging


text:
require 'spec_helper'

describe 'Entering Points data' do
  let!(:user) { FactoryBot.create(:data_entry_volunteer_user, name: "Judge User") }

  include_context 'unpaid registration'
  include_context 'basic event configuration'
  include_context 'points_event', name: 'Basketball'
  include_context 'user is logged in'

  describe "the event on the page" do
    before do
      user.add_role(:data_recording_volunteer, Competition.first)
      visit '/en/welcome/data_entry_menu'
    end

    specify { expect(page).to have_content("Basketball") }

    describe "when entering results" do
      before do
        click_link "Entry Form"
      end

      it "can add and update scores" do
        select "Robin Robin", from: 'external_result[competitor_id]'
        fill_in "external_result[points]", with: "1.0"
        fill_in "external_result[details]", with: "1 pts"

        expect do
          click_button "Create Entered Point Result"
        end.to change(ExternalResult, :count).by(1)
      end
    end
  end
end


text:
class NonZeroValidator < ActiveModel::EachValidator
  def validate_each(object, attribute, value)
    if value == 0
      object.errors[attribute] << (options[:message] || I18n.t('activerecord.errors.messages.not_equal_to', count: 0.0))
    end
  end
end


text:
package com.github.maven_nar.cpptasks;

import java.io.File;
import java.lang.reflect.Method;
import java.util.Vector;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.DataType;
import org.apache.tools.ant.types.Environment;
import org.apache.tools.ant.types.Reference;

import com.github.maven_nar.cpptasks.compiler.LinkType;
import com.github.maven_nar.cpptasks.compiler.Processor;
import com.github.maven_nar.cpptasks.compiler.ProcessorConfiguration;
import com.github.maven_nar.cpptasks.types.CommandLineArgument;
import com.github.maven_nar.cpptasks.types.ConditionalFileSet;

/**
 * An abstract compiler/linker definition.
 *
 * @author Curt Arnold
 */
public abstract class ProcessorDef extends DataType {
  /**
   * Returns the equivalent Boolean object for the specified value
   *
   * Equivalent to Boolean.valueOf in JDK 1.4
   *
   * @param val
   *          boolean value
   * @return Boolean.TRUE or Boolean.FALSE
   */
  protected static Boolean booleanValueOf(final boolean val) {
    if (val) {
      return Boolean.TRUE;
    }
    return Boolean.FALSE;
  }

  /**
   * if true, targets will be built for debugging
   */
  private Boolean debug;
  private Environment env = null;
  /**
   * Reference for "extends" processor definition
   */
  private Reference extendsRef = null;
  /**
   * Name of property that must be present or definition will be ignored. May
   * be null.
   */
  private String ifProp;
  /**
   * if true, processor definition inherits values from containing cc
   * element
   */
  private boolean inherit;
  private Boolean libtool = null;
  protected boolean newEnvironment = false;
  /**
   * Processor.
   */
  private Processor processor;
  /**
   * Collection of <compilerarg>or <linkerarg>contained by definition
   */
  private final Vector processorArgs = new Vector();
  /**
   * Collection of <compilerparam>or <linkerparam>contained by definition
   */
  private final Vector processorParams = new Vector();
  /**
   * if true, all targets will be unconditionally rebuilt
   */
  private Boolean rebuild;
  /**
   * Collection of <fileset>contained by definition
   */
  private final Vector srcSets = new Vector();
  /**
   * Name of property that if present will cause definition to be ignored.
   * May be null.
   */
  private String unlessProp;

  /**
   * Constructor
   *
   */
  protected ProcessorDef() throws NullPointerException {
    this.inherit = true;
  }

  /**
   * Adds a <compilerarg>or <linkerarg>
   *
   * @param arg
   *          command line argument, must not be null
   * @throws NullPointerException
   *           if arg is null
   * @throws BuildException
   *           if this definition is a reference
   */
  protected void addConfiguredProcessorArg(final CommandLineArgument arg) throws NullPointerException, BuildException {
    if (arg == null) {
      throw new NullPointerException("arg");
    }
    if (isReference()) {
      throw noChildrenAllowed();
    }
    this.processorArgs.addElement(arg);
  }

  /**
   * Adds a <compilerarg>or <linkerarg>
   *
   * @param param
   *          command line argument, must not be null
   * @throws NullPointerException
   *           if arg is null
   * @throws BuildException
   *           if this definition is a reference
   */
  protected void addConfiguredProcessorParam(final ProcessorParam param) throws NullPointerException, BuildException {
    if (param == null) {
      throw new NullPointerException("param");
    }
    if (isReference()) {
      throw noChildrenAllowed();
    }
    this.processorParams.addElement(param);
  }

  /**
   * Add an environment variable to the launched process.
   */
  public void addEnv(final Environment.Variable var) {
    if (this.env == null) {
      this.env = new Environment();
      this.newEnvironment = true;
      if (this.processor != null) {
        // Change the environment in the processor
        setProcessor(this.processor);
      }
    }
    this.env.addVariable(var);
  }

  /**
   * Adds a source file set.
   *
   * Files in these set will be processed by this configuration and will not
   * participate in the auction.
   *
   * @param srcSet
   *          Fileset identifying files that should be processed by this
   *          processor
   * @throws BuildException
   *           if processor definition is a reference
   */
  public void addFileset(final ConditionalFileSet srcSet) throws BuildException {
    if (isReference()) {
      throw noChildrenAllowed();
    }
    srcSet.setProject(getProject());
    this.srcSets.addElement(srcSet);
  }

  /**
   * Creates a configuration
   *
   * @param baseDef
   *          reference to def from containing cc element, may be null
   * @return configuration
   *
   */
  public ProcessorConfiguration createConfiguration(final CCTask task, final LinkType linkType,
      final ProcessorDef baseDef, final TargetDef targetPlatform, final VersionInfo versionInfo) {
    if (isReference()) {
      return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).createConfiguration(task, linkType,
          baseDef, targetPlatform, versionInfo);
    }
    final ProcessorDef[] defaultProviders = getDefaultProviders(baseDef);
    final Processor proc = getProcessor(linkType);
    return proc.createConfiguration(task, linkType, defaultProviders, this, targetPlatform, versionInfo);
  }

  /**
   * Prepares list of processor arguments ( compilerarg, linkerarg ) that
   * are active for the current project settings.
   *
   * @return active compiler arguments
   */
  public CommandLineArgument[] getActiveProcessorArgs() {
    final Project p = getProject();
    if (p == null) {
      throw new java.lang.IllegalStateException("project must be set");
    }
    if (isReference()) {
      return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).getActiveProcessorArgs();
    }
    final Vector activeArgs = new Vector(this.processorArgs.size());
    for (int i = 0; i < this.processorArgs.size(); i++) {
      final CommandLineArgument arg = (CommandLineArgument) this.processorArgs.elementAt(i);
      if (arg.isActive(p)) {
        activeArgs.addElement(arg);
      }
    }
    final CommandLineArgument[] array = new CommandLineArgument[activeArgs.size()];
    activeArgs.copyInto(array);
    return array;
  }

  /**
   * Prepares list of processor arguments ( compilerarg, linkerarg) that
   * are active for the current project settings.
   *
   * @return active compiler arguments
   */
  public ProcessorParam[] getActiveProcessorParams() {
    final Project p = getProject();
    if (p == null) {
      throw new java.lang.IllegalStateException("project must be set");
    }
    if (isReference()) {
      return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).getActiveProcessorParams();
    }
    final Vector activeParams = new Vector(this.processorParams.size());
    for (int i = 0; i < this.processorParams.size(); i++) {
      final ProcessorParam param = (ProcessorParam) this.processorParams.elementAt(i);
      if (param.isActive(p)) {
        activeParams.addElement(param);
      }
    }
    final ProcessorParam[] array = new ProcessorParam[activeParams.size()];
    activeParams.copyInto(array);
    return array;
  }

  /**
   * Gets boolean indicating debug build
   *
   * @param defaultProviders
   *          array of ProcessorDef's in descending priority
   * @param index
   *          index to first element in array that should be considered
   * @return if true, built targets for debugging
   */
  public boolean getDebug(final ProcessorDef[] defaultProviders, final int index) {
    if (isReference()) {
      return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).getDebug(defaultProviders, index);
    }
    if (this.debug != null) {
      return this.debug.booleanValue();
    } else {
      if (defaultProviders != null && index < defaultProviders.length) {
        return defaultProviders[index].getDebug(defaultProviders, index + 1);
      }
    }
    return false;
  }

  /**
   * Creates an chain of objects which provide default values in descending
   * order of significance.
   *
   * @param baseDef
   *          corresponding ProcessorDef from CCTask, will be last element
   *          in array unless inherit = false
   * @return default provider array
   *
   */
  protected final ProcessorDef[] getDefaultProviders(final ProcessorDef baseDef) {
    ProcessorDef extendsDef = getExtends();
    final Vector chain = new Vector();
    while (extendsDef != null && !chain.contains(extendsDef)) {
      chain.addElement(extendsDef);
      extendsDef = extendsDef.getExtends();
    }
    if (baseDef != null && getInherit()) {
      chain.addElement(baseDef);
    }
    final ProcessorDef[] defaultProviders = new ProcessorDef[chain.size()];
    chain.copyInto(defaultProviders);
    return defaultProviders;
  }

  /**
   * Because linkers have multiples and none of them share the environment
   * settings here is a hack to give direct access to copy it just before
   * running
   *
   * @return
   */
  public Environment getEnv() {
    return this.env;
  }

  /**
   * Gets the ProcessorDef specified by the extends attribute
   *
   * @return Base ProcessorDef, null if extends is not specified
   * @throws BuildException
   *           if reference is not same type object
   */
  public ProcessorDef getExtends() throws BuildException {
    if (this.extendsRef != null) {
      final Object obj = this.extendsRef.getReferencedObject(getProject());
      if (!getClass().isInstance(obj)) {
        throw new BuildException("Referenced object " + this.extendsRef.getRefId() + " not correct type, is "
            + obj.getClass().getName() + " should be " + getClass().getName());
      }
      return (ProcessorDef) obj;
    }
    return null;
  }

  /**
   * Gets the inherit attribute. If the inherit value is true, this processor
   * definition will inherit default values from the containing cc element.
   *
   * @return if true then properties from the containing <cc>element are
   *         used.
   */
  public final boolean getInherit() {
    return this.inherit;
  }

  public boolean getLibtool() {
    if (this.libtool != null) {
      return this.libtool.booleanValue();
    }
    if (isReference()) {
      return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).getLibtool();
    }
    final ProcessorDef extendsDef = getExtends();
    if (extendsDef != null) {
      return extendsDef.getLibtool();
    }
    return false;
  }

  /**
   * Obtains the appropriate processor (compiler, linker)
   *
   * @return processor
   */
  protected Processor getProcessor() {
    if (isReference()) {
      return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).getProcessor();
    }
    //
    // if a processor has not been explicitly set
    // then may be set by an extended definition
    if (this.processor == null) {
      final ProcessorDef extendsDef = getExtends();
      if (extendsDef != null) {
        return extendsDef.getProcessor();
      }
    }
    return this.processor;
  }

  /**
   * Obtains the appropriate processor (compiler, linker) based on the
   * LinkType.
   *
   * @return processor
   */
  protected Processor getProcessor(final LinkType linkType) {
    // by default ignore the linkType.
    return getProcessor();
  }

  /**
   * Gets a boolean value indicating whether all targets must be rebuilt
   * regardless of dependency analysis.
   *
   * @param defaultProviders
   *          array of ProcessorDef's in descending priority
   * @param index
   *          index to first element in array that should be considered
   * @return true if all targets should be rebuilt.
   */
  public boolean getRebuild(final ProcessorDef[] defaultProviders, final int index) {
    if (isReference()) {
      return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).getRebuild(defaultProviders, index);
    }
    if (this.rebuild != null) {
      return this.rebuild.booleanValue();
    } else {
      if (defaultProviders != null && index < defaultProviders.length) {
        return defaultProviders[index].getRebuild(defaultProviders, index + 1);
      }
    }
    return false;
  }

  /**
   * Returns true if the processor definition contains embedded file set
   * definitions
   *
   * @return true if processor definition contains embedded filesets
   */
  public boolean hasFileSets() {
    if (isReference()) {
      return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).hasFileSets();
    }
    return this.srcSets.size() > 0;
  }

  /**
   * Determine if this def should be used.
   *
   * Definition will be active if the "if" variable (if specified) is set and
   * the "unless" variable (if specified) is not set and that all reference
   * or extended definitions are active
   *
   * @return true if processor is active
   * @throws IllegalStateException
   *           if not properly initialized
   * @throws BuildException
   *           if "if" or "unless" variable contains suspicious values
   *           "false" or "no" which indicates possible confusion
   */
  public boolean isActive() throws BuildException, IllegalStateException {
    final Project project = getProject();
    if (!CUtil.isActive(project, this.ifProp, this.unlessProp)) {
      return false;
    }
    if (isReference()) {
      if (!((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).isActive()) {
        return false;
      }
    }
    //
    // walk through any extended definitions
    //
    final ProcessorDef[] defaultProviders = getDefaultProviders(null);
    for (int i = 0; i < defaultProviders.length; i++) {
      if (!defaultProviders[i].isActive()) {
        return false;
      }
    }
    return true;
  }

  /**
   * Sets the class name for the adapter. Use the "name" attribute when the
   * tool is supported.
   *
   * @param className
   *          full class name
   *
   */
  public void setClassname(final String className) throws BuildException {
    Object proc = null;
    try {
      final Class implClass = ProcessorDef.class.getClassLoader().loadClass(className);
      try {
        final Method getInstance = implClass.getMethod("getInstance", new Class[0]);
        proc = getInstance.invoke(null, new Object[0]);
      } catch (final Exception ex) {
        proc = implClass.newInstance();
      }
    } catch (final Exception ex) {
      throw new BuildException(ex);
    }
    setProcessor((Processor) proc);
  }

  /**
   * If set true, all targets will be built for debugging.
   *
   * @param debug
   *          true if targets should be built for debugging
   * @throws BuildException
   *           if processor definition is a reference
   */
  public void setDebug(final boolean debug) throws BuildException {
    if (isReference()) {
      throw tooManyAttributes();
    }
    this.debug = booleanValueOf(debug);
  }

  /**
   * Sets a description of the current data type.
   */
  @Override
  public void setDescription(final String desc) {
    super.setDescription(desc);
  }

  /**
   * Specifies that this element extends the element with id attribute with a
   * matching value. The configuration will be constructed from the settings
   * of this element, element referenced by extends, and the containing cc
   * element.
   *
   * @param extendsRef
   *          Reference to the extended processor definition.
   * @throws BuildException
   *           if this processor definition is a reference
   */
  public void setExtends(final Reference extendsRef) throws BuildException {
    if (isReference()) {
      throw tooManyAttributes();
    }
    this.extendsRef = extendsRef;
  }

  /**
   * Sets an id that can be used to reference this element.
   *
   * @param id
   *          id
   */
  public void setId(final String id) {
    //
    // this is actually accomplished by a different
    // mechanism, but we can document it
    //
  }

  /**
   * Sets the property name for the 'if' condition.
   *
   * The configuration will be ignored unless the property is defined.
   *
   * The value of the property is insignificant, but values that would imply
   * misinterpretation ("false", "no") will throw an exception when
   * evaluated.
   *
   * @param propName
   *          name of property
   */
  public void setIf(final String propName) {
    this.ifProp = propName;
  }

  /**
   * If inherit has the default value of true, defines, includes and other
   * settings from the containing cc element will be inherited.
   *
   * @param inherit
   *          new value
   * @throws BuildException
   *           if processor definition is a reference
   */
  public void setInherit(final boolean inherit) throws BuildException {
    if (isReference()) {
      throw super.tooManyAttributes();
    }
    this.inherit = inherit;
  }

  /**
   * Set use of libtool.
   *
   * If set to true, the "libtool " will be prepended to the command line
   *
   * @param libtool
   *          If true, use libtool.
   */
  public void setLibtool(final boolean libtool) {
    if (isReference()) {
      throw tooManyAttributes();
    }
    this.libtool = booleanValueOf(libtool);
  }

  /**
   * Do not propagate old environment when new environment variables are
   * specified.
   */
  public void setNewenvironment(final boolean newenv) {
    this.newEnvironment = newenv;
  }
  public boolean isNewEnvironment() {
    return this.newEnvironment;
  }

  /**
   * Sets the processor
   *
   * @param processor
   *          processor, may not be null.
   * @throws BuildException
   *           if ProcessorDef is a reference
   * @throws NullPointerException
   *           if processor is null
   */
  protected void setProcessor(final Processor processor) throws BuildException, NullPointerException {
    if (processor == null) {
      throw new NullPointerException("processor");
    }
    if (isReference()) {
      throw super.tooManyAttributes();
    }
    if (this.env == null && !this.newEnvironment) {
      this.processor = processor;
    } else {
      this.processor = processor.changeEnvironment(this.newEnvironment, this.env);
    }
  }

  /**
   * If set true, all targets will be unconditionally rebuilt.
   *
   * @param rebuild
   *          if true, rebuild all targets.
   * @throws BuildException
   *           if processor definition is a reference
   */
  public void setRebuild(final boolean rebuild) throws BuildException {
    if (isReference()) {
      throw tooManyAttributes();
    }
    this.rebuild = booleanValueOf(rebuild);
  }

  /**
   * Specifies that this element should behave as if the content of the
   * element with the matching id attribute was inserted at this location. If
   * specified, no other attributes or child content should be specified,
   * other than "if", "unless" and "description".
   *
   * @param ref
   *          Reference to other element
   *
   */
  @Override
  public void setRefid(final org.apache.tools.ant.types.Reference ref) {
    super.setRefid(ref);
  }

  /**
   * Set the property name for the 'unless' condition.
   *
   * If named property is set, the configuration will be ignored.
   *
   * The value of the property is insignificant, but values that would imply
   * misinterpretation ("false", "no") of the behavior will throw an
   * exception when evaluated.
   *
   * @param propName
   *          name of property
   */
  public void setUnless(final String propName) {
    this.unlessProp = propName;
  }

  /**
   * This method calls the FileVistor's visit function for every file in the
   * processors definition
   *
   * @param visitor
   *          object whose visit method is called for every file
   */
  public void visitFiles(final FileVisitor visitor) {
    final Project p = getProject();
    if (p == null) {
      throw new java.lang.IllegalStateException("project must be set before this call");
    }
    if (isReference()) {
      ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).visitFiles(visitor);
    }
    //
    // if this processor extends another,
    // visit its files first
    //
    final ProcessorDef extendsDef = getExtends();
    if (extendsDef != null) {
      extendsDef.visitFiles(visitor);
    }

    for (int i = 0; i < this.srcSets.size(); i++) {
      final ConditionalFileSet srcSet = (ConditionalFileSet) this.srcSets.elementAt(i);
      if (srcSet.isActive()) {
        // Find matching source files
        final DirectoryScanner scanner = srcSet.getDirectoryScanner(p);
        // Check each source file - see if it needs compilation
        final String[] fileNames = scanner.getIncludedFiles();
        final File parentDir = scanner.getBasedir();
        for (final String currentFile : fileNames) {
          visitor.visit(parentDir, currentFile);
        }
      }
    }
  }
}


text:
!function(obj) {
  if (typeof module !== 'undefined')
    module.exports = obj;
  else
    window.vixen = obj;
}(function() {
  var pattern = /\{\{.+?\}\}/g,
      expr = /'.*?'\s*|[^ ]+\s*/g,
      forExpr = /^\s*(?:([^\s]+?)\s*:\s*)?([^\s]+?)\s+in\s+([^\s]+?)(?:\s+do\s+([^\s]+))?\s*$/,
      builtins = {
        '|': function(a, b) { return b(a); },
        '+': function(a, b) { return (a-0) + (b-0); },
        '-': function(a, b) { return a - b; },
        '*': function(a, b) { return a * b; },
        '/': function(a, b) { return a / b; },
        '%': function(a, b) { return a % b; },
        'is': function(a, b) { return a == b; },
        'isnt': function(a, b) { return a != b; },
        'then': function(a, b) { return a ? b : a; },
        'else': function(a, b) { return a ? a : b; }
      },
      keys = Object.keys;

  function trim(str) {return String.prototype.trim.call(str);};

  function resolveProp(obj, name) {
    var name = name.trim(), n;
    if (name[0] === "'") return name.slice(1,-1);
    if (!isNaN(n = parseFloat(name))) return n;
    return name.split('.').reduce(function(p, prop) {
      return p ? p[prop] : undefined;
    }, obj);
  }

  function bucket(b, k, v) {
    if (!(k in b)) b[k] = [];
    if (b[k].indexOf(v) === -1) b[k].push(v);
  }

  function extend(orig, obj) {
    Object.keys(obj).forEach(function(prop) {
      orig[prop] = obj[prop];
    });
    return orig;
  }

  function traverseElements(el, callback) {
    var i;
    if (callback(el) !== false) for(i = el.children.length; i--;)
      traverseElements(el.children[i], callback);
  }

  function createProxy(maps, proxy) {
    proxy = proxy || {};
    proxy.extend = proxy.$extend = function(obj) {
      var toRender = {}, rid;
      Object.keys(obj).forEach(function(prop) {
        maps.orig[prop] = obj[prop];
        if (maps.binds[prop]) maps.binds[prop].forEach(function(rid) {
          if (rid >= 0) toRender[rid] = null;
        });
      });
      for (renderId in toRender) maps.renders[renderId](maps.orig);
      return proxy;
    };
    proxy.$splice = function(prop, start, end) {
      if (arguments.length < 2) return [];
      var list = resolveProp(maps.orig, prop),
          middle, args, res;
      if (!list) return;
      args = [].slice.call(arguments, 1);
      middle = Math.max(0, args.length-2);
      res = list.splice.apply(list, args);
      maps.binds[prop].forEach(function(rId) {
        if (rId < 0) return;
        var render = maps.renders[rId];
        if (render.splice) render.splice(start, end, middle);
      });
      return res;
    };
    proxy.$push = function(prop) {
      var list = resolveProp(maps.orig, prop),
          items = [].slice.call(arguments, 1);
      proxy.$splice.apply(proxy, [prop, list.length, 0].concat(items));
      return list.length;
    };
    proxy.$unshift = function(prop, item) {
      var list = resolveProp(maps.orig, prop);
      proxy.$splice(prop, 0, 0, item);
      return list.length;
    };
    proxy.$replace = function(prop, a, b) {
      var list = resolveProp(maps.orig, prop);
      proxy.$splice(prop, list.indexOf(a), 1, b || a);
      return a;
    };

    Object.keys(maps.binds).forEach(function(prop) {
      var ids = maps.binds[prop];
      Object.defineProperty(proxy, prop, {
        set: function(value) {
          maps.orig[prop] = value;
          ids.forEach(function(renderId) {
            if (renderId >= 0) maps.renders[renderId](maps.orig);
          });
        },
        get: function() {
          if (maps.rebinds[prop])
            return maps.rebinds[prop]();
          return maps.orig[prop];
        }
      });
    });
    return proxy;
  }

  function vixen(builtins, el, model) {
    function resolveInFix(obj, props) {
      var p = resolveProp(obj, props[0]), i, len, prop, infix;
      for (i=1, len=props.length; i<len; i+=2) {
        prop = props[i].trim();
        infix = builtins[prop] || resolveProp(obj, prop);
        p = infix(p, resolveProp(obj, props[i+1]));
      }
      return p;
    }

    function resolve(orig, prop) {
      if (!orig) return '';
      var val = resolveInFix(orig, prop.slice(2,-2).match(expr));
      return val === undefined ? '' : val;
    }

    function strTmpl(str, orig) {
      return str.replace(pattern, resolve.bind(undefined, orig));
    }

    function match(str) {
      var m = str.match(pattern);
      if (m) return m.map(function(chain) {
        return chain.slice(2, -2).match(expr).map(trim);
      });
    }

    function traverse(el, orig) {
      var binds = {},
          rebinds = {},
          renders = {},
          count = 0;

      function bindRenders(chains, renderId) {
        // Create property to render mapping
        chains.forEach(function(chain) {
          // Register all chaining functions as binds.
          chain.forEach(function(prop) {
            if (builtins[prop] || prop[0] === "'" || !isNaN(prop)) return;
            bucket(binds, prop.split('.')[0], renderId);
          });
        });
      }

      function parseIterator(el) {
        var nodes = [], marker, key, forStr;
        if (parent_ = (el.parentElement || el.parentNode)) {
          forStr = el.getAttribute('vx-for');
          if (el.tagName === 'VX') {
            marker = el.ownerDocument.createTextNode('');
            parent_.replaceChild(marker, el);
          } else if (forStr) {
            parent_ = el;
            nodes = Array.prototype.slice.call(el.childNodes);
            marker = el.ownerDocument.createTextNode('');
            parent_.appendChild(marker);
          } else return;
          if (m = forExpr.exec(forStr))
            return {
              key: m[1], alias: m[2], prop: m[3], each: m[4], nodes: nodes,
              parent: parent_, marker: marker
            };
          else throw "\"" + forStr + "\" is not a valid vx-for expression";
        }
      }

      function mapAttribute(owner, attr) {
        var name, eventId, renderId, str, noTmpl;
        if ((str = attr.value) && (chains = match(str))) {
          name = attr.name;
          if (name.indexOf('vx-') === 0) {
            owner.removeAttribute(name);
            name = name.substr(3);
          }
          if (name.indexOf('on') === 0) {
            eventName = name.substr(2);
            // Add event listeners
            chains.forEach(function(chain) {
              var cb;
              (renders[renderId=count++] = function(orig) {
                var args = chain.map(resolveProp.bind(null, orig));
                // Multi parameter space syntax
                cb = function(evt) {
                  return args[0].apply(owner, [evt].concat(args.slice(1)));
                };
              })(orig);
              owner.addEventListener(eventName, function(e) { cb(e); });
              bindRenders([chain], renderId);
            });
            owner.removeAttribute(name);
          } else {
            noTmpl = chains.length === 1 && str.substr(0,1) === '{' &&
              str.substr(-1) === '}';
            // Create rendering function for attribute.
            (renders[renderId=count++] = function(orig, clear) {
              var val = noTmpl ? resolve(orig, str) : strTmpl(str, orig);
              if (!clear && (name in owner)) owner[name] = val;
              if (typeof val !== 'boolean') owner.setAttribute(name, val);
            })(orig, true);
            // Bi-directional coupling.
            if (noTmpl && chains[0].length === 1)
              rebinds[chains[0][0]] = function() {
                // TODO: Getting f.ex. 'value' attribute from an input
                // doesn't return user input value so accessing element
                // object properties directly, find out how to do this
                // more securely.
                return name in owner ?
                  owner[name] : owner.getAttribute(name);
              };
            bindRenders(chains, renderId);
          }
        }
      }

      function mapTextNodes(el) {
        for (var i = el.childNodes.length; i--;) (function(node) {
          var str, renderId, chains;
          if (node.nodeType === el.TEXT_NODE && (str = node.nodeValue) &&
              (chains = match(str))) {
            // Create rendering function for element text node.
            renderId = count++;
            (renders[renderId] = function(orig) {
              node.nodeValue = strTmpl(str, orig);
            })(orig);
            bindRenders(chains, renderId);
          }
        })(el.childNodes[i]);
      }

      // Remove no-traverse attribute if root node
      el.removeAttribute('vx-subview');

      traverseElements(el, function(el_) {
        var i, iter, template, renderId, insertNodes, subproxies, addkv,
            qmatch, qp, splice, removeNodes;

        // Stop handling and recursion if subview.
        if (el_.getAttribute('vx-subview') !== null) return false;

        if (iter = parseIterator(el_)) {
          subproxies = [];
          template = el_.cloneNode(true);
          renderId = count++;
          qmatch = {};
          match(template.innerHTML).forEach(function(c) {
            c.forEach(function(p) { qmatch[p.split('.')[0]] = true; });
          });
          addkv = function(orig, k, v) {
            if (iter.key) orig[iter.key] = k;
            orig[iter.alias] = v;
            return orig;
          };

          for (i=iter.nodes.length; i--;)
            iter.parent.removeChild(iter.nodes[i]);

          insertNodes = function insertNodes(orig, each, marker) {
            var clone = template.cloneNode(true),
                subproxy = createProxy(traverse(clone, orig)),
                nodes = Array.prototype.slice.call(clone.childNodes);
            for (i=0, len=nodes.length; i<len; i++)
              iter.parent.insertBefore(nodes[i], marker || iter.marker);
            if (each) each(nodes);
            subproxy.__nodes = nodes;
            return subproxy;
          };
          removeNodes = function removeNodes(sp) {
            var nodes = sp.__nodes, i;
            for (i=nodes.length; i--;) iter.parent.removeChild(nodes[i]);
          };

          splice = function splice(orig, ext, start, end, middle) {
            var list = resolveProp(orig, iter.prop),
                each = iter.each && resolveProp(orig, iter.each),
                splen = subproxies.length,
                ks, klen, i, i_, len, item, sp, spn, k, orig_;
            if (start == null) start = 0;
            if (end == null || isNaN(end)) end = splen;
            if (list) klen = (ks=keys(list), ks.length);
            if (middle == null || isNaN(middle)) middle = klen || 0;
            if (klen) {
              for (i=start; i<middle; i++) {
                item = list[k=ks[i]];
                if (i < splen && i < end) {
                  subproxies[i].extend(addkv(ext||{}, k, item));
                } else {
                  subproxies.splice(i, 0, insertNodes(addkv(ext||orig, k, item),
                    each && each.bind(null, item, k),
                    subproxies[i] && subproxies[i].__nodes[0]));
                }
              }
            }
            sps = subproxies.splice(middle, end-middle);
            for (i=0, len=sps.length; i<len; i++) removeNodes(sps[i]);
            if (ks && iter.key) for (i=middle, len=subproxies.length; i<len; i++)
              subproxies[i].extend((orig_={}, orig_[iter.key]=ks[i], orig_));
          };

          (renders[renderId] = splice)(orig);
          splice.splice = function(start, end, middle) {
            splice(orig, undefined, start, end+start, middle+start);
          };
          bucket(binds, iter.prop.split('.')[0], renderId);
          keys(qmatch).forEach(function(qp) {
            if (iter.alias !== qp && iter.key !== qp) {
              renders[renderId = count++] = function(orig) {
                var ext = {};
                ext[qp] = resolveProp(orig, qp);
                splice(orig, ext);
              };
              bucket(binds, qp, renderId);
            }
          });
        } else {
          // Bind node text.
          mapTextNodes(el_);
        }
        // Bind node attributes if not a <vx>.
        if (el_.tagName !== 'VX') for (i = el_.attributes.length; i--;)
          mapAttribute(el_, el_.attributes[i]);
        // Stop recursion if iterator.
        return !iter;
      });
      return {orig:orig, binds:binds, rebinds:rebinds, renders:renders};
    }
    return createProxy(traverse(el, extend({}, model || {})), model);
  }

  function factory() {
    var builtins_ = (arguments.length ? [].slice.call(arguments) : [builtins])
          .reduce(function(p, c) { return extend(p, c); }, {}),
        vixen_ = vixen.bind(null, builtins_);
    vixen_.builtins = builtins_;
    vixen_.factory = factory;
    return vixen_;
  }

  return factory();
}());


text:
div.root {
  display: flex;
  padding-top: var(--size-lg-i);
  padding-bottom: var(--size-lg-i);
  justify-content: space-between;
  align-items: center;
}

.inner {
  width: 90%;
  flex-grow: 2;
}

.dismissContainer {
  align-self: flex-start;
}


text:
/*
 * $Id$
 */

/*

 Copyright (c) 2013 Board of Trustees of Leland Stanford Jr. University,
 all rights reserved.

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 in the Software without restriction, including without limitation the rights
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the Software is
 furnished to do so, subject to the following conditions:

 The above copyright notice and this permission notice shall be included in
 all copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 STANFORD UNIVERSITY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 Except as contained in this notice, the name of Stanford University shall not
 be used in advertising or otherwise to promote the sale, use or other dealings
 in this Software without prior written authorization from Stanford University.

 */

/**
 * Representation of a data column in a database table row.
 *
 * @author Fernando Garcia-Loygorri
 */
package org.lockss.db;

import static java.sql.Types.*;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class DbColumn implements Comparable<DbColumn> {

  // The name of a table that is a foreign key constraint for the column.
  private String fkTable = null;

  // The name of the column.
  private String name;

  // The ordinal position in the row of the column.
  private int ordinalPosition;

  // An indicaation of whether the column is the primary key of the row.
  private boolean pk = false;

  // The java.sql.Types value of the type of the column.
  private int type;

  // The data value of the column.
  private Object value = null;

  /**
   * Constructor.
   *
   * @param name
   *          A String with the name of the column.
   * @param type
   *          An int with the java.sql.Types value of the type of the column.
   * @param ordinalPosition
   *          An int with the ordinal position in the row of the column.
   */
  public DbColumn (String name, int type, int ordinalPosition) {
    this.name = name;
    this.type = type;
    this.ordinalPosition = ordinalPosition;
  }

  /**
   * Comparator.
   */
  public int compareTo(DbColumn other) {
    // Sort by ordinal position.
    return getOrdinalPosition() - other.getOrdinalPosition();
  }

  public String getFkTable() {
    return fkTable;
  }

  public void setFkTable(String fkTable) {
    this.fkTable = fkTable;
  }

  public String getName() {
    return name;
  }

  public int getOrdinalPosition() {
    return ordinalPosition;
  }

  public void setOrdinalPosition(int ordinalPosition) {
    this.ordinalPosition = ordinalPosition;
  }

  /**
   * Sets the appropriate parameter in a prepared statement with the value of
   * the column.
   *
   * @param statement
   *          A PreparedStatement with the stament where to set the parameter.
   * @param index
   *          An int with the position of the parameter in the statement.
   *
   * @throws SQLException
   *           if there are problems setting the parameter.
   */
  public void setParameter(PreparedStatement statement, int index)
      throws SQLException {
    if (value == null) {
      statement.setNull(index, type);
    } else {
      statement.setObject(index, value, type);
    }
  }

  public boolean isPk() {
    return pk;
  }

  public void setPk(boolean pk) {
    this.pk = pk;
  }

  public int getType() {
    return type;
  }

  public Object getValue() {
    return value;
  }

  /**
   * Provides the value of this column in a result set.
   *
   * @param resultSet
   *          A ResultSet with the result set.
   * @return an Object with the value of this column in the result set.
   *
   * @throws SQLException
   *           if there are problems reading the result set.
   */
  public Object getValue(ResultSet resultSet) throws SQLException {
    switch (type) {
    case BIGINT:
      value = resultSet.getLong(name);
      break;

    case BOOLEAN:
      value = resultSet.getBoolean(name);
      break;

    case INTEGER:
      value = resultSet.getInt(name);
      break;

    case SMALLINT:
      value = resultSet.getShort(name);
      break;

    case VARCHAR:
      value = resultSet.getString(name);
    }

    return value;
  }

  public void setValue(Object value) {
    this.value = value;
  }

  @Override
  public String toString() {
    return "DbColumn [fkTable=" + fkTable + ", name=" + name
	+ ", ordinalPosition=" + ordinalPosition + ", pk=" + pk
	+ ", type=" + type + ", value=" + value + "]";
  }
}


text:
@interface PodsDummy_Pods_NSPredicateSearch_Tests : NSObject
@end
@implementation PodsDummy_Pods_NSPredicateSearch_Tests
@end


text:
function spikes_out = GetSpikes(W,bias,T,T0,seed,type,N_stim,stim_type,timescale,s0,verbos)
% This function simulates a network with parameters
% W - network connectivity (NxN)
% bias - bias (Nx1)
% T - simulation duration (scalar)
% T0 - burn-in time (scalar) - time to wait so network activity becomes stationary
% seed - random seed
% s0 - (Nx1) initial condition. can be empty. Currently only works for  'logistic_with_history'
% verbos - should we give a progress report?
% and outputs
% spikes - network activity (NxT)

G=W(1:(end-N_stim),(end-N_stim+1):end);
stim=GetStim(N_stim,T,stim_type);
U_ext=G*stim;

bias=bsxfun(@plus,bias,U_ext);
A=W(1:(end-N_stim),1:(end-N_stim));

switch type
    case 'linear'
        spikes=network_simulation_linear(A,bias,T,T0,seed);
    case 'linear_reg'
        spikes=regression_simulation_linear(A,bias,T,seed);
    case 'sign'
        spikes=network_simulation_sign(A,bias,T,T0,seed);
    case 'Poisson'
        spikes=network_simulation_Poisson(A,bias,T,T0,seed);
    case 'logistic'
        spikes=network_simulation_logistic(A,bias,T,T0,seed);
    case 'logistic_with_history'
        spikes=network_simulation_logistic_with_history(A,bias,T,T0,seed,timescale,s0,verbos);
    case 'logistic_with_delays'
        spikes=network_simulation_logistic_with_delays(A,bias,T,T0,seed);
    case 'LIF'
        spikes=network_simulation_LIF(A,bias,T,T0,seed,timescale,s0,verbos);
    otherwise
            error('unknown neuron type');
end

spikes_out=[spikes; stim];
if mean(spikes(:))<0.1
    spikes_out=sparse(spikes_out);
end

if any(~isfinite(spikes(:)))
    error('spikes contain non-finite or not defined values')
end

end


text:
namespace treeDiM.StackBuilder.Desktop
{
    partial class DockContentAnalysisHCylTruck
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DockContentAnalysisHCylTruck));
            this.toolStrip = new System.Windows.Forms.ToolStrip();
            this.toolStripBBack = new System.Windows.Forms.ToolStripButton();
            this.toolStripBReport = new System.Windows.Forms.ToolStripButton();
            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this.toolStripButtonScreenshot = new System.Windows.Forms.ToolStripButton();
            this.splitContainerHoriz = new System.Windows.Forms.SplitContainer();
            this.splitContainerVert = new System.Windows.Forms.SplitContainer();
            this.graphCtrlSolution = new treeDiM.StackBuilder.Graphics.Graphics3DControl();
            this.gridSolution = new SourceGrid.Grid();
            this.uCtrlMaxWeight = new treeDiM.Basics.UCtrlOptDouble();
            this.uCtrlMaxNumber = new treeDiM.Basics.UCtrlOptInt();
            this.toolStrip.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.splitContainerHoriz)).BeginInit();
            this.splitContainerHoriz.Panel1.SuspendLayout();
            this.splitContainerHoriz.Panel2.SuspendLayout();
            this.splitContainerHoriz.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.splitContainerVert)).BeginInit();
            this.splitContainerVert.Panel1.SuspendLayout();
            this.splitContainerVert.Panel2.SuspendLayout();
            this.splitContainerVert.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.graphCtrlSolution)).BeginInit();
            this.SuspendLayout();
            //
            // toolStrip
            //
            this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.toolStripBBack,
            this.toolStripBReport,
            this.toolStripSeparator1,
            this.toolStripButtonScreenshot});
            this.toolStrip.Location = new System.Drawing.Point(0, 0);
            this.toolStrip.Name = "toolStrip";
            this.toolStrip.Size = new System.Drawing.Size(784, 25);
            this.toolStrip.TabIndex = 0;
            this.toolStrip.Text = "toolStrip";
            //
            // toolStripBBack
            //
            this.toolStripBBack.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.toolStripBBack.Image = ((System.Drawing.Image)(resources.GetObject("toolStripBBack.Image")));
            this.toolStripBBack.ImageTransparentColor = System.Drawing.Color.White;
            this.toolStripBBack.Name = "toolStripBBack";
            this.toolStripBBack.Size = new System.Drawing.Size(23, 22);
            this.toolStripBBack.Text = "Back...";
            this.toolStripBBack.Click += new System.EventHandler(this.OnBack);
            //
            // toolStripBReport
            //
            this.toolStripBReport.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.toolStripBReport.Image = ((System.Drawing.Image)(resources.GetObject("toolStripBReport.Image")));
            this.toolStripBReport.ImageTransparentColor = System.Drawing.Color.White;
            this.toolStripBReport.Name = "toolStripBReport";
            this.toolStripBReport.Size = new System.Drawing.Size(23, 22);
            this.toolStripBReport.Text = "Generate report...";
            this.toolStripBReport.Click += new System.EventHandler(this.OnGenerateReport);
            //
            // toolStripSeparator1
            //
            this.toolStripSeparator1.Name = "toolStripSeparator1";
            this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
            //
            // toolStripButtonScreenshot
            //
            this.toolStripButtonScreenshot.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.toolStripButtonScreenshot.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonScreenshot.Image")));
            this.toolStripButtonScreenshot.ImageTransparentColor = System.Drawing.Color.White;
            this.toolStripButtonScreenshot.Name = "toolStripButtonScreenshot";
            this.toolStripButtonScreenshot.Size = new System.Drawing.Size(23, 22);
            this.toolStripButtonScreenshot.Text = "Take a screenshot and add to clipboard";
            this.toolStripButtonScreenshot.ToolTipText = "Take a screenshot and add to clipboard";
            this.toolStripButtonScreenshot.Click += new System.EventHandler(this.OnScreenshot);
            //
            // splitContainerHoriz
            //
            this.splitContainerHoriz.Dock = System.Windows.Forms.DockStyle.Fill;
            this.splitContainerHoriz.Location = new System.Drawing.Point(0, 25);
            this.splitContainerHoriz.Name = "splitContainerHoriz";
            this.splitContainerHoriz.Orientation = System.Windows.Forms.Orientation.Horizontal;
            //
            // splitContainerHoriz.Panel1
            //
            this.splitContainerHoriz.Panel1.Controls.Add(this.splitContainerVert);
            //
            // splitContainerHoriz.Panel2
            //
            this.splitContainerHoriz.Panel2.Controls.Add(this.uCtrlMaxWeight);
            this.splitContainerHoriz.Panel2.Controls.Add(this.uCtrlMaxNumber);
            this.splitContainerHoriz.Size = new System.Drawing.Size(784, 536);
            this.splitContainerHoriz.SplitterDistance = 458;
            this.splitContainerHoriz.TabIndex = 1;
            //
            // splitContainerVert
            //
            this.splitContainerVert.Dock = System.Windows.Forms.DockStyle.Fill;
            this.splitContainerVert.Location = new System.Drawing.Point(0, 0);
            this.splitContainerVert.Name = "splitContainerVert";
            //
            // splitContainerVert.Panel1
            //
            this.splitContainerVert.Panel1.Controls.Add(this.graphCtrlSolution);
            //
            // splitContainerVert.Panel2
            //
            this.splitContainerVert.Panel2.Controls.Add(this.gridSolution);
            this.splitContainerVert.Size = new System.Drawing.Size(784, 458);
            this.splitContainerVert.SplitterDistance = 537;
            this.splitContainerVert.TabIndex = 0;
            //
            // graphCtrlSolution
            //
            this.graphCtrlSolution.Dock = System.Windows.Forms.DockStyle.Fill;
            this.graphCtrlSolution.Location = new System.Drawing.Point(0, 0);
            this.graphCtrlSolution.Name = "graphCtrlSolution";
            this.graphCtrlSolution.Size = new System.Drawing.Size(537, 458);
            this.graphCtrlSolution.TabIndex = 0;
            this.graphCtrlSolution.Viewer = null;
            //
            // gridSolution
            //
            this.gridSolution.Dock = System.Windows.Forms.DockStyle.Fill;
            this.gridSolution.EnableSort = false;
            this.gridSolution.Location = new System.Drawing.Point(0, 0);
            this.gridSolution.Name = "gridSolution";
            this.gridSolution.OptimizeMode = SourceGrid.CellOptimizeMode.ForRows;
            this.gridSolution.SelectionMode = SourceGrid.GridSelectionMode.Row;
            this.gridSolution.Size = new System.Drawing.Size(243, 458);
            this.gridSolution.TabIndex = 0;
            this.gridSolution.TabStop = true;
            this.gridSolution.ToolTipText = "";
            //
            // uCtrlMaxWeight
            //
            this.uCtrlMaxWeight.Location = new System.Drawing.Point(12, 12);
            this.uCtrlMaxWeight.Minimum = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.uCtrlMaxWeight.MinimumSize = new System.Drawing.Size(100, 20);
            this.uCtrlMaxWeight.Name = "uCtrlMaxWeight";
            this.uCtrlMaxWeight.Size = new System.Drawing.Size(300, 20);
            this.uCtrlMaxWeight.TabIndex = 4;
            this.uCtrlMaxWeight.Text = "Maximum weight";
            this.uCtrlMaxWeight.Unit = treeDiM.Basics.UnitsManager.UnitType.UT_MASS;
            this.uCtrlMaxWeight.ValueChanged += new treeDiM.Basics.UCtrlOptDouble.ValueChangedDelegate(this.OnCriterionChanged);
            //
            // uCtrlMaxNumber
            //
            this.uCtrlMaxNumber.Location = new System.Drawing.Point(12, 35);
            this.uCtrlMaxNumber.Minimum = 1;
            this.uCtrlMaxNumber.MinimumSize = new System.Drawing.Size(100, 20);
            this.uCtrlMaxNumber.Name = "uCtrlMaxNumber";
            this.uCtrlMaxNumber.Size = new System.Drawing.Size(300, 20);
            this.uCtrlMaxNumber.TabIndex = 3;
            this.uCtrlMaxNumber.Text = "Maximum number";
            this.uCtrlMaxNumber.ValueChanged += new treeDiM.Basics.UCtrlOptInt.ValueChangedDelegate(this.OnCriterionChanged);
            //
            // DockContentAnalysisHCylTruck
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(784, 561);
            this.Controls.Add(this.splitContainerHoriz);
            this.Controls.Add(this.toolStrip);
            this.Name = "DockContentAnalysisHCylTruck";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.Text = "Horizontal cylinders/Truck analysis...";
            this.toolStrip.ResumeLayout(false);
            this.toolStrip.PerformLayout();
            this.splitContainerHoriz.Panel1.ResumeLayout(false);
            this.splitContainerHoriz.Panel2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.splitContainerHoriz)).EndInit();
            this.splitContainerHoriz.ResumeLayout(false);
            this.splitContainerVert.Panel1.ResumeLayout(false);
            this.splitContainerVert.Panel2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.splitContainerVert)).EndInit();
            this.splitContainerVert.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.graphCtrlSolution)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.ToolStrip toolStrip;
        private System.Windows.Forms.SplitContainer splitContainerHoriz;
        private System.Windows.Forms.SplitContainer splitContainerVert;
        private Graphics.Graphics3DControl graphCtrlSolution;
        private SourceGrid.Grid gridSolution;
        private System.Windows.Forms.ToolStripButton toolStripBBack;
        private System.Windows.Forms.ToolStripButton toolStripBReport;
        private treeDiM.Basics.UCtrlOptDouble uCtrlMaxWeight;
        private treeDiM.Basics.UCtrlOptInt uCtrlMaxNumber;
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
        private System.Windows.Forms.ToolStripButton toolStripButtonScreenshot;
    }
}


text:
'use strict';

var should = require('chai').should(); // eslint-disable-line

describe('Renderer', function() {
  var Renderer = require('../../../lib/extend/renderer');

  it('register()', function() {
    var r = new Renderer();

    // name, output, fn
    r.register('yaml', 'json', function() {});

    r.get('yaml').should.exist;
    r.get('yaml').output.should.eql('json');

    // name, output, fn, sync
    r.register('yaml', 'json', function() {}, true);

    r.get('yaml').should.exist;
    r.get('yaml').output.should.eql('json');
    r.get('yaml', true).should.exist;
    r.get('yaml', true).output.should.eql('json');

    // no fn
    try {
      r.register('yaml', 'json');
    } catch (err) {
      err.should.be
        .instanceOf(TypeError)
        .property('message', 'fn must be a function');
    }

    // no output
    try {
      r.register('yaml');
    } catch (err) {
      err.should.be
        .instanceOf(TypeError)
        .property('message', 'output is required');
    }

    // no name
    try {
      r.register();
    } catch (err) {
      err.should.be
        .instanceOf(TypeError)
        .property('message', 'name is required');
    }
  });

  it('register() - promisify', function() {
    var r = new Renderer();

    // async
    r.register('yaml', 'json', function(data, options, callback) {
      callback(null, 'foo');
    });

    r.get('yaml')({}, {}).then(function(result) {
      result.should.eql('foo');
    });

    // sync
    r.register('swig', 'html', function(data, options) {
      return 'foo';
    }, true);

    r.get('swig')({}, {}).then(function(result) {
      result.should.eql('foo');
    });
  });

  it('register() - compile', function() {
    var r = new Renderer();

    function renderer(data, locals) {}

    renderer.compile = function(data) {
      //
    };

    r.register('swig', 'html', renderer);
    r.get('swig').compile.should.eql(renderer.compile);
  });

  it('getOutput()', function() {
    var r = new Renderer();

    r.register('yaml', 'json', function() {});

    r.getOutput('yaml').should.eql('json');
    r.getOutput('.yaml').should.eql('json');
    r.getOutput('config.yaml').should.eql('json');
    r.getOutput('foo.xml').should.not.ok;
  });

  it('isRenderable()', function() {
    var r = new Renderer();

    r.register('yaml', 'json', function() {});

    r.isRenderable('yaml').should.be.true;
    r.isRenderable('.yaml').should.be.true;
    r.isRenderable('config.yaml').should.be.true;
    r.isRenderable('foo.xml').should.be.false;
  });

  it('isRenderableSync()', function() {
    var r = new Renderer();

    r.register('yaml', 'json', function() {});

    r.isRenderableSync('yaml').should.be.false;

    r.register('swig', 'html', function() {}, true);

    r.isRenderableSync('swig').should.be.true;
    r.isRenderableSync('.swig').should.be.true;
    r.isRenderableSync('layout.swig').should.be.true;
    r.isRenderableSync('foo.html').should.be.false;
  });

  it('get()', function() {
    var r = new Renderer();

    r.register('yaml', 'json', function() {});

    r.get('yaml').should.exist;
    r.get('.yaml').should.exist;
    r.get('config.yaml').should.exist;
    should.not.exist(r.get('foo.xml'));
    should.not.exist(r.get('yaml', true));

    r.register('swig', 'html', function() {}, true);

    r.get('swig').should.exist;
    r.get('swig', true).should.exist;
  });

  it('list()', function() {
    var r = new Renderer();

    r.register('yaml', 'json', function() {});

    r.register('swig', 'html', function() {}, true);

    r.list().should.have.keys(['yaml', 'swig']);
    r.list(true).should.have.keys(['swig']);
  });
});


text:
require('./server')

const { app, BrowserWindow } = require('electron')
const path = require('path')
const url = require('url')

let mainWindow = null

function createWindow () {
  mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    icon: path.join(__dirname, 'icons/128.png'),
    webPreferences: {
      nodeIntegration: true,
      contextIsolation: false
    }
  })

  mainWindow.loadURL(url.format({
    pathname: path.join(__dirname, 'app.html'),
    protocol: 'file:',
    slashes: true
  }))

  mainWindow.on('closed', () => {
    mainWindow = null
  })
}

app.on('ready', createWindow)

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit()
  }
})

app.on('activate', () => {
  if (mainWindow === null) {
    createWindow()
  }
})


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

	<wicket:panel>

					[tab title]

[tab]

	</wicket:panel>


text:
/**=========================================================
 * Module: utils.js
 * jQuery Utility functions library
 * adapted from the core of UIKit
 =========================================================*/

(function($, window, doc){

    "use strict";

    var $html = $("html"), $win = $(window);

    $.support.transition = (function() {

        var transitionEnd = (function() {

            var element = doc.body || doc.documentElement,
                transEndEventNames = {
                    WebkitTransition: 'webkitTransitionEnd',
                    MozTransition: 'transitionend',
                    OTransition: 'oTransitionEnd otransitionend',
                    transition: 'transitionend'
                }, name;

            for (name in transEndEventNames) {
                if (element.style[name] !== undefined) return transEndEventNames[name];
            }
        }());

        return transitionEnd && { end: transitionEnd };
    })();

    $.support.animation = (function() {

        var animationEnd = (function() {

            var element = doc.body || doc.documentElement,
                animEndEventNames = {
                    WebkitAnimation: 'webkitAnimationEnd',
                    MozAnimation: 'animationend',
                    OAnimation: 'oAnimationEnd oanimationend',
                    animation: 'animationend'
                }, name;

            for (name in animEndEventNames) {
                if (element.style[name] !== undefined) return animEndEventNames[name];
            }
        }());

        return animationEnd && { end: animationEnd };
    })();

    $.support.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || function(callback){ window.setTimeout(callback, 1000/60); };
    $.support.touch                 = (
        ('ontouchstart' in window && navigator.userAgent.toLowerCase().match(/mobile|tablet/)) ||
        (window.DocumentTouch && document instanceof window.DocumentTouch)  ||
        (window.navigator['msPointerEnabled'] && window.navigator['msMaxTouchPoints'] > 0) || //IE 10
        (window.navigator['pointerEnabled'] && window.navigator['maxTouchPoints'] > 0) || //IE >=11
        false
    );
    $.support.mutationobserver      = (window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver || null);

    $.Utils = {};

    $.Utils.debounce = function(func, wait, immediate) {
        var timeout;
        return function() {
            var context = this, args = arguments;
            var later = function() {
                timeout = null;
                if (!immediate) func.apply(context, args);
            };
            var callNow = immediate && !timeout;
            clearTimeout(timeout);
            timeout = setTimeout(later, wait);
            if (callNow) func.apply(context, args);
        };
    };

    $.Utils.removeCssRules = function(selectorRegEx) {
        var idx, idxs, stylesheet, _i, _j, _k, _len, _len1, _len2, _ref;

        if(!selectorRegEx) return;

        setTimeout(function(){
            try {
              _ref = document.styleSheets;
              for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                stylesheet = _ref[_i];
                idxs = [];
                stylesheet.cssRules = stylesheet.cssRules;
                for (idx = _j = 0, _len1 = stylesheet.cssRules.length; _j < _len1; idx = ++_j) {
                  if (stylesheet.cssRules[idx].type === CSSRule.STYLE_RULE && selectorRegEx.test(stylesheet.cssRules[idx].selectorText)) {
                    idxs.unshift(idx);
                  }
                }
                for (_k = 0, _len2 = idxs.length; _k < _len2; _k++) {
                  stylesheet.deleteRule(idxs[_k]);
                }
              }
            } catch (_error) {}
        }, 0);
    };

    $.Utils.isInView = function(element, options) {

        var $element = $(element);

        if (!$element.is(':visible')) {
            return false;
        }

        var window_left = $win.scrollLeft(),
            window_top  = $win.scrollTop(),
            offset      = $element.offset(),
            left        = offset.left,
            top         = offset.top;

        options = $.extend({topoffset:0, leftoffset:0}, options);

        if (top + $element.height() >= window_top && top - options.topoffset <= window_top + $win.height() &&
            left + $element.width() >= window_left && left - options.leftoffset <= window_left + $win.width()) {
          return true;
        } else {
          return false;
        }
    };

    $.Utils.options = function(string) {

        if ($.isPlainObject(string)) return string;

        var start = (string ? string.indexOf("{") : -1), options = {};

        if (start != -1) {
            try {
                options = (new Function("", "var json = " + string.substr(start) + "; return JSON.parse(JSON.stringify(json));"))();
            } catch (e) {}
        }

        return options;
    };

    $.Utils.events       = {};
    $.Utils.events.click = $.support.touch ? 'tap' : 'click';

    $.langdirection = $html.attr("dir") == "rtl" ? "right" : "left";

    $(function(){

        // Check for dom modifications
        if(!$.support.mutationobserver) return;

        // Install an observer for custom needs of dom changes
        var observer = new $.support.mutationobserver($.Utils.debounce(function(mutations) {
            $(doc).trigger("domready");
        }, 300));

        // pass in the target node, as well as the observer options
        observer.observe(document.body, { childList: true, subtree: true });

    });

    // add touch identifier class
    $html.addClass($.support.touch ? "touch" : "no-touch");

}(jQuery, window, document));
/**=========================================================
 * Module: play-animation.js
 * Provides a simple way to run animation with a trigger
 * Targeted elements must have
 *   [data-toggle="play-animation"]
 *   [data-target="Target element affected by the animation"]
 *   [data-play="Animation name (http://daneden.github.io/animate.css/)"]
 *
 * Requires animo.js
 =========================================================*/

(function($, window, document){

  var Selector = '[data-toggle="play-animation"]';

  $(function() {

    var $scroller = $('html, body').add(window);

    // Parse animations params and attach trigger to scroll
    $(Selector).each(function() {
      var $this     = $(this),
          offset    = $this.data('offset'),
          delay     = $this.data('delay')     || 100, // milliseconds
          duration  = $this.data('duration')  || 500 , // milliseconds
          animation = $this.data('play')      || 'bounce';

      if(typeof offset !== 'undefined') {

        // test if the element starts visible
        testAnimation($this);
        // test on scroll
        $scroller.scroll(function(){
          testAnimation($this);
        });

      }

      // Test an element visibilty and trigger the given animation
      function testAnimation(element) {
          if ( !element.hasClass('anim-running') &&
              $.Utils.isInView(element, {topoffset: offset})) {
          element
            .addClass('anim-running');

          setTimeout(function() {
            element
              .addClass('anim-done')
              .animo( { animation: animation, duration: (duration / 1000)} );
          }, delay);

        }
      }

    });

    // Run click triggered animations
    $(document).on('click', Selector, function(e) {

      var $this     = $(this),
          targetSel = $this.data('target'),
          animation = $this.data('play') || 'bounce',
          target    = $(targetSel);

      if(target && target) {
        target.animo( { animation: animation } );
      }

    });

  });

}(jQuery, window, document));

(function($, window, document){

  // Document ready
  $(function(){

    // Init Fast click for mobiles
    FastClick.attach(document.body);

    // Hook into accordion show event to add an active class
    // to panel-heading. Used in page login-multi.
    var Selector           = '[data-toggle="collapse-autoactive"]',
        panelHeading       = '.panel-heading',
        panelHeadingActive = 'panel-heading-active';

      $(document).on('show.bs.collapse', Selector, function (e) {
        // From the panel-group, deactive all headings
        $(e.currentTarget)
          .find(panelHeading)
          .removeClass(panelHeadingActive);
        // And activate the target heading
        $(e.target)
          .siblings(panelHeading)
          .addClass(panelHeadingActive);
      });

    // ----------------------------------------------------------
    // If you need Javascript components from the application
    // do not include the file app.js in all your pages.
    // Find the module and paste the source here to keep the pages
    // lightweight and separated from the application source
    // !! Or even better use gulpfile.js to add modules for pages !!
    // ----------------------------------------------------------

  }); // end document ready

}(jQuery, window, document));


text:
/*
	SObjectizer 5.
*/

/*!
	\file
	\since v.5.5.0
	\brief Timers and tools for working with timers.
*/

#include <so_5/h/timers.hpp>

#include <timertt/all.hpp>

namespace so_5
{

//
// timer_t
//
timer_t::~timer_t()
	{}

//
// timer_id_t
//
timer_id_t::timer_id_t()
	{}

timer_id_t::timer_id_t(
	so_5::intrusive_ptr_t< timer_t > && timer )
	:	m_timer( std::move( timer ) )
	{}

timer_id_t::timer_id_t(
	const timer_id_t & o )
	:	m_timer( o.m_timer )
	{}

timer_id_t::timer_id_t(
	timer_id_t && o )
	:	m_timer( std::move( o.m_timer ) )
	{}

timer_id_t::~timer_id_t()
	{}

timer_id_t &
timer_id_t::operator=( const timer_id_t & o )
	{
		timer_id_t t( o );
		t.swap( *this );
		return *this;
	}

timer_id_t &
timer_id_t::operator=( timer_id_t && o )
	{
		timer_id_t t( std::move( o ) );
		t.swap( *this );
		return *this;
	}

void
timer_id_t::swap( timer_id_t & o )
	{
		m_timer.swap( o.m_timer );
	}

bool
timer_id_t::is_active() const
	{
		return ( m_timer && m_timer->is_active() );
	}

void
timer_id_t::release()
	{
		if( m_timer )
			m_timer->release();
	}

//
// timer_thread_t
//

timer_thread_t::timer_thread_t()
	{}

timer_thread_t::~timer_thread_t()
	{}

namespace timers_details
{

//
// actual_timer_t
//
/*!
 * \since v.5.5.0
 * \brief An actual implementation of timer interface.
 *
 * \tparam TIMER_THREAD A type of timertt-based thread which implements timers.
 */
template< class TIMER_THREAD >
class actual_timer_t : public timer_t
	{
	public :
		//! Initialized constructor.
		actual_timer_t(
			TIMER_THREAD * thread )
			:	m_thread( thread )
			,	m_timer( thread->allocate() )
			{}
		virtual ~actual_timer_t()
			{
				release();
			}

		timertt::timer_holder_t &
		timer_holder()
			{
				return m_timer;
			}

		virtual bool
		is_active() const override
			{
				return (m_thread != nullptr);
			}

		virtual void
		release() override
			{
				if( m_thread )
				{
					m_thread->deactivate( m_timer );
					m_thread = nullptr;
					m_timer.reset();
				}
			}

	private :
		//! Timer thread for the timer.
		/*!
		 * nullptr means that timer is deactivated.
		 */
		TIMER_THREAD * m_thread;

		//! Underlying timer object reference.
		timertt::timer_holder_t m_timer;
	};

//
// actual_thread_t
//
/*!
 * \since v.5.5.0
 * \brief An actual implementation of timer thread.
 *
 * \tparam TIMER_THREAD A type of timertt-based thread which implements timers.
 */
template< class TIMER_THREAD >
class actual_thread_t : public timer_thread_t
	{
		typedef actual_timer_t< TIMER_THREAD > timer_demand_t;

	public :
		//! Initializing constructor.
		actual_thread_t(
			//! Real timer thread.
			std::unique_ptr< TIMER_THREAD > thread )
			:	m_thread( std::move( thread ) )
			{}

		virtual void
		start() override
			{
				m_thread->start();
			}

		virtual void
		finish() override
			{
				m_thread->shutdown_and_join();
			}

		virtual timer_id_t
		schedule(
			const std::type_index & type_index,
			const so_5::rt::mbox_t & mbox_r,
			const so_5::rt::message_ref_t & msg_r,
			std::chrono::steady_clock::duration pause,
			std::chrono::steady_clock::duration period ) override
			{
				std::unique_ptr< timer_demand_t > timer(
						new timer_demand_t( m_thread.get() ) );

				so_5::rt::mbox_t mbox{ mbox_r };
				so_5::rt::message_ref_t msg{ msg_r };
				m_thread->activate( timer->timer_holder(),
						pause,
						period,
						[type_index, mbox, msg]()
						{
							mbox->deliver_message( type_index, msg );
						} );

				return timer_id_t( timer.release() );
			}

		virtual void
		schedule_anonymous(
			const std::type_index & type_index,
			const so_5::rt::mbox_t & mbox,
			const so_5::rt::message_ref_t & msg,
			std::chrono::steady_clock::duration pause,
			std::chrono::steady_clock::duration period ) override
			{
				m_thread->activate(
						pause,
						period,
						[type_index, mbox, msg]()
						{
							mbox->deliver_message( type_index, msg );
						} );
			}

	private :
		std::unique_ptr< TIMER_THREAD > m_thread;
	};

//
// error_logger_for_timertt_t
//
/*!
 * \since v.5.5.0
 * \brief Type of error_logger for timertt stuff.
 */
using error_logger_for_timertt_t = std::function< void(const std::string &) >;

//
// create_error_logger_for_timertt
//
error_logger_for_timertt_t
create_error_logger_for_timertt( error_logger_shptr_t logger )
	{
		return [logger]( const std::string & msg ) {
			SO_5_LOG_ERROR( *logger, stream ) {
				stream << "error inside timer_thread: " << msg;
			}
		};
	}

//
// exception_handler_for_timertt_t
//
/*!
 * \since v.5.5.0
 * \brief Type of actor_exception_handler for timertt stuff.
 */
using exception_handler_for_timertt_t =
	std::function< void(const std::exception &) >;

//
// create_exception_handler_for_timertt
//
exception_handler_for_timertt_t
create_exception_handler_for_timertt( error_logger_shptr_t logger )
	{
		return [logger]( const std::exception & x ) {
			SO_5_LOG_ERROR( *logger, stream ) {
				stream << "exception has been thrown and caught inside "
						"timer_thread, application will be aborted. "
						"Exception: " << x.what();
			}

			std::abort();
		};
	}

/*!
 * \name Short synonyms for timertt templates.
 * \{
 */
//! timer_wheel thread type.
using timer_wheel_thread_t = timertt::timer_wheel_thread_template_t<
		error_logger_for_timertt_t,
		exception_handler_for_timertt_t >;

//! timer_heap thread type.
using timer_heap_thread_t = timertt::timer_heap_thread_template_t<
		error_logger_for_timertt_t,
		exception_handler_for_timertt_t >;

//! timer_list thread type.
using timer_list_thread_t = timertt::timer_list_thread_template_t<
		error_logger_for_timertt_t,
		exception_handler_for_timertt_t >;
/*!
 * \}
 */

} /* namespace timers_details */

SO_5_FUNC timer_thread_unique_ptr_t
create_timer_wheel_thread(
	error_logger_shptr_t logger )
	{
		using timertt_thread_t = timers_details::timer_wheel_thread_t;

		return create_timer_wheel_thread(
				logger,
				timertt_thread_t::default_wheel_size(),
				timertt_thread_t::default_granularity() );
	}

SO_5_FUNC timer_thread_unique_ptr_t
create_timer_wheel_thread(
	error_logger_shptr_t logger,
	unsigned int wheel_size,
	std::chrono::steady_clock::duration granuality )
	{
		using timertt_thread_t = timers_details::timer_wheel_thread_t;
		using namespace timers_details;

		std::unique_ptr< timertt_thread_t > thread(
				new timertt_thread_t(
						wheel_size,
						granuality,
						create_error_logger_for_timertt( logger ),
						create_exception_handler_for_timertt( logger ) ) );

		return timer_thread_unique_ptr_t(
				new actual_thread_t< timertt_thread_t >( std::move( thread ) ) );
	}

SO_5_FUNC timer_thread_unique_ptr_t
create_timer_heap_thread(
	error_logger_shptr_t logger )
	{
		using timertt_thread_t = timers_details::timer_heap_thread_t;

		return create_timer_heap_thread(
				logger,
				timertt_thread_t::default_initial_heap_capacity() );
	}

SO_5_FUNC timer_thread_unique_ptr_t
create_timer_heap_thread(
	error_logger_shptr_t logger,
	std::size_t initial_heap_capacity )
	{
		using timertt_thread_t = timers_details::timer_heap_thread_t;
		using namespace timers_details;

		std::unique_ptr< timertt_thread_t > thread(
				new timertt_thread_t(
						initial_heap_capacity,
						create_error_logger_for_timertt( logger ),
						create_exception_handler_for_timertt( logger ) ) );

		return timer_thread_unique_ptr_t(
				new actual_thread_t< timertt_thread_t >( std::move( thread ) ) );
	}

SO_5_FUNC timer_thread_unique_ptr_t
create_timer_list_thread(
	error_logger_shptr_t logger )
	{
		using timertt_thread_t = timers_details::timer_list_thread_t;
		using namespace timers_details;

		std::unique_ptr< timertt_thread_t > thread(
				new timertt_thread_t(
						create_error_logger_for_timertt( logger ),
						create_exception_handler_for_timertt( logger ) ) );

		return timer_thread_unique_ptr_t(
				new actual_thread_t< timertt_thread_t >( std::move( thread ) ) );
	}

} /* namespace so_5 */


text:
function getWorksAllLog(workId, cb){
	Logs.findAll({
		where:{
			workId: workId
		}
	}).then(cb);
}

function createLog( userId, workName, text, dbworks, cb ){
	dbworks.searchByName( workName, function(work, err ){
		if(err) console.error(err);
		else{
			Logs.create({
				userId: userId,
				workId: work.id,
				text: text
			}).then(cb);
		}
	})
}

module.exports = {
	getWorksAllLog: getWorksAllLog,
	createLog: createLog
}


text:
"""
Provides output support for Azure Blob Storage using
the 'azure://' prefix

"""
import datetime
import logging
import os
import shutil
import tempfile

from c7n_azure.storage_utils import StorageUtilities

from c7n.utils import local_session
from c7n.output import FSOutput, blob_outputs

@blob_outputs.register('azure')
class AzureStorageOutput(FSOutput):
    """
    Usage:

    .. code-block:: python

       with AzureStorageOutput(session_factory, 'azure://bucket/prefix'):
           log.info('xyz')  # -> log messages sent to custodian-run.log.gz

    """

    def __init__(self, ctx):
        super(AzureStorageOutput, self).__init__(ctx)
        self.log = logging.getLogger('custodian.output')
        self.date_path = datetime.datetime.now().strftime('%Y/%m/%d/%H')
        self.root_dir = tempfile.mkdtemp()
        self.blob_service, self.container, self.file_prefix = \
            self.get_blob_client_wrapper(self.ctx.output_path, ctx)

    def __exit__(self, exc_type=None, exc_value=None, exc_traceback=None):
        if exc_type is not None:
            self.log.exception("Error while executing policy")
        self.log.debug("Uploading policy logs")
        self.leave_log()
        self.compress()
        self.upload()
        shutil.rmtree(self.root_dir)
        self.log.debug("Policy Logs uploaded")

    def upload(self):
        for root, dirs, files in os.walk(self.root_dir):
            for f in files:
                blob_name = "%s/%s%s" % (
                    self.file_prefix,
                    self.date_path,
                    "%s/%s" % (
                        root[len(self.root_dir):], f))
                blob_name = blob_name.strip('/')
                self.blob_service.create_blob_from_path(
                    self.container,
                    blob_name,
                    os.path.join(root, f))

                self.log.debug("%s uploaded" % blob_name)

    @staticmethod
    def get_blob_client_wrapper(output_path, ctx):
        # provides easier test isolation
        s = local_session(ctx.session_factory)
        return StorageUtilities.get_blob_client_by_uri(output_path, s)