text:
name "books-manager"
description "Books Manager Vagrant Server Role"

run_list(
	"recipe[apt]",
	"recipe[build-essential]",
	"recipe[books-manager-mongodb]"
)

default_attributes(
	:basedir => "/usr/local/mongodb_repo",
	:environment => "vagrant",
	"nodejs.apphost" => "localhost",
	"nodejs.ssl" => "false",
	"nodejs.port" => "9000",

)
override_attributes(
	:mongodb => {
		:config => {
			:auth => true,
			:rest => true
		},
		:install_method => '10gen',
		:admin => {
		  'username' => 'admin',
		  'password' => 'admin',
		  'roles' => %w(userAdminAnyDatabase dbAdminAnyDatabase clusterAdmin),
		  'database' => 'admin'
		},
		:users => [{
		  'username' => 'zeta',
		  'password' => '123456',
		  'roles' => %w(readWrite),
		  'database' => 'books'
		}]
	}
)

redpajama_set_name: RedPajamaGithub


text:
import pytest
import inspect

from matroid.error import APIError
from test.helper import print_test_pass

class TestAccounts(object):
    def test_accounts(self, set_up_client):
        # set up client
        self.api = set_up_client

        # start testing
        self.get_account_info_test()
        self.account_info_test()
        self.retrieve_token()

    # test cases
    def get_account_info_test(self):
        res = self.api.get_account_info()
        assert res["account"] != None
        assert res["account"]["name"] != None
        assert res["account"]["email"] != None
        print_test_pass()

    # test deprecated method name (account_info, now get_account_info)
    def account_info_test(self):
        res = self.api.account_info()
        assert res["account"] != None
        assert res["account"]["name"] != None
        assert res["account"]["email"] != None
        print_test_pass()

    def retrieve_token(self):
        res = self.api.retrieve_token()
        assert res != None
        assert res.token_type != None
        assert res.token_str != None
        print_test_pass()

    def test_with_wrong_permission(self, set_up_wrong_permission_client):
        with pytest.raises(APIError) as e:
            api = set_up_wrong_permission_client
            api.retrieve_token()
        assert "authorization_err" in str(e)
        print_test_pass()


text:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008-2012. All Rights Reserved.                        */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/

package edu.wpi.first.wpilibj;

import java.nio.IntBuffer;
import java.nio.ByteBuffer;

import edu.wpi.first.wpilibj.hal.HALUtil;
import edu.wpi.first.wpilibj.hal.SolenoidJNI;

/**
 * SolenoidBase class is the common base class for the Solenoid and
 * DoubleSolenoid classes.
 */
public abstract class SolenoidBase extends SensorBase {

    private ByteBuffer[] m_ports;
    protected int m_moduleNumber; ///< The number of the solenoid module being used.
    protected Resource m_allocated = new Resource(63* SensorBase.kSolenoidChannels);

    /**
     * Constructor.
     *
     * @param moduleNumber The PCM CAN ID
     */
    public SolenoidBase(final int moduleNumber) {
        m_moduleNumber = moduleNumber;
        m_ports = new ByteBuffer[SensorBase.kSolenoidChannels];
        for (int i = 0; i < SensorBase.kSolenoidChannels; i++) {
            ByteBuffer port = SolenoidJNI.getPortWithModule((byte) moduleNumber, (byte) i);
            IntBuffer status = IntBuffer.allocate(1);
            m_ports[i] = SolenoidJNI.initializeSolenoidPort(port, status);
            HALUtil.checkStatus(status);
        }
    }

    /**
     * Set the value of a solenoid.
     *
     * @param value The value you want to set on the module.
     * @param mask The channels you want to be affected.
     */
    protected synchronized void set(int value, int mask) {
        IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
        for (int i = 0; i < SensorBase.kSolenoidChannels; i++) {
            int local_mask = 1 << i;
            if ((mask & local_mask) != 0)
                SolenoidJNI.setSolenoid(m_ports[i], (byte) (value & local_mask), status);
        }
        HALUtil.checkStatus(status);
    }

    /**
     * Read all 8 solenoids from the module used by this solenoid as a single byte
     *
     * @return The current value of all 8 solenoids on this module.
     */
    public byte getAll() {
        byte value = 0;
        IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();
        for (int i = 0; i < SensorBase.kSolenoidChannels; i++) {
            value |= SolenoidJNI.getSolenoid(m_ports[i], status) << i;
        }
        HALUtil.checkStatus(status);
        return value;
    }
	/**
	 * Reads complete solenoid blacklist for all 8 solenoids as a single byte.
	 *
	 *		If a solenoid is shorted, it is added to the blacklist and
	 *		disabled until power cycle, or until faults are cleared.
	 *		@see #clearAllPCMStickyFaults()
	 *
	 * @return The solenoid blacklist of all 8 solenoids on the module.
	 */
	public byte getPCMSolenoidBlackList() {
		IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();

		byte retval = SolenoidJNI.getPCMSolenoidBlackList(m_ports[0], status);
		HALUtil.checkStatus(status);

		return retval;
	}
	/**
	 * @return true if PCM sticky fault is set : The common
	 *			highside solenoid voltage rail is too low,
	 *	 		most likely a solenoid channel is shorted.
	 */
	public boolean getPCMSolenoidVoltageStickyFault() {
		IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();

		boolean retval = SolenoidJNI.getPCMSolenoidVoltageStickyFault(m_ports[0], status);
		HALUtil.checkStatus(status);

		return retval;
	}
	/**
	 * @return true if PCM is in fault state : The common
	 *			highside solenoid voltage rail is too low,
	 *	 		most likely a solenoid channel is shorted.
	 */
	public boolean getPCMSolenoidVoltageFault() {
		IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();

		boolean retval = SolenoidJNI.getPCMSolenoidVoltageFault(m_ports[0], status);
		HALUtil.checkStatus(status);

		return retval;
	}
	/**
	 * Clear ALL sticky faults inside PCM that Compressor is wired to.
	 *
	 * If a sticky fault is set, then it will be persistently cleared.  Compressor drive
	 *		maybe momentarily disable while flags are being cleared. Care should be
	 *		taken to not call this too frequently, otherwise normal compressor
	 *		functionality may be prevented.
	 *
	 * If no sticky faults are set then this call will have no effect.
	 */
	public void clearAllPCMStickyFaults() {
		IntBuffer status = ByteBuffer.allocateDirect(4).asIntBuffer();

		SolenoidJNI.clearAllPCMStickyFaults(m_ports[0], status);
		HALUtil.checkStatus(status);
	}
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">

<TITLE>
Xerces2 Implementation: Class  XSEmptyCM
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Serialized
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  SUMMARY:  INNER | FIELD | CONSTR | METHOD

DETAIL:  FIELD | CONSTR | METHOD

org.apache.xerces.impl.xs.models

Class  XSEmptyCM

java.lang.Object
  |
  +--org.apache.xerces.impl.xs.models.XSEmptyCM

All Implemented Interfaces:
XSCMValidator

public class XSEmptyCM
extends java.lang.Object
implements XSCMValidator

XSEmptyCM is a derivative of the abstract content model base class that
 handles a content model with no children (elements).

 This model validated on the way in.

INTERNAL:

Usage of this class is not supported. It may be altered or removed at any time.

Version:
$Id: XSEmptyCM.java 806363 2009-08-20 21:18:48Z mrglavas $

Author:
Elena Litani, IBM, Lisa Martin, IBM

Fields inherited from interface org.apache.xerces.impl.xs.models.XSCMValidator

FIRST_ERROR, SUBSEQUENT_ERROR

Constructor Summary

XSEmptyCM()

Method Summary

 boolean
checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler)

          check whether this content violates UPA constraint.

 boolean
endContentModel(int[] currentState)

          The method indicates the end of list of children

 java.lang.String
getTermName(int termId)

          Returns the name of the term (element or wildcard) for the given identifier.

 boolean
isCompactedForUPA()

          Checks if this content model has had its min/maxOccurs values reduced for
 purposes of speeding up UPA.

 int[]
occurenceInfo(int[] state)

          Returns an array containing information about the current repeating term
 or null if no occurrence counting was being performed at the
 current state.

 java.lang.Object
oneTransition(org.apache.xerces.xni.QName elementName,
              int[] currentState,
              SubstitutionGroupHandler subGroupHandler)

          The method corresponds to one transaction in the content model.

 int[]
startContentModel()

          This methods to be called on entering a first element whose type
 has this content model.

 java.util.Vector
whatCanGoHere(int[] state)

          Check which elements are valid to appear at this point.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

XSEmptyCM

public XSEmptyCM()

Method Detail

startContentModel

public int[] startContentModel()

This methods to be called on entering a first element whose type
 has this content model. It will return the initial state of the content model

Specified by:
startContentModel in interface XSCMValidator

Returns:
Start state of the content model

oneTransition

public java.lang.Object oneTransition(org.apache.xerces.xni.QName elementName,
                                      int[] currentState,
                                      SubstitutionGroupHandler subGroupHandler)

The method corresponds to one transaction in the content model.

Specified by:
oneTransition in interface XSCMValidator

Parameters:
elementName - the qualified name of the element
currentState - Current state
subGroupHandler - the substitution group handler
Returns:
element index corresponding to the element from the Schema grammar

endContentModel

public boolean endContentModel(int[] currentState)

The method indicates the end of list of children

Specified by:
endContentModel in interface XSCMValidator

Parameters:
currentState - Current state of the content model
Returns:
true if the last state was a valid final state

checkUniqueParticleAttribution

public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler)
                                       throws XMLSchemaException

check whether this content violates UPA constraint.

Specified by:
checkUniqueParticleAttribution in interface XSCMValidator

Parameters:
subGroupHandler - the substitution group handler
Returns:
true if this content model contains other or list wildcard

whatCanGoHere

public java.util.Vector whatCanGoHere(int[] state)

Check which elements are valid to appear at this point. This method also
 works if the state is in error, in which case it returns what should
 have been seen.

Specified by:
whatCanGoHere in interface XSCMValidator

Parameters:
state - the current state
Returns:
a Vector whose entries are instances of
               either XSWildcardDecl or XSElementDecl.

occurenceInfo

public int[] occurenceInfo(int[] state)

Description copied from interface: XSCMValidator

Returns an array containing information about the current repeating term
 or null if no occurrence counting was being performed at the
 current state.

If an array is returned it will have a length == 4 and will contain:

a[0] :: min occurs

a[1] :: max occurs

a[2] :: current value of the counter

a[3] :: identifier for the repeating term

Specified by:
occurenceInfo in interface XSCMValidator

Following copied from interface: org.apache.xerces.impl.xs.models.XSCMValidator

Parameters:
state - the current state
Returns:
an array containing information about the current repeating term

getTermName

public java.lang.String getTermName(int termId)

Description copied from interface: XSCMValidator

Returns the name of the term (element or wildcard) for the given identifier.

Specified by:
getTermName in interface XSCMValidator

Following copied from interface: org.apache.xerces.impl.xs.models.XSCMValidator

Parameters:
termId - identifier for the element declaration or wildcard
Returns:
the name of the element declaration or wildcard

isCompactedForUPA

public boolean isCompactedForUPA()

Description copied from interface: XSCMValidator

Checks if this content model has had its min/maxOccurs values reduced for
 purposes of speeding up UPA.  If so, this content model should not be used
 for any purpose other than checking unique particle attribution

Specified by:
isCompactedForUPA in interface XSCMValidator

Following copied from interface: org.apache.xerces.impl.xs.models.XSCMValidator

Returns:
a boolean that says whether this content has been compacted for UPA

      Overview
      Package
    Class
      Tree
      Serialized
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  SUMMARY:  INNER | FIELD | CONSTR | METHOD

DETAIL:  FIELD | CONSTR | METHOD

Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.


text:
//-----------------------------------------------------------------------
// <copyright>
// Copyright (C) Ruslan Yakushev for the PHP Manager for IIS project.
//
// This file is subject to the terms and conditions of the Microsoft Public License (MS-PL).
// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL for more details.
// </copyright>
//-----------------------------------------------------------------------

using Microsoft.Web.Administration;

namespace Web.Management.PHP.DefaultDocument
{

    public sealed class DefaultDocumentSection : ConfigurationSection
    {
        private FilesCollection _files;

        public FilesCollection Files
        {
            get
            {
                if (this._files == null)
                {
                    ConfigurationElement files = base.GetChildElement("files");
                    this._files = (FilesCollection)files.GetCollection(typeof(FilesCollection));
                }
                return this._files;
            }
        }
    }
}


text:
package org.apache.heron.examples.api;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

import org.apache.heron.api.Config;
import org.apache.heron.api.HeronSubmitter;
import org.apache.heron.api.bolt.BaseBasicBolt;
import org.apache.heron.api.bolt.BasicOutputCollector;
import org.apache.heron.api.spout.BaseRichSpout;
import org.apache.heron.api.spout.SpoutOutputCollector;
import org.apache.heron.api.topology.OutputFieldsDeclarer;
import org.apache.heron.api.topology.TopologyBuilder;
import org.apache.heron.api.topology.TopologyContext;
import org.apache.heron.api.tuple.Fields;
import org.apache.heron.api.tuple.Tuple;
import org.apache.heron.api.tuple.Values;
import org.apache.heron.common.basics.ByteAmount;

public final class SentenceWordCountTopology {
  private SentenceWordCountTopology() {

  }

  // Utils class to generate random String at given length
  public static class RandomString {
    private final char[] symbols;

    private final Random random = new Random();

    private final char[] buf;

    public RandomString(int length) {
      // Construct the symbol set
      StringBuilder tmp = new StringBuilder();
      for (char ch = '0'; ch <= '9'; ++ch) {
        tmp.append(ch);
      }

      for (char ch = 'a'; ch <= 'z'; ++ch) {
        tmp.append(ch);
      }

      symbols = tmp.toString().toCharArray();
      if (length < 1) {
        throw new IllegalArgumentException("length < 1: " + length);
      }

      buf = new char[length];
    }

    public String nextString() {
      for (int idx = 0; idx < buf.length; ++idx) {
        buf[idx] = symbols[random.nextInt(symbols.length)];
      }

      return new String(buf);
    }
  }

  /**
   * A spout that emits a random word
   */
  public static class FastRandomSentenceSpout extends BaseRichSpout {
    private static final long serialVersionUID = 8068075156393183973L;

    private static final int ARRAY_LENGTH = 128 * 1024;
    private static final int WORD_LENGTH = 20;
    private static final int SENTENCE_LENGTH = 10;

    // Every sentence would be words generated randomly, split by space
    private final String[] sentences = new String[ARRAY_LENGTH];

    private final Random rnd = new Random(31);

    private SpoutOutputCollector collector;

    @Override
    public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
      outputFieldsDeclarer.declare(new Fields("sentence"));
    }

    @Override
    @SuppressWarnings("rawtypes")
    public void open(Map map, TopologyContext topologyContext,
                     SpoutOutputCollector spoutOutputCollector) {
      RandomString randomString = new RandomString(WORD_LENGTH);
      for (int i = 0; i < ARRAY_LENGTH; i++) {
        StringBuilder sb = new StringBuilder(randomString.nextString());
        for (int j = 1; j < SENTENCE_LENGTH; j++) {
          sb.append(" ");
          sb.append(randomString.nextString());
        }
        sentences[i] = sb.toString();
      }

      collector = spoutOutputCollector;
    }

    @Override
    public void nextTuple() {
      int nextInt = rnd.nextInt(ARRAY_LENGTH);
      collector.emit(new Values(sentences[nextInt]));
    }
  }

  public static class SplitSentence extends BaseBasicBolt {
    private static final long serialVersionUID = 1249629174039601217L;

    @Override
    public void execute(Tuple tuple, BasicOutputCollector collector) {
      String sentence = tuple.getString(0);
      for (String word : sentence.split("\\s+")) {
        collector.emit(new Values(word, 1));
      }
    }

    @Override
    public void declareOutputFields(OutputFieldsDeclarer declarer) {
      declarer.declare(new Fields("word", "count"));
    }
  }

  public static class WordCount extends BaseBasicBolt {
    private static final long serialVersionUID = -8492566595062774310L;

    private Map<String, Integer> counts = new HashMap<String, Integer>();

    @Override
    public void execute(Tuple tuple, BasicOutputCollector collector) {
      String word = tuple.getString(0);
      Integer count = counts.get(word);
      if (count == null) {
        count = 0;
      }
      count++;
      counts.put(word, count);
      collector.emit(new Values(word, count));
    }

    @Override
    public void declareOutputFields(OutputFieldsDeclarer declarer) {
      declarer.declare(new Fields("word", "count"));
    }
  }

  public static void main(String[] args) throws Exception {
    String name = "fast-word-count-topology";
    if (args != null && args.length > 0) {
      name = args[0];
    }

    TopologyBuilder builder = new TopologyBuilder();

    builder.setSpout("spout", new FastRandomSentenceSpout(), 1);
    builder.setBolt("split", new SplitSentence(), 2).shuffleGrouping("spout");
    builder.setBolt("count", new WordCount(), 2).fieldsGrouping("split", new Fields("word"));

    Config conf = new Config();

    // component resource configuration
    conf.setComponentRam("spout", ByteAmount.fromMegabytes(512));
    conf.setComponentRam("split", ByteAmount.fromMegabytes(512));
    conf.setComponentRam("count", ByteAmount.fromMegabytes(512));

    // container resource configuration
    conf.setContainerDiskRequested(ByteAmount.fromGigabytes(3));
    conf.setContainerRamRequested(ByteAmount.fromGigabytes(3));
    conf.setContainerCpuRequested(2);

    conf.setNumStmgrs(2);

    HeronSubmitter.submitTopology(name, conf, builder.createTopology());
  }
}


text:
<?php
$this->breadcrumbs=array(
	'Languages'=>array('index'),
	$model->name,
);

$this->menu=array(
	array('label'=>'List Language','icon'=>'list','url'=>array('index')),
	array('label'=>'Create Language','icon'=>'plus','url'=>array('create')),
	array('label'=>'Update Language','icon'=>'pencil','url'=>array('update','id'=>$model->language_id)),
	array('label'=>'Delete Language','icon'=>'trash','url'=>'#','linkOptions'=>array('submit'=>array('delete','id'=>$model->language_id),'confirm'=>'Are you sure you want to delete this item?')),
	array('label'=>'Manage Language','icon'=>'cog','url'=>array('admin')),
);
?>

View Language #<?php echo $model->language_id; ?>

<?php $this->widget('bootstrap.widgets.TbDetailView',array(
	'data'=>$model,
	'attributes'=>array(
		'language_id',
		'code',
		'name',
	),
)); ?>


text:
echo "[ Installing prerequisites ]"

echo "[ Installing build tools and system packages ]"

if which apt-get &> /dev/null ; then
	echo "[ - Debian/Ubuntu based system detected ]"

	if [ "$upgrade" == 0 ]; then
		sudo apt-get update
		sudo apt-get install -y python-pip python-dev build-essential gfortran python-virtualenv
		sudo apt-get build-dep -y python-numpy
		# ubuntu installs very old versions of pip
		sudo -H pip install pip --upgrade
		sudo -H pip install virtualenvwrapper --upgrade
	fi
elif yum --version &> /dev/null ; then
	echo "[ - RHEL based system detected ]"

	if [ "$upgrade" == 0 ]; then
		sudo yum groupinstall -y development
		sudo yum install -y blas-devel lapack-devel gfortran python-devel python-pip python-virtualenv
	fi
else
	echo "[ - Unknown system. Some prerequisites will not be installed ]"
    read -p "Do you want to continue nevertheless?" yesno

    if [[ $yesno =~ ^[Yy] ]]; then
        echo "Continuing with the installation."
    else
        exit 1
    fi

fi

echo "[ Creating virtualenv in .env ]"
virtualenv .env

source .env/bin/activate

echo "[ Installing python packages ]"

pip install --upgrade pip
pip install -r requirements.txt --upgrade

echo "[ Building C modules ]"

make ccore

echo "[ Running tests ]"

py.test

echo "[ Done ]"
echo "Remember to execute 'source .env/bin/activate' to activate the virtualenv"


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Peziza bryophila Pers.

### Remarks
null


text:
import {computedFrom} from 'aurelia-framework';

export class Welcome {

  heading = 'Welcome to the Aurelia Navigation App!';
  firstName = 'John';
  lastName = 'Doe';

  @computedFrom('firstName', 'lastName') get fullName() {
    return `${this.firstName} ${this.lastName}`;
  }

  welcome() {
    alert(`Welcome, ${this.fullName}!`);
  }

}

export class UpperValueConverter {
  toView(value) {
    return value && value.toUpperCase();
  }
}


text:
package io.atomix.core.tree;

import io.atomix.core.transaction.TransactionId;
import io.atomix.core.transaction.TransactionLog;
import io.atomix.core.transaction.impl.CommitResult;
import io.atomix.core.transaction.impl.PrepareResult;
import io.atomix.core.transaction.impl.RollbackResult;
import io.atomix.core.tree.impl.DefaultAtomicDocumentTreeBuilder;
import io.atomix.core.tree.impl.DefaultDocumentTreeService;
import io.atomix.core.tree.impl.DocumentTreeResult;
import io.atomix.core.tree.impl.NodeUpdate;
import io.atomix.primitive.PrimitiveManagementService;
import io.atomix.primitive.PrimitiveType;
import io.atomix.primitive.service.PrimitiveService;
import io.atomix.primitive.service.ServiceConfig;
import io.atomix.utils.misc.Match;
import io.atomix.utils.serializer.Namespace;
import io.atomix.utils.serializer.Namespaces;
import io.atomix.utils.time.Versioned;

import java.util.LinkedHashMap;

import static com.google.common.base.MoreObjects.toStringHelper;

/**
 * Document tree primitive type.
 */
public class AtomicDocumentTreeType<V> implements PrimitiveType<AtomicDocumentTreeBuilder<V>, AtomicDocumentTreeConfig, AtomicDocumentTree<V>> {
  private static final String NAME = "atomic-document-tree";
  private static final AtomicDocumentTreeType INSTANCE = new AtomicDocumentTreeType();

  /**
   * Returns a new document tree type.
   *
   * @param <V> the tree value type
   * @return a new document tree type
   */
  @SuppressWarnings("unchecked")
  public static <V> AtomicDocumentTreeType<V> instance() {
    return INSTANCE;
  }

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

  @Override
  public Namespace namespace() {
    return Namespace.builder()
        .register(PrimitiveType.super.namespace())
        .nextId(Namespaces.BEGIN_USER_CUSTOM_ID)
        .register(LinkedHashMap.class)
        .register(TransactionId.class)
        .register(TransactionLog.class)
        .register(PrepareResult.class)
        .register(CommitResult.class)
        .register(RollbackResult.class)
        .register(NodeUpdate.class)
        .register(NodeUpdate.Type.class)
        .register(DocumentPath.class)
        .register(Match.class)
        .register(Versioned.class)
        .register(DocumentTreeResult.class)
        .register(DocumentTreeResult.Status.class)
        .register(DocumentTreeEvent.class)
        .register(DocumentTreeEvent.Type.class)
        .build();
  }

  @Override
  public PrimitiveService newService(ServiceConfig config) {
    return new DefaultDocumentTreeService();
  }

  @Override
  public AtomicDocumentTreeConfig newConfig() {
    return new AtomicDocumentTreeConfig();
  }

  @Override
  public AtomicDocumentTreeBuilder<V> newBuilder(String name, AtomicDocumentTreeConfig config, PrimitiveManagementService managementService) {
    return new DefaultAtomicDocumentTreeBuilder<>(name, config, managementService);
  }

  @Override
  public String toString() {
    return toStringHelper(this)
        .add("name", name())
        .toString();
  }
}


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>V8 API Reference Guide for node.js v5.1.0: v8::V8 Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

V8 API Reference Guide for node.js v5.1.0

Main Page

Namespaces

Classes

Files

Examples

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

v8

V8

Static Public Member Functions |
Friends |
List of all members

v8::V8 Class Reference

#include <v8.h>

Static Public Member Functions

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", void SetFatalErrorHandler(FatalErrorCallback that))

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", void SetAllowCodeGenerationFromStringsCallback(AllowCodeGenerationFromStringsCallback that))

static V8_INLINE 	V8_DEPRECATE_SOON ("no alternative", bool IsDead())

static void 	SetNativesDataBlob (StartupData *startup_blob)

static void 	SetSnapshotDataBlob (StartupData *startup_blob)

static StartupData 	CreateSnapshotDataBlob (const char *custom_source=NULL)

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", bool AddMessageListener(MessageCallback that, Local< Value > data=Local< Value >()))

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", void RemoveMessageListeners(MessageCallback that))

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", void SetCaptureStackTraceForUncaughtExceptions(bool capture, int frame_limit=10, StackTrace::StackTraceOptions options=StackTrace::kOverview))

static void 	SetFlagsFromString (const char *str, int length)

static void 	SetFlagsFromCommandLine (int *argc, char **argv, bool remove_flags)

static const char * 	GetVersion ()

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback))

static 	V8_DEPRECATE_SOON ("Use isolate version", void AddGCPrologueCallback(GCCallback callback, GCType gc_type_filter=kGCTypeAll))

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", void RemoveGCPrologueCallback(GCCallback callback))

static 	V8_DEPRECATE_SOON ("Use isolate version", void AddGCEpilogueCallback(GCCallback callback, GCType gc_type_filter=kGCTypeAll))

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", void RemoveGCEpilogueCallback(GCCallback callback))

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", void AddMemoryAllocationCallback(MemoryAllocationCallback callback, ObjectSpace space, AllocationAction action))

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback))

static bool 	Initialize ()

static void 	SetEntropySource (EntropySource source)

static void 	SetReturnAddressLocationResolver (ReturnAddressLocationResolver return_address_resolver)

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", void TerminateExecution(Isolate *isolate))

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", bool IsExecutionTerminating(Isolate *isolate=NULL))

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", void CancelTerminateExecution(Isolate *isolate))

static bool 	Dispose ()

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isoalte version", void VisitExternalResources(ExternalResourceVisitor *visitor))

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", void VisitHandlesWithClassIds(PersistentHandleVisitor *visitor))

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", void VisitHandlesWithClassIds(Isolate *isolate, PersistentHandleVisitor *visitor))

static V8_INLINE 	V8_DEPRECATE_SOON ("Use isolate version", void VisitHandlesForPartialDependence(Isolate *isolate, PersistentHandleVisitor *visitor))

static bool 	InitializeICU (const char *icu_data_file=NULL)

static void 	InitializeExternalStartupData (const char *directory_path)

static void 	InitializeExternalStartupData (const char *natives_blob, const char *snapshot_blob)

static void 	InitializePlatform (Platform *platform)

static void 	ShutdownPlatform ()

Friends

template<class T >

class 	Local

template<class T >

class 	MaybeLocal

template<class T >

class 	Maybe

template<class T >

class 	WeakCallbackInfo

template<class T >

class 	Eternal

template<class T >

class 	PersistentBase

template<class T , class M >

class 	Persistent

class 	Context

Detailed Description

Container class for static utility functions.

Member Function Documentation

          static StartupData v8::V8::CreateSnapshotDataBlob
          (
          const char *
          custom_source = NULL	)

static

Create a new isolate and context for the purpose of capturing a snapshot Returns { NULL, 0 } on failure. The caller owns the data array in the return value.

          static bool v8::V8::Dispose
          (
          	)

static

Releases any resources used by v8 and stops any utility threads that may be running. Note that disposing v8 is permanent, it cannot be reinitialized.

It should generally not be necessary to dispose v8 before exiting a process, this should happen automatically. It is only necessary to use if the process needs the resources taken up by v8.

          static const char* v8::V8::GetVersion
          (
          	)

static

Get the version string.

          static bool v8::V8::Initialize
          (
          	)

static

Initializes V8. This function needs to be called before the first Isolate is created. It always returns true.

          static void v8::V8::InitializeExternalStartupData
          (
          const char *
          directory_path	)

static

Initialize the external startup data. The embedder only needs to invoke this method when external startup data was enabled in a build.

If V8 was compiled with the startup data in an external file, then V8 needs to be given those external files during startup. There are three ways to do this:

InitializeExternalStartupData(const char*) This will look in the given directory for files "natives_blob.bin" and "snapshot_blob.bin" - which is what the default build calls them.

InitializeExternalStartupData(const char*, const char*) As above, but will directly use the two given file names.

Call SetNativesDataBlob, SetNativesDataBlob. This will read the blobs from the given data structures and will not perform any file IO.

          static bool v8::V8::InitializeICU
          (
          const char *
          icu_data_file = NULL	)

static

Initialize the ICU library bundled with V8. The embedder should only invoke this method when using the bundled ICU. Returns true on success.

If V8 was compiled with the ICU data in an external file, the location of the data file has to be provided.

          static void v8::V8::InitializePlatform
          (
          Platform *
          platform	)

static

Sets the v8::Platform to use. This should be invoked before V8 is initialized.

          static void v8::V8::SetEntropySource
          (
          EntropySource
          source	)

static

Allows the host application to provide a callback which can be used as a source of entropy for random number generators.

          static void v8::V8::SetFlagsFromCommandLine
          (
          int *
          argc,

          char **
          argv,

          bool
          remove_flags

          )

static

Sets V8 flags from the command line.

          static void v8::V8::SetFlagsFromString
          (
          const char *
          str,

          int
          length

          )

static

Sets V8 flags from a string.

          static void v8::V8::SetNativesDataBlob
          (
          StartupData *
          startup_blob	)

static

Hand startup data to V8, in case the embedder has chosen to build V8 with external startup data.

Note:

By default the startup data is linked into the V8 library, in which case this function is not meaningful.

If this needs to be called, it needs to be called before V8 tries to make use of its built-ins.

To avoid unnecessary copies of data, V8 will point directly into the given data blob, so pretty please keep it around until V8 exit.

Compression of the startup blob might be useful, but needs to handled entirely on the embedders' side.

The call will abort if the data is invalid.

          static void v8::V8::SetReturnAddressLocationResolver
          (
          ReturnAddressLocationResolver
          return_address_resolver	)

static

Allows the host application to provide a callback that allows v8 to cooperate with a profiler that rewrites return addresses on stack.

          static void v8::V8::ShutdownPlatform
          (
          	)

static

Clears all references to the v8::Platform. This should be invoked after V8 was disposed.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          SetFatalErrorHandlerFatalErrorCallback that

          )

static

Set the callback to invoke in case of fatal errors.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          SetAllowCodeGenerationFromStringsCallbackAllowCodeGenerationFromStringsCallback that

          )

static

Set the callback to invoke to check if code generation from strings should be allowed.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "no alternative"
          ,

          bool
          IsDead()

          )

static

Check if V8 is dead and therefore unusable. This is the case after fatal errors such as out-of-memory situations.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          bool
          AddMessageListenerMessageCallback that, Local< Value > data=Local< Value >()

          )

static

Adds a message listener.

The same message listener can be added more than once and in that case it will be called more than once for each message.

If data is specified, it will be passed to the callback when it is called. Otherwise, the exception object will be passed to the callback instead.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          RemoveMessageListenersMessageCallback that

          )

static

Remove all message listeners from the specified callback function.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          SetCaptureStackTraceForUncaughtExceptionsbool capture, int frame_limit=10, StackTrace::StackTraceOptions options=StackTrace::kOverview

          )

static

Tells V8 to capture current stack trace when uncaught exception occurs and report it to the message listeners. The option is off by default.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          SetFailedAccessCheckCallbackFunctionFailedAccessCheckCallback

          )

static

Callback function for reporting failed access checks.

          static v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          AddGCPrologueCallbackGCCallback callback, GCType gc_type_filter=kGCTypeAll

          )

static

Enables the host application to receive a notification before a garbage collection. Allocations are not allowed in the callback function, you therefore cannot manipulate objects (set or delete properties for example) since it is possible such operations will result in the allocation of objects. It is possible to specify the GCType filter for your callback. But it is not possible to register the same callback function two times with different GCType filters.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          RemoveGCPrologueCallbackGCCallback callback

          )

static

This function removes callback which was installed by AddGCPrologueCallback function.

          static v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          AddGCEpilogueCallbackGCCallback callback, GCType gc_type_filter=kGCTypeAll

          )

static

Enables the host application to receive a notification after a garbage collection. Allocations are not allowed in the callback function, you therefore cannot manipulate objects (set or delete properties for example) since it is possible such operations will result in the allocation of objects. It is possible to specify the GCType filter for your callback. But it is not possible to register the same callback function two times with different GCType filters.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          RemoveGCEpilogueCallbackGCCallback callback

          )

static

This function removes callback which was installed by AddGCEpilogueCallback function.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          AddMemoryAllocationCallbackMemoryAllocationCallback callback, ObjectSpace space, AllocationAction action

          )

static

Enables the host application to provide a mechanism to be notified and perform custom logging when V8 Allocates Executable Memory.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          RemoveMemoryAllocationCallbackMemoryAllocationCallback callback

          )

static

Removes callback that was installed by AddMemoryAllocationCallback.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          TerminateExecutionIsolate *isolate

          )

static

Forcefully terminate the current thread of JavaScript execution in the given isolate.

This method can be used by any thread even if that thread has not acquired the V8 lock with a Locker object.

Parameters

isolate	The isolate in which to terminate the current JS execution.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          bool
          IsExecutionTerminatingIsolate *isolate=NULL

          )

static

Is V8 terminating JavaScript execution.

Returns true if JavaScript execution is currently terminating because of a call to TerminateExecution. In that case there are still JavaScript frames on the stack and the termination exception is still active.

Parameters

isolate	The isolate in which to check.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          CancelTerminateExecutionIsolate *isolate

          )

static

Resume execution capability in the given isolate, whose execution was previously forcefully terminated using TerminateExecution().

When execution is forcefully terminated using TerminateExecution(), the isolate can not resume execution until all JavaScript frames have propagated the uncatchable exception which is generated. This method allows the program embedding the engine to handle the termination event and resume execution capability, even if JavaScript frames remain on the stack.

This method can be used by any thread even if that thread has not acquired the V8 lock with a Locker object.

Parameters

isolate	The isolate in which to resume execution capability.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isoalte version"
          ,

          void
          VisitExternalResourcesExternalResourceVisitor *visitor

          )

static

Iterates through all external resources referenced from current isolate heap. GC is not invoked prior to iterating, therefore there is no guarantee that visited objects are still alive.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          VisitHandlesWithClassIdsPersistentHandleVisitor *visitor

          )

static

Iterates through all the persistent handles in the current isolate's heap that have class_ids.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          VisitHandlesWithClassIdsIsolate *isolate, PersistentHandleVisitor *visitor

          )

static

Iterates through all the persistent handles in isolate's heap that have class_ids.

          static V8_INLINE v8::V8::V8_DEPRECATE_SOON
          (
          "Use isolate version"
          ,

          void
          VisitHandlesForPartialDependenceIsolate *isolate, PersistentHandleVisitor *visitor

          )

static

Iterates through all the persistent handles in the current isolate's heap that have class_ids and are candidates to be marked as partially dependent handles. This will visit handles to young objects created since the last garbage collection but is free to visit an arbitrary superset of these objects.

The documentation for this class was generated from the following file:

deps/v8/include/v8.h

<address class="footer">
Generated by

 1.8.9.1
</address>


text:
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

function check_file($field, $field_value) {

    $CI = & get_instance();
    if (isset($this->custom_errors[$field_value])) {
        $CI->form_validation->set_message($field, "");

        return FALSE;
    }
    return TRUE;
}

function toDateTime($unixTimestamp){
    return date("d-m-Y H:i", $unixTimestamp);
}

function _get_csrf_nonce() {
    $CI = & get_instance();
    $CI->load->helper('string');
    $key = random_string('alnum', 8);
    $value = random_string('alnum', 20);
    $CI->session->set_flashdata('csrfkey', $key);
    $CI->session->set_flashdata('csrfvalue', $value);

    return array($key => $value);
}

function _valid_csrf_nonce() {
    $CI = & get_instance();
    if ($CI->input->post($CI->session->flashdata('csrfkey')) !== FALSE &&
            $CI->input->post($CI->session->flashdata('csrfkey')) == $CI->session->flashdata('csrfvalue')) {
        return TRUE;
    } else {
        return FALSE;
    }
}

 function time_ago($date) {

            if(empty($date)) {
                return "No date provided";
            }

            $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
            $lengths = array("60","60","24","7","4.35","12","10");
            $now = time();
            $unix_date = strtotime($date);

            // check validity of date

            if(empty($unix_date)) {
                return "Bad date";
            }

            // is it future date or past date
            if($now > $unix_date) {
                $difference = $now - $unix_date;
                $tense = "ago";
            } else {
                $difference = $unix_date - $now;
                $tense = "from now";
            }
            for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
                $difference /= $lengths[$j];
            }
            $difference = round($difference);
            if($difference != 1) {
                $periods[$j].= "s";
            }

            return "$difference $periods[$j] {$tense}";
        }


text:
package aQute.lib.collections;

import java.util.Enumeration;
import java.util.Iterator;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * Simple facade for enumerators so they can be used in for loops.
 *
 * @param <T>
 */
public class EnumerationIterator<T> implements Iterable<T>, Iterator<T> {

	public static <T> EnumerationIterator<T> iterator(Enumeration<? extends T> e) {
		return new EnumerationIterator<>(e);
	}

	private final Enumeration<? extends T>	enumerator;
	private final AtomicBoolean				done	= new AtomicBoolean();

	public EnumerationIterator(Enumeration<? extends T> e) {
		enumerator = e;
	}

	@Override
	public Iterator<T> iterator() {
		if (!done.compareAndSet(false, true))
			throw new IllegalStateException("Can only be used once");
		return this;

	}

	@Override
	public boolean hasNext() {
		return enumerator.hasMoreElements();
	}

	@Override
	public T next() {
		return enumerator.nextElement();
	}

	@Override
	public void remove() {
		throw new UnsupportedOperationException("Does not support removes");
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.synthform.colombo">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
    <uses-permission android:name="com.android.vending.BILLING" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme.BrandedLaunch">
        <activity
            android:name=".activities.MainActivity"
            android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
            android:windowSoftInputMode="adjustResize"
            android:resizeableActivity="true">
            <intent-filter>
                <category android:name="android.intent.category.LAUNCHER" />
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="http" />
                <data android:scheme="https" />
            </intent-filter>
            <meta-data
                android:name="android.app.searchable"
                android:resource="@xml/searchable" />
            <meta-data
                android:name="android.app.shortcuts"
                android:resource="@xml/shortcuts" />
        </activity>

        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_action_action_search" />
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_color"
            android:resource="@color/colorAccent" />

        <service
            android:name=".firebase.MyFirebaseMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT"/>
            </intent-filter>
        </service>

        <activity
            android:name=".activities.SettingsActivity"
            android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
            android:label="@string/app_name"
            android:parentActivityName=".activities.MainActivity"
            android:resizeableActivity="true">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".activities.MainActivity" />
        </activity>

        <activity
            android:name=".activities.MainIntroActivity"
            android:theme="@style/Theme.Intro"
            android:resizeableActivity="true"/>

        <activity
            android:name=".activities.AboutActivity"
            android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
            android:label="@string/title_activity_about"
            android:parentActivityName=".activities.SettingsActivity"
            android:resizeableActivity="true">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".activities.SettingsActivity" />
        </activity>

        <activity
            android:name=".activities.HistoryActivity"
            android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
            android:label="@string/title_activity_history"
            android:resizeableActivity="true"/>
    </application>

</manifest>


text:
package BASE;

import java.text.DecimalFormat;
import java.util.Scanner;

public class ·ÖÖ§_20 {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		DecimalFormat decimalFormat = new DecimalFormat("#0.00");
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		if (a < 0) {
			System.out.println("sign("+a+") = -1");
		} else if (a == 0) {
			System.out.println("sign("+a+") = 0");
		}else {
			System.out.println("sign("+a+") = 1");
		}
	}
}


text:
*NOTE*: This library has not been used in production for some time and has practices that
I would no longer recommend e.g. some of the querying practices.

## Description

Use datomic with intention revealing names. Ease of use and sticking to datomic's principles are
encouraged. Should work with datomic >= 0.8.3789.

[![Build Status](https://travis-ci.org/cldwalker/datomico.png?branch=master)](https://travis-ci.org/cldwalker/datomico)

## Install

Add to your project.clj:

    [datomico "0.2.0"]

## Usage

Let's build a datomic entity type and start datomic with `build-schema` and `start`:

```clojure
(ns models.user)
(require '[datomico.core :as dc])

; Define a model's database key once and don't think of it again while
; interacting with your model
(def model-namespace :user)

; Build schemas easily without needing to think of partitions and a number of
; internal schema attributes. Basically you don't have to pore over
; http://docs.datomic.com/schema.html
(def schema (dc/build-schema model-namespace
  [[:username :string]
  [:password :string]]))

; Starting in a repl is easy;  a uri, db and connection will be auto-generated
(ns user)
(require '[datomico.core :as dc])
(dc/start {:dynamic-vars true
           :schemas [models.user/schema]})
```

Let's create, update, delete and query entity types with `create`, `update`, `delete` and `find-all`:

```clojure
(ns models.user)
; creates several helper functions that scope your database interaction to the model.
(dc/create-model-fns model-namespace)

(create {:username "dodo" :password "bird"})
; => {:username "dodo" :password "bird" :id 1024053}
(find-all {:username "dodo"})
; => ({:username "dodo" :password "bird" :id 1024053})
(find-first {:password "bird"})
; => {:username "dodo" :password "bird" :id 1024053}

(update 1024053 {:username "big"})
(dc/delete 1024053)
```

## Transacting Batch Data

To transact data in batches, datomico provides *-tx corollaries to fns in `datomico.action` and
`datomico.model`. These fns generate transaction data which can be batched and transacted as needed.

For this example, assume we're in a url model that has string attributes :name and :desc and a many ref with :tags.
Let's create a new entity that associates itself with two existing entities "clojure" and "database". We'll use
`create`'s corollary `create-tx` to do this

```clojure
(ns models.url
  (:require [datomico.db :as db]
            [datomic.model :as model]))

(def model-namespace :url)
(def find-first (partial model/find-first model-namespace))
(def create-tx (partial model/create-tx model-namespace))

(let [input {:name "http://datomic.com" :desc "DESC" :tags ["clojure" "database"]}
      new-map (create-tx (dissoc input :tags))]
  (->> (:tags input)
       (map #(find-first {:name %}))
       (map #(create-tx {:id (:db/id new-map) :tags (:id %)}))
       (cons new-map)
       db/transact!))
```

Note that `create-tx` provides `:db/id` with a tempid you can use to associate it to other entities
in the same transaction.

## Dynamic Binding

For actual production code, it is *not* recommended to use `:dynamic-vars` with
`datomico.core/start`. Instead, you should be more explicit about handling your `*db*` and
`*connection*` as `:dynamic-vars` incurs a performance penalty in exchange for convenience. For
example, a ring app should start datomic with:

```clojure
(dc/start {:uri "datomic:mem://my-app"
           :schemas [models.user/schema]})
```

Then, your ring app should use datomico's ring middleware to
explicitly define `*db*` and `*connection*` for the duration of a web request:

```clojure
(-> app datomico.db/wrap-datomic)
```

Look at `wrap-datomic`'s implementation if not in a ring context.

## TODO
* More tests!

## Bugs/Issues

Please report them [on github](http://github.com/cldwalker/datomico/issues).

## License

See LICENSE.TXT

## Credits
* @relevance for fridays!
* @bobby for much of the initial abstraction - https://gist.github.com/3150938
* @boxxxie - for schema improvements
* @ravster - for tests

## Links
* [demonic](https://github.com/zololabs/demonic) - Datomic utils for testing, batch commits, schema definitions, and more
* [adi](https://github.com/zcaudate/adi) - An Object/Map Based Syntax for Datomic
* [Sample blog using datomico](https://github.com/cldwalker/datomic-noir-blog) - Needs to be
  updated. Last known working commit - 50da3787e11608a98ed54220a371c7035ccdfa12.
* [Sample pastebin using datomico](https://github.com/cldwalker/datomic-refheap) - Needs to be
  updated. Last known working commit - 50da3787e11608a98ed54220a371c7035ccdfa12.


text:
<form class="form-elements" role="form">

            First name
            <input type="text" name="" value="" class="form-control" />

            Last name
            <input type="text" name="" value="" class="form-control" />

            Address
            <input type="text" name="" value="" class="form-control" />

    </form>

### Complete example

    <form class="form-elements" role="form">

            Input Left
            <input type="text" name="" value="" class="form-control" />

Example below help text here.

            Input Right
            <input type="text" name="" value="" class="form-control" />

Example below help text here.

            Input Full

Example above help text here.

            <input type="text" name="" value="" class="form-control" />

            Drop Down
            <select class="form-control custom-select">
                <option selected="selected" value="2">Approved</option>
                <option value="3">Deleted</option>
                <option value="1">New</option>
            </select>

            Grouped Drop Down
            <select class="form-control custom-select">
                <optgroup label="NFC EAST">
                    <option>Dallas Cowboys</option>
                    <option>New York Giants</option>
                    <option>Philadelphia Eagles</option>
                    <option>Washington Redskins</option>
                </optgroup><optgroup>
                </optgroup><optgroup label="NFC NORTH">
                    <option>Chicago Bears</option>
                    <option>Detroit Lions</option>
                    <option>Green Bay Packers</option>
                    <option>Minnesota Vikings</option>
                </optgroup>
                <optgroup label="NFC SOUTH">
                    <option>Atlanta Falcons</option>
                    <option>Carolina Panthers</option>
                    <option>New Orleans Saints</option>
                    <option>Tampa Bay Buccaneers</option>
                </optgroup>
                <optgroup label="NFC WEST">
                    <option>Arizona Cardinals</option>
                    <option>St. Louis Rams</option>
                    <option>San Francisco 49ers</option>
                    <option>Seattle Seahawks</option>
                </optgroup>
                <optgroup label="AFC EAST">
                    <option>Buffalo Bills</option>
                    <option>Miami Dolphins</option>
                    <option>New England Patriots</option>
                    <option>New York Jets</option>
                </optgroup>
                <optgroup label="AFC NORTH">
                    <option>Baltimore Ravens</option>
                    <option>Cincinnati Bengals</option>
                    <option>Cleveland Browns</option>
                    <option>Pittsburgh Steelers</option>
                </optgroup>
                <optgroup label="AFC SOUTH">
                    <option>Houston Texans</option>
                    <option>Indianapolis Colts</option>
                    <option>Jacksonville Jaguars</option>
                    <option>Tennessee Titans</option>
                </optgroup>
                <optgroup label="AFC WEST">
                    <option>Denver Broncos</option>
                    <option>Kansas City Chiefs</option>
                    <option>Oakland Raiders</option>
                    <option>San Diego Chargers</option>
                </optgroup>
            </select>

                <input name="checkbox" value="1" type="checkbox" id="checkbox_1">
                Enable Googie Berry Power-up

Use this checkbox to enable the Googie Berry power-up specifically for this page. You can configure the Googie Berry power-up on the System Settings and Dashboard page.

                Would you like fries with that?

Use this checkbox to enable the Googie Berry power-up specifically for this page. You can configure the Googie Berry power-up on the System Settings and Dashboard page.

                <input type="checkbox" />
                OnOff

            Radio List

Where should you propose to your beautiful girl?

                <input name="radio" value="1" type="radio" id="radio_1">
                Paris

Do not send new comment notifications.

                <input checked="checked" name="radio" value="2" type="radio" id="radio_2">
                Dubai

Send new comment notifications only to post author.

                <input name="radio" value="3" type="radio" id="radio_3">
                New Zealand

Notify all users who have permissions to receive blog notifications.

            Checkbox List

What cars would you like in your garage?

                <input id="checkbox-example1" name="checkbox" value="1" type="checkbox">
                 Dodge Viper

Do not send new comment notifications.

                <input checked="checked" id="checkbox-example2" name="checkbox" value="2" type="checkbox">
                 GM Corvette

Send new comment notifications only to post author.

                <input id="checkbox-example3" name="checkbox" value="3" type="checkbox">
                 Porsche Boxter

Notify all users who have permissions to receive blog notifications.

    </form>


text:
module AtomchainsHelper
end


text:
package multiline

import (
	"errors"
	"os"
	"regexp"
	"strconv"
	"strings"
	"sync"
	"time"

	docker "github.com/fsouza/go-dockerclient"

	"github.com/gliderlabs/logspout/router"
)

const (
	matchFirst        = "first"
	matchLast         = "last"
	matchNonFirst     = "nonfirst"
	matchNonLast      = "nonlast"
	defaultFlushAfter = 500 * time.Millisecond
)

func init() {
	router.AdapterFactories.Register(NewMultilineAdapter, "multiline")
}

// Adapter collects multi-lint log entries and sends them to the next adapter as a single entry
type Adapter struct {
	out             chan *router.Message
	subAdapter      router.LogAdapter
	enableByDefault bool
	pattern         *regexp.Regexp
	separator       string
	matchFirstLine  bool
	negateMatch     bool
	flushAfter      time.Duration
	checkInterval   time.Duration
	buffers         map[string]*router.Message
	nextCheck       <-chan time.Time
}

// NewMultilineAdapter returns a configured multiline.Adapter
func NewMultilineAdapter(route *router.Route) (a router.LogAdapter, err error) { //nolint:gocyclo
	enableByDefault := true
	enableStr := os.Getenv("MULTILINE_ENABLE_DEFAULT")
	if enableStr != "" {
		enableByDefault, err = strconv.ParseBool(enableStr)
		if err != nil {
			return nil, errors.New("multiline: invalid value for MULTILINE_ENABLE_DEFAULT (must be true|false): " + enableStr)
		}
	}

	pattern := os.Getenv("MULTILINE_PATTERN")
	if pattern == "" {
		pattern = `^\s`
	}

	separator := os.Getenv("MULTILINE_SEPARATOR")
	if separator == "" {
		separator = "\n"
	}
	patternRegexp, err := regexp.Compile(pattern)
	if err != nil {
		return nil, errors.New("multiline: invalid value for MULTILINE_PATTERN (must be regexp): " + pattern)
	}

	matchType := os.Getenv("MULTILINE_MATCH")
	if matchType == "" {
		matchType = matchNonFirst
	}
	matchType = strings.ToLower(matchType)
	matchFirstLine := false
	negateMatch := false
	switch matchType {
	case matchFirst:
		matchFirstLine = true
		negateMatch = false
	case matchLast:
		matchFirstLine = false
		negateMatch = false
	case matchNonFirst:
		matchFirstLine = true
		negateMatch = true
	case matchNonLast:
		matchFirstLine = false
		negateMatch = true
	default:
		return nil, errors.New("multiline: invalid value for MULTILINE_MATCH (must be one of first|last|nonfirst|nonlast): " + matchType)
	}

	flushAfter := defaultFlushAfter
	flushAfterStr := os.Getenv("MULTILINE_FLUSH_AFTER")
	if flushAfterStr != "" {
		timeoutMS, errConv := strconv.Atoi(flushAfterStr)
		if errConv != nil {
			return nil, errors.New("multiline: invalid value for multiline_timeout (must be number): " + flushAfterStr)
		}
		flushAfter = time.Duration(timeoutMS) * time.Millisecond
	}

	parts := strings.SplitN(route.Adapter, "+", 2)
	if len(parts) != 2 { //nolint:gomnd
		return nil, errors.New("multiline: adapter must have a sub-adapter, eg: multiline+raw+tcp")
	}

	originalAdapter := route.Adapter
	route.Adapter = parts[1]
	factory, found := router.AdapterFactories.Lookup(route.AdapterType())
	if !found {
		return nil, errors.New("bad adapter: " + originalAdapter)
	}
	subAdapter, err := factory(route)
	if err != nil {
		return nil, err
	}
	route.Adapter = originalAdapter

	out := make(chan *router.Message)
	checkInterval := flushAfter / 2 //nolint:gomnd

	return &Adapter{
		out:             out,
		subAdapter:      subAdapter,
		enableByDefault: enableByDefault,
		pattern:         patternRegexp,
		separator:       separator,
		matchFirstLine:  matchFirstLine,
		negateMatch:     negateMatch,
		flushAfter:      flushAfter,
		checkInterval:   checkInterval,
		buffers:         make(map[string]*router.Message),
		nextCheck:       time.After(checkInterval),
	}, nil
}

// Stream sends log data to the next adapter
func (a *Adapter) Stream(logstream chan *router.Message) { //nolint:gocyclo,gocognit
	wg := sync.WaitGroup{}
	wg.Add(1)
	go func() {
		a.subAdapter.Stream(a.out)
		wg.Done()
	}()
	defer func() {
		for _, message := range a.buffers {
			a.out <- message
		}

		close(a.out)
		wg.Wait()
	}()

	for {
		select {
		case message, ok := <-logstream:
			if !ok {
				return
			}

			if !multilineContainer(message.Container, a.enableByDefault) {
				a.out <- message
				continue
			}

			cID := message.Container.ID
			old, oldExists := a.buffers[cID]
			if a.isFirstLine(message) { //nolint:nestif
				if oldExists {
					a.out <- old
				}

				a.buffers[cID] = message
			} else {
				isLastLine := a.isLastLine(message)

				if oldExists {
					old.Data += a.separator + message.Data
					message = old
				}

				if isLastLine {
					a.out <- message
					if oldExists {
						delete(a.buffers, cID)
					}
				} else {
					a.buffers[cID] = message
				}
			}
		case <-a.nextCheck:
			now := time.Now()

			for key, message := range a.buffers {
				if message.Time.Add(a.flushAfter).After(now) {
					a.out <- message
					delete(a.buffers, key)
				}
			}

			a.nextCheck = time.After(a.checkInterval)
		}
	}
}

func (a *Adapter) isFirstLine(message *router.Message) bool {
	if !a.matchFirstLine {
		return false
	}

	match := a.pattern.MatchString(message.Data)
	if a.negateMatch {
		return !match
	}

	return match
}

func (a *Adapter) isLastLine(message *router.Message) bool {
	if a.matchFirstLine {
		return false
	}

	match := a.pattern.MatchString(message.Data)
	if a.negateMatch {
		return !match
	}

	return match
}

func multilineContainer(container *docker.Container, def bool) bool {
	for _, kv := range container.Config.Env {
		kvp := strings.SplitN(kv, "=", 2)
		if len(kvp) == 2 && kvp[0] == "LOGSPOUT_MULTILINE" {
			switch strings.ToLower(kvp[1]) {
			case "true":
				return true
			case "false":
				return false
			}
			return def
		}
	}

	return def
}


text:
using System;
using System.ComponentModel;

namespace Nettiers.AdventureWorks.Entities
{
	/// <summary>
	///		The data structure representation of the 'Individual' table via interface.
	/// </summary>
	/// <remarks>
	/// 	This struct is generated by a tool and should never be modified.
	/// </remarks>
	public interface IIndividual
	{
		/// <summary>
		/// CustomerID : Unique customer identification number. Foreign key to Customer.CustomerID.
		/// </summary>
		/// <remarks>Member of the primary key of the underlying table "Individual"</remarks>
		System.Int32 CustomerId { get; set; }

		/// <summary>
		/// keep a copy of the original so it can be used for editable primary keys.
		/// </summary>
		System.Int32 OriginalCustomerId { get; set; }

		/// <summary>
		/// ContactID : Identifies the customer in the Contact table. Foreign key to Contact.ContactID.
		/// </summary>
		System.Int32  ContactId  { get; set; }

		/// <summary>
		/// Demographics : Personal information such as hobbies, and income collected from online shoppers. Used for sales analysis.
		/// </summary>
		string  Demographics  { get; set; }

		/// <summary>
		/// ModifiedDate : Date and time the record was last updated.
		/// </summary>
		System.DateTime  ModifiedDate  { get; set; }

		/// <summary>
		/// Creates a new object that is a copy of the current instance.
		/// </summary>
		/// <returns>A new object that is a copy of this instance.</returns>
		System.Object Clone();

		#region Data Properties

		#endregion Data Properties

	}
}


text:
<?php

/**
 * Abstract class which wraps some sort of output mechanism for HTTP responses.
 * Normally this is just @{class:AphrontPHPHTTPSink}, which uses "echo" and
 * "header()" to emit responses.
 *
 * Mostly, this class allows us to do install security or metrics hooks in the
 * output pipeline.
 *
 * @task write  Writing Response Components
 * @task emit   Emitting the Response
 *
 * @group aphront
 */
abstract class AphrontHTTPSink {

/* -(  Writing Response Components  )---------------------------------------- */

  /**
   * Write an HTTP status code to the output.
   *
   * @param int Numeric HTTP status code.
   * @return void
   */
  final public function writeHTTPStatus($code, $message = '') {
    if (!preg_match('/^\d{3}$/', $code)) {
      throw new Exception("Malformed HTTP status code '{$code}'!");
    }

    $code = (int)$code;
    $this->emitHTTPStatus($code, $message);
  }

  /**
   * Write HTTP headers to the output.
   *
   * @param list<pair> List of <name, value> pairs.
   * @return void
   */
  final public function writeHeaders(array $headers) {
    foreach ($headers as $header) {
      if (!is_array($header) || count($header) !== 2) {
        throw new Exception('Malformed header.');
      }
      list($name, $value) = $header;

      if (strpos($name, ':') !== false) {
        throw new Exception(
          "Declining to emit response with malformed HTTP header name: ".
          $name);
      }

      // Attackers may perform an "HTTP response splitting" attack by making
      // the application emit certain types of headers containing newlines:
      //
      //   http://en.wikipedia.org/wiki/HTTP_response_splitting
      //
      // PHP has built-in protections against HTTP response-splitting, but they
      // are of dubious trustworthiness:
      //
      //   http://news.php.net/php.internals/57655

      if (preg_match('/[\r\n\0]/', $name.$value)) {
        throw new Exception(
          "Declining to emit response with unsafe HTTP header: ".
          "<'".$name."', '".$value."'>.");
      }
    }

    foreach ($headers as $header) {
      list($name, $value) = $header;
      $this->emitHeader($name, $value);
    }
  }

  /**
   * Write HTTP body data to the output.
   *
   * @param string Body data.
   * @return void
   */
  final public function writeData($data) {
    $this->emitData($data);
  }

  /**
   * Write an entire @{class:AphrontResponse} to the output.
   *
   * @param AphrontResponse The response object to write.
   * @return void
   */
  final public function writeResponse(AphrontResponse $response) {
    // Do this first, in case it throws.
    $response_string = $response->buildResponseString();

    $all_headers = array_merge(
      $response->getHeaders(),
      $response->getCacheHeaders());

    $this->writeHTTPStatus(
      $response->getHTTPResponseCode(),
      $response->getHTTPResponseMessage());
    $this->writeHeaders($all_headers);
    $this->writeData($response_string);
  }

/* -(  Emitting the Response  )---------------------------------------------- */

  abstract protected function emitHTTPStatus($code, $message = '');
  abstract protected function emitHeader($name, $value);
  abstract protected function emitData($data);
}